feat: use line height preference in super editor (skip e2e) (#2045)

This commit is contained in:
Aman Harwara
2022-11-23 18:05:15 +05:30
committed by GitHub
parent 8755001f7e
commit 87cd31ae5d
62 changed files with 145 additions and 91 deletions

View File

@@ -30,6 +30,8 @@ import FloatingTextFormatToolbarPlugin from '../Lexical/Plugins/FloatingTextForm
import FloatingLinkEditorPlugin from '../Lexical/Plugins/FloatingLinkEditorPlugin';
import {truncateString} from './Utils';
import {SuperEditorContentId} from './Constants';
import {classNames} from '@standardnotes/utils';
import {EditorLineHeight} from '@standardnotes/snjs';
type BlocksEditorProps = {
onChange: (value: string, preview: string) => void;
@@ -38,6 +40,7 @@ type BlocksEditorProps = {
previewLength: number;
spellcheck?: boolean;
ignoreFirstChange?: boolean;
lineHeight?: EditorLineHeight;
};
export const BlocksEditor: FunctionComponent<BlocksEditorProps> = ({
@@ -47,6 +50,7 @@ export const BlocksEditor: FunctionComponent<BlocksEditorProps> = ({
previewLength,
spellcheck,
ignoreFirstChange = false,
lineHeight,
}) => {
const [didIgnoreFirstChange, setDidIgnoreFirstChange] = useState(false);
const handleChange = useCallback(
@@ -98,7 +102,11 @@ export const BlocksEditor: FunctionComponent<BlocksEditorProps> = ({
<div className="editor" ref={onRef}>
<ContentEditable
id={SuperEditorContentId}
className={`ContentEditable__root overflow-y-auto ${className}`}
className={classNames(
'ContentEditable__root overflow-y-auto',
lineHeight && `leading-${lineHeight.toLowerCase()}`,
className,
)}
spellCheck={spellcheck}
/>
</div>