Skip to content

Commit e2c2993

Browse files
committed
Move getPropertyValue
1 parent ee67a71 commit e2c2993

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/web/inputElements/codeblock.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type {MarkdownTextInputElement} from '../../MarkdownTextInput.web';
22
import {parseStringWithUnitToNumber} from '../../styleUtils';
33
import type {PartialMarkdownStyle} from '../../styleUtils';
4+
import {getPropertyValue} from '../utils/webStyleUtils';
45

56
type Rule = {selector: string; properties: Record<string, string>};
67

@@ -32,10 +33,6 @@ function addStylesheetRules(rules: Rule[], sheet: CSSStyleSheet) {
3233
sheet.replaceSync(newSheet);
3334
}
3435

35-
function getPropertyValue(e: HTMLElement, p: string) {
36-
return parseFloat(window.getComputedStyle(e).getPropertyValue(p).replace('px', ''));
37-
}
38-
3936
function generateCodeBlocksRules(target: MarkdownTextInputElement, markdownStyle: PartialMarkdownStyle): Rule[] {
4037
const line = target.querySelector('*[data-type="line"]:has(> *[data-type="pre"]) > span:first-child');
4138
if (!line) {

src/web/utils/webStyleUtils.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,8 @@ function configureCustomWebStylesheet(): CSSStyleSheet | null {
6666
return sheet;
6767
}
6868

69-
export {parseToReactDOMStyle, processMarkdownStyle, idGenerator, configureCustomWebStylesheet};
69+
function getPropertyValue(e: HTMLElement, p: string) {
70+
return parseFloat(window.getComputedStyle(e).getPropertyValue(p).replace('px', ''));
71+
}
72+
73+
export {parseToReactDOMStyle, processMarkdownStyle, idGenerator, configureCustomWebStylesheet, getPropertyValue};

0 commit comments

Comments
 (0)