Skip to content

Commit

Permalink
fix: opt out calc() from text-indent value on exported html
Browse files Browse the repository at this point in the history
  • Loading branch information
2wheeh committed May 11, 2024
1 parent c175385 commit e1cfb7d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ui/src/editor/html-config/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { HTMLConfig } from 'lexical';
import { ParagraphNode, isHTMLElement } from 'lexical';

// https://github.com/facebook/lexical/issues/6082
export const htmlConfig: HTMLConfig = {
export: new Map([
[
Expand Down Expand Up @@ -45,13 +46,13 @@ function setElementIndent(dom: HTMLElement, indent: number, indentClassName?: st
}

const indentationBaseValue =
global.window.getComputedStyle(dom).getPropertyValue('--lexical-indent-base-value') ||
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 e1cfb7d

Please sign in to comment.