@blocklet/editor-lite 2.6.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/LICENSE +13 -0
- package/README.md +33 -0
- package/lib/blocklet-editor-viewer.d.ts +4 -0
- package/lib/blocklet-editor-viewer.js +12 -0
- package/lib/blocklet-editor.d.ts +2 -0
- package/lib/blocklet-editor.js +12 -0
- package/lib/components/Loading.d.ts +4 -0
- package/lib/components/Loading.js +13 -0
- package/lib/components/SelectionPopper.d.ts +14 -0
- package/lib/components/SelectionPopper.js +73 -0
- package/lib/components/animateText.d.ts +3 -0
- package/lib/components/animateText.js +29 -0
- package/lib/components/createPortal.d.ts +2 -0
- package/lib/components/createPortal.js +16 -0
- package/lib/config.d.ts +37 -0
- package/lib/config.js +12 -0
- package/lib/ext/AIPlugin/AIIcon.d.ts +5 -0
- package/lib/ext/AIPlugin/AIIcon.js +7 -0
- package/lib/ext/AIPlugin/Arrow.d.ts +1 -0
- package/lib/ext/AIPlugin/Arrow.js +5 -0
- package/lib/ext/AIPlugin/TextGeneration.d.ts +6 -0
- package/lib/ext/AIPlugin/TextGeneration.js +131 -0
- package/lib/ext/AIPlugin/Writing.d.ts +1 -0
- package/lib/ext/AIPlugin/Writing.js +7 -0
- package/lib/ext/AIPlugin/index.d.ts +9 -0
- package/lib/ext/AIPlugin/index.js +180 -0
- package/lib/ext/AIPlugin/utils.d.ts +6 -0
- package/lib/ext/AIPlugin/utils.js +44 -0
- package/lib/ext/AITranslationPlugin/index.d.ts +9 -0
- package/lib/ext/AITranslationPlugin/index.js +124 -0
- package/lib/ext/AITranslationPlugin/selection.d.ts +3 -0
- package/lib/ext/AITranslationPlugin/selection.js +45 -0
- package/lib/ext/AITranslationPlugin/translation.d.ts +3 -0
- package/lib/ext/AITranslationPlugin/translation.js +67 -0
- package/lib/ext/AITranslationPlugin/types.d.ts +49 -0
- package/lib/ext/AITranslationPlugin/types.js +1 -0
- package/lib/ext/AITranslationPlugin/utils.d.ts +46 -0
- package/lib/ext/AITranslationPlugin/utils.js +343 -0
- package/lib/ext/Aide/Aide.d.ts +4 -0
- package/lib/ext/Aide/Aide.js +30 -0
- package/lib/ext/Aide/Delayed.d.ts +7 -0
- package/lib/ext/Aide/Delayed.js +12 -0
- package/lib/ext/Aide/Input.d.ts +6 -0
- package/lib/ext/Aide/Input.js +49 -0
- package/lib/ext/Aide/Menu.d.ts +4 -0
- package/lib/ext/Aide/Menu.js +29 -0
- package/lib/ext/Aide/Output.d.ts +4 -0
- package/lib/ext/Aide/Output.js +14 -0
- package/lib/ext/Aide/Templates.d.ts +4 -0
- package/lib/ext/Aide/Templates.js +34 -0
- package/lib/ext/Aide/builtin-templates.d.ts +3 -0
- package/lib/ext/Aide/builtin-templates.js +48 -0
- package/lib/ext/Aide/context.d.ts +47 -0
- package/lib/ext/Aide/context.js +114 -0
- package/lib/ext/Aide/external-templates/Breadcrumb.d.ts +10 -0
- package/lib/ext/Aide/external-templates/Breadcrumb.js +11 -0
- package/lib/ext/Aide/external-templates/Output.d.ts +8 -0
- package/lib/ext/Aide/external-templates/Output.js +22 -0
- package/lib/ext/Aide/external-templates/Search.d.ts +6 -0
- package/lib/ext/Aide/external-templates/Search.js +14 -0
- package/lib/ext/Aide/external-templates/Tags.d.ts +4 -0
- package/lib/ext/Aide/external-templates/Tags.js +44 -0
- package/lib/ext/Aide/external-templates/Template.d.ts +7 -0
- package/lib/ext/Aide/external-templates/Template.js +110 -0
- package/lib/ext/Aide/external-templates/Templates.d.ts +6 -0
- package/lib/ext/Aide/external-templates/Templates.js +61 -0
- package/lib/ext/Aide/external-templates/index.d.ts +4 -0
- package/lib/ext/Aide/external-templates/index.js +83 -0
- package/lib/ext/Aide/external-templates/parameter-field.d.ts +6 -0
- package/lib/ext/Aide/external-templates/parameter-field.js +92 -0
- package/lib/ext/Aide/hooks.d.ts +7 -0
- package/lib/ext/Aide/hooks.js +14 -0
- package/lib/ext/Aide/index.d.ts +2 -0
- package/lib/ext/Aide/index.js +2 -0
- package/lib/ext/Aide/types.d.ts +84 -0
- package/lib/ext/Aide/types.js +25 -0
- package/lib/ext/Aide/withAiAvailable.d.ts +5 -0
- package/lib/ext/Aide/withAiAvailable.js +11 -0
- package/lib/ext/Alert/AlertComponent.d.ts +10 -0
- package/lib/ext/Alert/AlertComponent.js +38 -0
- package/lib/ext/Alert/AlertNode.d.ts +28 -0
- package/lib/ext/Alert/AlertNode.js +105 -0
- package/lib/ext/Alert/AlertPlugin.d.ts +11 -0
- package/lib/ext/Alert/AlertPlugin.js +41 -0
- package/lib/ext/BilibiliPlugin/BilibiliNode.d.ts +31 -0
- package/lib/ext/BilibiliPlugin/BilibiliNode.js +95 -0
- package/lib/ext/BilibiliPlugin/BilibiliVideo.d.ts +6 -0
- package/lib/ext/BilibiliPlugin/BilibiliVideo.js +24 -0
- package/lib/ext/BilibiliPlugin/config.d.ts +2 -0
- package/lib/ext/BilibiliPlugin/config.js +40 -0
- package/lib/ext/BilibiliPlugin/index.d.ts +5 -0
- package/lib/ext/BilibiliPlugin/index.js +20 -0
- package/lib/ext/BlockletEmbedPlugin/BlockletEmbed.d.ts +7 -0
- package/lib/ext/BlockletEmbedPlugin/BlockletEmbed.js +51 -0
- package/lib/ext/BlockletEmbedPlugin/BlockletEmbedNode.d.ts +30 -0
- package/lib/ext/BlockletEmbedPlugin/BlockletEmbedNode.js +96 -0
- package/lib/ext/BlockletEmbedPlugin/index.d.ts +12 -0
- package/lib/ext/BlockletEmbedPlugin/index.js +76 -0
- package/lib/ext/BlurTextPlugin.d.ts +1 -0
- package/lib/ext/BlurTextPlugin.js +40 -0
- package/lib/ext/BookmarkPlugin/Bookmark.d.ts +7 -0
- package/lib/ext/BookmarkPlugin/Bookmark.js +175 -0
- package/lib/ext/BookmarkPlugin/BookmarkNode.d.ts +35 -0
- package/lib/ext/BookmarkPlugin/BookmarkNode.js +110 -0
- package/lib/ext/BookmarkPlugin/index.d.ts +11 -0
- package/lib/ext/BookmarkPlugin/index.js +45 -0
- package/lib/ext/BusyPlugin.d.ts +9 -0
- package/lib/ext/BusyPlugin.js +17 -0
- package/lib/ext/CharacterCountPlugin/index.d.ts +10 -0
- package/lib/ext/CharacterCountPlugin/index.js +39 -0
- package/lib/ext/CharacterCountPlugin/useCharacterCount.d.ts +11 -0
- package/lib/ext/CharacterCountPlugin/useCharacterCount.js +49 -0
- package/lib/ext/CharacterLimitPlugin/index.d.ts +9 -0
- package/lib/ext/CharacterLimitPlugin/index.js +49 -0
- package/lib/ext/CheckboxPlugin.d.ts +3 -0
- package/lib/ext/CheckboxPlugin.js +75 -0
- package/lib/ext/CodeCopyPlugin/CodeCopyPlugin.d.ts +2 -0
- package/lib/ext/CodeCopyPlugin/CodeCopyPlugin.js +90 -0
- package/lib/ext/CodeCopyPlugin/copy.svg +1 -0
- package/lib/ext/CodeCopyPlugin/index.d.ts +1 -0
- package/lib/ext/CodeCopyPlugin/index.js +1 -0
- package/lib/ext/CodeCopyPlugin/style.css +12 -0
- package/lib/ext/ContentLocale.d.ts +7 -0
- package/lib/ext/ContentLocale.js +15 -0
- package/lib/ext/CustomOnChangePlugin/index.d.ts +5 -0
- package/lib/ext/CustomOnChangePlugin/index.js +17 -0
- package/lib/ext/CustomOnChangePlugin/styles.css +14 -0
- package/lib/ext/CustomOnChangePlugin/utils.d.ts +30 -0
- package/lib/ext/CustomOnChangePlugin/utils.js +148 -0
- package/lib/ext/EditorHolderPlugin/EditorHolderContext.d.ts +13 -0
- package/lib/ext/EditorHolderPlugin/EditorHolderContext.js +15 -0
- package/lib/ext/EditorHolderPlugin/EditorHolderPlugin.d.ts +1 -0
- package/lib/ext/EditorHolderPlugin/EditorHolderPlugin.js +11 -0
- package/lib/ext/EditorHolderPlugin/index.d.ts +2 -0
- package/lib/ext/EditorHolderPlugin/index.js +2 -0
- package/lib/ext/EditorReadyPlugin.d.ts +3 -0
- package/lib/ext/EditorReadyPlugin.js +15 -0
- package/lib/ext/FilePlugin/FileNode.d.ts +44 -0
- package/lib/ext/FilePlugin/FileNode.js +195 -0
- package/lib/ext/FilePlugin/FilePlugin.d.ts +7 -0
- package/lib/ext/FilePlugin/FilePlugin.js +27 -0
- package/lib/ext/FilePlugin/index.d.ts +2 -0
- package/lib/ext/FilePlugin/index.js +2 -0
- package/lib/ext/HeadingsIdPlugin.d.ts +1 -0
- package/lib/ext/HeadingsIdPlugin.js +67 -0
- package/lib/ext/ImagePathFixerPlugin.d.ts +1 -0
- package/lib/ext/ImagePathFixerPlugin.js +31 -0
- package/lib/ext/InlineTranslationPlugin/EditorTranslator.d.ts +42 -0
- package/lib/ext/InlineTranslationPlugin/EditorTranslator.js +199 -0
- package/lib/ext/InlineTranslationPlugin/InlineTranslationPlugin.d.ts +12 -0
- package/lib/ext/InlineTranslationPlugin/InlineTranslationPlugin.js +232 -0
- package/lib/ext/InlineTranslationPlugin/TranslationNode.d.ts +23 -0
- package/lib/ext/InlineTranslationPlugin/TranslationNode.js +49 -0
- package/lib/ext/InlineTranslationPlugin/index.d.ts +4 -0
- package/lib/ext/InlineTranslationPlugin/index.js +4 -0
- package/lib/ext/InlineTranslationPlugin/store.d.ts +50 -0
- package/lib/ext/InlineTranslationPlugin/store.js +94 -0
- package/lib/ext/InlineTranslationPlugin/types.d.ts +1 -0
- package/lib/ext/InlineTranslationPlugin/types.js +1 -0
- package/lib/ext/LexicalEditorRefPlugin.d.ts +14 -0
- package/lib/ext/LexicalEditorRefPlugin.js +26 -0
- package/lib/ext/OnContentChangePlugin.d.ts +14 -0
- package/lib/ext/OnContentChangePlugin.js +35 -0
- package/lib/ext/PasteSlackImagePlugin/index.d.ts +2 -0
- package/lib/ext/PasteSlackImagePlugin/index.js +22 -0
- package/lib/ext/PostLinkEmbedPlugin/PostLinkNode.d.ts +32 -0
- package/lib/ext/PostLinkEmbedPlugin/PostLinkNode.js +140 -0
- package/lib/ext/PostLinkEmbedPlugin/fixInvalidPostLinkNodes.d.ts +1 -0
- package/lib/ext/PostLinkEmbedPlugin/fixInvalidPostLinkNodes.js +15 -0
- package/lib/ext/PostLinkEmbedPlugin/index.d.ts +21 -0
- package/lib/ext/PostLinkEmbedPlugin/index.js +148 -0
- package/lib/ext/RemoveListPlugin.d.ts +1 -0
- package/lib/ext/RemoveListPlugin.js +63 -0
- package/lib/ext/SafeAreaPlugin.d.ts +12 -0
- package/lib/ext/SafeAreaPlugin.js +56 -0
- package/lib/ext/SelectBlockPlugin.d.ts +1 -0
- package/lib/ext/SelectBlockPlugin.js +95 -0
- package/lib/ext/ShortcutPlugin/CtrlsShortcutPlugin.d.ts +6 -0
- package/lib/ext/ShortcutPlugin/CtrlsShortcutPlugin.js +17 -0
- package/lib/ext/ShortcutPlugin/index.d.ts +1 -0
- package/lib/ext/ShortcutPlugin/index.js +1 -0
- package/lib/ext/TemplatePlugin.d.ts +8 -0
- package/lib/ext/TemplatePlugin.js +170 -0
- package/lib/ext/VideoPathFixerPlugin.d.ts +1 -0
- package/lib/ext/VideoPathFixerPlugin.js +31 -0
- package/lib/ext/VideoPlugin/VideoComponent.d.ts +5 -0
- package/lib/ext/VideoPlugin/VideoComponent.js +5 -0
- package/lib/ext/VideoPlugin/VideoNode.d.ts +37 -0
- package/lib/ext/VideoPlugin/VideoNode.js +97 -0
- package/lib/ext/VideoPlugin/VideoPlugin.d.ts +7 -0
- package/lib/ext/VideoPlugin/VideoPlugin.js +26 -0
- package/lib/ext/VideoPlugin/index.d.ts +2 -0
- package/lib/ext/VideoPlugin/index.js +2 -0
- package/lib/ext/common.d.ts +15 -0
- package/lib/ext/common.js +62 -0
- package/lib/ext/nodes/GithubComp.d.ts +3 -0
- package/lib/ext/nodes/GithubComp.js +20 -0
- package/lib/ext/nodes/GithubNode.d.ts +28 -0
- package/lib/ext/nodes/GithubNode.js +94 -0
- package/lib/ext/nodes/util.d.ts +5 -0
- package/lib/ext/nodes/util.js +1 -0
- package/lib/ext/translation/translation-utils.d.ts +16 -0
- package/lib/ext/translation/translation-utils.js +63 -0
- package/lib/ext/utils.d.ts +21 -0
- package/lib/ext/utils.js +88 -0
- package/lib/global.d.ts +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +5 -0
- package/lib/lexical-utils/index.d.ts +46 -0
- package/lib/lexical-utils/index.js +243 -0
- package/lib/libs/sort-array-by-key.d.ts +4 -0
- package/lib/libs/sort-array-by-key.js +68 -0
- package/lib/libs/utm.d.ts +9 -0
- package/lib/libs/utm.js +43 -0
- package/lib/main/appSettings.d.ts +11 -0
- package/lib/main/appSettings.js +20 -0
- package/lib/main/context/SharedAutocompleteContext.d.ts +16 -0
- package/lib/main/context/SharedAutocompleteContext.js +35 -0
- package/lib/main/context/SharedHistoryContext.d.ts +17 -0
- package/lib/main/context/SharedHistoryContext.js +11 -0
- package/lib/main/editor-root.d.ts +2 -0
- package/lib/main/editor-root.js +46 -0
- package/lib/main/editor.d.ts +21 -0
- package/lib/main/editor.js +99 -0
- package/lib/main/hooks/hooks.d.ts +15 -0
- package/lib/main/hooks/hooks.js +49 -0
- package/lib/main/hooks/medium-zoom.d.ts +9 -0
- package/lib/main/hooks/medium-zoom.js +34 -0
- package/lib/main/hooks/use-mobile.d.ts +4 -0
- package/lib/main/hooks/use-mobile.js +6 -0
- package/lib/main/hooks/useBeforeUnload.d.ts +1 -0
- package/lib/main/hooks/useBeforeUnload.js +15 -0
- package/lib/main/hooks/useHasNodes.d.ts +1 -0
- package/lib/main/hooks/useHasNodes.js +8 -0
- package/lib/main/hooks/useIsFocused.d.ts +1 -0
- package/lib/main/hooks/useIsFocused.js +20 -0
- package/lib/main/hooks/useModal.d.ts +12 -0
- package/lib/main/hooks/useModal.js +33 -0
- package/lib/main/hooks/useReport.d.ts +8 -0
- package/lib/main/hooks/useReport.js +48 -0
- package/lib/main/hooks/useResponsiveTable.d.ts +5 -0
- package/lib/main/hooks/useResponsiveTable.js +31 -0
- package/lib/main/hooks/useTranslationListener.d.ts +4 -0
- package/lib/main/hooks/useTranslationListener.js +94 -0
- package/lib/main/icons.d.ts +3 -0
- package/lib/main/icons.js +25 -0
- package/lib/main/images/emoji/1F600.png +0 -0
- package/lib/main/images/emoji/1F641.png +0 -0
- package/lib/main/images/emoji/1F642.png +0 -0
- package/lib/main/images/emoji/2764.png +0 -0
- package/lib/main/images/excalidraw.svg +3 -0
- package/lib/main/images/icons/arrow-clockwise.svg +1 -0
- package/lib/main/images/icons/arrow-counterclockwise.svg +1 -0
- package/lib/main/images/icons/bg-color.svg +1 -0
- package/lib/main/images/icons/camera.svg +1 -0
- package/lib/main/images/icons/caret-right-fill.svg +1 -0
- package/lib/main/images/icons/chat-left-text.svg +1 -0
- package/lib/main/images/icons/chat-right-dots.svg +1 -0
- package/lib/main/images/icons/chat-right-text.svg +1 -0
- package/lib/main/images/icons/chat-right.svg +1 -0
- package/lib/main/images/icons/chat-square-quote.svg +1 -0
- package/lib/main/images/icons/chevron-down.svg +1 -0
- package/lib/main/images/icons/clipboard.svg +1 -0
- package/lib/main/images/icons/close.svg +1 -0
- package/lib/main/images/icons/code.svg +1 -0
- package/lib/main/images/icons/comments.svg +1 -0
- package/lib/main/images/icons/copy.svg +1 -0
- package/lib/main/images/icons/diagram-2.svg +1 -0
- package/lib/main/images/icons/download.svg +1 -0
- package/lib/main/images/icons/draggable-block-menu.svg +1 -0
- package/lib/main/images/icons/dropdown-more.svg +1 -0
- package/lib/main/images/icons/figma.svg +1 -0
- package/lib/main/images/icons/file-image.svg +1 -0
- package/lib/main/images/icons/filetype-gif.svg +1 -0
- package/lib/main/images/icons/font-color.svg +1 -0
- package/lib/main/images/icons/font-family.svg +1 -0
- package/lib/main/images/icons/gear.svg +1 -0
- package/lib/main/images/icons/horizontal-rule.svg +1 -0
- package/lib/main/images/icons/indent.svg +1 -0
- package/lib/main/images/icons/journal-code.svg +1 -0
- package/lib/main/images/icons/journal-text.svg +1 -0
- package/lib/main/images/icons/justify.svg +1 -0
- package/lib/main/images/icons/link.svg +1 -0
- package/lib/main/images/icons/list-ol.svg +1 -0
- package/lib/main/images/icons/list-ul.svg +1 -0
- package/lib/main/images/icons/lock-fill.svg +1 -0
- package/lib/main/images/icons/lock.svg +1 -0
- package/lib/main/images/icons/markdown.svg +1 -0
- package/lib/main/images/icons/mic.svg +1 -0
- package/lib/main/images/icons/outdent.svg +1 -0
- package/lib/main/images/icons/paint-bucket.svg +1 -0
- package/lib/main/images/icons/palette.svg +1 -0
- package/lib/main/images/icons/pencil-fill.svg +1 -0
- package/lib/main/images/icons/plug-fill.svg +1 -0
- package/lib/main/images/icons/plug.svg +1 -0
- package/lib/main/images/icons/plus-slash-minus.svg +1 -0
- package/lib/main/images/icons/plus.svg +1 -0
- package/lib/main/images/icons/prettier-error.svg +1 -0
- package/lib/main/images/icons/prettier.svg +1 -0
- package/lib/main/images/icons/send.svg +1 -0
- package/lib/main/images/icons/square-check.svg +1 -0
- package/lib/main/images/icons/sticky.svg +1 -0
- package/lib/main/images/icons/success.svg +1 -0
- package/lib/main/images/icons/table.svg +1 -0
- package/lib/main/images/icons/text-center.svg +1 -0
- package/lib/main/images/icons/text-left.svg +1 -0
- package/lib/main/images/icons/text-paragraph.svg +1 -0
- package/lib/main/images/icons/text-right.svg +1 -0
- package/lib/main/images/icons/trash.svg +1 -0
- package/lib/main/images/icons/trash3.svg +1 -0
- package/lib/main/images/icons/tweet.svg +1 -0
- package/lib/main/images/icons/type-bold.svg +1 -0
- package/lib/main/images/icons/type-h1.svg +1 -0
- package/lib/main/images/icons/type-h2.svg +1 -0
- package/lib/main/images/icons/type-h3.svg +1 -0
- package/lib/main/images/icons/type-h4.svg +1 -0
- package/lib/main/images/icons/type-h5.svg +1 -0
- package/lib/main/images/icons/type-h6.svg +1 -0
- package/lib/main/images/icons/type-italic.svg +1 -0
- package/lib/main/images/icons/type-strikethrough.svg +1 -0
- package/lib/main/images/icons/type-subscript.svg +1 -0
- package/lib/main/images/icons/type-superscript.svg +1 -0
- package/lib/main/images/icons/type-underline.svg +1 -0
- package/lib/main/images/icons/upload.svg +1 -0
- package/lib/main/images/icons/user.svg +1 -0
- package/lib/main/images/icons/youtube.svg +1 -0
- package/lib/main/images/landscape.jpg +0 -0
- package/lib/main/index.css +257 -0
- package/lib/main/index.d.ts +28 -0
- package/lib/main/index.js +52 -0
- package/lib/main/nodes/EmojiNode.d.ts +25 -0
- package/lib/main/nodes/EmojiNode.js +57 -0
- package/lib/main/nodes/EquationNode.d.ts +31 -0
- package/lib/main/nodes/EquationNode.js +65 -0
- package/lib/main/nodes/ExcalidrawNode/ExcalidrawComponent.d.ts +13 -0
- package/lib/main/nodes/ExcalidrawNode/ExcalidrawComponent.js +155 -0
- package/lib/main/nodes/ExcalidrawNode/ExcalidrawImage.d.ts +58 -0
- package/lib/main/nodes/ExcalidrawNode/ExcalidrawImage.js +60 -0
- package/lib/main/nodes/ExcalidrawNode/ExcalidrawModal.css +75 -0
- package/lib/main/nodes/ExcalidrawNode/ExcalidrawModal.d.ts +49 -0
- package/lib/main/nodes/ExcalidrawNode/ExcalidrawModal.js +197 -0
- package/lib/main/nodes/ExcalidrawNode/index.d.ts +30 -0
- package/lib/main/nodes/ExcalidrawNode/index.js +95 -0
- package/lib/main/nodes/ExcalidrawNode/utils.d.ts +5 -0
- package/lib/main/nodes/ExcalidrawNode/utils.js +71 -0
- package/lib/main/nodes/FigmaNode.d.ts +30 -0
- package/lib/main/nodes/FigmaNode.js +59 -0
- package/lib/main/nodes/ImageComponent.d.ts +27 -0
- package/lib/main/nodes/ImageComponent.js +432 -0
- package/lib/main/nodes/ImageNode.css +51 -0
- package/lib/main/nodes/ImageNode.d.ts +74 -0
- package/lib/main/nodes/ImageNode.js +151 -0
- package/lib/main/nodes/KeywordNode.d.ts +25 -0
- package/lib/main/nodes/KeywordNode.js +52 -0
- package/lib/main/nodes/MentionNode.d.ts +27 -0
- package/lib/main/nodes/MentionNode.js +88 -0
- package/lib/main/nodes/PlaygroundNodes.d.ts +10 -0
- package/lib/main/nodes/PlaygroundNodes.js +70 -0
- package/lib/main/nodes/TweetNode.d.ts +31 -0
- package/lib/main/nodes/TweetNode.js +126 -0
- package/lib/main/nodes/YouTubeNode.d.ts +32 -0
- package/lib/main/nodes/YouTubeNode.js +94 -0
- package/lib/main/plugins/AutoEmbedPlugin/index.d.ts +27 -0
- package/lib/main/plugins/AutoEmbedPlugin/index.js +353 -0
- package/lib/main/plugins/AutoEmbedPlugin/urlParseCache.d.ts +2 -0
- package/lib/main/plugins/AutoEmbedPlugin/urlParseCache.js +14 -0
- package/lib/main/plugins/AutoLinkPlugin/index.d.ts +9 -0
- package/lib/main/plugins/AutoLinkPlugin/index.js +39 -0
- package/lib/main/plugins/ClickableLinkPlugin/index.d.ts +8 -0
- package/lib/main/plugins/ClickableLinkPlugin/index.js +141 -0
- package/lib/main/plugins/CodeActionMenuPlugin/components/CopyButton/index.d.ts +7 -0
- package/lib/main/plugins/CodeActionMenuPlugin/components/CopyButton/index.js +44 -0
- package/lib/main/plugins/CodeActionMenuPlugin/index.css +46 -0
- package/lib/main/plugins/CodeActionMenuPlugin/index.d.ts +12 -0
- package/lib/main/plugins/CodeActionMenuPlugin/index.js +100 -0
- package/lib/main/plugins/CodeActionMenuPlugin/utils.d.ts +2 -0
- package/lib/main/plugins/CodeActionMenuPlugin/utils.js +18 -0
- package/lib/main/plugins/CodeHighlightPlugin/index.d.ts +9 -0
- package/lib/main/plugins/CodeHighlightPlugin/index.js +17 -0
- package/lib/main/plugins/CollapsiblePlugin/Collapsible.css +61 -0
- package/lib/main/plugins/CollapsiblePlugin/CollapsibleContainerNode.d.ts +30 -0
- package/lib/main/plugins/CollapsiblePlugin/CollapsibleContainerNode.js +120 -0
- package/lib/main/plugins/CollapsiblePlugin/CollapsibleContentNode.d.ts +24 -0
- package/lib/main/plugins/CollapsiblePlugin/CollapsibleContentNode.js +90 -0
- package/lib/main/plugins/CollapsiblePlugin/CollapsibleTitleNode.d.ts +24 -0
- package/lib/main/plugins/CollapsiblePlugin/CollapsibleTitleNode.js +95 -0
- package/lib/main/plugins/CollapsiblePlugin/CollapsibleUtils.d.ts +9 -0
- package/lib/main/plugins/CollapsiblePlugin/CollapsibleUtils.js +15 -0
- package/lib/main/plugins/CollapsiblePlugin/index.d.ts +11 -0
- package/lib/main/plugins/CollapsiblePlugin/index.js +147 -0
- package/lib/main/plugins/ComponentPickerPlugin/index.d.ts +12 -0
- package/lib/main/plugins/ComponentPickerPlugin/index.js +438 -0
- package/lib/main/plugins/DragDropPastePlugin/index.d.ts +8 -0
- package/lib/main/plugins/DragDropPastePlugin/index.js +32 -0
- package/lib/main/plugins/DraggableBlockPlugin/index.css +36 -0
- package/lib/main/plugins/DraggableBlockPlugin/index.d.ts +12 -0
- package/lib/main/plugins/DraggableBlockPlugin/index.js +288 -0
- package/lib/main/plugins/EmojisPlugin/index.d.ts +9 -0
- package/lib/main/plugins/EmojisPlugin/index.js +63 -0
- package/lib/main/plugins/ExcalidrawPlugin/index.d.ts +3 -0
- package/lib/main/plugins/ExcalidrawPlugin/index.js +30 -0
- package/lib/main/plugins/FigmaPlugin/index.d.ts +11 -0
- package/lib/main/plugins/FigmaPlugin/index.js +27 -0
- package/lib/main/plugins/FloatingLinkEditorPlugin/index.css +39 -0
- package/lib/main/plugins/FloatingLinkEditorPlugin/index.d.ts +12 -0
- package/lib/main/plugins/FloatingLinkEditorPlugin/index.js +181 -0
- package/lib/main/plugins/FloatingTextFormatToolbarPlugin/ColorPickerButton.d.ts +5 -0
- package/lib/main/plugins/FloatingTextFormatToolbarPlugin/ColorPickerButton.js +24 -0
- package/lib/main/plugins/FloatingTextFormatToolbarPlugin/index.css +128 -0
- package/lib/main/plugins/FloatingTextFormatToolbarPlugin/index.d.ts +12 -0
- package/lib/main/plugins/FloatingTextFormatToolbarPlugin/index.js +216 -0
- package/lib/main/plugins/HorizontalRulePlugin/index.d.ts +8 -0
- package/lib/main/plugins/HorizontalRulePlugin/index.js +30 -0
- package/lib/main/plugins/ImagesPlugin/index.d.ts +15 -0
- package/lib/main/plugins/ImagesPlugin/index.js +36 -0
- package/lib/main/plugins/LexicalTypeaheadMenuPlugin/index.d.ts +64 -0
- package/lib/main/plugins/LexicalTypeaheadMenuPlugin/index.js +493 -0
- package/lib/main/plugins/MarkdownShortcutPlugin/index.d.ts +9 -0
- package/lib/main/plugins/MarkdownShortcutPlugin/index.js +22 -0
- package/lib/main/plugins/MarkdownTransformers/index.d.ts +12 -0
- package/lib/main/plugins/MarkdownTransformers/index.js +185 -0
- package/lib/main/plugins/MaxLengthPlugin/index.d.ts +10 -0
- package/lib/main/plugins/MaxLengthPlugin/index.js +43 -0
- package/lib/main/plugins/MentionsPlugin/HighlightStyle.d.ts +2 -0
- package/lib/main/plugins/MentionsPlugin/HighlightStyle.js +13 -0
- package/lib/main/plugins/MentionsPlugin/index.d.ts +9 -0
- package/lib/main/plugins/MentionsPlugin/index.js +175 -0
- package/lib/main/plugins/TabFocusPlugin/index.d.ts +8 -0
- package/lib/main/plugins/TabFocusPlugin/index.js +41 -0
- package/lib/main/plugins/TableActionMenuPlugin/index.d.ts +12 -0
- package/lib/main/plugins/TableActionMenuPlugin/index.js +486 -0
- package/lib/main/plugins/TableCellResizer/index.css +20 -0
- package/lib/main/plugins/TableCellResizer/index.d.ts +3 -0
- package/lib/main/plugins/TableCellResizer/index.js +295 -0
- package/lib/main/plugins/TableOfContentsPlugin/index.css +87 -0
- package/lib/main/plugins/TableOfContentsPlugin/index.d.ts +2 -0
- package/lib/main/plugins/TableOfContentsPlugin/index.js +106 -0
- package/lib/main/plugins/TablePlugin.d.ts +38 -0
- package/lib/main/plugins/TablePlugin.js +63 -0
- package/lib/main/plugins/ToolbarPlugin/index.d.ts +8 -0
- package/lib/main/plugins/ToolbarPlugin/index.js +467 -0
- package/lib/main/plugins/TreeViewPlugin/index.d.ts +9 -0
- package/lib/main/plugins/TreeViewPlugin/index.js +14 -0
- package/lib/main/plugins/TwitterPlugin/index.d.ts +11 -0
- package/lib/main/plugins/TwitterPlugin/index.js +27 -0
- package/lib/main/plugins/TypingPerfPlugin/index.d.ts +9 -0
- package/lib/main/plugins/TypingPerfPlugin/index.js +100 -0
- package/lib/main/plugins/YouTubePlugin/index.d.ts +11 -0
- package/lib/main/plugins/YouTubePlugin/index.js +27 -0
- package/lib/main/server/validation.d.ts +8 -0
- package/lib/main/server/validation.js +119 -0
- package/lib/main/setupEnv.d.ts +8 -0
- package/lib/main/setupEnv.js +25 -0
- package/lib/main/style/editable.css +476 -0
- package/lib/main/styled-editor-content.d.ts +5 -0
- package/lib/main/styled-editor-content.js +206 -0
- package/lib/main/themes/code-highlight/index.d.ts +32 -0
- package/lib/main/themes/code-highlight/index.js +58 -0
- package/lib/main/themes/customTheme.d.ts +2 -0
- package/lib/main/themes/customTheme.js +324 -0
- package/lib/main/themes/defaultTheme.d.ts +10 -0
- package/lib/main/themes/defaultTheme.js +554 -0
- package/lib/main/themes/table/index.d.ts +3 -0
- package/lib/main/themes/table/index.js +20 -0
- package/lib/main/themes/table/table.css +214 -0
- package/lib/main/ui/Button.css +36 -0
- package/lib/main/ui/Button.d.ts +18 -0
- package/lib/main/ui/Button.js +13 -0
- package/lib/main/ui/ColorPicker.css +89 -0
- package/lib/main/ui/ColorPicker.d.ts +28 -0
- package/lib/main/ui/ColorPicker.js +206 -0
- package/lib/main/ui/ContentEditable.d.ts +2 -0
- package/lib/main/ui/ContentEditable.js +15 -0
- package/lib/main/ui/Dialog.css +17 -0
- package/lib/main/ui/Dialog.d.ts +16 -0
- package/lib/main/ui/Dialog.js +15 -0
- package/lib/main/ui/DropDown.d.ts +25 -0
- package/lib/main/ui/DropDown.js +146 -0
- package/lib/main/ui/FileInput.d.ts +17 -0
- package/lib/main/ui/FileInput.js +5 -0
- package/lib/main/ui/FrameMockup/browser.css +52 -0
- package/lib/main/ui/FrameMockup/browser.d.ts +13 -0
- package/lib/main/ui/FrameMockup/browser.js +22 -0
- package/lib/main/ui/FrameMockup/index.d.ts +113 -0
- package/lib/main/ui/FrameMockup/index.js +61 -0
- package/lib/main/ui/ImageEnhancer.d.ts +29 -0
- package/lib/main/ui/ImageEnhancer.js +113 -0
- package/lib/main/ui/ImageResizer.d.ts +24 -0
- package/lib/main/ui/ImageResizer.js +154 -0
- package/lib/main/ui/Input.css +30 -0
- package/lib/main/ui/Modal.css +62 -0
- package/lib/main/ui/Modal.d.ts +15 -0
- package/lib/main/ui/Modal.js +50 -0
- package/lib/main/ui/Placeholder.d.ts +6 -0
- package/lib/main/ui/Placeholder.js +20 -0
- package/lib/main/ui/TextInput.d.ts +20 -0
- package/lib/main/ui/TextInput.js +14 -0
- package/lib/main/utils/getDOMRangeRect.d.ts +8 -0
- package/lib/main/utils/getDOMRangeRect.js +22 -0
- package/lib/main/utils/getSelectedNode.d.ts +2 -0
- package/lib/main/utils/getSelectedNode.js +22 -0
- package/lib/main/utils/guard.d.ts +14 -0
- package/lib/main/utils/guard.js +36 -0
- package/lib/main/utils/images.d.ts +10 -0
- package/lib/main/utils/images.js +16 -0
- package/lib/main/utils/join-classes.d.ts +8 -0
- package/lib/main/utils/join-classes.js +10 -0
- package/lib/main/utils/point.d.ts +21 -0
- package/lib/main/utils/point.js +42 -0
- package/lib/main/utils/prevent-duplicate-upload.d.ts +2 -0
- package/lib/main/utils/prevent-duplicate-upload.js +25 -0
- package/lib/main/utils/rect.d.ts +45 -0
- package/lib/main/utils/rect.js +98 -0
- package/lib/main/utils/sanitizeUrl.d.ts +8 -0
- package/lib/main/utils/sanitizeUrl.js +17 -0
- package/lib/main/utils/setFloatingElemPosition.d.ts +1 -0
- package/lib/main/utils/setFloatingElemPosition.js +32 -0
- package/lib/main/utils/swipe.d.ts +11 -0
- package/lib/main/utils/swipe.js +98 -0
- package/lib/main/viewer/index.d.ts +5 -0
- package/lib/main/viewer/index.js +25 -0
- package/lib/main/viewer/types.d.ts +14 -0
- package/lib/main/viewer/types.js +1 -0
- package/lib/main/viewer/viewer.d.ts +3 -0
- package/lib/main/viewer/viewer.js +31 -0
- package/lib/shared/canUseDOM.d.ts +8 -0
- package/lib/shared/canUseDOM.js +10 -0
- package/lib/shared/environment.d.ts +24 -0
- package/lib/shared/environment.js +21 -0
- package/lib/shared/getDOMSelection.d.ts +9 -0
- package/lib/shared/getDOMSelection.js +10 -0
- package/lib/shared/invariant.d.ts +8 -0
- package/lib/shared/invariant.js +16 -0
- package/lib/shared/useLayoutEffect.d.ts +10 -0
- package/lib/shared/useLayoutEffect.js +11 -0
- package/lib/types.d.ts +19 -0
- package/lib/types.js +1 -0
- package/lib/vendor/LexicalCharacterLimitPlugin/LexicalCharacterLimitPlugin.d.ts +15 -0
- package/lib/vendor/LexicalCharacterLimitPlugin/LexicalCharacterLimitPlugin.js +45 -0
- package/lib/vendor/LexicalCharacterLimitPlugin/index.d.ts +1 -0
- package/lib/vendor/LexicalCharacterLimitPlugin/index.js +1 -0
- package/lib/vendor/LexicalCharacterLimitPlugin/useCharacterLimit.d.ts +16 -0
- package/lib/vendor/LexicalCharacterLimitPlugin/useCharacterLimit.js +208 -0
- package/lib/vendor/history/LexicalHistoryPlugin.d.ts +14 -0
- package/lib/vendor/history/LexicalHistoryPlugin.js +15 -0
- package/lib/vendor/history/history/index.d.ts +63 -0
- package/lib/vendor/history/history/index.js +351 -0
- package/lib/vendor/history/useHistory.d.ts +10 -0
- package/lib/vendor/history/useHistory.js +15 -0
- package/package.json +109 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, styled, GlobalStyles, useTheme } from '@mui/material';
|
|
3
|
+
const getShapeRadiusValue = (theme) => {
|
|
4
|
+
if (typeof theme.shape.borderRadius === 'number') {
|
|
5
|
+
return theme.shape.borderRadius;
|
|
6
|
+
}
|
|
7
|
+
return parseInt(theme.shape.borderRadius, 10);
|
|
8
|
+
};
|
|
9
|
+
const StyledEditorWrapper = styled(Box) `
|
|
10
|
+
position: relative;
|
|
11
|
+
.be-editable {
|
|
12
|
+
transition: padding-bottom 0.2s;
|
|
13
|
+
code {
|
|
14
|
+
white-space: pre-wrap;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&.editable {
|
|
19
|
+
> .be-editable {
|
|
20
|
+
padding: 8px 24px;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
> .be-editable {
|
|
25
|
+
hr {
|
|
26
|
+
height: 0;
|
|
27
|
+
border: none;
|
|
28
|
+
border-top: 1px solid ${({ theme }) => theme.palette.divider};
|
|
29
|
+
margin: 1em 0;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
hr:after {
|
|
34
|
+
content: '';
|
|
35
|
+
display: block;
|
|
36
|
+
height: 2px;
|
|
37
|
+
background-color: #ccc;
|
|
38
|
+
line-height: 2px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
hr.selected {
|
|
42
|
+
outline: 2px solid rgb(60, 132, 244);
|
|
43
|
+
user-select: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 增大最外层 list item 的 marginLeft, https://github.com/blocklet/discuss-kit/issues/2123
|
|
47
|
+
> ol > li,
|
|
48
|
+
> ul > li {
|
|
49
|
+
margin-left: 24px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// collapsible dark-mode
|
|
53
|
+
summary.Collapsible__title:before {
|
|
54
|
+
border-left-color: ${({ theme }) => theme.palette.text.primary} !important;
|
|
55
|
+
}
|
|
56
|
+
.Collapsible__container[open] > .Collapsible__title:before {
|
|
57
|
+
border-left-color: transparent !important;
|
|
58
|
+
border-width: 6px 4px 0 4px;
|
|
59
|
+
border-top-color: ${({ theme }) => theme.palette.text.primary} !important;
|
|
60
|
+
}
|
|
61
|
+
.Collapsible__container {
|
|
62
|
+
background: ${({ theme }) => theme.palette.grey[50]};
|
|
63
|
+
border: 1px solid ${({ theme }) => theme.palette.divider};
|
|
64
|
+
border-radius: ${({ theme }) => theme.shape.borderRadius}px;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* table 支持圆角框 */
|
|
69
|
+
.PlaygroundEditorTheme__table {
|
|
70
|
+
border-collapse: separate; // 为了出现圆角效果
|
|
71
|
+
border-spacing: 0;
|
|
72
|
+
}
|
|
73
|
+
.PlaygroundEditorTheme__tableCell {
|
|
74
|
+
border-top: 0;
|
|
75
|
+
border-right: 1px solid ${({ theme }) => theme.palette.divider};
|
|
76
|
+
border-bottom: 1px solid ${({ theme }) => theme.palette.divider};
|
|
77
|
+
border-left: 0;
|
|
78
|
+
}
|
|
79
|
+
.PlaygroundEditorTheme__table tr:nth-of-type(1) {
|
|
80
|
+
th,
|
|
81
|
+
td {
|
|
82
|
+
border-top: 1px solid ${({ theme }) => theme.palette.divider};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
.PlaygroundEditorTheme__table tr {
|
|
86
|
+
th:first-child,
|
|
87
|
+
td:first-child {
|
|
88
|
+
border-left: 1px solid ${({ theme }) => theme.palette.divider};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
.PlaygroundEditorTheme__table tr:nth-of-type(1) {
|
|
92
|
+
th:first-child,
|
|
93
|
+
td:first-child {
|
|
94
|
+
border-top-left-radius: ${({ theme }) => theme.shape.borderRadius}px;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
.PlaygroundEditorTheme__table tr:nth-of-type(1) {
|
|
98
|
+
th:last-child,
|
|
99
|
+
td:last-child {
|
|
100
|
+
border-top-right-radius: ${({ theme }) => theme.shape.borderRadius}px;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
.PlaygroundEditorTheme__table tr:last-child {
|
|
104
|
+
th:first-child,
|
|
105
|
+
td:first-child {
|
|
106
|
+
border-bottom-left-radius: ${({ theme }) => theme.shape.borderRadius}px;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
.PlaygroundEditorTheme__table tr:last-child {
|
|
110
|
+
th:first-child,
|
|
111
|
+
td:first-child {
|
|
112
|
+
border-bottom-left-radius: ${({ theme }) => theme.shape.borderRadius}px;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
.PlaygroundEditorTheme__table tr:last-child td:last-child {
|
|
116
|
+
border-bottom-right-radius: ${({ theme }) => theme.shape.borderRadius}px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* fix: 自定义样式引起的 cell 高度偏大的问题 */
|
|
120
|
+
.PlaygroundEditorTheme__tableCell p {
|
|
121
|
+
margin: 0;
|
|
122
|
+
}
|
|
123
|
+
table th,
|
|
124
|
+
.PlaygroundEditorTheme__tableRowStriping tr:nth-child(even) {
|
|
125
|
+
background-color: ${({ theme }) => theme.palette.grey[100]} !important;
|
|
126
|
+
}
|
|
127
|
+
.PlaygroundEditorTheme__tableCellHeader {
|
|
128
|
+
background-color: ${({ theme }) => theme.palette.background.paper} !important;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@container blocklet-editor (max-width: 1000px) {
|
|
132
|
+
.be-editable span.be-image,
|
|
133
|
+
.be-editable span.be-image img {
|
|
134
|
+
width: 100% !important;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/* img/video 圆角样式 */
|
|
139
|
+
.be-editable div:has(> video) {
|
|
140
|
+
padding: 8px;
|
|
141
|
+
border: 1px solid ${({ theme }) => theme.palette.divider};
|
|
142
|
+
border-radius: ${({ theme }) => getShapeRadiusValue(theme) * 2}px;
|
|
143
|
+
overflow: hidden;
|
|
144
|
+
line-height: 1;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.be-editable video,
|
|
148
|
+
.be-editable img {
|
|
149
|
+
border-radius: 8px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* table 上下边距调 */
|
|
153
|
+
.be-editable p > table {
|
|
154
|
+
margin: 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/* list item 内 code block 对齐问题, 注意别影响内联 code block */
|
|
158
|
+
.be-editable li > code[data-language] {
|
|
159
|
+
margin-left: -20px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* heading 紧邻的 table 上边距, 调大 */
|
|
163
|
+
.be-editable h1 + p:has(table),
|
|
164
|
+
.be-editable h2 + p:has(table),
|
|
165
|
+
.be-editable h3 + p:has(table) {
|
|
166
|
+
padding-top: 4px;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* fix: 文本与 image 间距问题 (docsmith 生成的文档有时候会把文本与 image 放在同一个 p 标签中) */
|
|
170
|
+
.be-editable p span + span.be-image {
|
|
171
|
+
margin-top: 32px;
|
|
172
|
+
}
|
|
173
|
+
`;
|
|
174
|
+
export function StyledEditorContent({ ref = undefined, children, ...rest }) {
|
|
175
|
+
return (_jsxs(StyledEditorWrapper, { ref: ref, ...rest, children: [_jsx(EditorGlobalStyle, {}), children] }));
|
|
176
|
+
}
|
|
177
|
+
function EditorGlobalStyle() {
|
|
178
|
+
const theme = useTheme();
|
|
179
|
+
return (_jsx(GlobalStyles, { styles: {
|
|
180
|
+
'.dropdown': {
|
|
181
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
182
|
+
backgroundColor: theme.palette.background.default,
|
|
183
|
+
'.item': {
|
|
184
|
+
display: 'flex',
|
|
185
|
+
alignItems: 'center',
|
|
186
|
+
gap: 1,
|
|
187
|
+
/* fix: safari dropdown menu item 右侧溢出问题 */
|
|
188
|
+
width: '-webkit-fill-available',
|
|
189
|
+
color: theme.palette.text.primary,
|
|
190
|
+
backgroundColor: theme.palette.background.default,
|
|
191
|
+
'.iconify': {
|
|
192
|
+
flexShrink: 0,
|
|
193
|
+
fontSize: '1.4em',
|
|
194
|
+
},
|
|
195
|
+
'&:hover': {
|
|
196
|
+
backgroundColor: theme.palette.action.hover,
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
hr: {
|
|
200
|
+
height: 0,
|
|
201
|
+
border: 'none',
|
|
202
|
+
borderTop: `1px solid ${theme.palette.divider}`,
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
} }));
|
|
206
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare const codeHighlight: {
|
|
2
|
+
atrule: string;
|
|
3
|
+
attr: string;
|
|
4
|
+
boolean: string;
|
|
5
|
+
builtin: string;
|
|
6
|
+
cdata: string;
|
|
7
|
+
char: string;
|
|
8
|
+
class: string;
|
|
9
|
+
comment: string;
|
|
10
|
+
constant: string;
|
|
11
|
+
deleted: string;
|
|
12
|
+
doctype: string;
|
|
13
|
+
entity: string;
|
|
14
|
+
function: string;
|
|
15
|
+
important: string;
|
|
16
|
+
inserted: string;
|
|
17
|
+
keyword: string;
|
|
18
|
+
namespace: string;
|
|
19
|
+
number: string;
|
|
20
|
+
operator: string;
|
|
21
|
+
prolog: string;
|
|
22
|
+
property: string;
|
|
23
|
+
punctuation: string;
|
|
24
|
+
regex: string;
|
|
25
|
+
selector: string;
|
|
26
|
+
string: string;
|
|
27
|
+
symbol: string;
|
|
28
|
+
tag: string;
|
|
29
|
+
url: string;
|
|
30
|
+
variable: string;
|
|
31
|
+
};
|
|
32
|
+
export default codeHighlight;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { css } from '@emotion/css';
|
|
2
|
+
// Dark theme tokens
|
|
3
|
+
const tokenComment = css `
|
|
4
|
+
color: var(--lexical-code-comment);
|
|
5
|
+
`;
|
|
6
|
+
const tokenPunctuation = css `
|
|
7
|
+
color: var(--lexical-code-punctuation);
|
|
8
|
+
`;
|
|
9
|
+
const tokenProperty = css `
|
|
10
|
+
color: var(--lexical-code-property);
|
|
11
|
+
`;
|
|
12
|
+
const tokenSelector = css `
|
|
13
|
+
color: var(--lexical-code-selector);
|
|
14
|
+
`;
|
|
15
|
+
const tokenOperator = css `
|
|
16
|
+
color: var(--lexical-code-operator);
|
|
17
|
+
`;
|
|
18
|
+
const tokenAttr = css `
|
|
19
|
+
color: var(--lexical-code-attr);
|
|
20
|
+
`;
|
|
21
|
+
const tokenVariable = css `
|
|
22
|
+
color: var(--lexical-code-variable);
|
|
23
|
+
`;
|
|
24
|
+
const tokenFunction = css `
|
|
25
|
+
color: var(--lexical-code-function);
|
|
26
|
+
`;
|
|
27
|
+
const codeHighlight = {
|
|
28
|
+
atrule: tokenAttr,
|
|
29
|
+
attr: tokenAttr,
|
|
30
|
+
boolean: tokenProperty,
|
|
31
|
+
builtin: tokenSelector,
|
|
32
|
+
cdata: tokenComment,
|
|
33
|
+
char: tokenSelector,
|
|
34
|
+
class: tokenFunction,
|
|
35
|
+
comment: tokenComment,
|
|
36
|
+
constant: tokenProperty,
|
|
37
|
+
deleted: tokenProperty,
|
|
38
|
+
doctype: tokenComment,
|
|
39
|
+
entity: tokenOperator,
|
|
40
|
+
function: tokenFunction,
|
|
41
|
+
important: tokenVariable,
|
|
42
|
+
inserted: tokenSelector,
|
|
43
|
+
keyword: tokenAttr,
|
|
44
|
+
namespace: tokenVariable,
|
|
45
|
+
number: tokenProperty,
|
|
46
|
+
operator: tokenOperator,
|
|
47
|
+
prolog: tokenComment,
|
|
48
|
+
property: tokenProperty,
|
|
49
|
+
punctuation: tokenPunctuation,
|
|
50
|
+
regex: tokenVariable,
|
|
51
|
+
selector: tokenSelector,
|
|
52
|
+
string: tokenSelector,
|
|
53
|
+
symbol: tokenProperty,
|
|
54
|
+
tag: tokenProperty,
|
|
55
|
+
url: tokenOperator,
|
|
56
|
+
variable: tokenVariable,
|
|
57
|
+
};
|
|
58
|
+
export default codeHighlight;
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { css } from '@emotion/css';
|
|
2
|
+
import { useTheme } from '@mui/material';
|
|
3
|
+
import defaultTheme from './defaultTheme';
|
|
4
|
+
import codeHighlight from './code-highlight';
|
|
5
|
+
import { isHeadFontTooTall, isBodyFontTooTall } from '../utils/guard';
|
|
6
|
+
const createCustomTheme = (theme) => {
|
|
7
|
+
const noMarginTopStyle = css(`
|
|
8
|
+
// 首个元素的 margin-top 设置为 0 或者为 “超高” 字体预留一点空间
|
|
9
|
+
.be-editable &:first-child {
|
|
10
|
+
margin-top: ${isHeadFontTooTall || isBodyFontTooTall ? '2px' : '0'};
|
|
11
|
+
}
|
|
12
|
+
`);
|
|
13
|
+
const paragraph = css(
|
|
14
|
+
// use default theme's paragraph style
|
|
15
|
+
defaultTheme.paragraph, `
|
|
16
|
+
margin-bottom: 20px;
|
|
17
|
+
&:has(img) {
|
|
18
|
+
margin: 32px 0;
|
|
19
|
+
line-height: 1;
|
|
20
|
+
}
|
|
21
|
+
line-height: 1.75;
|
|
22
|
+
`,
|
|
23
|
+
// 兼容旧 table 水平滚动条问题 (与 useResponsiveTable 配合使用)
|
|
24
|
+
`
|
|
25
|
+
&:has(table) {
|
|
26
|
+
overflow-x: auto;
|
|
27
|
+
// scroll bar and table gap
|
|
28
|
+
padding-bottom: 0.628em;
|
|
29
|
+
}
|
|
30
|
+
`, theme.typography.body1, noMarginTopStyle);
|
|
31
|
+
const quote = css(`
|
|
32
|
+
margin: 1.6em 0;
|
|
33
|
+
border-left-color: var(--mui-palette-grey-200);
|
|
34
|
+
border-left-width: 2px;
|
|
35
|
+
border-left-style: solid;
|
|
36
|
+
padding-left: 1.5rem;
|
|
37
|
+
font-style: italic;
|
|
38
|
+
`, theme.typography.body1, { fontWeight: 500 });
|
|
39
|
+
const h1 = css(`
|
|
40
|
+
margin: 0;
|
|
41
|
+
margin-bottom: 0.833333em;
|
|
42
|
+
& + * {
|
|
43
|
+
margin-top: 0!important;
|
|
44
|
+
}
|
|
45
|
+
`, theme.typography.h1);
|
|
46
|
+
const h2 = css(`
|
|
47
|
+
margin: 2em 0 0.6666em 0;
|
|
48
|
+
& + * {
|
|
49
|
+
margin-top: 0!important;
|
|
50
|
+
}
|
|
51
|
+
`, theme.typography.h2, noMarginTopStyle);
|
|
52
|
+
const h3 = css(`
|
|
53
|
+
margin: 2.4em 0 0.6em 0;
|
|
54
|
+
& + * {
|
|
55
|
+
margin-top: 0!important;
|
|
56
|
+
}
|
|
57
|
+
`, theme.typography.h3, noMarginTopStyle);
|
|
58
|
+
const h4 = css(`
|
|
59
|
+
margin: 2em 0 0.5em 0;
|
|
60
|
+
& + * {
|
|
61
|
+
margin-top: 0!important;
|
|
62
|
+
}
|
|
63
|
+
`, theme.typography.h4, noMarginTopStyle);
|
|
64
|
+
const h5 = css(`
|
|
65
|
+
margin: 0;
|
|
66
|
+
& + * {
|
|
67
|
+
margin-top: 0!important;
|
|
68
|
+
}
|
|
69
|
+
`, theme.typography.h5, noMarginTopStyle);
|
|
70
|
+
const h6 = css(`
|
|
71
|
+
margin: 0;
|
|
72
|
+
& + * {
|
|
73
|
+
margin-top: 0!important;
|
|
74
|
+
}
|
|
75
|
+
`, theme.typography.h6, noMarginTopStyle);
|
|
76
|
+
const link = css(`
|
|
77
|
+
color: inherit;
|
|
78
|
+
text-decoration: none;
|
|
79
|
+
border-bottom: 1px solid var(--mui-palette-primary-main);
|
|
80
|
+
&:hover {
|
|
81
|
+
border-bottom-width: 2px;
|
|
82
|
+
}
|
|
83
|
+
`, { fontWeight: 600 });
|
|
84
|
+
const textBold = css `
|
|
85
|
+
font-weight: bold;
|
|
86
|
+
`;
|
|
87
|
+
const textItalic = css `
|
|
88
|
+
font-style: italic;
|
|
89
|
+
`;
|
|
90
|
+
const textUnderline = css `
|
|
91
|
+
text-decoration: underline;
|
|
92
|
+
`;
|
|
93
|
+
const textStrikethrough = css `
|
|
94
|
+
text-decoration: line-through;
|
|
95
|
+
`;
|
|
96
|
+
const textUnderlineStrikethrough = css `
|
|
97
|
+
text-decoration: underline line-through;
|
|
98
|
+
`;
|
|
99
|
+
const textSubscript = css `
|
|
100
|
+
font-size: 0.8em;
|
|
101
|
+
vertical-align: sub !important;
|
|
102
|
+
`;
|
|
103
|
+
const textSuperscript = css `
|
|
104
|
+
font-size: 0.8em;
|
|
105
|
+
vertical-align: super;
|
|
106
|
+
`;
|
|
107
|
+
const textCode = css(theme.typography.body1, {
|
|
108
|
+
fontSize: '.875em',
|
|
109
|
+
fontWeight: 500,
|
|
110
|
+
borderRadius: '.25rem',
|
|
111
|
+
border: '1px solid var(--mui-palette-grey-200)',
|
|
112
|
+
padding: '1px .375rem',
|
|
113
|
+
fontFamily: 'Menlo, Consolas, Monaco, monospace',
|
|
114
|
+
fontVariantLigatures: 'none',
|
|
115
|
+
backgroundColor: 'var(--mui-palette-grey-50)',
|
|
116
|
+
color: 'var(--lexical-text-code)',
|
|
117
|
+
});
|
|
118
|
+
const olCommon = {
|
|
119
|
+
margin: 0,
|
|
120
|
+
padding: 0,
|
|
121
|
+
...theme.typography.body1,
|
|
122
|
+
};
|
|
123
|
+
const ol1 = css(`
|
|
124
|
+
margin: '1.3333333em 0';
|
|
125
|
+
`, olCommon);
|
|
126
|
+
const ol2 = css(`
|
|
127
|
+
list-style-type: upper-alpha;
|
|
128
|
+
`, olCommon);
|
|
129
|
+
const ol3 = css(`
|
|
130
|
+
list-style-type: lower-alpha;
|
|
131
|
+
`, olCommon);
|
|
132
|
+
const ol4 = css(`
|
|
133
|
+
list-style-type: upper-roman;
|
|
134
|
+
`, olCommon);
|
|
135
|
+
const ol5 = css(`
|
|
136
|
+
list-style-type: lower-roman;
|
|
137
|
+
`, olCommon);
|
|
138
|
+
const ul = css `
|
|
139
|
+
padding: 0;
|
|
140
|
+
margin: '1.3333333em 0';
|
|
141
|
+
& & {
|
|
142
|
+
margin: 0;
|
|
143
|
+
}
|
|
144
|
+
`;
|
|
145
|
+
const listItem = css(`
|
|
146
|
+
margin-left: 28px;
|
|
147
|
+
margin-top: 0.5em;
|
|
148
|
+
margin-bottom: 0.5em;
|
|
149
|
+
padding-left: 0.25em;
|
|
150
|
+
`, theme.typography.body1
|
|
151
|
+
// { lineHeight: 1.5 }
|
|
152
|
+
);
|
|
153
|
+
const listItemChecked = css `
|
|
154
|
+
margin-left: 0 !important;
|
|
155
|
+
margin-right: 8px;
|
|
156
|
+
padding-left: 24px;
|
|
157
|
+
padding-right: 24px;
|
|
158
|
+
&:before {
|
|
159
|
+
border: 1px solid var(--mui-palette-primary-main);
|
|
160
|
+
background-color: var(--mui-palette-primary-main);
|
|
161
|
+
top: 4px;
|
|
162
|
+
}
|
|
163
|
+
&:after {
|
|
164
|
+
top: 7px;
|
|
165
|
+
}
|
|
166
|
+
&:focus:before {
|
|
167
|
+
box-shadow: 0 0 0 1px var(--mui-palette-primary-light);
|
|
168
|
+
}
|
|
169
|
+
`;
|
|
170
|
+
const listItemUnchecked = css `
|
|
171
|
+
margin-left: 0 !important;
|
|
172
|
+
margin-right: 8px;
|
|
173
|
+
padding-left: 24px;
|
|
174
|
+
padding-right: 24px;
|
|
175
|
+
&:before {
|
|
176
|
+
top: 4px;
|
|
177
|
+
left: 1px;
|
|
178
|
+
}
|
|
179
|
+
&:focus:before {
|
|
180
|
+
box-shadow: 0 0 0 1px var(--mui-palette-primary-light);
|
|
181
|
+
}
|
|
182
|
+
`;
|
|
183
|
+
const nestedListItem = css `
|
|
184
|
+
list-style-type: none;
|
|
185
|
+
|
|
186
|
+
&:before,
|
|
187
|
+
&:after {
|
|
188
|
+
display: none;
|
|
189
|
+
}
|
|
190
|
+
`;
|
|
191
|
+
const embedBlock = css `
|
|
192
|
+
user-select: none;
|
|
193
|
+
padding: 8px 0;
|
|
194
|
+
`;
|
|
195
|
+
const embedBlockFocus = css `
|
|
196
|
+
outline: 2px solid var(--mui-palette-primary-light);
|
|
197
|
+
`;
|
|
198
|
+
const alert = css `
|
|
199
|
+
// user-select: none;
|
|
200
|
+
padding: 8px 0;
|
|
201
|
+
`;
|
|
202
|
+
const alertFocus = css `
|
|
203
|
+
outline: 2px solid var(--mui-palette-primary-light);
|
|
204
|
+
`;
|
|
205
|
+
const xComponent = css `
|
|
206
|
+
padding: 8px 0;
|
|
207
|
+
`;
|
|
208
|
+
const xComponentFocus = css `
|
|
209
|
+
outline: 2px solid var(--mui-palette-primary-light);
|
|
210
|
+
`;
|
|
211
|
+
const image = css `
|
|
212
|
+
.image-caption-container {
|
|
213
|
+
// fix #924
|
|
214
|
+
.ImageNode__contentEditable {
|
|
215
|
+
box-sizing: content-box;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.ImageNode__contentEditable p {
|
|
219
|
+
margin: 0;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.be-content:not(.editable) & {
|
|
223
|
+
position: relative;
|
|
224
|
+
margin-top: 0.5em;
|
|
225
|
+
|
|
226
|
+
.ImageNode__contentEditable {
|
|
227
|
+
padding: 0;
|
|
228
|
+
p {
|
|
229
|
+
color: var(--mui-palette-text-secondary);
|
|
230
|
+
font-size: 12px;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
`;
|
|
236
|
+
const code = css `
|
|
237
|
+
background-color: var(--mui-palette-background-paper);
|
|
238
|
+
color: var(--mui-palette-text-primary);
|
|
239
|
+
font-family: Menlo, Consolas, Monaco, monospace;
|
|
240
|
+
display: block;
|
|
241
|
+
// padding: 16px;
|
|
242
|
+
padding: 16px 16px 16px 52px;
|
|
243
|
+
line-height: 1.53;
|
|
244
|
+
font-size: 13px;
|
|
245
|
+
margin: 0;
|
|
246
|
+
margin-top: 20px;
|
|
247
|
+
margin-bottom: 32px;
|
|
248
|
+
tab-size: 2;
|
|
249
|
+
/* white-space: pre; */
|
|
250
|
+
overflow-x: auto;
|
|
251
|
+
position: relative;
|
|
252
|
+
border-radius: ${theme.shape.borderRadius}px;
|
|
253
|
+
border: 1px solid var(--mui-palette-divider);
|
|
254
|
+
|
|
255
|
+
&:before {
|
|
256
|
+
content: attr(data-gutter);
|
|
257
|
+
position: absolute;
|
|
258
|
+
left: 0;
|
|
259
|
+
top: 0;
|
|
260
|
+
// border-right: 1px solid #ccc;
|
|
261
|
+
padding: 16px;
|
|
262
|
+
color: #777;
|
|
263
|
+
white-space: pre-wrap;
|
|
264
|
+
text-align: right;
|
|
265
|
+
min-width: 25px;
|
|
266
|
+
}
|
|
267
|
+
&[data-gutter='1'] {
|
|
268
|
+
padding: 12px 16px !important;
|
|
269
|
+
}
|
|
270
|
+
&[data-gutter='1']:before {
|
|
271
|
+
display: none;
|
|
272
|
+
}
|
|
273
|
+
`;
|
|
274
|
+
/**
|
|
275
|
+
* 基于 mui theme 的自定义主题
|
|
276
|
+
*/
|
|
277
|
+
const customTheme = {
|
|
278
|
+
...defaultTheme,
|
|
279
|
+
paragraph,
|
|
280
|
+
quote,
|
|
281
|
+
heading: { h1, h2, h3, h4, h5, h6 },
|
|
282
|
+
text: {
|
|
283
|
+
bold: textBold,
|
|
284
|
+
code: textCode,
|
|
285
|
+
italic: textItalic,
|
|
286
|
+
strikethrough: textStrikethrough,
|
|
287
|
+
subscript: textSubscript,
|
|
288
|
+
superscript: textSuperscript,
|
|
289
|
+
underline: textUnderline,
|
|
290
|
+
underlineStrikethrough: textUnderlineStrikethrough,
|
|
291
|
+
},
|
|
292
|
+
link,
|
|
293
|
+
list: {
|
|
294
|
+
listitem: listItem,
|
|
295
|
+
listitemChecked: `${defaultTheme.list.listitemChecked} ${listItemChecked}`,
|
|
296
|
+
listitemUnchecked: `${defaultTheme.list.listitemUnchecked} ${listItemUnchecked}`,
|
|
297
|
+
nested: {
|
|
298
|
+
listitem: nestedListItem,
|
|
299
|
+
},
|
|
300
|
+
olDepth: [ol1, ol2, ol3, ol4, ol5],
|
|
301
|
+
ul,
|
|
302
|
+
},
|
|
303
|
+
codeHighlight,
|
|
304
|
+
embedBlock: {
|
|
305
|
+
base: embedBlock,
|
|
306
|
+
focus: embedBlockFocus,
|
|
307
|
+
},
|
|
308
|
+
alert: {
|
|
309
|
+
base: alert,
|
|
310
|
+
focus: alertFocus,
|
|
311
|
+
},
|
|
312
|
+
xComponent: {
|
|
313
|
+
base: xComponent,
|
|
314
|
+
focus: xComponentFocus,
|
|
315
|
+
},
|
|
316
|
+
image: `${defaultTheme.image} ${image}`,
|
|
317
|
+
code,
|
|
318
|
+
};
|
|
319
|
+
return customTheme;
|
|
320
|
+
};
|
|
321
|
+
export const useCustomTheme = () => {
|
|
322
|
+
const muiTheme = useTheme();
|
|
323
|
+
return createCustomTheme(muiTheme);
|
|
324
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
import { EditorThemeClasses } from 'lexical';
|
|
9
|
+
declare const defaultTheme: EditorThemeClasses;
|
|
10
|
+
export default defaultTheme;
|