Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
2wheeh committed May 11, 2024
1 parent af70b95 commit b7a4b7b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/lexical/src/nodes/LexicalParagraphNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ function $convertParagraphElement(element: HTMLElement): DOMConversionOutput {
const node = $createParagraphNode();
if (element.style) {
node.setFormat(element.style.textAlign as ElementFormatType);
const indent = parseInt(element.style.textIndent, 10) / 20;

// TODO: leverage theme indent class or default 40 ?
const indent = parseInt(element.style.textIndent, 10) / 40;
if (indent > 0) {
node.setIndent(indent);
}
Expand Down Expand Up @@ -224,14 +226,14 @@ function setElementIndent(
}

const indentationBaseValue =
global.window
window
.getComputedStyle(dom)
.getPropertyValue('--lexical-indent-base-value') || DEFAULT_INDENT_VALUE;

dom.style.setProperty(
// padding-inline-start is not widely supported in email HTML, but
// Lexical Reconciler uses padding-inline-start. Using text-indent instead.
'text-indent',
`calc(${indent} * ${indentationBaseValue})`,
`${indent * parseInt(indentationBaseValue, 10)}px`,
);
}

0 comments on commit b7a4b7b

Please sign in to comment.