@webiny/lexical-editor 0.0.0-unstable.085ff6572f
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/LICENSE +21 -0
- package/README.md +17 -0
- package/commands/webiny-list.d.ts +7 -0
- package/commands/webiny-list.js +13 -0
- package/commands/webiny-list.js.map +1 -0
- package/commands/webiny-quote.d.ts +5 -0
- package/commands/webiny-quote.js +9 -0
- package/commands/webiny-quote.js.map +1 -0
- package/components/AddRichTextEditorNodeType.d.ts +6 -0
- package/components/AddRichTextEditorNodeType.js +28 -0
- package/components/AddRichTextEditorNodeType.js.map +1 -0
- package/components/AddRichTextEditorPlugin.d.ts +12 -0
- package/components/AddRichTextEditorPlugin.js +33 -0
- package/components/AddRichTextEditorPlugin.js.map +1 -0
- package/components/AddToolbarAction.d.ts +7 -0
- package/components/AddToolbarAction.js +33 -0
- package/components/AddToolbarAction.js.map +1 -0
- package/components/Editor/HeadingEditor.d.ts +7 -0
- package/components/Editor/HeadingEditor.js +29 -0
- package/components/Editor/HeadingEditor.js.map +1 -0
- package/components/Editor/ParagraphEditor.d.ts +7 -0
- package/components/Editor/ParagraphEditor.js +30 -0
- package/components/Editor/ParagraphEditor.js.map +1 -0
- package/components/Editor/RichTextEditor.d.ts +26 -0
- package/components/Editor/RichTextEditor.js +138 -0
- package/components/Editor/RichTextEditor.js.map +1 -0
- package/components/LexicalEditorConfig/LexicalEditorConfig.d.ts +11 -0
- package/components/LexicalEditorConfig/LexicalEditorConfig.js +19 -0
- package/components/LexicalEditorConfig/LexicalEditorConfig.js.map +1 -0
- package/components/LexicalHtmlRenderer.d.ts +16 -0
- package/components/LexicalHtmlRenderer.js +67 -0
- package/components/LexicalHtmlRenderer.js.map +1 -0
- package/components/Toolbar/HeadingToolbar.d.ts +12 -0
- package/components/Toolbar/HeadingToolbar.js +23 -0
- package/components/Toolbar/HeadingToolbar.js.map +1 -0
- package/components/Toolbar/ParagraphToolbar.d.ts +12 -0
- package/components/Toolbar/ParagraphToolbar.js +23 -0
- package/components/Toolbar/ParagraphToolbar.js.map +1 -0
- package/components/Toolbar/Toolbar.css +435 -0
- package/components/Toolbar/Toolbar.d.ts +13 -0
- package/components/Toolbar/Toolbar.js +215 -0
- package/components/Toolbar/Toolbar.js.map +1 -0
- package/components/ToolbarActions/BoldAction.d.ts +2 -0
- package/components/ToolbarActions/BoldAction.js +43 -0
- package/components/ToolbarActions/BoldAction.js.map +1 -0
- package/components/ToolbarActions/BulletListAction.d.ts +2 -0
- package/components/ToolbarActions/BulletListAction.js +56 -0
- package/components/ToolbarActions/BulletListAction.js.map +1 -0
- package/components/ToolbarActions/CodeHighlightAction.d.ts +2 -0
- package/components/ToolbarActions/CodeHighlightAction.js +43 -0
- package/components/ToolbarActions/CodeHighlightAction.js.map +1 -0
- package/components/ToolbarActions/FontColorAction.d.ts +11 -0
- package/components/ToolbarActions/FontColorAction.js +83 -0
- package/components/ToolbarActions/FontColorAction.js.map +1 -0
- package/components/ToolbarActions/FontSizeAction.d.ts +2 -0
- package/components/ToolbarActions/FontSizeAction.js +101 -0
- package/components/ToolbarActions/FontSizeAction.js.map +1 -0
- package/components/ToolbarActions/ItalicAction.d.ts +2 -0
- package/components/ToolbarActions/ItalicAction.js +43 -0
- package/components/ToolbarActions/ItalicAction.js.map +1 -0
- package/components/ToolbarActions/LinkAction.d.ts +2 -0
- package/components/ToolbarActions/LinkAction.js +64 -0
- package/components/ToolbarActions/LinkAction.js.map +1 -0
- package/components/ToolbarActions/NumberedListAction.d.ts +2 -0
- package/components/ToolbarActions/NumberedListAction.js +58 -0
- package/components/ToolbarActions/NumberedListAction.js.map +1 -0
- package/components/ToolbarActions/QuoteAction.d.ts +2 -0
- package/components/ToolbarActions/QuoteAction.js +52 -0
- package/components/ToolbarActions/QuoteAction.js.map +1 -0
- package/components/ToolbarActions/TextAlignmentAction.d.ts +11 -0
- package/components/ToolbarActions/TextAlignmentAction.js +70 -0
- package/components/ToolbarActions/TextAlignmentAction.js.map +1 -0
- package/components/ToolbarActions/TypographyAction.d.ts +11 -0
- package/components/ToolbarActions/TypographyAction.js +145 -0
- package/components/ToolbarActions/TypographyAction.js.map +1 -0
- package/components/ToolbarActions/UnderlineAction.d.ts +2 -0
- package/components/ToolbarActions/UnderlineAction.js +43 -0
- package/components/ToolbarActions/UnderlineAction.js.map +1 -0
- package/components/ToolbarPresets/HeadingToolbarPreset.d.ts +2 -0
- package/components/ToolbarPresets/HeadingToolbarPreset.js +56 -0
- package/components/ToolbarPresets/HeadingToolbarPreset.js.map +1 -0
- package/components/ToolbarPresets/ParagraphToolbarPreset.d.ts +2 -0
- package/components/ToolbarPresets/ParagraphToolbarPreset.js +71 -0
- package/components/ToolbarPresets/ParagraphToolbarPreset.js.map +1 -0
- package/context/FontColorActionContext.d.ts +6 -0
- package/context/FontColorActionContext.js +10 -0
- package/context/FontColorActionContext.js.map +1 -0
- package/context/RichTextEditorContext.d.ts +26 -0
- package/context/RichTextEditorContext.js +68 -0
- package/context/RichTextEditorContext.js.map +1 -0
- package/context/SharedHistoryContext.d.ts +11 -0
- package/context/SharedHistoryContext.js +26 -0
- package/context/SharedHistoryContext.js.map +1 -0
- package/context/TextAlignmentActionContextProps.d.ts +9 -0
- package/context/TextAlignmentActionContextProps.js +10 -0
- package/context/TextAlignmentActionContextProps.js.map +1 -0
- package/context/TypographyActionContext.d.ts +7 -0
- package/context/TypographyActionContext.js +10 -0
- package/context/TypographyActionContext.js.map +1 -0
- package/hooks/useFontColorPicker.d.ts +2 -0
- package/hooks/useFontColorPicker.js +15 -0
- package/hooks/useFontColorPicker.js.map +1 -0
- package/hooks/useList.d.ts +2 -0
- package/hooks/useList.js +39 -0
- package/hooks/useList.js.map +1 -0
- package/hooks/useQuote.d.ts +2 -0
- package/hooks/useQuote.js +20 -0
- package/hooks/useQuote.js.map +1 -0
- package/hooks/useRichTextEditor.d.ts +2 -0
- package/hooks/useRichTextEditor.js +15 -0
- package/hooks/useRichTextEditor.js.map +1 -0
- package/hooks/useTextAlignmentAction.d.ts +1 -0
- package/hooks/useTextAlignmentAction.js +15 -0
- package/hooks/useTextAlignmentAction.js.map +1 -0
- package/hooks/useTypographyAction.d.ts +1 -0
- package/hooks/useTypographyAction.js +15 -0
- package/hooks/useTypographyAction.js.map +1 -0
- package/images/icons/LICENSE.md +5 -0
- package/images/icons/chat-square-quote.svg +1 -0
- package/images/icons/chevron-down.svg +1 -0
- package/images/icons/code.svg +1 -0
- package/images/icons/font-color.svg +1 -0
- package/images/icons/indent.svg +3 -0
- package/images/icons/justify.svg +3 -0
- package/images/icons/link.svg +1 -0
- package/images/icons/list-ol.svg +1 -0
- package/images/icons/list-ul.svg +1 -0
- package/images/icons/outdent.svg +3 -0
- package/images/icons/pencil-fill.svg +1 -0
- package/images/icons/text-center.svg +1 -0
- package/images/icons/text-left.svg +1 -0
- package/images/icons/text-paragraph.svg +1 -0
- package/images/icons/text-right.svg +1 -0
- package/images/icons/type-bold.svg +1 -0
- package/images/icons/type-h1.svg +1 -0
- package/images/icons/type-h2.svg +1 -0
- package/images/icons/type-h3.svg +1 -0
- package/images/icons/type-h4.svg +1 -0
- package/images/icons/type-h5.svg +1 -0
- package/images/icons/type-h6.svg +1 -0
- package/images/icons/type-italic.svg +1 -0
- package/images/icons/type-strikethrough.svg +1 -0
- package/images/icons/type-underline.svg +1 -0
- package/images/icons/unlink_icon.svg +1 -0
- package/index.d.ts +42 -0
- package/index.js +295 -0
- package/index.js.map +1 -0
- package/nodes/FontColorNode.d.ts +43 -0
- package/nodes/FontColorNode.js +127 -0
- package/nodes/FontColorNode.js.map +1 -0
- package/nodes/HeadingNode.d.ts +34 -0
- package/nodes/HeadingNode.js +192 -0
- package/nodes/HeadingNode.js.map +1 -0
- package/nodes/ListItemNode.d.ts +46 -0
- package/nodes/ListItemNode.js +441 -0
- package/nodes/ListItemNode.js.map +1 -0
- package/nodes/ListNode/formatList.d.ts +12 -0
- package/nodes/ListNode/formatList.js +424 -0
- package/nodes/ListNode/formatList.js.map +1 -0
- package/nodes/ListNode.d.ts +42 -0
- package/nodes/ListNode.js +294 -0
- package/nodes/ListNode.js.map +1 -0
- package/nodes/ParagraphNode.d.ts +32 -0
- package/nodes/ParagraphNode.js +218 -0
- package/nodes/ParagraphNode.js.map +1 -0
- package/nodes/QuoteNode.d.ts +34 -0
- package/nodes/QuoteNode.js +225 -0
- package/nodes/QuoteNode.js.map +1 -0
- package/nodes/TypographyElementNode.d.ts +42 -0
- package/nodes/TypographyElementNode.js +155 -0
- package/nodes/TypographyElementNode.js.map +1 -0
- package/nodes/types.d.ts +15 -0
- package/nodes/types.js +5 -0
- package/nodes/types.js.map +1 -0
- package/nodes/webinyNodes.d.ts +7 -0
- package/nodes/webinyNodes.js +45 -0
- package/nodes/webinyNodes.js.map +1 -0
- package/package.json +41 -0
- package/plugins/AutoLinkPlugin/AutoLinkPlugin.d.ts +11 -0
- package/plugins/AutoLinkPlugin/AutoLinkPlugin.js +46 -0
- package/plugins/AutoLinkPlugin/AutoLinkPlugin.js.map +1 -0
- package/plugins/AutoLinkPlugin/index.d.ts +1 -0
- package/plugins/AutoLinkPlugin/index.js +16 -0
- package/plugins/AutoLinkPlugin/index.js.map +1 -0
- package/plugins/BlurEventPlugin/BlurEventPlugin.d.ts +7 -0
- package/plugins/BlurEventPlugin/BlurEventPlugin.js +28 -0
- package/plugins/BlurEventPlugin/BlurEventPlugin.js.map +1 -0
- package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.d.ts +17 -0
- package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.js +88 -0
- package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.js.map +1 -0
- package/plugins/ClickableLinkPlugin/index.d.ts +1 -0
- package/plugins/ClickableLinkPlugin/index.js +16 -0
- package/plugins/ClickableLinkPlugin/index.js.map +1 -0
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.d.ts +1 -0
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js +20 -0
- package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js.map +1 -0
- package/plugins/CodeHighlightPlugin/index.d.ts +1 -0
- package/plugins/CodeHighlightPlugin/index.js +16 -0
- package/plugins/CodeHighlightPlugin/index.js.map +1 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.css +118 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.d.ts +7 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js +222 -0
- package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js.map +1 -0
- package/plugins/FloatingLinkEditorPlugin/index.d.ts +1 -0
- package/plugins/FloatingLinkEditorPlugin/index.js +16 -0
- package/plugins/FloatingLinkEditorPlugin/index.js.map +1 -0
- package/plugins/FontColorPlugin/FontColorPlugin.d.ts +2 -0
- package/plugins/FontColorPlugin/FontColorPlugin.js +39 -0
- package/plugins/FontColorPlugin/FontColorPlugin.js.map +1 -0
- package/plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin.d.ts +8 -0
- package/plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin.js +34 -0
- package/plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin.js.map +1 -0
- package/plugins/LexicalUpdateStatePlugin/index.d.ts +1 -0
- package/plugins/LexicalUpdateStatePlugin/index.js +16 -0
- package/plugins/LexicalUpdateStatePlugin/index.js.map +1 -0
- package/plugins/TypographyPlugin/TypographyPlugin.d.ts +2 -0
- package/plugins/TypographyPlugin/TypographyPlugin.js +35 -0
- package/plugins/TypographyPlugin/TypographyPlugin.js.map +1 -0
- package/plugins/WebinyListPLugin/WebinyListPlugin.d.ts +1 -0
- package/plugins/WebinyListPLugin/WebinyListPlugin.js +25 -0
- package/plugins/WebinyListPLugin/WebinyListPlugin.js.map +1 -0
- package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.d.ts +1 -0
- package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.js +24 -0
- package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.js.map +1 -0
- package/themes/webinyLexicalTheme.css +429 -0
- package/themes/webinyLexicalTheme.d.ts +9 -0
- package/themes/webinyLexicalTheme.js +87 -0
- package/themes/webinyLexicalTheme.js.map +1 -0
- package/types.d.ts +63 -0
- package/types.js +25 -0
- package/types.js.map +1 -0
- package/ui/Divider.d.ts +2 -0
- package/ui/Divider.js +13 -0
- package/ui/Divider.js.map +1 -0
- package/ui/DropDown.d.ts +26 -0
- package/ui/DropDown.js +206 -0
- package/ui/DropDown.js.map +1 -0
- package/ui/Input.css +32 -0
- package/ui/LinkPreview.css +69 -0
- package/ui/LinkPreview.d.ts +12 -0
- package/ui/LinkPreview.js +101 -0
- package/ui/LinkPreview.js.map +1 -0
- package/ui/Placeholder.css +23 -0
- package/ui/Placeholder.d.ts +13 -0
- package/ui/Placeholder.js +24 -0
- package/ui/Placeholder.js.map +1 -0
- package/ui/TextInput.d.ts +18 -0
- package/ui/TextInput.js +39 -0
- package/ui/TextInput.js.map +1 -0
- package/ui/ToolbarActionDialog.d.ts +12 -0
- package/ui/ToolbarActionDialog.js +106 -0
- package/ui/ToolbarActionDialog.js.map +1 -0
- package/utils/findTypographyStyleByHtmlTag.d.ts +8 -0
- package/utils/findTypographyStyleByHtmlTag.js +16 -0
- package/utils/findTypographyStyleByHtmlTag.js.map +1 -0
- package/utils/generateInitialLexicalValue.d.ts +5 -0
- package/utils/generateInitialLexicalValue.js +30 -0
- package/utils/generateInitialLexicalValue.js.map +1 -0
- package/utils/getDOMRangeRect.d.ts +10 -0
- package/utils/getDOMRangeRect.js +27 -0
- package/utils/getDOMRangeRect.js.map +1 -0
- package/utils/getLexicalTextSelectionState.d.ts +5 -0
- package/utils/getLexicalTextSelectionState.js +163 -0
- package/utils/getLexicalTextSelectionState.js.map +1 -0
- package/utils/getSelectedNode.d.ts +2 -0
- package/utils/getSelectedNode.js +30 -0
- package/utils/getSelectedNode.js.map +1 -0
- package/utils/isValidJSON.d.ts +1 -0
- package/utils/isValidJSON.js +18 -0
- package/utils/isValidJSON.js.map +1 -0
- package/utils/isValidLexicalData.d.ts +2 -0
- package/utils/isValidLexicalData.js +24 -0
- package/utils/isValidLexicalData.js.map +1 -0
- package/utils/nodes/clearNodeFormating.d.ts +2 -0
- package/utils/nodes/clearNodeFormating.js +28 -0
- package/utils/nodes/clearNodeFormating.js.map +1 -0
- package/utils/nodes/formatToHeading.d.ts +3 -0
- package/utils/nodes/formatToHeading.js +25 -0
- package/utils/nodes/formatToHeading.js.map +1 -0
- package/utils/nodes/formatToParagraph.d.ts +2 -0
- package/utils/nodes/formatToParagraph.js +20 -0
- package/utils/nodes/formatToParagraph.js.map +1 -0
- package/utils/nodes/formatToQuote.d.ts +2 -0
- package/utils/nodes/formatToQuote.js +25 -0
- package/utils/nodes/formatToQuote.js.map +1 -0
- package/utils/nodes/listNode.d.ts +11 -0
- package/utils/nodes/listNode.js +107 -0
- package/utils/nodes/listNode.js.map +1 -0
- package/utils/point.d.ts +21 -0
- package/utils/point.js +77 -0
- package/utils/point.js.map +1 -0
- package/utils/rect.d.ts +47 -0
- package/utils/rect.js +169 -0
- package/utils/rect.js.map +1 -0
- package/utils/sanitizeUrl.d.ts +8 -0
- package/utils/sanitizeUrl.js +27 -0
- package/utils/sanitizeUrl.js.map +1 -0
- package/utils/setFloatingElemPosition.d.ts +3 -0
- package/utils/setFloatingElemPosition.js +40 -0
- package/utils/setFloatingElemPosition.js.map +1 -0
- package/utils/styleObjectToString.d.ts +2 -0
- package/utils/styleObjectToString.js +22 -0
- package/utils/styleObjectToString.js.map +1 -0
- package/utils/toTypographyEmotionMap.d.ts +3 -0
- package/utils/toTypographyEmotionMap.js +36 -0
- package/utils/toTypographyEmotionMap.js.map +1 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.LexicalAutoLinkPlugin = void 0;
|
|
8
|
+
var _LexicalAutoLinkPlugin = require("@lexical/react/LexicalAutoLinkPlugin");
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
/**
|
|
11
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the MIT license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
var URL_MATCHER = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
|
|
19
|
+
var EMAIL_MATCHER = /(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/;
|
|
20
|
+
var MATCHERS = [function (text) {
|
|
21
|
+
var match = URL_MATCHER.exec(text);
|
|
22
|
+
if (match === null) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
var fullMatch = match[0];
|
|
26
|
+
return {
|
|
27
|
+
index: match.index,
|
|
28
|
+
length: fullMatch.length,
|
|
29
|
+
text: fullMatch,
|
|
30
|
+
url: fullMatch.startsWith("http") ? fullMatch : "https://".concat(fullMatch)
|
|
31
|
+
};
|
|
32
|
+
}, function (text) {
|
|
33
|
+
var match = EMAIL_MATCHER.exec(text);
|
|
34
|
+
return match && {
|
|
35
|
+
index: match.index,
|
|
36
|
+
length: match[0].length,
|
|
37
|
+
text: match[0],
|
|
38
|
+
url: "mailto:".concat(match[0])
|
|
39
|
+
};
|
|
40
|
+
}];
|
|
41
|
+
var LexicalAutoLinkPlugin = function LexicalAutoLinkPlugin() {
|
|
42
|
+
return /*#__PURE__*/React.createElement(_LexicalAutoLinkPlugin.AutoLinkPlugin, {
|
|
43
|
+
matchers: MATCHERS
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
exports.LexicalAutoLinkPlugin = LexicalAutoLinkPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["URL_MATCHER","EMAIL_MATCHER","MATCHERS","text","match","exec","fullMatch","index","length","url","startsWith","LexicalAutoLinkPlugin"],"sources":["AutoLinkPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { AutoLinkPlugin } from \"@lexical/react/LexicalAutoLinkPlugin\";\nimport * as React from \"react\";\n\nconst URL_MATCHER =\n /((https?:\\/\\/(www\\.)?)|(www\\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;\n\nconst EMAIL_MATCHER =\n /(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))/;\n\nconst MATCHERS = [\n (text: string) => {\n const match = URL_MATCHER.exec(text);\n if (match === null) {\n return null;\n }\n const fullMatch = match[0];\n return {\n index: match.index,\n length: fullMatch.length,\n text: fullMatch,\n url: fullMatch.startsWith(\"http\") ? fullMatch : `https://${fullMatch}`\n };\n },\n (text: string) => {\n const match = EMAIL_MATCHER.exec(text);\n return (\n match && {\n index: match.index,\n length: match[0].length,\n text: match[0],\n url: `mailto:${match[0]}`\n }\n );\n }\n];\n\nexport const LexicalAutoLinkPlugin = (): JSX.Element => {\n return <AutoLinkPlugin matchers={MATCHERS} />;\n};\n"],"mappings":";;;;;;;AAQA;AACA;AATA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,IAAMA,WAAW,GACb,iHAAiH;AAErH,IAAMC,aAAa,GACf,qJAAqJ;AAEzJ,IAAMC,QAAQ,GAAG,CACb,UAACC,IAAY,EAAK;EACd,IAAMC,KAAK,GAAGJ,WAAW,CAACK,IAAI,CAACF,IAAI,CAAC;EACpC,IAAIC,KAAK,KAAK,IAAI,EAAE;IAChB,OAAO,IAAI;EACf;EACA,IAAME,SAAS,GAAGF,KAAK,CAAC,CAAC,CAAC;EAC1B,OAAO;IACHG,KAAK,EAAEH,KAAK,CAACG,KAAK;IAClBC,MAAM,EAAEF,SAAS,CAACE,MAAM;IACxBL,IAAI,EAAEG,SAAS;IACfG,GAAG,EAAEH,SAAS,CAACI,UAAU,CAAC,MAAM,CAAC,GAAGJ,SAAS,qBAAcA,SAAS;EACxE,CAAC;AACL,CAAC,EACD,UAACH,IAAY,EAAK;EACd,IAAMC,KAAK,GAAGH,aAAa,CAACI,IAAI,CAACF,IAAI,CAAC;EACtC,OACIC,KAAK,IAAI;IACLG,KAAK,EAAEH,KAAK,CAACG,KAAK;IAClBC,MAAM,EAAEJ,KAAK,CAAC,CAAC,CAAC,CAACI,MAAM;IACvBL,IAAI,EAAEC,KAAK,CAAC,CAAC,CAAC;IACdK,GAAG,mBAAYL,KAAK,CAAC,CAAC,CAAC;EAC3B,CAAC;AAET,CAAC,CACJ;AAEM,IAAMO,qBAAqB,GAAG,SAAxBA,qBAAqB,GAAsB;EACpD,oBAAO,oBAAC,qCAAc;IAAC,QAAQ,EAAET;EAAS,EAAG;AACjD,CAAC;AAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./AutoLinkPlugin";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _AutoLinkPlugin = require("./AutoLinkPlugin");
|
|
7
|
+
Object.keys(_AutoLinkPlugin).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _AutoLinkPlugin[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _AutoLinkPlugin[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./AutoLinkPlugin\";\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.BlurEventPlugin = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _LexicalComposerContext = require("@lexical/react/LexicalComposerContext");
|
|
11
|
+
var _lexical = require("lexical");
|
|
12
|
+
var BlurEventPlugin = function BlurEventPlugin(_ref) {
|
|
13
|
+
var onBlur = _ref.onBlur;
|
|
14
|
+
var _useLexicalComposerCo = (0, _LexicalComposerContext.useLexicalComposerContext)(),
|
|
15
|
+
_useLexicalComposerCo2 = (0, _slicedToArray2.default)(_useLexicalComposerCo, 1),
|
|
16
|
+
editor = _useLexicalComposerCo2[0];
|
|
17
|
+
(0, _react.useEffect)(function () {
|
|
18
|
+
return editor.registerCommand(_lexical.BLUR_COMMAND, function () {
|
|
19
|
+
if (typeof onBlur === "function") {
|
|
20
|
+
var _editorState = editor.getEditorState();
|
|
21
|
+
onBlur(JSON.stringify(_editorState.toJSON()));
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
}, _lexical.COMMAND_PRIORITY_LOW);
|
|
25
|
+
}, []);
|
|
26
|
+
return null;
|
|
27
|
+
};
|
|
28
|
+
exports.BlurEventPlugin = BlurEventPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BlurEventPlugin","onBlur","useLexicalComposerContext","editor","useEffect","registerCommand","BLUR_COMMAND","editorState","getEditorState","JSON","stringify","toJSON","COMMAND_PRIORITY_LOW"],"sources":["BlurEventPlugin.tsx"],"sourcesContent":["import { FC, useEffect } from \"react\";\nimport { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW } from \"lexical\";\nimport { LexicalValue } from \"~/types\";\n\ninterface BlurEventPlugin {\n onBlur?: (editorState: LexicalValue) => void;\n}\n\nexport const BlurEventPlugin: FC<BlurEventPlugin> = ({ onBlur }) => {\n const [editor] = useLexicalComposerContext();\n\n useEffect(\n () =>\n editor.registerCommand(\n BLUR_COMMAND,\n () => {\n if (typeof onBlur === \"function\") {\n const editorState = editor.getEditorState();\n onBlur(JSON.stringify(editorState.toJSON()));\n }\n return false;\n },\n COMMAND_PRIORITY_LOW\n ),\n []\n );\n return null;\n};\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AAOO,IAAMA,eAAoC,GAAG,SAAvCA,eAAoC,OAAmB;EAAA,IAAbC,MAAM,QAANA,MAAM;EACzD,4BAAiB,IAAAC,iDAAyB,GAAE;IAAA;IAArCC,MAAM;EAEb,IAAAC,gBAAS,EACL;IAAA,OACID,MAAM,CAACE,eAAe,CAClBC,qBAAY,EACZ,YAAM;MACF,IAAI,OAAOL,MAAM,KAAK,UAAU,EAAE;QAC9B,IAAMM,YAAW,GAAGJ,MAAM,CAACK,cAAc,EAAE;QAC3CP,MAAM,CAACQ,IAAI,CAACC,SAAS,CAACH,YAAW,CAACI,MAAM,EAAE,CAAC,CAAC;MAChD;MACA,OAAO,KAAK;IAChB,CAAC,EACDC,6BAAoB,CACvB;EAAA,GACL,EAAE,CACL;EACD,OAAO,IAAI;AACf,CAAC;AAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
/// <reference types="react" />
|
|
9
|
+
/// <reference types="react" />
|
|
10
|
+
/// <reference types="web" />
|
|
11
|
+
import type { LinkNode } from "@lexical/link";
|
|
12
|
+
declare type LinkFilter = (event: MouseEvent, linkNode: LinkNode) => boolean;
|
|
13
|
+
export declare function ClickableLinkPlugin({ filter, newTab }: {
|
|
14
|
+
filter?: LinkFilter;
|
|
15
|
+
newTab?: boolean;
|
|
16
|
+
}): JSX.Element | null;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ClickableLinkPlugin = ClickableLinkPlugin;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _link = require("@lexical/link");
|
|
10
|
+
var _LexicalComposerContext = require("@lexical/react/LexicalComposerContext");
|
|
11
|
+
var _lexical = require("lexical");
|
|
12
|
+
var _react = require("react");
|
|
13
|
+
/**
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
function ClickableLinkPlugin(_ref) {
|
|
22
|
+
var filter = _ref.filter,
|
|
23
|
+
_ref$newTab = _ref.newTab,
|
|
24
|
+
newTab = _ref$newTab === void 0 ? true : _ref$newTab;
|
|
25
|
+
var _useLexicalComposerCo = (0, _LexicalComposerContext.useLexicalComposerContext)(),
|
|
26
|
+
_useLexicalComposerCo2 = (0, _slicedToArray2.default)(_useLexicalComposerCo, 1),
|
|
27
|
+
editor = _useLexicalComposerCo2[0];
|
|
28
|
+
(0, _react.useEffect)(function () {
|
|
29
|
+
function onClick(e) {
|
|
30
|
+
var event = e;
|
|
31
|
+
var linkDomNode = getLinkDomNode(event, editor);
|
|
32
|
+
if (linkDomNode === null) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
var href = linkDomNode.getAttribute("href");
|
|
36
|
+
if (linkDomNode.getAttribute("contenteditable") === "false" || href === undefined) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Allow user to select link text without following url
|
|
41
|
+
var selection = editor.getEditorState().read(_lexical.$getSelection);
|
|
42
|
+
if ((0, _lexical.$isRangeSelection)(selection) && !selection.isCollapsed()) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
var linkNode = null;
|
|
46
|
+
editor.update(function () {
|
|
47
|
+
var maybeLinkNode = (0, _lexical.$getNearestNodeFromDOMNode)(linkDomNode);
|
|
48
|
+
if ((0, _link.$isLinkNode)(maybeLinkNode)) {
|
|
49
|
+
linkNode = maybeLinkNode;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
if (linkNode === null || filter !== undefined && !filter(event, linkNode)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
if (href !== null) {
|
|
57
|
+
window.open(href, newTab || event.metaKey || event.ctrlKey ? "_blank" : "_self");
|
|
58
|
+
}
|
|
59
|
+
} catch (_unused) {
|
|
60
|
+
// It didn't work, which is better than throwing an exception!
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return editor.registerRootListener(function (rootElement, prevRootElement) {
|
|
64
|
+
if (prevRootElement !== null) {
|
|
65
|
+
prevRootElement.removeEventListener("click", onClick);
|
|
66
|
+
}
|
|
67
|
+
if (rootElement !== null) {
|
|
68
|
+
rootElement.addEventListener("click", onClick);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}, [editor, filter, newTab]);
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
function isLinkDomNode(domNode) {
|
|
75
|
+
return domNode.nodeName.toLowerCase() === "a";
|
|
76
|
+
}
|
|
77
|
+
function getLinkDomNode(event, editor) {
|
|
78
|
+
return editor.getEditorState().read(function () {
|
|
79
|
+
var domNode = event.target;
|
|
80
|
+
if (isLinkDomNode(domNode)) {
|
|
81
|
+
return domNode;
|
|
82
|
+
}
|
|
83
|
+
if (domNode.parentNode && isLinkDomNode(domNode.parentNode)) {
|
|
84
|
+
return domNode.parentNode;
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ClickableLinkPlugin","filter","newTab","useLexicalComposerContext","editor","useEffect","onClick","e","event","linkDomNode","getLinkDomNode","href","getAttribute","undefined","selection","getEditorState","read","$getSelection","$isRangeSelection","isCollapsed","linkNode","update","maybeLinkNode","$getNearestNodeFromDOMNode","$isLinkNode","window","open","metaKey","ctrlKey","registerRootListener","rootElement","prevRootElement","removeEventListener","addEventListener","isLinkDomNode","domNode","nodeName","toLowerCase","target","parentNode"],"sources":["ClickableLinkPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport type { LinkNode } from \"@lexical/link\";\nimport type { LexicalEditor } from \"lexical\";\n\nimport { $isLinkNode } from \"@lexical/link\";\nimport { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { $getNearestNodeFromDOMNode, $getSelection, $isRangeSelection } from \"lexical\";\nimport { useEffect } from \"react\";\n\ntype LinkFilter = (event: MouseEvent, linkNode: LinkNode) => boolean;\n\nexport function ClickableLinkPlugin({\n filter,\n newTab = true\n}: {\n filter?: LinkFilter;\n newTab?: boolean;\n}): JSX.Element | null {\n const [editor] = useLexicalComposerContext();\n useEffect(() => {\n function onClick(e: Event) {\n const event = e as MouseEvent;\n const linkDomNode = getLinkDomNode(event, editor);\n\n if (linkDomNode === null) {\n return;\n }\n\n const href = linkDomNode.getAttribute(\"href\");\n\n if (linkDomNode.getAttribute(\"contenteditable\") === \"false\" || href === undefined) {\n return;\n }\n\n // Allow user to select link text without following url\n const selection = editor.getEditorState().read($getSelection);\n if ($isRangeSelection(selection) && !selection.isCollapsed()) {\n return;\n }\n\n let linkNode = null;\n editor.update(() => {\n const maybeLinkNode = $getNearestNodeFromDOMNode(linkDomNode);\n\n if ($isLinkNode(maybeLinkNode)) {\n linkNode = maybeLinkNode;\n }\n });\n\n if (linkNode === null || (filter !== undefined && !filter(event, linkNode))) {\n return;\n }\n\n try {\n if (href !== null) {\n window.open(\n href,\n newTab || event.metaKey || event.ctrlKey ? \"_blank\" : \"_self\"\n );\n }\n } catch {\n // It didn't work, which is better than throwing an exception!\n }\n }\n\n return editor.registerRootListener(\n (rootElement: null | HTMLElement, prevRootElement: null | HTMLElement) => {\n if (prevRootElement !== null) {\n prevRootElement.removeEventListener(\"click\", onClick);\n }\n\n if (rootElement !== null) {\n rootElement.addEventListener(\"click\", onClick);\n }\n }\n );\n }, [editor, filter, newTab]);\n return null;\n}\n\nfunction isLinkDomNode(domNode: Node): boolean {\n return domNode.nodeName.toLowerCase() === \"a\";\n}\n\nfunction getLinkDomNode(event: MouseEvent, editor: LexicalEditor): HTMLAnchorElement | null {\n return editor.getEditorState().read(() => {\n const domNode = event.target as Node;\n\n if (isLinkDomNode(domNode)) {\n return domNode as HTMLAnchorElement;\n }\n\n if (domNode.parentNode && isLinkDomNode(domNode.parentNode)) {\n return domNode.parentNode as HTMLAnchorElement;\n }\n\n return null;\n });\n}\n"],"mappings":";;;;;;;;AAWA;AACA;AACA;AACA;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYO,SAASA,mBAAmB,OAMZ;EAAA,IALnBC,MAAM,QAANA,MAAM;IAAA,mBACNC,MAAM;IAANA,MAAM,4BAAG,IAAI;EAKb,4BAAiB,IAAAC,iDAAyB,GAAE;IAAA;IAArCC,MAAM;EACb,IAAAC,gBAAS,EAAC,YAAM;IACZ,SAASC,OAAO,CAACC,CAAQ,EAAE;MACvB,IAAMC,KAAK,GAAGD,CAAe;MAC7B,IAAME,WAAW,GAAGC,cAAc,CAACF,KAAK,EAAEJ,MAAM,CAAC;MAEjD,IAAIK,WAAW,KAAK,IAAI,EAAE;QACtB;MACJ;MAEA,IAAME,IAAI,GAAGF,WAAW,CAACG,YAAY,CAAC,MAAM,CAAC;MAE7C,IAAIH,WAAW,CAACG,YAAY,CAAC,iBAAiB,CAAC,KAAK,OAAO,IAAID,IAAI,KAAKE,SAAS,EAAE;QAC/E;MACJ;;MAEA;MACA,IAAMC,SAAS,GAAGV,MAAM,CAACW,cAAc,EAAE,CAACC,IAAI,CAACC,sBAAa,CAAC;MAC7D,IAAI,IAAAC,0BAAiB,EAACJ,SAAS,CAAC,IAAI,CAACA,SAAS,CAACK,WAAW,EAAE,EAAE;QAC1D;MACJ;MAEA,IAAIC,QAAQ,GAAG,IAAI;MACnBhB,MAAM,CAACiB,MAAM,CAAC,YAAM;QAChB,IAAMC,aAAa,GAAG,IAAAC,mCAA0B,EAACd,WAAW,CAAC;QAE7D,IAAI,IAAAe,iBAAW,EAACF,aAAa,CAAC,EAAE;UAC5BF,QAAQ,GAAGE,aAAa;QAC5B;MACJ,CAAC,CAAC;MAEF,IAAIF,QAAQ,KAAK,IAAI,IAAKnB,MAAM,KAAKY,SAAS,IAAI,CAACZ,MAAM,CAACO,KAAK,EAAEY,QAAQ,CAAE,EAAE;QACzE;MACJ;MAEA,IAAI;QACA,IAAIT,IAAI,KAAK,IAAI,EAAE;UACfc,MAAM,CAACC,IAAI,CACPf,IAAI,EACJT,MAAM,IAAIM,KAAK,CAACmB,OAAO,IAAInB,KAAK,CAACoB,OAAO,GAAG,QAAQ,GAAG,OAAO,CAChE;QACL;MACJ,CAAC,CAAC,gBAAM;QACJ;MAAA;IAER;IAEA,OAAOxB,MAAM,CAACyB,oBAAoB,CAC9B,UAACC,WAA+B,EAAEC,eAAmC,EAAK;MACtE,IAAIA,eAAe,KAAK,IAAI,EAAE;QAC1BA,eAAe,CAACC,mBAAmB,CAAC,OAAO,EAAE1B,OAAO,CAAC;MACzD;MAEA,IAAIwB,WAAW,KAAK,IAAI,EAAE;QACtBA,WAAW,CAACG,gBAAgB,CAAC,OAAO,EAAE3B,OAAO,CAAC;MAClD;IACJ,CAAC,CACJ;EACL,CAAC,EAAE,CAACF,MAAM,EAAEH,MAAM,EAAEC,MAAM,CAAC,CAAC;EAC5B,OAAO,IAAI;AACf;AAEA,SAASgC,aAAa,CAACC,OAAa,EAAW;EAC3C,OAAOA,OAAO,CAACC,QAAQ,CAACC,WAAW,EAAE,KAAK,GAAG;AACjD;AAEA,SAAS3B,cAAc,CAACF,KAAiB,EAAEJ,MAAqB,EAA4B;EACxF,OAAOA,MAAM,CAACW,cAAc,EAAE,CAACC,IAAI,CAAC,YAAM;IACtC,IAAMmB,OAAO,GAAG3B,KAAK,CAAC8B,MAAc;IAEpC,IAAIJ,aAAa,CAACC,OAAO,CAAC,EAAE;MACxB,OAAOA,OAAO;IAClB;IAEA,IAAIA,OAAO,CAACI,UAAU,IAAIL,aAAa,CAACC,OAAO,CAACI,UAAU,CAAC,EAAE;MACzD,OAAOJ,OAAO,CAACI,UAAU;IAC7B;IAEA,OAAO,IAAI;EACf,CAAC,CAAC;AACN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ClickableLinkPlugin";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _ClickableLinkPlugin = require("./ClickableLinkPlugin");
|
|
7
|
+
Object.keys(_ClickableLinkPlugin).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _ClickableLinkPlugin[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _ClickableLinkPlugin[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./ClickableLinkPlugin\";\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CodeHighlightPlugin(): null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.CodeHighlightPlugin = CodeHighlightPlugin;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _code = require("@lexical/code");
|
|
11
|
+
var _LexicalComposerContext = require("@lexical/react/LexicalComposerContext");
|
|
12
|
+
function CodeHighlightPlugin() {
|
|
13
|
+
var _useLexicalComposerCo = (0, _LexicalComposerContext.useLexicalComposerContext)(),
|
|
14
|
+
_useLexicalComposerCo2 = (0, _slicedToArray2.default)(_useLexicalComposerCo, 1),
|
|
15
|
+
editor = _useLexicalComposerCo2[0];
|
|
16
|
+
(0, _react.useEffect)(function () {
|
|
17
|
+
return (0, _code.registerCodeHighlighting)(editor);
|
|
18
|
+
}, [editor]);
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CodeHighlightPlugin","useLexicalComposerContext","editor","useEffect","registerCodeHighlighting"],"sources":["CodeHighlightPlugin.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { registerCodeHighlighting } from \"@lexical/code\";\nimport { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\n\nexport function CodeHighlightPlugin() {\n const [editor] = useLexicalComposerContext();\n useEffect(() => {\n return registerCodeHighlighting(editor);\n }, [editor]);\n return null;\n}\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AAEO,SAASA,mBAAmB,GAAG;EAClC,4BAAiB,IAAAC,iDAAyB,GAAE;IAAA;IAArCC,MAAM;EACb,IAAAC,gBAAS,EAAC,YAAM;IACZ,OAAO,IAAAC,8BAAwB,EAACF,MAAM,CAAC;EAC3C,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EACZ,OAAO,IAAI;AACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./CodeHighlightPlugin";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _CodeHighlightPlugin = require("./CodeHighlightPlugin");
|
|
7
|
+
Object.keys(_CodeHighlightPlugin).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _CodeHighlightPlugin[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _CodeHighlightPlugin[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./CodeHighlightPlugin\";\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
.link-editor {
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: 0;
|
|
4
|
+
left: 0;
|
|
5
|
+
z-index: 10;
|
|
6
|
+
max-width: 400px;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 48px;
|
|
9
|
+
opacity: 0;
|
|
10
|
+
background-color: #fff;
|
|
11
|
+
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
|
|
12
|
+
border-radius: 8px;
|
|
13
|
+
transition: opacity 0.5s;
|
|
14
|
+
will-change: transform;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.link-editor .button {
|
|
18
|
+
width: 20px;
|
|
19
|
+
height: 20px;
|
|
20
|
+
display: inline-block;
|
|
21
|
+
padding: 6px;
|
|
22
|
+
border-radius: 8px;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
margin: 0 2px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.link-editor .button.hovered {
|
|
28
|
+
width: 20px;
|
|
29
|
+
height: 20px;
|
|
30
|
+
display: inline-block;
|
|
31
|
+
background-color: #eee;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.link-editor .button.active,
|
|
35
|
+
.toolbar .button.active {
|
|
36
|
+
background-color: rgb(223, 232, 250);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.link-editor .link-input {
|
|
40
|
+
display: block;
|
|
41
|
+
width: calc(100% - 24px);
|
|
42
|
+
height: 32px;
|
|
43
|
+
box-sizing: border-box;
|
|
44
|
+
margin: 8px 12px;
|
|
45
|
+
padding: 8px 12px;
|
|
46
|
+
border-radius: 15px;
|
|
47
|
+
background-color: #eee;
|
|
48
|
+
font-size: 15px;
|
|
49
|
+
color: rgb(5, 5, 5);
|
|
50
|
+
border: 0;
|
|
51
|
+
outline: 0;
|
|
52
|
+
position: relative;
|
|
53
|
+
font-family: inherit;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.link-editor .link-input .link-unlink {
|
|
57
|
+
background-image: url(../../images/icons/unlink_icon.svg);
|
|
58
|
+
background-size: 18px;
|
|
59
|
+
background-position: center;
|
|
60
|
+
background-repeat: no-repeat;
|
|
61
|
+
width: 35px;
|
|
62
|
+
vertical-align: -0.25em;
|
|
63
|
+
position: absolute;
|
|
64
|
+
right: 5px;
|
|
65
|
+
top: 0;
|
|
66
|
+
bottom: 0;
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.link-editor .link-input .link-edit {
|
|
71
|
+
background-image: url(../../images/icons/pencil-fill.svg);
|
|
72
|
+
background-size: 16px;
|
|
73
|
+
background-position: center;
|
|
74
|
+
background-repeat: no-repeat;
|
|
75
|
+
width: 35px;
|
|
76
|
+
vertical-align: -0.25em;
|
|
77
|
+
position: absolute;
|
|
78
|
+
right: 35px;
|
|
79
|
+
top: 0;
|
|
80
|
+
bottom: 0;
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.link-editor .link-input a {
|
|
85
|
+
color: rgb(33, 111, 219);
|
|
86
|
+
text-decoration: none;
|
|
87
|
+
display: block;
|
|
88
|
+
white-space: nowrap;
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
margin-right: 30px;
|
|
91
|
+
text-overflow: ellipsis;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.link-editor .link-input a:hover {
|
|
95
|
+
text-decoration: underline;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.link-editor .font-size-wrapper,
|
|
99
|
+
.link-editor .font-family-wrapper {
|
|
100
|
+
display: flex;
|
|
101
|
+
margin: 0 4px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.link-editor select {
|
|
105
|
+
padding: 6px;
|
|
106
|
+
border: none;
|
|
107
|
+
background-color: rgba(0, 0, 0, 0.075);
|
|
108
|
+
border-radius: 4px;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.link-editor .button i,
|
|
112
|
+
.actions i {
|
|
113
|
+
background-size: contain;
|
|
114
|
+
display: inline-block;
|
|
115
|
+
height: 20px;
|
|
116
|
+
width: 20px;
|
|
117
|
+
vertical-align: -0.25em;
|
|
118
|
+
}
|