Skip to content

Commit a3e38fb

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
refactor(ui): make measurement styles explicit and reuse preview white
1 parent 17e415d commit a3e38fb

4 files changed

Lines changed: 34 additions & 37 deletions

File tree

‎apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/code/code.tsx‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -564,19 +564,19 @@ export const Code = memo(function Code({
564564
const newVisualLineHeights: number[] = []
565565

566566
const tempContainer = document.createElement('div')
567-
tempContainer.style.cssText = `
568-
position: absolute;
569-
visibility: hidden;
570-
height: auto;
571-
width: ${preElement.clientWidth}px;
572-
font-family: ${window.getComputedStyle(preElement).fontFamily};
573-
font-size: ${window.getComputedStyle(preElement).fontSize};
574-
line-height: ${LINE_HEIGHT_PX}px;
575-
padding: 8px;
576-
white-space: pre-wrap;
577-
word-break: break-word;
578-
box-sizing: border-box;
579-
`
567+
Object.assign(tempContainer.style, {
568+
position: 'absolute',
569+
visibility: 'hidden',
570+
height: 'auto',
571+
width: `${preElement.clientWidth}px`,
572+
fontFamily: window.getComputedStyle(preElement).fontFamily,
573+
fontSize: window.getComputedStyle(preElement).fontSize,
574+
lineHeight: `${LINE_HEIGHT_PX}px`,
575+
padding: '8px',
576+
whiteSpace: 'pre-wrap',
577+
wordBreak: 'break-word',
578+
boxSizing: 'border-box',
579+
})
580580
document.body.appendChild(tempContainer)
581581

582582
lines.forEach((line: string) => {

‎apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/condition-input/condition-input.tsx‎

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -466,16 +466,16 @@ export function ConditionInput({
466466

467467
// Create a hidden container with the same width as the editor
468468
const container = document.createElement('div')
469-
container.style.cssText = `
470-
position: absolute;
471-
visibility: hidden;
472-
width: ${preElement.clientWidth}px;
473-
font-family: ${window.getComputedStyle(preElement).fontFamily};
474-
font-size: ${window.getComputedStyle(preElement).fontSize};
475-
padding: 12px;
476-
white-space: pre-wrap;
477-
word-break: break-word;
478-
`
469+
Object.assign(container.style, {
470+
position: 'absolute',
471+
visibility: 'hidden',
472+
width: `${preElement.clientWidth}px`,
473+
fontFamily: window.getComputedStyle(preElement).fontFamily,
474+
fontSize: window.getComputedStyle(preElement).fontSize,
475+
padding: '12px',
476+
whiteSpace: 'pre-wrap',
477+
wordBreak: 'break-word',
478+
})
479479
document.body.appendChild(container)
480480

481481
// Process each line
@@ -487,9 +487,6 @@ export function ConditionInput({
487487
parts.forEach((part) => {
488488
const span = document.createElement('span')
489489
span.textContent = part
490-
if (part.startsWith('<') && part.endsWith('>')) {
491-
span.style.color = 'rgb(153, 0, 85)'
492-
}
493490
lineDiv.appendChild(span)
494491
})
495492
} else {

‎apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/components/code-editor/code-editor.tsx‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,16 @@ export function CodeEditor({
6464
const newVisualLineHeights: number[] = []
6565

6666
const container = document.createElement('div')
67-
container.style.cssText = `
68-
position: absolute;
69-
visibility: hidden;
70-
width: ${preElement.clientWidth}px;
71-
font-family: ${window.getComputedStyle(preElement).fontFamily};
72-
font-size: ${window.getComputedStyle(preElement).fontSize};
73-
padding: 12px;
74-
white-space: pre-wrap;
75-
word-break: break-word;
76-
`
67+
Object.assign(container.style, {
68+
position: 'absolute',
69+
visibility: 'hidden',
70+
width: `${preElement.clientWidth}px`,
71+
fontFamily: window.getComputedStyle(preElement).fontFamily,
72+
fontSize: window.getComputedStyle(preElement).fontSize,
73+
padding: '12px',
74+
whiteSpace: 'pre-wrap',
75+
wordBreak: 'break-word',
76+
})
7777
document.body.appendChild(container)
7878

7979
lines.forEach((line) => {

‎apps/sim/lib/pptx-renderer/core/viewer.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ export class PptxViewer extends EventTarget {
617617
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
618618
overflow: hidden;
619619
position: relative;
620-
background: #fff;
620+
background: var(--white);
621621
`
622622

623623
item.appendChild(wrapper)

0 commit comments

Comments
 (0)