@webiny/lexical-editor 5.44.1-beta.1 → 5.45.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -12
- package/commands/image.d.ts +2 -2
- package/commands/image.js +2 -8
- package/commands/image.js.map +1 -1
- package/commands/index.d.ts +5 -4
- package/commands/index.js +5 -49
- package/commands/index.js.map +1 -1
- package/commands/list.d.ts +1 -1
- package/commands/list.js +4 -10
- package/commands/list.js.map +1 -1
- package/commands/quote.d.ts +1 -1
- package/commands/quote.js +2 -8
- package/commands/quote.js.map +1 -1
- package/commands/toolbar.js +2 -8
- package/commands/toolbar.js.map +1 -1
- package/commands/typography.d.ts +8 -0
- package/commands/typography.js +4 -0
- package/commands/typography.js.map +1 -0
- package/components/Editor/EnsureHeadingTagPlugin.js +10 -16
- package/components/Editor/EnsureHeadingTagPlugin.js.map +1 -1
- package/components/Editor/RichTextEditor.d.ts +12 -8
- package/components/Editor/RichTextEditor.js +89 -102
- package/components/Editor/RichTextEditor.js.map +1 -1
- package/components/Editor/normalizeInputValue.d.ts +1 -1
- package/components/Editor/normalizeInputValue.js +2 -8
- package/components/Editor/normalizeInputValue.js.map +1 -1
- package/components/LexicalEditorConfig/LexicalEditorConfig.d.ts +2 -3
- package/components/LexicalEditorConfig/LexicalEditorConfig.js +21 -32
- package/components/LexicalEditorConfig/LexicalEditorConfig.js.map +1 -1
- package/components/LexicalEditorConfig/components/Node.d.ts +1 -1
- package/components/LexicalEditorConfig/components/Node.js +17 -26
- package/components/LexicalEditorConfig/components/Node.js.map +1 -1
- package/components/LexicalEditorConfig/components/Plugin.js +17 -26
- package/components/LexicalEditorConfig/components/Plugin.js.map +1 -1
- package/components/LexicalEditorConfig/components/ToolbarElement.js +17 -26
- package/components/LexicalEditorConfig/components/ToolbarElement.js.map +1 -1
- package/components/LexicalHtmlRenderer.d.ts +4 -7
- package/components/LexicalHtmlRenderer.js +35 -53
- package/components/LexicalHtmlRenderer.js.map +1 -1
- package/components/Toolbar/StaticToolbar.css +416 -0
- package/components/Toolbar/StaticToolbar.d.ts +3 -1
- package/components/Toolbar/StaticToolbar.js +19 -23
- package/components/Toolbar/StaticToolbar.js.map +1 -1
- package/components/ToolbarActions/BoldAction.js +16 -21
- package/components/ToolbarActions/BoldAction.js.map +1 -1
- package/components/ToolbarActions/BulletListAction.js +25 -31
- package/components/ToolbarActions/BulletListAction.js.map +1 -1
- package/components/ToolbarActions/CodeHighlightAction.js +16 -21
- package/components/ToolbarActions/CodeHighlightAction.js.map +1 -1
- package/components/ToolbarActions/FontColorAction.js +32 -42
- package/components/ToolbarActions/FontColorAction.js.map +1 -1
- package/components/ToolbarActions/ImageAction.js +19 -34
- package/components/ToolbarActions/ImageAction.js.map +1 -1
- package/components/ToolbarActions/ItalicAction.js +16 -21
- package/components/ToolbarActions/ItalicAction.js.map +1 -1
- package/components/ToolbarActions/LinkAction.js +19 -24
- package/components/ToolbarActions/LinkAction.js.map +1 -1
- package/components/ToolbarActions/NumberedListAction.js +25 -36
- package/components/ToolbarActions/NumberedListAction.js.map +1 -1
- package/components/ToolbarActions/QuoteAction.js +20 -25
- package/components/ToolbarActions/QuoteAction.js.map +1 -1
- package/components/ToolbarActions/TextAlignmentAction.js +36 -45
- package/components/ToolbarActions/TextAlignmentAction.js.map +1 -1
- package/components/ToolbarActions/TypographyAction.js +57 -79
- package/components/ToolbarActions/TypographyAction.js.map +1 -1
- package/components/ToolbarActions/UnderlineAction.js +16 -21
- package/components/ToolbarActions/UnderlineAction.js.map +1 -1
- package/context/FontColorActionContext.js +2 -9
- package/context/FontColorActionContext.js.map +1 -1
- package/context/RichTextEditorContext.d.ts +6 -7
- package/context/RichTextEditorContext.js +28 -26
- package/context/RichTextEditorContext.js.map +1 -1
- package/context/SharedHistoryContext.d.ts +2 -2
- package/context/SharedHistoryContext.js +12 -20
- package/context/SharedHistoryContext.js.map +1 -1
- package/context/TextAlignmentActionContextProps.d.ts +1 -1
- package/context/TextAlignmentActionContextProps.js +2 -9
- package/context/TextAlignmentActionContextProps.js.map +1 -1
- package/context/TypographyActionContext.d.ts +3 -2
- package/context/TypographyActionContext.js +2 -9
- package/context/TypographyActionContext.js.map +1 -1
- package/exports/admin/lexical.d.ts +15 -0
- package/exports/admin/lexical.js +23 -0
- package/exports/admin/lexical.js.map +1 -0
- package/hooks/index.d.ts +7 -8
- package/hooks/index.js +7 -93
- package/hooks/index.js.map +1 -1
- package/hooks/useCurrentElement.d.ts +3 -3
- package/hooks/useCurrentElement.js +11 -18
- package/hooks/useCurrentElement.js.map +1 -1
- package/hooks/useCurrentSelection.d.ts +2 -1
- package/hooks/useCurrentSelection.js +27 -40
- package/hooks/useCurrentSelection.js.map +1 -1
- package/hooks/useFontColorPicker.d.ts +1 -1
- package/hooks/useFontColorPicker.js +5 -11
- package/hooks/useFontColorPicker.js.map +1 -1
- package/hooks/useIsMounted.js +6 -14
- package/hooks/useIsMounted.js.map +1 -1
- package/hooks/useRichTextEditor.d.ts +1 -1
- package/hooks/useRichTextEditor.js +5 -11
- package/hooks/useRichTextEditor.js.map +1 -1
- package/hooks/useTextAlignmentAction.d.ts +1 -1
- package/hooks/useTextAlignmentAction.js +5 -11
- package/hooks/useTextAlignmentAction.js.map +1 -1
- package/hooks/useTypographyAction.d.ts +1 -1
- package/hooks/useTypographyAction.js +5 -11
- package/hooks/useTypographyAction.js.map +1 -1
- package/index.d.ts +33 -38
- package/index.js +44 -322
- package/index.js.map +1 -1
- package/package.json +18 -22
- package/plugins/BlurEventPlugin/BlurEventPlugin.d.ts +2 -2
- package/plugins/BlurEventPlugin/BlurEventPlugin.js +16 -22
- package/plugins/BlurEventPlugin/BlurEventPlugin.js.map +1 -1
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js +9 -14
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js.map +1 -1
- package/plugins/CodeHighlightPlugin/index.d.ts +1 -1
- package/plugins/CodeHighlightPlugin/index.js +1 -16
- package/plugins/CodeHighlightPlugin/index.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.d.ts +10 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js +28 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js.map +1 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.d.ts +7 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.js +61 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.js.map +1 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.css +2 -136
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.d.ts +4 -16
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js +7 -180
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/index.d.ts +1 -1
- package/plugins/FloatingLinkEditorPlugin/index.js +1 -16
- package/plugins/FloatingLinkEditorPlugin/index.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/isChildOfLinkEditor.js +3 -9
- package/plugins/FloatingLinkEditorPlugin/isChildOfLinkEditor.js.map +1 -1
- package/plugins/FloatingLinkEditorPlugin/types.d.ts +10 -0
- package/plugins/FloatingLinkEditorPlugin/types.js +3 -0
- package/plugins/FloatingLinkEditorPlugin/types.js.map +1 -0
- package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.d.ts +8 -2
- package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.js +120 -88
- package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.js.map +1 -1
- package/plugins/FontColorPlugin/FontColorPlugin.js +19 -22
- package/plugins/FontColorPlugin/FontColorPlugin.js.map +1 -1
- package/plugins/FontColorPlugin/applyColorToNode.d.ts +2 -2
- package/plugins/FontColorPlugin/applyColorToNode.js +4 -10
- package/plugins/FontColorPlugin/applyColorToNode.js.map +1 -1
- package/plugins/FontColorPlugin/applyColorToSelection.d.ts +2 -2
- package/plugins/FontColorPlugin/applyColorToSelection.js +28 -44
- package/plugins/FontColorPlugin/applyColorToSelection.js.map +1 -1
- package/plugins/ImagesPlugin/ImagesPlugin.d.ts +1 -2
- package/plugins/ImagesPlugin/ImagesPlugin.js +58 -60
- package/plugins/ImagesPlugin/ImagesPlugin.js.map +1 -1
- package/plugins/LinkPlugin/LinkPlugin.js +29 -37
- package/plugins/LinkPlugin/LinkPlugin.js.map +1 -1
- package/plugins/ListPLugin/ListPlugin.js +52 -15
- package/plugins/ListPLugin/ListPlugin.js.map +1 -1
- package/plugins/QuoteNodePlugin/QuoteNodePlugin.js +19 -16
- package/plugins/QuoteNodePlugin/QuoteNodePlugin.js.map +1 -1
- package/plugins/StateHandlingPlugin.d.ts +1 -1
- package/plugins/StateHandlingPlugin.js +32 -39
- package/plugins/StateHandlingPlugin.js.map +1 -1
- package/plugins/TypographyPlugin/TypographyPlugin.js +17 -21
- package/plugins/TypographyPlugin/TypographyPlugin.js.map +1 -1
- package/types.d.ts +4 -4
- package/types.js +6 -38
- package/types.js.map +1 -1
- package/ui/ContentEditable.d.ts +0 -1
- package/ui/ContentEditable.js +7 -14
- package/ui/ContentEditable.js.map +1 -1
- package/ui/Divider.d.ts +0 -1
- package/ui/Divider.js +3 -10
- package/ui/Divider.js.map +1 -1
- package/ui/DropDown.d.ts +1 -1
- package/ui/DropDown.js +64 -90
- package/ui/DropDown.js.map +1 -1
- package/ui/ImageResizer.d.ts +0 -1
- package/ui/ImageResizer.js +78 -83
- package/ui/ImageResizer.js.map +1 -1
- package/ui/LinkPreview.d.ts +0 -1
- package/ui/LinkPreview.js +22 -29
- package/ui/LinkPreview.js.map +1 -1
- package/ui/Placeholder.d.ts +1 -1
- package/ui/Placeholder.js +10 -16
- package/ui/Placeholder.js.map +1 -1
- package/ui/TextInput.d.ts +0 -1
- package/ui/TextInput.js +11 -18
- package/ui/TextInput.js.map +1 -1
- package/ui/ToolbarActionDialog.js +30 -42
- package/ui/ToolbarActionDialog.js.map +1 -1
- package/utils/canUseDOM.js +1 -7
- package/utils/canUseDOM.js.map +1 -1
- package/utils/files.d.ts +6 -6
- package/utils/files.js +5 -32
- package/utils/files.js.map +1 -1
- package/utils/getDOMRangeRect.js +4 -10
- package/utils/getDOMRangeRect.js.map +1 -1
- package/utils/getSelectedNode.d.ts +1 -1
- package/utils/getSelectedNode.js +9 -16
- package/utils/getSelectedNode.js.map +1 -1
- package/utils/getTransparentImage.js +1 -7
- package/utils/getTransparentImage.js.map +1 -1
- package/utils/insertImage.d.ts +1 -1
- package/utils/insertImage.js +8 -14
- package/utils/insertImage.js.map +1 -1
- package/utils/isAnchorLink.js +1 -7
- package/utils/isAnchorLink.js.map +1 -1
- package/utils/isChildOfFloatingToolbar.js +3 -12
- package/utils/isChildOfFloatingToolbar.js.map +1 -1
- package/utils/isHTMLElement.js +1 -7
- package/utils/isHTMLElement.js.map +1 -1
- package/utils/isValidJSON.js +3 -9
- package/utils/isValidJSON.js.map +1 -1
- package/utils/isValidLexicalData.d.ts +3 -3
- package/utils/isValidLexicalData.js +6 -12
- package/utils/isValidLexicalData.js.map +1 -1
- package/utils/point.js +35 -60
- package/utils/point.js.map +1 -1
- package/utils/rect.d.ts +1 -1
- package/utils/rect.js +115 -149
- package/utils/rect.js.map +1 -1
- package/utils/sanitizeUrl.js +6 -13
- package/utils/sanitizeUrl.js.map +1 -1
- package/utils/setFloatingElemPosition.d.ts +1 -1
- package/utils/setFloatingElemPosition.js +24 -30
- package/utils/setFloatingElemPosition.js.map +1 -1
- package/components/Editor/HeadingEditor.d.ts +0 -7
- package/components/Editor/HeadingEditor.js +0 -30
- package/components/Editor/HeadingEditor.js.map +0 -1
- package/components/Editor/ParagraphEditor.d.ts +0 -7
- package/components/Editor/ParagraphEditor.js +0 -29
- package/components/Editor/ParagraphEditor.js.map +0 -1
- package/components/Toolbar/Toolbar.css +0 -643
- package/components/Toolbar/Toolbar.d.ts +0 -11
- package/components/Toolbar/Toolbar.js +0 -165
- package/components/Toolbar/Toolbar.js.map +0 -1
- package/components/ToolbarActions/FontSizeAction.d.ts +0 -14
- package/components/ToolbarActions/FontSizeAction.js +0 -109
- package/components/ToolbarActions/FontSizeAction.js.map +0 -1
- package/hooks/useList.d.ts +0 -2
- package/hooks/useList.js +0 -54
- package/hooks/useList.js.map +0 -1
- package/hooks/useQuote.d.ts +0 -2
- package/hooks/useQuote.js +0 -22
- package/hooks/useQuote.js.map +0 -1
- package/plugins/FloatingLinkEditorPlugin/LinkEditForm.d.ts +0 -9
- package/plugins/FloatingLinkEditorPlugin/LinkEditForm.js +0 -118
- package/plugins/FloatingLinkEditorPlugin/LinkEditForm.js.map +0 -1
- package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.d.ts +0 -9
- package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.js +0 -44
- package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.js.map +0 -1
- package/utils/generateInitialLexicalValue.d.ts +0 -4
- package/utils/generateInitialLexicalValue.js +0 -33
- package/utils/generateInitialLexicalValue.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["React","useRef","LexicalComposer","RichTextPlugin","ContentEditable","LexicalErrorBoundary","allNodes","RichTextEditorProvider","StateHandlingPlugin","LexicalHtmlRenderer","nodes","value","props","theme","editorTheme","initialConfig","editorState","namespace","onError","editable","current","tokens","$colors","colors","$typography","typography","$cacheKey","JSON","stringify","createElement","key","length","contentEditable","className","ErrorBoundary","placeholder"],"sources":["LexicalHtmlRenderer.tsx"],"sourcesContent":["import React, { useRef } from \"react\";\nimport type { Klass, LexicalNode } from \"lexical\";\nimport { LexicalComposer } from \"@lexical/react/LexicalComposer\";\nimport { RichTextPlugin } from \"@lexical/react/LexicalRichTextPlugin\";\nimport { ContentEditable } from \"@lexical/react/LexicalContentEditable\";\nimport { LexicalErrorBoundary } from \"@lexical/react/LexicalErrorBoundary.js\";\nimport { allNodes } from \"@webiny/lexical-nodes\";\nimport type { EditorTheme } from \"@webiny/lexical-theme\";\nimport type { LexicalValue } from \"~/types.js\";\nimport { RichTextEditorProvider } from \"~/context/RichTextEditorContext.js\";\nimport { StateHandlingPlugin } from \"~/plugins/StateHandlingPlugin.js\";\n\ninterface LexicalHtmlRendererProps {\n nodes?: Klass<LexicalNode>[];\n value: LexicalValue | null;\n theme: EditorTheme;\n}\n\nexport const LexicalHtmlRenderer = ({ nodes, value, ...props }: LexicalHtmlRendererProps) => {\n const theme: EditorTheme = props.theme;\n const editorTheme = useRef(theme);\n\n const initialConfig = {\n editorState: null,\n namespace: \"webiny\",\n onError: () => {\n // Ignore errors. We don't want to break the app because of errors caused by config/value updates.\n // These are usually resolved in the next component render cycle.\n },\n editable: false,\n nodes: [...allNodes, ...(nodes || [])],\n theme: {\n ...editorTheme.current.tokens,\n // I'm not aware of a better way to pass custom data to nodes.\n // For now, we're using Lexical's theme to pass colors and typography.\n $colors: editorTheme.current.colors,\n $typography: editorTheme.current.typography,\n $cacheKey: JSON.stringify(editorTheme.current)\n }\n };\n\n return (\n <LexicalComposer initialConfig={initialConfig} key={initialConfig.nodes.length}>\n <RichTextEditorProvider theme={theme}>\n <RichTextPlugin\n contentEditable={\n <div className=\"editor\">\n <ContentEditable />\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n placeholder={null}\n />\n <StateHandlingPlugin value={value} />\n </RichTextEditorProvider>\n </LexicalComposer>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,MAAM,QAAQ,OAAO;AAErC,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,cAAc,QAAQ,sCAAsC;AACrE,SAASC,eAAe,QAAQ,uCAAuC;AACvE,SAASC,oBAAoB,QAAQ,wCAAwC;AAC7E,SAASC,QAAQ,QAAQ,uBAAuB;AAGhD,SAASC,sBAAsB;AAC/B,SAASC,mBAAmB;AAQ5B,OAAO,MAAMC,mBAAmB,GAAGA,CAAC;EAAEC,KAAK;EAAEC,KAAK;EAAE,GAAGC;AAAgC,CAAC,KAAK;EACzF,MAAMC,KAAkB,GAAGD,KAAK,CAACC,KAAK;EACtC,MAAMC,WAAW,GAAGb,MAAM,CAACY,KAAK,CAAC;EAEjC,MAAME,aAAa,GAAG;IAClBC,WAAW,EAAE,IAAI;IACjBC,SAAS,EAAE,QAAQ;IACnBC,OAAO,EAAEA,CAAA,KAAM;MACX;MACA;IAAA,CACH;IACDC,QAAQ,EAAE,KAAK;IACfT,KAAK,EAAE,CAAC,GAAGJ,QAAQ,EAAE,IAAII,KAAK,IAAI,EAAE,CAAC,CAAC;IACtCG,KAAK,EAAE;MACH,GAAGC,WAAW,CAACM,OAAO,CAACC,MAAM;MAC7B;MACA;MACAC,OAAO,EAAER,WAAW,CAACM,OAAO,CAACG,MAAM;MACnCC,WAAW,EAAEV,WAAW,CAACM,OAAO,CAACK,UAAU;MAC3CC,SAAS,EAAEC,IAAI,CAACC,SAAS,CAACd,WAAW,CAACM,OAAO;IACjD;EACJ,CAAC;EAED,oBACIpB,KAAA,CAAA6B,aAAA,CAAC3B,eAAe;IAACa,aAAa,EAAEA,aAAc;IAACe,GAAG,EAAEf,aAAa,CAACL,KAAK,CAACqB;EAAO,gBAC3E/B,KAAA,CAAA6B,aAAA,CAACtB,sBAAsB;IAACM,KAAK,EAAEA;EAAM,gBACjCb,KAAA,CAAA6B,aAAA,CAAC1B,cAAc;IACX6B,eAAe,eACXhC,KAAA,CAAA6B,aAAA;MAAKI,SAAS,EAAC;IAAQ,gBACnBjC,KAAA,CAAA6B,aAAA,CAACzB,eAAe,MAAE,CACjB,CACR;IACD8B,aAAa,EAAE7B,oBAAqB;IACpC8B,WAAW,EAAE;EAAK,CACrB,CAAC,eACFnC,KAAA,CAAA6B,aAAA,CAACrB,mBAAmB;IAACG,KAAK,EAAEA;EAAM,CAAE,CAChB,CACX,CAAC;AAE1B,CAAC","ignoreList":[]}
|
|
@@ -258,3 +258,419 @@
|
|
|
258
258
|
.static-toolbar button.item.dropdown-item-active i {
|
|
259
259
|
opacity: 1;
|
|
260
260
|
}
|
|
261
|
+
|
|
262
|
+
i.bold {
|
|
263
|
+
background-image: url("../../images/icons/type-bold.svg");
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
i.italic {
|
|
267
|
+
background-image: url("../../images/icons/type-italic.svg");
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
i.code {
|
|
271
|
+
background-image: url("../../images/icons/code.svg");
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
i.underline {
|
|
275
|
+
background-image: url("../../images/icons/type-underline.svg");
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
i.strikethrough {
|
|
279
|
+
background-image: url("../../images/icons/type-strikethrough.svg");
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
i.link {
|
|
283
|
+
background-image: url("../../images/icons/link.svg");
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
i.quote {
|
|
287
|
+
background-image: url("../../images/icons/chat-square-quote.svg");
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.icon.left-align,
|
|
291
|
+
i.left-align {
|
|
292
|
+
background-image: url("../../images/icons/text-left.svg");
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
i.center-align {
|
|
296
|
+
background-image: url("../../images/icons/text-center.svg");
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
i.right-align {
|
|
300
|
+
background-image: url("../../images/icons/text-right.svg");
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
i.indent {
|
|
304
|
+
background-image: url("../../images/icons/indent.svg");
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
i.outdent {
|
|
308
|
+
background-image: url("../../images/icons/outdent.svg");
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
i.justify-align {
|
|
312
|
+
background-image: url("../../images/icons/justify.svg");
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
i.chevron-down {
|
|
316
|
+
background-color: transparent;
|
|
317
|
+
background-size: contain;
|
|
318
|
+
display: inline-block;
|
|
319
|
+
height: 8px;
|
|
320
|
+
width: 8px;
|
|
321
|
+
background-image: url("../../images/icons/chevron-down.svg");
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
i.insert-image,
|
|
325
|
+
.icon.insert-image {
|
|
326
|
+
background-color: transparent;
|
|
327
|
+
background-size: contain;
|
|
328
|
+
display: inline-block;
|
|
329
|
+
height: 8px;
|
|
330
|
+
width: 8px;
|
|
331
|
+
background-image: url("../../images/icons/insert-image.svg");
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.icon.bullet-list,
|
|
335
|
+
.icon.bullet {
|
|
336
|
+
background-image: url("../../images/icons/list-ul.svg");
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.icon.numbered-list,
|
|
340
|
+
.icon.number {
|
|
341
|
+
background-image: url("../../images/icons/list-ol.svg");
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
i.font-color,
|
|
345
|
+
.icon.font-color {
|
|
346
|
+
background-image: url("../../images/icons/font-color.svg");
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.link-editor .button.active,
|
|
350
|
+
.toolbar .button.active {
|
|
351
|
+
background-color: rgb(223, 232, 250);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.toolbar .divider {
|
|
355
|
+
width: 1px;
|
|
356
|
+
background-color: #eee;
|
|
357
|
+
margin: 0 4px;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.lexical-dropdown-container {
|
|
361
|
+
position: absolute;
|
|
362
|
+
bottom: -5px;
|
|
363
|
+
left: 0;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.lexical-dropdown {
|
|
367
|
+
z-index: 10;
|
|
368
|
+
display: block;
|
|
369
|
+
position: fixed;
|
|
370
|
+
box-shadow:
|
|
371
|
+
0 12px 28px 0 rgba(0, 0, 0, 0.2),
|
|
372
|
+
0 2px 4px 0 rgba(0, 0, 0, 0.1),
|
|
373
|
+
inset 0 0 0 1px rgba(255, 255, 255, 0.5);
|
|
374
|
+
border-radius: 8px;
|
|
375
|
+
min-height: 40px;
|
|
376
|
+
background-color: #fff;
|
|
377
|
+
max-height: 250px;
|
|
378
|
+
overflow: hidden;
|
|
379
|
+
overflow-y: auto;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.lexical-dropdown.no-scroll {
|
|
383
|
+
max-height: inherit;
|
|
384
|
+
overflow: auto;
|
|
385
|
+
overflow-y: auto;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.lexical-dropdown .item {
|
|
389
|
+
margin: 0 8px 0 8px;
|
|
390
|
+
padding: 8px;
|
|
391
|
+
color: #050505;
|
|
392
|
+
cursor: pointer;
|
|
393
|
+
line-height: 16px;
|
|
394
|
+
font-size: 15px;
|
|
395
|
+
display: flex;
|
|
396
|
+
align-content: center;
|
|
397
|
+
flex-direction: row;
|
|
398
|
+
flex-shrink: 0;
|
|
399
|
+
justify-content: space-between;
|
|
400
|
+
background-color: #fff;
|
|
401
|
+
border-radius: 8px;
|
|
402
|
+
border: 0;
|
|
403
|
+
max-width: 250px;
|
|
404
|
+
min-width: 100px;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.lexical-dropdown .item.fontsize-item,
|
|
408
|
+
.lexical-dropdown .item.fontsize-item .text {
|
|
409
|
+
min-width: unset;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.lexical-dropdown .item .active {
|
|
413
|
+
display: flex;
|
|
414
|
+
width: 20px;
|
|
415
|
+
height: 20px;
|
|
416
|
+
background-size: contain;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.lexical-dropdown .item:first-child {
|
|
420
|
+
margin-top: 8px;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.lexical-dropdown .item:last-child {
|
|
424
|
+
margin-bottom: 8px;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.lexical-dropdown .item:hover {
|
|
428
|
+
background-color: #eee;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.lexical-dropdown .item .text {
|
|
432
|
+
display: flex;
|
|
433
|
+
line-height: 20px;
|
|
434
|
+
flex-grow: 1;
|
|
435
|
+
min-width: 150px;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.lexical-dropdown .item .icon {
|
|
439
|
+
display: flex;
|
|
440
|
+
width: 20px;
|
|
441
|
+
height: 20px;
|
|
442
|
+
user-select: none;
|
|
443
|
+
margin-right: 12px;
|
|
444
|
+
line-height: 16px;
|
|
445
|
+
background-size: contain;
|
|
446
|
+
background-position: center;
|
|
447
|
+
background-repeat: no-repeat;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.lexical-dropdown .divider {
|
|
451
|
+
width: auto;
|
|
452
|
+
background-color: #eee;
|
|
453
|
+
margin: 4px 8px;
|
|
454
|
+
height: 1px;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
@media screen and (max-width: 1100px) {
|
|
458
|
+
.dropdown-button-text {
|
|
459
|
+
display: none !important;
|
|
460
|
+
}
|
|
461
|
+
.font-size .dropdown-button-text {
|
|
462
|
+
display: flex !important;
|
|
463
|
+
}
|
|
464
|
+
.code-language .dropdown-button-text {
|
|
465
|
+
display: flex !important;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
button.item i {
|
|
470
|
+
opacity: 0.6;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
button.item.dropdown-item-active {
|
|
474
|
+
background-color: rgba(223, 232, 250, 0.3);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
button.item.dropdown-item-active i {
|
|
478
|
+
opacity: 1;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.editor-shell span.editor-image {
|
|
482
|
+
cursor: default;
|
|
483
|
+
display: inline-block;
|
|
484
|
+
position: relative;
|
|
485
|
+
user-select: none;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.editor-shell .editor-image img {
|
|
489
|
+
max-width: 100%;
|
|
490
|
+
cursor: default;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.editor-shell .editor-image img.focused {
|
|
494
|
+
outline: 2px solid rgb(60, 132, 244);
|
|
495
|
+
user-select: none;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
.editor-shell .editor-image img.focused.draggable {
|
|
499
|
+
cursor: grab;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.editor-shell .editor-image img.focused.draggable:active {
|
|
503
|
+
cursor: grabbing;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.editor-shell .editor-image .image-caption-container .tree-view-output {
|
|
507
|
+
margin: 0;
|
|
508
|
+
border-radius: 0;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.editor-shell .editor-image .image-caption-container {
|
|
512
|
+
display: block;
|
|
513
|
+
position: absolute;
|
|
514
|
+
bottom: 4px;
|
|
515
|
+
left: 0;
|
|
516
|
+
right: 0;
|
|
517
|
+
padding: 0;
|
|
518
|
+
margin: 0;
|
|
519
|
+
border-top: 1px solid #fff;
|
|
520
|
+
background-color: #ffffffe6;
|
|
521
|
+
min-width: 100px;
|
|
522
|
+
color: #000;
|
|
523
|
+
overflow: hidden;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.editor-shell .editor-image .image-caption-button {
|
|
527
|
+
display: block;
|
|
528
|
+
position: absolute;
|
|
529
|
+
bottom: 20px;
|
|
530
|
+
left: 0;
|
|
531
|
+
right: 0;
|
|
532
|
+
width: 30%;
|
|
533
|
+
padding: 10px;
|
|
534
|
+
margin: 0 auto;
|
|
535
|
+
border: 1px solid rgba(255, 255, 255, 0.3);
|
|
536
|
+
border-radius: 5px;
|
|
537
|
+
background-color: #00000080;
|
|
538
|
+
min-width: 100px;
|
|
539
|
+
color: #fff;
|
|
540
|
+
cursor: pointer;
|
|
541
|
+
user-select: none;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
.editor-shell .editor-image .image-caption-button:hover {
|
|
545
|
+
background-color: #3c84f480;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.editor-shell .editor-image .image-resizer {
|
|
549
|
+
display: block;
|
|
550
|
+
width: 7px;
|
|
551
|
+
height: 7px;
|
|
552
|
+
position: absolute;
|
|
553
|
+
background-color: #3c84f4;
|
|
554
|
+
border: 1px solid #fff;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
.editor-shell .editor-image .image-resizer.image-resizer-n {
|
|
558
|
+
top: -6px;
|
|
559
|
+
left: 48%;
|
|
560
|
+
cursor: n-resize;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
.editor-shell .editor-image .image-resizer.image-resizer-ne {
|
|
564
|
+
top: -6px;
|
|
565
|
+
right: -6px;
|
|
566
|
+
cursor: ne-resize;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
.editor-shell .editor-image .image-resizer.image-resizer-e {
|
|
570
|
+
bottom: 48%;
|
|
571
|
+
right: -6px;
|
|
572
|
+
cursor: e-resize;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
.editor-shell .editor-image .image-resizer.image-resizer-se {
|
|
576
|
+
bottom: -2px;
|
|
577
|
+
right: -6px;
|
|
578
|
+
cursor: nwse-resize;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.editor-shell .editor-image .image-resizer.image-resizer-s {
|
|
582
|
+
bottom: -2px;
|
|
583
|
+
left: 48%;
|
|
584
|
+
cursor: s-resize;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
.editor-shell .editor-image .image-resizer.image-resizer-sw {
|
|
588
|
+
bottom: -2px;
|
|
589
|
+
left: -6px;
|
|
590
|
+
cursor: sw-resize;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
.editor-shell .editor-image .image-resizer.image-resizer-w {
|
|
594
|
+
bottom: 48%;
|
|
595
|
+
left: -6px;
|
|
596
|
+
cursor: w-resize;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.editor-shell .editor-image .image-resizer.image-resizer-nw {
|
|
600
|
+
top: -6px;
|
|
601
|
+
left: -6px;
|
|
602
|
+
cursor: nw-resize;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
.editor-shell span.inline-editor-image {
|
|
606
|
+
cursor: default;
|
|
607
|
+
display: inline-block;
|
|
608
|
+
position: relative;
|
|
609
|
+
z-index: 1;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
.editor-shell .inline-editor-image img {
|
|
613
|
+
max-width: 100%;
|
|
614
|
+
cursor: default;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
.editor-shell .inline-editor-image img.focused {
|
|
618
|
+
outline: 2px solid rgb(60, 132, 244);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
.editor-shell .inline-editor-image img.focused.draggable {
|
|
622
|
+
cursor: grab;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.editor-shell .inline-editor-image img.focused.draggable:active {
|
|
626
|
+
cursor: grabbing;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
.editor-shell .inline-editor-image .image-caption-container .tree-view-output {
|
|
630
|
+
margin: 0;
|
|
631
|
+
border-radius: 0;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
.editor-shell .inline-editor-image.position-full {
|
|
635
|
+
margin: 1em 0;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
.editor-shell .inline-editor-image.position-left {
|
|
639
|
+
float: left;
|
|
640
|
+
width: 50%;
|
|
641
|
+
margin: 1em 1em 0 0;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
.editor-shell .inline-editor-image.position-right {
|
|
645
|
+
float: right;
|
|
646
|
+
width: 50%;
|
|
647
|
+
margin: 1em 0 0 1em;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
.editor-shell .inline-editor-image .image-edit-button {
|
|
651
|
+
display: block;
|
|
652
|
+
position: absolute;
|
|
653
|
+
top: 12px;
|
|
654
|
+
right: 12px;
|
|
655
|
+
padding: 6px 8px;
|
|
656
|
+
margin: 0 auto;
|
|
657
|
+
border: 1px solid rgba(255, 255, 255, 0.3);
|
|
658
|
+
border-radius: 5px;
|
|
659
|
+
background-color: #00000080;
|
|
660
|
+
min-width: 60px;
|
|
661
|
+
color: #fff;
|
|
662
|
+
cursor: pointer;
|
|
663
|
+
user-select: none;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
.editor-shell .inline-editor-image .image-edit-button:hover {
|
|
667
|
+
background-color: #3c84f480;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
.editor-shell .inline-editor-image .image-caption-container {
|
|
671
|
+
display: block;
|
|
672
|
+
background-color: #f4f4f4;
|
|
673
|
+
min-width: 100%;
|
|
674
|
+
color: #000;
|
|
675
|
+
overflow: hidden;
|
|
676
|
+
}
|
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
21
|
-
key: action.name
|
|
22
|
-
}, action.element);
|
|
23
|
-
})));
|
|
1
|
+
import React, { Fragment } from "react";
|
|
2
|
+
import "./StaticToolbar.css";
|
|
3
|
+
import { useLexicalEditorConfig } from "../LexicalEditorConfig/LexicalEditorConfig.js";
|
|
4
|
+
import { useRichTextEditor } from "../../hooks/index.js";
|
|
5
|
+
export const StaticToolbar = ({
|
|
6
|
+
className
|
|
7
|
+
}) => {
|
|
8
|
+
const {
|
|
9
|
+
toolbarElements
|
|
10
|
+
} = useLexicalEditorConfig();
|
|
11
|
+
const {
|
|
12
|
+
editor
|
|
13
|
+
} = useRichTextEditor();
|
|
14
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
className: className ?? "static-toolbar",
|
|
16
|
+
"data-role": "toolbar"
|
|
17
|
+
}, editor.isEditable() && /*#__PURE__*/React.createElement(React.Fragment, null, toolbarElements.map(action => /*#__PURE__*/React.createElement(Fragment, {
|
|
18
|
+
key: action.name
|
|
19
|
+
}, action.element))));
|
|
24
20
|
};
|
|
25
21
|
|
|
26
22
|
//# sourceMappingURL=StaticToolbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["React","Fragment","useLexicalEditorConfig","useRichTextEditor","StaticToolbar","className","toolbarElements","editor","createElement","isEditable","map","action","key","name","element"],"sources":["StaticToolbar.tsx"],"sourcesContent":["import React, { Fragment } from \"react\";\nimport \"./StaticToolbar.css\";\nimport { useLexicalEditorConfig } from \"~/components/LexicalEditorConfig/LexicalEditorConfig.js\";\nimport { useRichTextEditor } from \"~/hooks/index.js\";\n\nexport const StaticToolbar = ({ className }: { className?: string }) => {\n const { toolbarElements } = useLexicalEditorConfig();\n const { editor } = useRichTextEditor();\n\n return (\n <div className={className ?? \"static-toolbar\"} data-role={\"toolbar\"}>\n {editor.isEditable() && (\n <>\n {toolbarElements.map(action => (\n <Fragment key={action.name}>{action.element}</Fragment>\n ))}\n </>\n )}\n </div>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC;AACA,SAASC,sBAAsB;AAC/B,SAASC,iBAAiB;AAE1B,OAAO,MAAMC,aAAa,GAAGA,CAAC;EAAEC;AAAkC,CAAC,KAAK;EACpE,MAAM;IAAEC;EAAgB,CAAC,GAAGJ,sBAAsB,CAAC,CAAC;EACpD,MAAM;IAAEK;EAAO,CAAC,GAAGJ,iBAAiB,CAAC,CAAC;EAEtC,oBACIH,KAAA,CAAAQ,aAAA;IAAKH,SAAS,EAAEA,SAAS,IAAI,gBAAiB;IAAC,aAAW;EAAU,GAC/DE,MAAM,CAACE,UAAU,CAAC,CAAC,iBAChBT,KAAA,CAAAQ,aAAA,CAAAR,KAAA,CAAAC,QAAA,QACKK,eAAe,CAACI,GAAG,CAACC,MAAM,iBACvBX,KAAA,CAAAQ,aAAA,CAACP,QAAQ;IAACW,GAAG,EAAED,MAAM,CAACE;EAAK,GAAEF,MAAM,CAACG,OAAkB,CACzD,CACH,CAEL,CAAC;AAEd,CAAC","ignoreList":[]}
|
|
@@ -1,28 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
editor
|
|
15
|
-
var _useCurrentSelection = (0, _useCurrentSelection2.useCurrentSelection)(),
|
|
16
|
-
rangeSelection = _useCurrentSelection.rangeSelection;
|
|
17
|
-
var isBoldSelected = rangeSelection ? rangeSelection.hasFormat("bold") : false;
|
|
18
|
-
var handleClick = function handleClick() {
|
|
19
|
-
editor.dispatchCommand(_lexical.FORMAT_TEXT_COMMAND, "bold");
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FORMAT_TEXT_COMMAND } from "lexical";
|
|
3
|
+
import { useCurrentSelection } from "../../hooks/useCurrentSelection.js";
|
|
4
|
+
import { useRichTextEditor } from "../../hooks/index.js";
|
|
5
|
+
export const BoldAction = () => {
|
|
6
|
+
const {
|
|
7
|
+
editor
|
|
8
|
+
} = useRichTextEditor();
|
|
9
|
+
const {
|
|
10
|
+
rangeSelection
|
|
11
|
+
} = useCurrentSelection();
|
|
12
|
+
const isBoldSelected = rangeSelection ? rangeSelection.hasFormat("bold") : false;
|
|
13
|
+
const handleClick = () => {
|
|
14
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold");
|
|
20
15
|
};
|
|
21
|
-
return /*#__PURE__*/
|
|
16
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
22
17
|
onClick: handleClick,
|
|
23
18
|
className: "popup-item spaced " + (isBoldSelected ? "active" : ""),
|
|
24
19
|
"aria-label": "Format text as bold"
|
|
25
|
-
}, /*#__PURE__*/
|
|
20
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
26
21
|
className: "format bold"
|
|
27
22
|
}));
|
|
28
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["React","FORMAT_TEXT_COMMAND","useCurrentSelection","useRichTextEditor","BoldAction","editor","rangeSelection","isBoldSelected","hasFormat","handleClick","dispatchCommand","createElement","onClick","className"],"sources":["BoldAction.tsx"],"sourcesContent":["import React from \"react\";\nimport { FORMAT_TEXT_COMMAND } from \"lexical\";\nimport { useCurrentSelection } from \"~/hooks/useCurrentSelection.js\";\nimport { useRichTextEditor } from \"~/hooks/index.js\";\n\nexport const BoldAction = () => {\n const { editor } = useRichTextEditor();\n const { rangeSelection } = useCurrentSelection();\n const isBoldSelected = rangeSelection ? rangeSelection.hasFormat(\"bold\") : false;\n\n const handleClick = () => {\n editor.dispatchCommand(FORMAT_TEXT_COMMAND, \"bold\");\n };\n\n return (\n <button\n onClick={handleClick}\n className={\"popup-item spaced \" + (isBoldSelected ? \"active\" : \"\")}\n aria-label=\"Format text as bold\"\n >\n <i className=\"format bold\" />\n </button>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,mBAAmB,QAAQ,SAAS;AAC7C,SAASC,mBAAmB;AAC5B,SAASC,iBAAiB;AAE1B,OAAO,MAAMC,UAAU,GAAGA,CAAA,KAAM;EAC5B,MAAM;IAAEC;EAAO,CAAC,GAAGF,iBAAiB,CAAC,CAAC;EACtC,MAAM;IAAEG;EAAe,CAAC,GAAGJ,mBAAmB,CAAC,CAAC;EAChD,MAAMK,cAAc,GAAGD,cAAc,GAAGA,cAAc,CAACE,SAAS,CAAC,MAAM,CAAC,GAAG,KAAK;EAEhF,MAAMC,WAAW,GAAGA,CAAA,KAAM;IACtBJ,MAAM,CAACK,eAAe,CAACT,mBAAmB,EAAE,MAAM,CAAC;EACvD,CAAC;EAED,oBACID,KAAA,CAAAW,aAAA;IACIC,OAAO,EAAEH,WAAY;IACrBI,SAAS,EAAE,oBAAoB,IAAIN,cAAc,GAAG,QAAQ,GAAG,EAAE,CAAE;IACnE,cAAW;EAAqB,gBAEhCP,KAAA,CAAAW,aAAA;IAAGE,SAAS,EAAC;EAAa,CAAE,CACxB,CAAC;AAEjB,CAAC","ignoreList":[]}
|
|
@@ -1,43 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var _useRichTextEditor2 = (0, _useRichTextEditor3.useRichTextEditor)(),
|
|
20
|
-
themeEmotionMap = _useRichTextEditor2.themeEmotionMap;
|
|
21
|
-
var isList = (0, _lexicalNodes.$isListNode)(element);
|
|
22
|
-
var isBullet = isList && element.getListType() === "bullet";
|
|
23
|
-
var formatBulletList = function formatBulletList() {
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { INSERT_UNORDERED_LIST_COMMAND, REMOVE_LIST_COMMAND } from "../../commands/index.js";
|
|
3
|
+
import { useRichTextEditor } from "../../hooks/useRichTextEditor.js";
|
|
4
|
+
import { $isListNode } from "@webiny/lexical-nodes";
|
|
5
|
+
import { useCurrentElement } from "../../hooks/useCurrentElement.js";
|
|
6
|
+
export const BulletListAction = () => {
|
|
7
|
+
const {
|
|
8
|
+
editor
|
|
9
|
+
} = useRichTextEditor();
|
|
10
|
+
const {
|
|
11
|
+
element
|
|
12
|
+
} = useCurrentElement();
|
|
13
|
+
const {
|
|
14
|
+
theme
|
|
15
|
+
} = useRichTextEditor();
|
|
16
|
+
const isList = $isListNode(element);
|
|
17
|
+
const isBullet = isList && element.getListType() === "bullet";
|
|
18
|
+
const formatBulletList = () => {
|
|
24
19
|
if (!isBullet) {
|
|
25
|
-
|
|
20
|
+
const styleId = theme.getTypographyByTag("ul")?.id;
|
|
21
|
+
|
|
26
22
|
// will update the active state in the useEffect
|
|
27
|
-
editor.dispatchCommand(
|
|
23
|
+
editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, {
|
|
28
24
|
themeStyleId: styleId
|
|
29
25
|
});
|
|
30
26
|
} else {
|
|
31
|
-
editor.dispatchCommand(
|
|
27
|
+
editor.dispatchCommand(REMOVE_LIST_COMMAND, undefined);
|
|
32
28
|
}
|
|
33
29
|
};
|
|
34
|
-
return /*#__PURE__*/
|
|
35
|
-
onClick:
|
|
36
|
-
return formatBulletList();
|
|
37
|
-
},
|
|
30
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
31
|
+
onClick: () => formatBulletList(),
|
|
38
32
|
className: "popup-item spaced " + (isBullet ? "active" : ""),
|
|
39
33
|
"aria-label": "Format text as bullet list"
|
|
40
|
-
}, /*#__PURE__*/
|
|
34
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
41
35
|
className: "icon bullet-list"
|
|
42
36
|
}));
|
|
43
37
|
};
|