@shelamkoff/rector 1.0.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 +21 -0
- package/NOTICE +17 -0
- package/README.md +23 -0
- package/THIRD_PARTY_LICENSES.txt +298 -0
- package/dist/I18n.d.ts +1 -0
- package/dist/core/Block.d.ts +110 -0
- package/dist/core/Block.js +390 -0
- package/dist/core/BlockAnimator.d.ts +39 -0
- package/dist/core/BlockAnimator.js +106 -0
- package/dist/core/BlockManager.d.ts +163 -0
- package/dist/core/BlockManager.js +640 -0
- package/dist/core/BlockOperations.d.ts +67 -0
- package/dist/core/BlockOperations.js +238 -0
- package/dist/core/ChangeNotifier.d.ts +15 -0
- package/dist/core/ChangeNotifier.js +55 -0
- package/dist/core/CommandDispatcher.d.ts +52 -0
- package/dist/core/CommandDispatcher.js +208 -0
- package/dist/core/CrossBlockSelection.d.ts +30 -0
- package/dist/core/CrossBlockSelection.js +74 -0
- package/dist/core/Diagnostics.d.ts +23 -0
- package/dist/core/Diagnostics.js +62 -0
- package/dist/core/DocumentSchema.d.ts +29 -0
- package/dist/core/DocumentSchema.js +147 -0
- package/dist/core/DocumentSnapshotStore.d.ts +34 -0
- package/dist/core/DocumentSnapshotStore.js +153 -0
- package/dist/core/DragManager.d.ts +17 -0
- package/dist/core/DragManager.js +223 -0
- package/dist/core/EditorFacade.d.ts +154 -0
- package/dist/core/EditorFacade.js +361 -0
- package/dist/core/EditorHolderOwnership.d.ts +12 -0
- package/dist/core/EditorHolderOwnership.js +28 -0
- package/dist/core/I18n.d.ts +147 -0
- package/dist/core/I18n.js +296 -0
- package/dist/core/InlinePatternMatcher.d.ts +26 -0
- package/dist/core/InlinePatternMatcher.js +267 -0
- package/dist/core/InlinePluginRegistry.d.ts +55 -0
- package/dist/core/InlinePluginRegistry.js +128 -0
- package/dist/core/KeyboardManager.d.ts +17 -0
- package/dist/core/KeyboardManager.js +231 -0
- package/dist/core/LifecycleScope.d.ts +19 -0
- package/dist/core/LifecycleScope.js +41 -0
- package/dist/core/MouseSelectionManager.d.ts +30 -0
- package/dist/core/MouseSelectionManager.js +307 -0
- package/dist/core/PluginOwnership.d.ts +9 -0
- package/dist/core/PluginOwnership.js +40 -0
- package/dist/core/PopupManager.d.ts +50 -0
- package/dist/core/PopupManager.js +183 -0
- package/dist/core/PreservedBlockPlugin.d.ts +11 -0
- package/dist/core/PreservedBlockPlugin.js +42 -0
- package/dist/core/PublicEditorApi.d.ts +82 -0
- package/dist/core/PublicEditorApi.js +158 -0
- package/dist/core/SelectionManager.d.ts +50 -0
- package/dist/core/SelectionManager.js +205 -0
- package/dist/core/ShortcutRegistry.d.ts +29 -0
- package/dist/core/ShortcutRegistry.js +106 -0
- package/dist/core/SlashCommands.d.ts +34 -0
- package/dist/core/SlashCommands.js +483 -0
- package/dist/core/StyleInjector.d.ts +1 -0
- package/dist/core/StyleInjector.js +1 -0
- package/dist/core/Tooltip.d.ts +17 -0
- package/dist/core/Tooltip.js +60 -0
- package/dist/core/TriggerManager.d.ts +17 -0
- package/dist/core/TriggerManager.js +159 -0
- package/dist/core/TypeSelector.d.ts +31 -0
- package/dist/core/TypeSelector.js +464 -0
- package/dist/core/UndoManager.d.ts +72 -0
- package/dist/core/UndoManager.js +383 -0
- package/dist/core/block-settings-menu/BlockActions.d.ts +81 -0
- package/dist/core/block-settings-menu/BlockActions.js +233 -0
- package/dist/core/block-settings-menu/BlockSettingsMenu.d.ts +46 -0
- package/dist/core/block-settings-menu/BlockSettingsMenu.js +205 -0
- package/dist/core/block-settings-menu/MenuBuilder.d.ts +43 -0
- package/dist/core/block-settings-menu/MenuBuilder.js +203 -0
- package/dist/core/block-settings-menu/MenuPositioner.d.ts +22 -0
- package/dist/core/block-settings-menu/MenuPositioner.js +79 -0
- package/dist/core/clipboard/Clipboard.d.ts +47 -0
- package/dist/core/clipboard/Clipboard.js +653 -0
- package/dist/core/clipboard/CrossBlockEditor.d.ts +43 -0
- package/dist/core/clipboard/CrossBlockEditor.js +198 -0
- package/dist/core/clipboard/PasteRouter.d.ts +27 -0
- package/dist/core/clipboard/PasteRouter.js +86 -0
- package/dist/core/clipboard/pasteInsert.d.ts +35 -0
- package/dist/core/clipboard/pasteInsert.js +215 -0
- package/dist/core/clipboard/pasteUtils.d.ts +25 -0
- package/dist/core/clipboard/pasteUtils.js +98 -0
- package/dist/core/config.d.ts +77 -0
- package/dist/core/config.js +100 -0
- package/dist/core/constants.d.ts +23 -0
- package/dist/core/constants.js +30 -0
- package/dist/core/crossBlockConvert.d.ts +38 -0
- package/dist/core/crossBlockConvert.js +253 -0
- package/dist/core/dom.d.ts +35 -0
- package/dist/core/dom.js +65 -0
- package/dist/core/editorEvents.d.ts +89 -0
- package/dist/core/editorEvents.js +60 -0
- package/dist/core/hydrateInlinePlugins.d.ts +9 -0
- package/dist/core/hydrateInlinePlugins.js +36 -0
- package/dist/core/icons.d.ts +10 -0
- package/dist/core/icons.js +21 -0
- package/dist/core/index.d.ts +59 -0
- package/dist/core/index.js +703 -0
- package/dist/core/inline-toolbar/ActionsPanel.d.ts +61 -0
- package/dist/core/inline-toolbar/ActionsPanel.js +132 -0
- package/dist/core/inline-toolbar/InlinePositioner.d.ts +20 -0
- package/dist/core/inline-toolbar/InlinePositioner.js +63 -0
- package/dist/core/inline-toolbar/InlineToolbar.d.ts +45 -0
- package/dist/core/inline-toolbar/InlineToolbar.js +456 -0
- package/dist/core/inline-toolbar/PluginControlsSlot.d.ts +52 -0
- package/dist/core/inline-toolbar/PluginControlsSlot.js +118 -0
- package/dist/core/inline-toolbar/SelectionTracker.d.ts +63 -0
- package/dist/core/inline-toolbar/SelectionTracker.js +173 -0
- package/dist/core/inlinePluginInsert.d.ts +13 -0
- package/dist/core/inlinePluginInsert.js +56 -0
- package/dist/core/locale/en.d.ts +35 -0
- package/dist/core/locale/en.js +37 -0
- package/dist/core/locale/ru.d.ts +35 -0
- package/dist/core/locale/ru.js +37 -0
- package/dist/core/menuKeyboardNav.d.ts +15 -0
- package/dist/core/menuKeyboardNav.js +52 -0
- package/dist/core/sanitize.d.ts +2 -0
- package/dist/core/sanitize.js +6 -0
- package/dist/core/splitConvert.d.ts +46 -0
- package/dist/core/splitConvert.js +190 -0
- package/dist/core/textOffset.d.ts +46 -0
- package/dist/core/textOffset.js +180 -0
- package/dist/core/themes/dark.css +30 -0
- package/dist/core/themes/light.css +33 -0
- package/dist/core/themes/variables.css +1170 -0
- package/dist/core/toolbar/OffcanvasRoot.d.ts +37 -0
- package/dist/core/toolbar/OffcanvasRoot.js +127 -0
- package/dist/core/toolbar/Toolbar.d.ts +70 -0
- package/dist/core/toolbar/Toolbar.js +432 -0
- package/dist/core/toolbar/ToolbarPositioner.d.ts +60 -0
- package/dist/core/toolbar/ToolbarPositioner.js +188 -0
- package/dist/core/toolbar/ToolboxBuilder.d.ts +44 -0
- package/dist/core/toolbar/ToolboxBuilder.js +260 -0
- package/dist/core/types.d.ts +747 -0
- package/dist/core/uid.d.ts +6 -0
- package/dist/core/uid.js +29 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/inline-plugins/README.md +35 -0
- package/dist/inline-plugins/README.ru.md +35 -0
- package/dist/inline-plugins/color/README.md +61 -0
- package/dist/inline-plugins/color/README.ru.md +61 -0
- package/dist/inline-plugins/color.d.ts +8 -0
- package/dist/inline-plugins/color.js +184 -0
- package/dist/inline-plugins/locale/en.d.ts +7 -0
- package/dist/inline-plugins/locale/en.js +6 -0
- package/dist/inline-plugins/locale/ru.d.ts +7 -0
- package/dist/inline-plugins/locale/ru.js +6 -0
- package/dist/inline-plugins/mention/README.md +97 -0
- package/dist/inline-plugins/mention/README.ru.md +97 -0
- package/dist/inline-plugins/mention/index.d.ts +110 -0
- package/dist/inline-plugins/mention/index.js +1897 -0
- package/dist/inline-plugins/mention/styles.css +183 -0
- package/dist/inline-plugins/mention/widget.d.ts +16 -0
- package/dist/inline-plugins/mention/widget.js +75 -0
- package/dist/inline-tools/align.d.ts +14 -0
- package/dist/inline-tools/align.js +120 -0
- package/dist/inline-tools/bold.d.ts +8 -0
- package/dist/inline-tools/bold.js +12 -0
- package/dist/inline-tools/caseTransform.d.ts +8 -0
- package/dist/inline-tools/caseTransform.js +87 -0
- package/dist/inline-tools/clearFormatting.d.ts +8 -0
- package/dist/inline-tools/clearFormatting.js +74 -0
- package/dist/inline-tools/code.d.ts +8 -0
- package/dist/inline-tools/code.js +12 -0
- package/dist/inline-tools/colorPicker.d.ts +7 -0
- package/dist/inline-tools/colorPicker.js +271 -0
- package/dist/inline-tools/defaults.d.ts +10 -0
- package/dist/inline-tools/defaults.js +57 -0
- package/dist/inline-tools/fontSize.d.ts +7 -0
- package/dist/inline-tools/fontSize.js +524 -0
- package/dist/inline-tools/italic.d.ts +8 -0
- package/dist/inline-tools/italic.js +12 -0
- package/dist/inline-tools/link.d.ts +12 -0
- package/dist/inline-tools/link.js +251 -0
- package/dist/inline-tools/marker.d.ts +8 -0
- package/dist/inline-tools/marker.js +12 -0
- package/dist/inline-tools/scriptTool.d.ts +11 -0
- package/dist/inline-tools/scriptTool.js +149 -0
- package/dist/inline-tools/strikethrough.d.ts +8 -0
- package/dist/inline-tools/strikethrough.js +12 -0
- package/dist/inline-tools/utils.d.ts +220 -0
- package/dist/inline-tools/utils.js +992 -0
- package/dist/locale/en.d.ts +311 -0
- package/dist/locale/en.js +52 -0
- package/dist/locale/ru.d.ts +315 -0
- package/dist/locale/ru.js +52 -0
- package/dist/plugins/BlockPluginAbstract.d.ts +82 -0
- package/dist/plugins/BlockPluginAbstract.js +111 -0
- package/dist/plugins/README.md +44 -0
- package/dist/plugins/README.ru.md +40 -0
- package/dist/plugins/async.d.ts +35 -0
- package/dist/plugins/async.js +79 -0
- package/dist/plugins/attaches/README.md +86 -0
- package/dist/plugins/attaches/README.ru.md +87 -0
- package/dist/plugins/attaches/attaches.css +374 -0
- package/dist/plugins/attaches/index.d.ts +133 -0
- package/dist/plugins/attaches/index.js +921 -0
- package/dist/plugins/attaches/locale/en.d.ts +23 -0
- package/dist/plugins/attaches/locale/en.js +19 -0
- package/dist/plugins/attaches/locale/keys.d.ts +5 -0
- package/dist/plugins/attaches/locale/ru.d.ts +25 -0
- package/dist/plugins/attaches/locale/ru.js +19 -0
- package/dist/plugins/carousel/README.md +108 -0
- package/dist/plugins/carousel/README.ru.md +109 -0
- package/dist/plugins/carousel/carousel.css +198 -0
- package/dist/plugins/carousel/icons.d.ts +12 -0
- package/dist/plugins/carousel/icons.js +13 -0
- package/dist/plugins/carousel/index.d.ts +137 -0
- package/dist/plugins/carousel/index.js +859 -0
- package/dist/plugins/carousel/locale/en.d.ts +41 -0
- package/dist/plugins/carousel/locale/en.js +40 -0
- package/dist/plugins/carousel/locale/keys.d.ts +2 -0
- package/dist/plugins/carousel/locale/ru.d.ts +41 -0
- package/dist/plugins/carousel/locale/ru.js +40 -0
- package/dist/plugins/carousel/state.d.ts +29 -0
- package/dist/plugins/carousel/state.js +42 -0
- package/dist/plugins/checklist/README.md +54 -0
- package/dist/plugins/checklist/README.ru.md +55 -0
- package/dist/plugins/checklist/checklist.css +80 -0
- package/dist/plugins/checklist/index.d.ts +75 -0
- package/dist/plugins/checklist/index.js +407 -0
- package/dist/plugins/checklist/locale/en.d.ts +5 -0
- package/dist/plugins/checklist/locale/en.js +4 -0
- package/dist/plugins/checklist/locale/keys.d.ts +5 -0
- package/dist/plugins/checklist/locale/ru.d.ts +5 -0
- package/dist/plugins/checklist/locale/ru.js +4 -0
- package/dist/plugins/checklist/mapTextFields.d.ts +1 -0
- package/dist/plugins/checklist/mapTextFields.js +1 -0
- package/dist/plugins/code/README.md +59 -0
- package/dist/plugins/code/README.ru.md +60 -0
- package/dist/plugins/code/code.css +360 -0
- package/dist/plugins/code/index.d.ts +109 -0
- package/dist/plugins/code/index.js +1012 -0
- package/dist/plugins/code/locale/en.d.ts +11 -0
- package/dist/plugins/code/locale/en.js +10 -0
- package/dist/plugins/code/locale/keys.d.ts +5 -0
- package/dist/plugins/code/locale/ru.d.ts +11 -0
- package/dist/plugins/code/locale/ru.js +10 -0
- package/dist/plugins/columns/README.md +55 -0
- package/dist/plugins/columns/README.ru.md +56 -0
- package/dist/plugins/columns/columns.css +103 -0
- package/dist/plugins/columns/index.d.ts +58 -0
- package/dist/plugins/columns/index.js +236 -0
- package/dist/plugins/columns/locale/en.d.ts +6 -0
- package/dist/plugins/columns/locale/en.js +5 -0
- package/dist/plugins/columns/locale/keys.d.ts +5 -0
- package/dist/plugins/columns/locale/ru.d.ts +6 -0
- package/dist/plugins/columns/locale/ru.js +5 -0
- package/dist/plugins/delimiter/README.md +48 -0
- package/dist/plugins/delimiter/README.ru.md +49 -0
- package/dist/plugins/delimiter/delimiter.css +22 -0
- package/dist/plugins/delimiter/index.d.ts +38 -0
- package/dist/plugins/delimiter/index.js +69 -0
- package/dist/plugins/delimiter/locale/en.d.ts +4 -0
- package/dist/plugins/delimiter/locale/en.js +3 -0
- package/dist/plugins/delimiter/locale/keys.d.ts +5 -0
- package/dist/plugins/delimiter/locale/ru.d.ts +4 -0
- package/dist/plugins/delimiter/locale/ru.js +3 -0
- package/dist/plugins/embed/README.md +81 -0
- package/dist/plugins/embed/README.ru.md +82 -0
- package/dist/plugins/embed/embed.css +558 -0
- package/dist/plugins/embed/index.d.ts +271 -0
- package/dist/plugins/embed/index.js +967 -0
- package/dist/plugins/embed/locale/en.d.ts +20 -0
- package/dist/plugins/embed/locale/en.js +19 -0
- package/dist/plugins/embed/locale/keys.d.ts +5 -0
- package/dist/plugins/embed/locale/ru.d.ts +20 -0
- package/dist/plugins/embed/locale/ru.js +19 -0
- package/dist/plugins/embed/player.d.ts +1 -0
- package/dist/plugins/embed/player.js +1 -0
- package/dist/plugins/gallery/README.md +92 -0
- package/dist/plugins/gallery/README.ru.md +93 -0
- package/dist/plugins/gallery/css.d.ts +52 -0
- package/dist/plugins/gallery/css.js +67 -0
- package/dist/plugins/gallery/gallery.css +860 -0
- package/dist/plugins/gallery/icons.d.ts +13 -0
- package/dist/plugins/gallery/icons.js +45 -0
- package/dist/plugins/gallery/index.d.ts +126 -0
- package/dist/plugins/gallery/index.js +355 -0
- package/dist/plugins/gallery/layout.d.ts +35 -0
- package/dist/plugins/gallery/layout.js +79 -0
- package/dist/plugins/gallery/locale/en.d.ts +36 -0
- package/dist/plugins/gallery/locale/en.js +35 -0
- package/dist/plugins/gallery/locale/keys.d.ts +5 -0
- package/dist/plugins/gallery/locale/ru.d.ts +36 -0
- package/dist/plugins/gallery/locale/ru.js +35 -0
- package/dist/plugins/gallery/settings.d.ts +25 -0
- package/dist/plugins/gallery/settings.js +199 -0
- package/dist/plugins/gallery/slot.d.ts +73 -0
- package/dist/plugins/gallery/slot.js +260 -0
- package/dist/plugins/gallery/state.d.ts +67 -0
- package/dist/plugins/gallery/state.js +133 -0
- package/dist/plugins/gallery/styles.d.ts +10 -0
- package/dist/plugins/gallery/styles.js +24 -0
- package/dist/plugins/gallery/uploader.d.ts +31 -0
- package/dist/plugins/gallery/uploader.js +111 -0
- package/dist/plugins/gallery/view-empty.d.ts +41 -0
- package/dist/plugins/gallery/view-empty.js +56 -0
- package/dist/plugins/gallery/view-filled.d.ts +55 -0
- package/dist/plugins/gallery/view-filled.js +353 -0
- package/dist/plugins/heading/HeadingLevelSelect.d.ts +16 -0
- package/dist/plugins/heading/HeadingLevelSelect.js +183 -0
- package/dist/plugins/heading/README.md +58 -0
- package/dist/plugins/heading/README.ru.md +59 -0
- package/dist/plugins/heading/heading.css +76 -0
- package/dist/plugins/heading/index.d.ts +124 -0
- package/dist/plugins/heading/index.js +273 -0
- package/dist/plugins/heading/locale/en.d.ts +11 -0
- package/dist/plugins/heading/locale/en.js +10 -0
- package/dist/plugins/heading/locale/keys.d.ts +5 -0
- package/dist/plugins/heading/locale/ru.d.ts +11 -0
- package/dist/plugins/heading/locale/ru.js +10 -0
- package/dist/plugins/heading/mapTextFields.d.ts +1 -0
- package/dist/plugins/heading/mapTextFields.js +1 -0
- package/dist/plugins/image/README.md +93 -0
- package/dist/plugins/image/README.ru.md +94 -0
- package/dist/plugins/image/css.d.ts +47 -0
- package/dist/plugins/image/css.js +47 -0
- package/dist/plugins/image/icons.d.ts +13 -0
- package/dist/plugins/image/icons.js +26 -0
- package/dist/plugins/image/image.css +559 -0
- package/dist/plugins/image/index.d.ts +129 -0
- package/dist/plugins/image/index.js +346 -0
- package/dist/plugins/image/locale/en.d.ts +39 -0
- package/dist/plugins/image/locale/en.js +38 -0
- package/dist/plugins/image/locale/keys.d.ts +5 -0
- package/dist/plugins/image/locale/ru.d.ts +39 -0
- package/dist/plugins/image/locale/ru.js +38 -0
- package/dist/plugins/image/settings.d.ts +23 -0
- package/dist/plugins/image/settings.js +347 -0
- package/dist/plugins/image/state.d.ts +86 -0
- package/dist/plugins/image/state.js +151 -0
- package/dist/plugins/image/styles.d.ts +21 -0
- package/dist/plugins/image/styles.js +58 -0
- package/dist/plugins/image/uploader.d.ts +31 -0
- package/dist/plugins/image/uploader.js +92 -0
- package/dist/plugins/image/view-empty.d.ts +44 -0
- package/dist/plugins/image/view-empty.js +61 -0
- package/dist/plugins/image/view-filled.d.ts +49 -0
- package/dist/plugins/image/view-filled.js +282 -0
- package/dist/plugins/index.d.ts +21 -0
- package/dist/plugins/index.js +22 -0
- package/dist/plugins/link-preview/README.md +69 -0
- package/dist/plugins/link-preview/README.ru.md +70 -0
- package/dist/plugins/link-preview/index.d.ts +169 -0
- package/dist/plugins/link-preview/index.js +698 -0
- package/dist/plugins/link-preview/link-preview.css +254 -0
- package/dist/plugins/link-preview/locale/en.d.ts +14 -0
- package/dist/plugins/link-preview/locale/en.js +13 -0
- package/dist/plugins/link-preview/locale/keys.d.ts +5 -0
- package/dist/plugins/link-preview/locale/ru.d.ts +14 -0
- package/dist/plugins/link-preview/locale/ru.js +13 -0
- package/dist/plugins/list/README.md +59 -0
- package/dist/plugins/list/README.ru.md +60 -0
- package/dist/plugins/list/index.d.ts +134 -0
- package/dist/plugins/list/index.js +566 -0
- package/dist/plugins/list/list.css +57 -0
- package/dist/plugins/list/locale/en.d.ts +5 -0
- package/dist/plugins/list/locale/en.js +4 -0
- package/dist/plugins/list/locale/keys.d.ts +5 -0
- package/dist/plugins/list/locale/ru.d.ts +5 -0
- package/dist/plugins/list/locale/ru.js +4 -0
- package/dist/plugins/list/mapTextFields.d.ts +1 -0
- package/dist/plugins/list/mapTextFields.js +1 -0
- package/dist/plugins/paragraph/README.md +57 -0
- package/dist/plugins/paragraph/README.ru.md +58 -0
- package/dist/plugins/paragraph/index.d.ts +112 -0
- package/dist/plugins/paragraph/index.js +158 -0
- package/dist/plugins/paragraph/locale/en.d.ts +5 -0
- package/dist/plugins/paragraph/locale/en.js +4 -0
- package/dist/plugins/paragraph/locale/keys.d.ts +5 -0
- package/dist/plugins/paragraph/locale/ru.d.ts +5 -0
- package/dist/plugins/paragraph/locale/ru.js +4 -0
- package/dist/plugins/paragraph/mapTextFields.d.ts +1 -0
- package/dist/plugins/paragraph/mapTextFields.js +1 -0
- package/dist/plugins/paragraph/paragraph.css +56 -0
- package/dist/plugins/person/README.md +72 -0
- package/dist/plugins/person/README.ru.md +73 -0
- package/dist/plugins/person/index.d.ts +189 -0
- package/dist/plugins/person/index.js +777 -0
- package/dist/plugins/person/locale/en.d.ts +18 -0
- package/dist/plugins/person/locale/en.js +17 -0
- package/dist/plugins/person/locale/keys.d.ts +5 -0
- package/dist/plugins/person/locale/ru.d.ts +18 -0
- package/dist/plugins/person/locale/ru.js +17 -0
- package/dist/plugins/person/person.css +431 -0
- package/dist/plugins/person/socialResolver.d.ts +18 -0
- package/dist/plugins/person/socialResolver.js +69 -0
- package/dist/plugins/poll/README.md +96 -0
- package/dist/plugins/poll/README.ru.md +97 -0
- package/dist/plugins/poll/index.d.ts +134 -0
- package/dist/plugins/poll/index.js +825 -0
- package/dist/plugins/poll/locale/en.d.ts +23 -0
- package/dist/plugins/poll/locale/en.js +22 -0
- package/dist/plugins/poll/locale/keys.d.ts +5 -0
- package/dist/plugins/poll/locale/ru.d.ts +23 -0
- package/dist/plugins/poll/locale/ru.js +22 -0
- package/dist/plugins/poll/poll.css +400 -0
- package/dist/plugins/quote/README.md +55 -0
- package/dist/plugins/quote/README.ru.md +56 -0
- package/dist/plugins/quote/index.d.ts +81 -0
- package/dist/plugins/quote/index.js +165 -0
- package/dist/plugins/quote/locale/en.d.ts +6 -0
- package/dist/plugins/quote/locale/en.js +5 -0
- package/dist/plugins/quote/locale/keys.d.ts +5 -0
- package/dist/plugins/quote/locale/ru.d.ts +6 -0
- package/dist/plugins/quote/locale/ru.js +5 -0
- package/dist/plugins/quote/mapTextFields.d.ts +1 -0
- package/dist/plugins/quote/mapTextFields.js +1 -0
- package/dist/plugins/quote/quote.css +72 -0
- package/dist/plugins/raw/README.md +54 -0
- package/dist/plugins/raw/README.ru.md +55 -0
- package/dist/plugins/raw/index.d.ts +62 -0
- package/dist/plugins/raw/index.js +227 -0
- package/dist/plugins/raw/locale/en.d.ts +7 -0
- package/dist/plugins/raw/locale/en.js +6 -0
- package/dist/plugins/raw/locale/keys.d.ts +5 -0
- package/dist/plugins/raw/locale/ru.d.ts +7 -0
- package/dist/plugins/raw/locale/ru.js +6 -0
- package/dist/plugins/raw/raw.css +127 -0
- package/dist/plugins/shared/actionBar.d.ts +19 -0
- package/dist/plugins/shared/actionBar.js +35 -0
- package/dist/plugins/shared/dropzone.d.ts +106 -0
- package/dist/plugins/shared/dropzone.js +107 -0
- package/dist/plugins/shared/fileInput.d.ts +44 -0
- package/dist/plugins/shared/fileInput.js +62 -0
- package/dist/plugins/spoiler/README.md +55 -0
- package/dist/plugins/spoiler/README.ru.md +56 -0
- package/dist/plugins/spoiler/index.d.ts +61 -0
- package/dist/plugins/spoiler/index.js +169 -0
- package/dist/plugins/spoiler/locale/en.d.ts +7 -0
- package/dist/plugins/spoiler/locale/en.js +6 -0
- package/dist/plugins/spoiler/locale/keys.d.ts +5 -0
- package/dist/plugins/spoiler/locale/ru.d.ts +7 -0
- package/dist/plugins/spoiler/locale/ru.js +6 -0
- package/dist/plugins/spoiler/spoiler.css +101 -0
- package/dist/plugins/table/README.md +55 -0
- package/dist/plugins/table/README.ru.md +56 -0
- package/dist/plugins/table/index.d.ts +85 -0
- package/dist/plugins/table/index.js +399 -0
- package/dist/plugins/table/locale/en.d.ts +9 -0
- package/dist/plugins/table/locale/en.js +8 -0
- package/dist/plugins/table/locale/keys.d.ts +5 -0
- package/dist/plugins/table/locale/ru.d.ts +9 -0
- package/dist/plugins/table/locale/ru.js +8 -0
- package/dist/plugins/table/table.css +58 -0
- package/dist/plugins/toggle/README.md +56 -0
- package/dist/plugins/toggle/README.ru.md +57 -0
- package/dist/plugins/toggle/index.d.ts +69 -0
- package/dist/plugins/toggle/index.js +191 -0
- package/dist/plugins/toggle/locale/en.d.ts +7 -0
- package/dist/plugins/toggle/locale/en.js +6 -0
- package/dist/plugins/toggle/locale/keys.d.ts +5 -0
- package/dist/plugins/toggle/locale/ru.d.ts +7 -0
- package/dist/plugins/toggle/locale/ru.js +6 -0
- package/dist/plugins/toggle/toggle.css +101 -0
- package/dist/plugins/warning/README.md +55 -0
- package/dist/plugins/warning/README.ru.md +56 -0
- package/dist/plugins/warning/index.d.ts +66 -0
- package/dist/plugins/warning/index.js +167 -0
- package/dist/plugins/warning/locale/en.d.ts +6 -0
- package/dist/plugins/warning/locale/en.js +5 -0
- package/dist/plugins/warning/locale/keys.d.ts +5 -0
- package/dist/plugins/warning/locale/ru.d.ts +6 -0
- package/dist/plugins/warning/locale/ru.js +5 -0
- package/dist/plugins/warning/warning.css +63 -0
- package/dist/renderer/async.d.ts +1 -0
- package/dist/renderer/async.js +7 -0
- package/dist/renderer/errors.d.ts +27 -0
- package/dist/renderer/errors.js +48 -0
- package/dist/renderer/index.d.ts +82 -0
- package/dist/renderer/index.js +413 -0
- package/dist/renderer/inline.d.ts +5 -0
- package/dist/renderer/inline.js +61 -0
- package/dist/renderer/locale/en.d.ts +35 -0
- package/dist/renderer/locale/en.js +29 -0
- package/dist/renderer/locale/ru.d.ts +37 -0
- package/dist/renderer/locale/ru.js +29 -0
- package/dist/renderer/renderers/README.md +7 -0
- package/dist/renderer/renderers/README.ru.md +5 -0
- package/dist/renderer/renderers/async.d.ts +51 -0
- package/dist/renderer/renderers/async.js +99 -0
- package/dist/renderer/renderers/attaches/README.md +48 -0
- package/dist/renderer/renderers/attaches/README.ru.md +48 -0
- package/dist/renderer/renderers/attaches/index.d.ts +37 -0
- package/dist/renderer/renderers/attaches/index.js +451 -0
- package/dist/renderer/renderers/attaches/locale/en.d.ts +11 -0
- package/dist/renderer/renderers/attaches/locale/en.js +7 -0
- package/dist/renderer/renderers/attaches/locale/ru.d.ts +13 -0
- package/dist/renderer/renderers/attaches/locale/ru.js +7 -0
- package/dist/renderer/renderers/attaches/styles.css +196 -0
- package/dist/renderer/renderers/carousel/README.md +43 -0
- package/dist/renderer/renderers/carousel/README.ru.md +43 -0
- package/dist/renderer/renderers/carousel/index.d.ts +7 -0
- package/dist/renderer/renderers/carousel/index.js +110 -0
- package/dist/renderer/renderers/carousel/styles.css +7 -0
- package/dist/renderer/renderers/checklist/README.md +33 -0
- package/dist/renderer/renderers/checklist/README.ru.md +33 -0
- package/dist/renderer/renderers/checklist/index.d.ts +7 -0
- package/dist/renderer/renderers/checklist/index.js +55 -0
- package/dist/renderer/renderers/checklist/styles.css +54 -0
- package/dist/renderer/renderers/code/README.md +33 -0
- package/dist/renderer/renderers/code/README.ru.md +33 -0
- package/dist/renderer/renderers/code/index.d.ts +9 -0
- package/dist/renderer/renderers/code/index.js +137 -0
- package/dist/renderer/renderers/code/locale/en.d.ts +5 -0
- package/dist/renderer/renderers/code/locale/en.js +4 -0
- package/dist/renderer/renderers/code/locale/ru.d.ts +5 -0
- package/dist/renderer/renderers/code/locale/ru.js +4 -0
- package/dist/renderer/renderers/code/styles.css +330 -0
- package/dist/renderer/renderers/columns/README.md +33 -0
- package/dist/renderer/renderers/columns/README.ru.md +33 -0
- package/dist/renderer/renderers/columns/index.d.ts +7 -0
- package/dist/renderer/renderers/columns/index.js +53 -0
- package/dist/renderer/renderers/columns/styles.css +5 -0
- package/dist/renderer/renderers/delimiter/README.md +33 -0
- package/dist/renderer/renderers/delimiter/README.ru.md +33 -0
- package/dist/renderer/renderers/delimiter/index.d.ts +7 -0
- package/dist/renderer/renderers/delimiter/index.js +28 -0
- package/dist/renderer/renderers/delimiter/styles.css +12 -0
- package/dist/renderer/renderers/embed/README.md +35 -0
- package/dist/renderer/renderers/embed/README.ru.md +35 -0
- package/dist/renderer/renderers/embed/index.d.ts +8 -0
- package/dist/renderer/renderers/embed/index.js +66 -0
- package/dist/renderer/renderers/embed/styles.css +217 -0
- package/dist/renderer/renderers/gallery/README.md +41 -0
- package/dist/renderer/renderers/gallery/README.ru.md +41 -0
- package/dist/renderer/renderers/gallery/index.d.ts +8 -0
- package/dist/renderer/renderers/gallery/index.js +329 -0
- package/dist/renderer/renderers/gallery/styles.css +419 -0
- package/dist/renderer/renderers/heading/README.md +33 -0
- package/dist/renderer/renderers/heading/README.ru.md +33 -0
- package/dist/renderer/renderers/heading/index.d.ts +8 -0
- package/dist/renderer/renderers/heading/index.js +38 -0
- package/dist/renderer/renderers/heading/styles.css +26 -0
- package/dist/renderer/renderers/image/README.md +42 -0
- package/dist/renderer/renderers/image/README.ru.md +42 -0
- package/dist/renderer/renderers/image/index.d.ts +7 -0
- package/dist/renderer/renderers/image/index.js +93 -0
- package/dist/renderer/renderers/image/styles.css +40 -0
- package/dist/renderer/renderers/index.d.ts +47 -0
- package/dist/renderer/renderers/index.js +125 -0
- package/dist/renderer/renderers/link-preview/README.md +43 -0
- package/dist/renderer/renderers/link-preview/README.ru.md +43 -0
- package/dist/renderer/renderers/link-preview/index.d.ts +9 -0
- package/dist/renderer/renderers/link-preview/index.js +118 -0
- package/dist/renderer/renderers/link-preview/styles.css +246 -0
- package/dist/renderer/renderers/list/README.md +33 -0
- package/dist/renderer/renderers/list/README.ru.md +33 -0
- package/dist/renderer/renderers/list/index.d.ts +8 -0
- package/dist/renderer/renderers/list/index.js +42 -0
- package/dist/renderer/renderers/list/styles.css +20 -0
- package/dist/renderer/renderers/paragraph/README.md +33 -0
- package/dist/renderer/renderers/paragraph/README.ru.md +33 -0
- package/dist/renderer/renderers/paragraph/index.d.ts +7 -0
- package/dist/renderer/renderers/paragraph/index.js +35 -0
- package/dist/renderer/renderers/paragraph/styles.css +3 -0
- package/dist/renderer/renderers/person/README.md +44 -0
- package/dist/renderer/renderers/person/README.ru.md +44 -0
- package/dist/renderer/renderers/person/index.d.ts +7 -0
- package/dist/renderer/renderers/person/index.js +213 -0
- package/dist/renderer/renderers/person/locale/en.d.ts +6 -0
- package/dist/renderer/renderers/person/locale/en.js +5 -0
- package/dist/renderer/renderers/person/locale/ru.d.ts +6 -0
- package/dist/renderer/renderers/person/locale/ru.js +5 -0
- package/dist/renderer/renderers/person/styles.css +47 -0
- package/dist/renderer/renderers/poll/README.md +68 -0
- package/dist/renderer/renderers/poll/README.ru.md +68 -0
- package/dist/renderer/renderers/poll/index.d.ts +9 -0
- package/dist/renderer/renderers/poll/index.js +339 -0
- package/dist/renderer/renderers/poll/styles.css +148 -0
- package/dist/renderer/renderers/quote/README.md +33 -0
- package/dist/renderer/renderers/quote/README.ru.md +33 -0
- package/dist/renderer/renderers/quote/index.d.ts +7 -0
- package/dist/renderer/renderers/quote/index.js +59 -0
- package/dist/renderer/renderers/quote/styles.css +43 -0
- package/dist/renderer/renderers/raw/README.md +33 -0
- package/dist/renderer/renderers/raw/README.ru.md +33 -0
- package/dist/renderer/renderers/raw/index.d.ts +7 -0
- package/dist/renderer/renderers/raw/index.js +27 -0
- package/dist/renderer/renderers/spoiler/README.md +33 -0
- package/dist/renderer/renderers/spoiler/README.ru.md +33 -0
- package/dist/renderer/renderers/spoiler/index.d.ts +9 -0
- package/dist/renderer/renderers/spoiler/index.js +84 -0
- package/dist/renderer/renderers/spoiler/locale/en.d.ts +4 -0
- package/dist/renderer/renderers/spoiler/locale/en.js +3 -0
- package/dist/renderer/renderers/spoiler/locale/ru.d.ts +4 -0
- package/dist/renderer/renderers/spoiler/locale/ru.js +3 -0
- package/dist/renderer/renderers/spoiler/styles.css +61 -0
- package/dist/renderer/renderers/table/README.md +33 -0
- package/dist/renderer/renderers/table/README.ru.md +33 -0
- package/dist/renderer/renderers/table/index.d.ts +7 -0
- package/dist/renderer/renderers/table/index.js +83 -0
- package/dist/renderer/renderers/table/styles.css +34 -0
- package/dist/renderer/renderers/toggle/README.md +33 -0
- package/dist/renderer/renderers/toggle/README.ru.md +33 -0
- package/dist/renderer/renderers/toggle/index.d.ts +7 -0
- package/dist/renderer/renderers/toggle/index.js +59 -0
- package/dist/renderer/renderers/toggle/styles.css +49 -0
- package/dist/renderer/renderers/warning/README.md +33 -0
- package/dist/renderer/renderers/warning/README.ru.md +33 -0
- package/dist/renderer/renderers/warning/index.d.ts +7 -0
- package/dist/renderer/renderers/warning/index.js +62 -0
- package/dist/renderer/renderers/warning/styles.css +41 -0
- package/dist/renderer/styles/base.css +168 -0
- package/dist/renderer/types.d.ts +464 -0
- package/dist/shared/blockDataNormalizers.d.ts +14 -0
- package/dist/shared/blockDataNormalizers.js +235 -0
- package/dist/shared/blockDataValidators.d.ts +81 -0
- package/dist/shared/blockDataValidators.js +313 -0
- package/dist/shared/blockTypes.d.ts +2 -0
- package/dist/shared/blockTypes.js +26 -0
- package/dist/shared/carouselData.d.ts +34 -0
- package/dist/shared/carouselData.js +111 -0
- package/dist/shared/cloneEditorData.d.ts +11 -0
- package/dist/shared/cloneEditorData.js +20 -0
- package/dist/shared/documentTypes.d.ts +35 -0
- package/dist/shared/embedPlayer.d.ts +42 -0
- package/dist/shared/embedPlayer.js +141 -0
- package/dist/shared/fileUtils.d.ts +33 -0
- package/dist/shared/fileUtils.js +109 -0
- package/dist/shared/highlightRuntime.d.ts +38 -0
- package/dist/shared/highlightRuntime.js +75 -0
- package/dist/shared/inlineMarshal.d.ts +82 -0
- package/dist/shared/inlineMarshal.js +215 -0
- package/dist/shared/jsonData.d.ts +11 -0
- package/dist/shared/jsonData.js +53 -0
- package/dist/shared/localeTypes.d.ts +11 -0
- package/dist/shared/mapTextFields.d.ts +89 -0
- package/dist/shared/mapTextFields.js +119 -0
- package/dist/shared/pollData.d.ts +90 -0
- package/dist/shared/pollData.js +231 -0
- package/dist/shared/resolvePath.d.ts +8 -0
- package/dist/shared/resolvePath.js +10 -0
- package/dist/shared/runtime/dompurify.js +2424 -0
- package/dist/shared/runtime/highlightBundle.js +10 -0
- package/dist/shared/runtime/jszip.js +13 -0
- package/dist/shared/sanitize/allowlist.d.ts +21 -0
- package/dist/shared/sanitize/allowlist.js +40 -0
- package/dist/shared/sanitize/escapeHtml.d.ts +6 -0
- package/dist/shared/sanitize/escapeHtml.js +11 -0
- package/dist/shared/sanitize/index.d.ts +8 -0
- package/dist/shared/sanitize/index.js +8 -0
- package/dist/shared/sanitize/parseInline.d.ts +11 -0
- package/dist/shared/sanitize/parseInline.js +25 -0
- package/dist/shared/sanitize/sanitizeHtml.d.ts +8 -0
- package/dist/shared/sanitize/sanitizeHtml.js +19 -0
- package/dist/shared/sanitize/sanitizeRawHtml.d.ts +15 -0
- package/dist/shared/sanitize/sanitizeRawHtml.js +162 -0
- package/dist/shared/sanitize/sanitizeStyle.d.ts +9 -0
- package/dist/shared/sanitize/sanitizeStyle.js +39 -0
- package/dist/shared/sanitize/sanitizeUrl.d.ts +28 -0
- package/dist/shared/sanitize/sanitizeUrl.js +86 -0
- package/dist/shared/sanitize/walker.d.ts +15 -0
- package/dist/shared/sanitize/walker.js +98 -0
- package/dist/shared/styleRegistry.d.ts +4 -0
- package/dist/shared/styleRegistry.js +38 -0
- package/dist/shared/textFormat.d.ts +32 -0
- package/dist/shared/textFormat.js +48 -0
- package/dist/shared/zipRuntime.d.ts +19 -0
- package/dist/shared/zipRuntime.js +54 -0
- package/dist/styles/editor.css +3 -0
- package/dist/types.d.ts +1 -0
- package/package.json +149 -0
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
import { el, positionPopup } from './dom.js'
|
|
2
|
+
import { EditorEvent } from './editorEvents.js'
|
|
3
|
+
import { createRangeFromLastTextMatch } from './textOffset.js'
|
|
4
|
+
|
|
5
|
+
export class SlashCommands {
|
|
6
|
+
/** @type {HTMLElement} */
|
|
7
|
+
#rootEl
|
|
8
|
+
|
|
9
|
+
/** @type {import('./types').IBlockManager} */
|
|
10
|
+
#blocks
|
|
11
|
+
|
|
12
|
+
/** @type {import('./types').ISelectionManager} */
|
|
13
|
+
#selection
|
|
14
|
+
|
|
15
|
+
/** @type {import('./types').IEventBus} */
|
|
16
|
+
#events
|
|
17
|
+
|
|
18
|
+
/** @type {import('./CommandDispatcher').CommandDispatcher} */
|
|
19
|
+
#commands
|
|
20
|
+
|
|
21
|
+
/** @type {import('./I18n').I18n} */
|
|
22
|
+
#i18n
|
|
23
|
+
|
|
24
|
+
/** @type {HTMLElement} */
|
|
25
|
+
#menuEl
|
|
26
|
+
|
|
27
|
+
/** @type {boolean} */
|
|
28
|
+
#open = false
|
|
29
|
+
|
|
30
|
+
/** @type {string} */
|
|
31
|
+
#filter = ''
|
|
32
|
+
|
|
33
|
+
/** @type {{ type: string, title: string, searchText: string, icon: string, data?: Record<string, unknown>, inlineInsert?: boolean }[]} */
|
|
34
|
+
#allItems = []
|
|
35
|
+
|
|
36
|
+
/** @type {{ type: string, title: string, searchText: string, icon: string, data?: Record<string, unknown>, inlineInsert?: boolean }[]} */
|
|
37
|
+
#filteredItems = []
|
|
38
|
+
|
|
39
|
+
/** @type {number} */
|
|
40
|
+
#activeIndex = 0
|
|
41
|
+
|
|
42
|
+
/** @type {(() => void) | null} */
|
|
43
|
+
#scrollCleanup = null
|
|
44
|
+
|
|
45
|
+
/** @type {number} */
|
|
46
|
+
#positionFrame = 0
|
|
47
|
+
|
|
48
|
+
/** @type {import('./InlinePluginRegistry').InlinePluginRegistry | null} */
|
|
49
|
+
#inlinePluginRegistry
|
|
50
|
+
|
|
51
|
+
/** @type {import('./types').InlinePluginContext | null} */
|
|
52
|
+
#inlinePluginCtx
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @typedef {Object} SlashCommandsConfig
|
|
56
|
+
* @property {Map<string, import('./types').BlockPlugin>} plugins
|
|
57
|
+
* @property {import('./types').IBlockManager} blocks
|
|
58
|
+
* @property {import('./types').ISelectionManager} selection
|
|
59
|
+
* @property {import('./types').IEventBus} events
|
|
60
|
+
* @property {import('./CommandDispatcher').CommandDispatcher} commands
|
|
61
|
+
* @property {import('./I18n').I18n} i18n
|
|
62
|
+
* @property {import('./InlinePluginRegistry').InlinePluginRegistry} [inlinePluginRegistry]
|
|
63
|
+
* @property {import('./types').InlinePluginContext} [inlinePluginCtx]
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @param {HTMLElement} rootEl
|
|
68
|
+
* @param {SlashCommandsConfig} config
|
|
69
|
+
*/
|
|
70
|
+
constructor(rootEl, config) {
|
|
71
|
+
const { plugins, blocks, selection, events, commands, i18n, inlinePluginRegistry, inlinePluginCtx } = config
|
|
72
|
+
this.#rootEl = rootEl
|
|
73
|
+
this.#blocks = blocks
|
|
74
|
+
this.#selection = selection
|
|
75
|
+
this.#events = events
|
|
76
|
+
this.#commands = commands
|
|
77
|
+
this.#i18n = i18n
|
|
78
|
+
this.#inlinePluginRegistry = inlinePluginRegistry ?? null
|
|
79
|
+
this.#inlinePluginCtx = inlinePluginCtx ?? null
|
|
80
|
+
|
|
81
|
+
for (const plugin of plugins.values()) {
|
|
82
|
+
// searchText includes English type name + localized title for bilingual search
|
|
83
|
+
const title = plugin.title
|
|
84
|
+
const enFallback = plugin.type.charAt(0).toUpperCase() + plugin.type.slice(1)
|
|
85
|
+
this.#allItems.push({
|
|
86
|
+
type: plugin.type,
|
|
87
|
+
title,
|
|
88
|
+
searchText: `${enFallback}\0${title}`.toLowerCase(),
|
|
89
|
+
icon: plugin.icon,
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Add inline plugins to the menu
|
|
94
|
+
if (inlinePluginRegistry) {
|
|
95
|
+
for (const ip of inlinePluginRegistry.values()) {
|
|
96
|
+
const title = ip.title
|
|
97
|
+
const enFallback = ip.type.charAt(0).toUpperCase() + ip.type.slice(1)
|
|
98
|
+
this.#allItems.push({
|
|
99
|
+
type: ip.type,
|
|
100
|
+
title,
|
|
101
|
+
searchText: `${enFallback}\0${title}`.toLowerCase(),
|
|
102
|
+
icon: ip.icon,
|
|
103
|
+
inlineInsert: true,
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
this.#menuEl = el('ul', 'oe-slash-menu', { role: 'menu' })
|
|
109
|
+
this.#menuEl.style.display = 'none'
|
|
110
|
+
rootEl.appendChild(this.#menuEl)
|
|
111
|
+
|
|
112
|
+
// Capture-phase keydown to intercept before KeyboardManager
|
|
113
|
+
rootEl.addEventListener('keydown', this.#onKeyDown, true)
|
|
114
|
+
rootEl.addEventListener('input', this.#onInput)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** @returns {boolean} */
|
|
118
|
+
get isOpen() {
|
|
119
|
+
return this.#open
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** Close the slash menu. */
|
|
123
|
+
close() {
|
|
124
|
+
if (!this.#open) return
|
|
125
|
+
this.#open = false
|
|
126
|
+
this.#filter = ''
|
|
127
|
+
this.#menuEl.style.display = 'none'
|
|
128
|
+
this.#removeScrollListener()
|
|
129
|
+
this.#cancelScheduledPosition()
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Clean up. */
|
|
133
|
+
destroy() {
|
|
134
|
+
this.#removeScrollListener()
|
|
135
|
+
this.#cancelScheduledPosition()
|
|
136
|
+
this.#rootEl.removeEventListener('keydown', this.#onKeyDown, true)
|
|
137
|
+
this.#rootEl.removeEventListener('input', this.#onInput)
|
|
138
|
+
this.#menuEl.remove()
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
#onInput = () => {
|
|
142
|
+
const block = this.#blocks.getCurrentBlock()
|
|
143
|
+
if (!block) return
|
|
144
|
+
|
|
145
|
+
const text = block.contentElement.textContent || ''
|
|
146
|
+
|
|
147
|
+
if (this.#open) {
|
|
148
|
+
// Update filter: text after last "/"
|
|
149
|
+
const slashIdx = text.lastIndexOf('/')
|
|
150
|
+
if (slashIdx >= 0) {
|
|
151
|
+
this.#filter = text.slice(slashIdx + 1)
|
|
152
|
+
this.#updateItems()
|
|
153
|
+
this.#position()
|
|
154
|
+
this.#schedulePosition()
|
|
155
|
+
} else {
|
|
156
|
+
// Slash removed — close
|
|
157
|
+
this.close()
|
|
158
|
+
}
|
|
159
|
+
return
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Detect "/" typed — at start of empty block or anywhere if inline plugins exist
|
|
163
|
+
if (text === '/') {
|
|
164
|
+
this.#openMenu()
|
|
165
|
+
} else if (this.#inlinePluginRegistry && this.#inlinePluginRegistry.size > 0 && text.endsWith('/')) {
|
|
166
|
+
// "/" typed in the middle of text — open menu for inline plugins
|
|
167
|
+
this.#openMenu()
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
#onKeyDown = (/** @type {KeyboardEvent} */ e) => {
|
|
172
|
+
if (!this.#open) return
|
|
173
|
+
|
|
174
|
+
switch (e.key) {
|
|
175
|
+
case 'ArrowDown':
|
|
176
|
+
e.preventDefault()
|
|
177
|
+
e.stopPropagation()
|
|
178
|
+
if (this.#filteredItems.length === 0) return
|
|
179
|
+
this.#activeIndex = (this.#activeIndex + 1) % this.#filteredItems.length
|
|
180
|
+
this.#renderItems()
|
|
181
|
+
break
|
|
182
|
+
|
|
183
|
+
case 'ArrowUp':
|
|
184
|
+
e.preventDefault()
|
|
185
|
+
e.stopPropagation()
|
|
186
|
+
if (this.#filteredItems.length === 0) return
|
|
187
|
+
this.#activeIndex = (this.#activeIndex - 1 + this.#filteredItems.length) % this.#filteredItems.length
|
|
188
|
+
this.#renderItems()
|
|
189
|
+
break
|
|
190
|
+
|
|
191
|
+
case 'Enter':
|
|
192
|
+
e.preventDefault()
|
|
193
|
+
e.stopPropagation()
|
|
194
|
+
this.#selectItem(this.#activeIndex)
|
|
195
|
+
break
|
|
196
|
+
|
|
197
|
+
case 'Escape':
|
|
198
|
+
e.preventDefault()
|
|
199
|
+
e.stopPropagation()
|
|
200
|
+
this.#runBatch(() => {
|
|
201
|
+
const block = this.#blocks.getCurrentBlock()
|
|
202
|
+
if (block) this.#commands.runForBlock(block, () => this.#clearSlashText())
|
|
203
|
+
})
|
|
204
|
+
this.close()
|
|
205
|
+
break
|
|
206
|
+
|
|
207
|
+
case 'Backspace': {
|
|
208
|
+
// If only "/" remains, close and let backspace remove it
|
|
209
|
+
const block = this.#blocks.getCurrentBlock()
|
|
210
|
+
const text = block?.contentElement.textContent || ''
|
|
211
|
+
if (text === '/') {
|
|
212
|
+
this.close()
|
|
213
|
+
// Don't stopPropagation — let the key go through to remove "/"
|
|
214
|
+
}
|
|
215
|
+
break
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
case 'Tab':
|
|
219
|
+
e.preventDefault()
|
|
220
|
+
e.stopPropagation()
|
|
221
|
+
this.#selectItem(this.#activeIndex)
|
|
222
|
+
break
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
#openMenu() {
|
|
227
|
+
this.#open = true
|
|
228
|
+
this.#filter = ''
|
|
229
|
+
this.#activeIndex = 0
|
|
230
|
+
this.#updateItems()
|
|
231
|
+
this.#menuEl.style.display = ''
|
|
232
|
+
this.#position()
|
|
233
|
+
this.#schedulePosition()
|
|
234
|
+
this.#addScrollListener()
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
#schedulePosition() {
|
|
238
|
+
this.#cancelScheduledPosition()
|
|
239
|
+
this.#positionFrame = requestAnimationFrame(() => {
|
|
240
|
+
this.#positionFrame = 0
|
|
241
|
+
if (this.#open) this.#position()
|
|
242
|
+
})
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
#cancelScheduledPosition() {
|
|
246
|
+
if (!this.#positionFrame) return
|
|
247
|
+
cancelAnimationFrame(this.#positionFrame)
|
|
248
|
+
this.#positionFrame = 0
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
#addScrollListener() {
|
|
252
|
+
this.#removeScrollListener()
|
|
253
|
+
const onScroll = () => { if (this.#open) this.#position() }
|
|
254
|
+
// Listen on nearest scrollable ancestor and window
|
|
255
|
+
let scrollParent = this.#rootEl.parentElement
|
|
256
|
+
while (scrollParent && scrollParent !== document.documentElement) {
|
|
257
|
+
if (scrollParent.scrollHeight > scrollParent.clientHeight) break
|
|
258
|
+
scrollParent = scrollParent.parentElement
|
|
259
|
+
}
|
|
260
|
+
const target = scrollParent || window
|
|
261
|
+
target.addEventListener('scroll', onScroll, { passive: true })
|
|
262
|
+
this.#scrollCleanup = () => target.removeEventListener('scroll', onScroll)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
#removeScrollListener() {
|
|
266
|
+
if (this.#scrollCleanup) {
|
|
267
|
+
this.#scrollCleanup()
|
|
268
|
+
this.#scrollCleanup = null
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
#updateItems() {
|
|
273
|
+
const query = this.#filter.toLowerCase()
|
|
274
|
+
this.#filteredItems = query
|
|
275
|
+
? this.#allItems.filter(item => item.searchText.includes(query))
|
|
276
|
+
: [...this.#allItems]
|
|
277
|
+
this.#activeIndex = Math.min(this.#activeIndex, Math.max(0, this.#filteredItems.length - 1))
|
|
278
|
+
this.#renderItems()
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
#renderItems() {
|
|
282
|
+
this.#menuEl.innerHTML = ''
|
|
283
|
+
|
|
284
|
+
if (this.#filteredItems.length === 0) {
|
|
285
|
+
const empty = el('li', 'oe-slash-menu__empty', { role: 'none' })
|
|
286
|
+
empty.textContent = this.#i18n.t('slash.noResults')
|
|
287
|
+
this.#menuEl.appendChild(empty)
|
|
288
|
+
return
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
this.#filteredItems.forEach((item, i) => {
|
|
292
|
+
const btn = el('li', 'oe-slash-menu__item', { role: 'menuitem', tabindex: '-1' })
|
|
293
|
+
if (i === this.#activeIndex) btn.classList.add('oe-slash-menu__item--active')
|
|
294
|
+
|
|
295
|
+
const icon = el('span', 'oe-slash-menu__icon')
|
|
296
|
+
icon.innerHTML = item.icon
|
|
297
|
+
btn.appendChild(icon)
|
|
298
|
+
|
|
299
|
+
const label = el('span', 'oe-slash-menu__label')
|
|
300
|
+
label.textContent = item.title
|
|
301
|
+
btn.appendChild(label)
|
|
302
|
+
|
|
303
|
+
btn.addEventListener('mousedown', (e) => {
|
|
304
|
+
e.preventDefault()
|
|
305
|
+
e.stopPropagation()
|
|
306
|
+
this.#selectItem(i)
|
|
307
|
+
})
|
|
308
|
+
|
|
309
|
+
btn.addEventListener('mouseenter', () => {
|
|
310
|
+
if (this.#activeIndex === i) return
|
|
311
|
+
const prev = this.#menuEl.children[this.#activeIndex]
|
|
312
|
+
if (prev) prev.classList.remove('oe-slash-menu__item--active')
|
|
313
|
+
this.#activeIndex = i
|
|
314
|
+
btn.classList.add('oe-slash-menu__item--active')
|
|
315
|
+
})
|
|
316
|
+
|
|
317
|
+
this.#menuEl.appendChild(btn)
|
|
318
|
+
})
|
|
319
|
+
|
|
320
|
+
// Scroll active item into view
|
|
321
|
+
const activeEl = this.#menuEl.children[this.#activeIndex]
|
|
322
|
+
if (activeEl) {
|
|
323
|
+
activeEl.scrollIntoView({ block: 'nearest' })
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* @param {number} index
|
|
329
|
+
*/
|
|
330
|
+
#selectItem(index) {
|
|
331
|
+
const item = this.#filteredItems[index]
|
|
332
|
+
if (!item) return
|
|
333
|
+
|
|
334
|
+
const blocks = this.#blocks
|
|
335
|
+
const currentIndex = blocks.getCurrentIndex()
|
|
336
|
+
const current = blocks.getCurrentBlock()
|
|
337
|
+
if (!current) return
|
|
338
|
+
|
|
339
|
+
this.close()
|
|
340
|
+
|
|
341
|
+
if (item.inlineInsert && this.#inlinePluginRegistry && this.#inlinePluginCtx) {
|
|
342
|
+
// Inline plugin: delete "/text" and insert widget at caret position
|
|
343
|
+
this.#runBatch(() => this.#commands.runForBlock(
|
|
344
|
+
current,
|
|
345
|
+
() => this.#insertInlineWidget(current, item.type),
|
|
346
|
+
))
|
|
347
|
+
return
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
this.#runBatch(() => this.#commands.runForBlock(current, () => {
|
|
351
|
+
const slashIndex = (current.contentElement.textContent || '').lastIndexOf('/')
|
|
352
|
+
|
|
353
|
+
// A block command typed after existing content must not destroy that
|
|
354
|
+
// content. Remove only the command query and insert the requested block
|
|
355
|
+
// directly after the source block. An otherwise empty command block is
|
|
356
|
+
// converted in place, which avoids leaving an empty paragraph behind.
|
|
357
|
+
if (slashIndex > 0) {
|
|
358
|
+
this.#clearSlashText()
|
|
359
|
+
current.markDirty()
|
|
360
|
+
|
|
361
|
+
const inserted = blocks.insert(item.type, item.data, currentIndex + 1)
|
|
362
|
+
if (inserted) {
|
|
363
|
+
blocks.setCurrentIndex(currentIndex + 1)
|
|
364
|
+
this.#selection.setCaretToBlock(inserted.id, 'start')
|
|
365
|
+
inserted.focus()
|
|
366
|
+
}
|
|
367
|
+
return
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
current.contentElement.textContent = ''
|
|
371
|
+
current.markDirty()
|
|
372
|
+
|
|
373
|
+
const converted = blocks.convert(currentIndex, item.type, item.data)
|
|
374
|
+
if (converted) {
|
|
375
|
+
blocks.setCurrentIndex(currentIndex)
|
|
376
|
+
this.#selection.setCaretToBlock(converted.id, 'start')
|
|
377
|
+
converted.focus()
|
|
378
|
+
}
|
|
379
|
+
}))
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Delete the "/command" text and insert an inline plugin widget via event bus.
|
|
384
|
+
* EditorFacade handles actual widget creation/hydration.
|
|
385
|
+
* @param {import('./types').IBlock} block
|
|
386
|
+
* @param {string} pluginType
|
|
387
|
+
*/
|
|
388
|
+
#insertInlineWidget(block, pluginType) {
|
|
389
|
+
this.#removeQueryText(block)
|
|
390
|
+
|
|
391
|
+
// Delegate widget creation to EditorFacade via event bus
|
|
392
|
+
this.#events.emit(EditorEvent.INLINE_PLUGIN_INSERT, { type: pluginType })
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Remove only the `/command` text from the current block, preserving
|
|
397
|
+
* any content that preceded the slash.
|
|
398
|
+
*/
|
|
399
|
+
#clearSlashText() {
|
|
400
|
+
const block = this.#blocks.getCurrentBlock()
|
|
401
|
+
if (!block) return false
|
|
402
|
+
|
|
403
|
+
return this.#removeQueryText(block)
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Remove the last slash query in one block and keep the caret at the
|
|
408
|
+
* deletion boundary so the selected command can insert at that position.
|
|
409
|
+
* @param {import('./types').IBlock} block
|
|
410
|
+
* @returns {boolean}
|
|
411
|
+
*/
|
|
412
|
+
#removeQueryText(block) {
|
|
413
|
+
const ce = block.contentElement
|
|
414
|
+
const text = ce.textContent || ''
|
|
415
|
+
const slashIdx = text.lastIndexOf('/')
|
|
416
|
+
if (slashIdx < 0) return false
|
|
417
|
+
|
|
418
|
+
// If the block contains only the slash command, clear everything.
|
|
419
|
+
if (slashIdx === 0) {
|
|
420
|
+
ce.textContent = ''
|
|
421
|
+
return true
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// Walk text nodes to find the slash position and delete from there to end.
|
|
425
|
+
const walker = document.createTreeWalker(ce, NodeFilter.SHOW_TEXT)
|
|
426
|
+
let charCount = 0
|
|
427
|
+
while (walker.nextNode()) {
|
|
428
|
+
const node = /** @type {import('./types').DOMText} */ (walker.currentNode)
|
|
429
|
+
const nodeLen = node.length
|
|
430
|
+
if (charCount + nodeLen > slashIdx) {
|
|
431
|
+
const offsetInNode = slashIdx - charCount
|
|
432
|
+
const range = document.createRange()
|
|
433
|
+
range.setStart(node, offsetInNode)
|
|
434
|
+
range.setEnd(node, nodeLen)
|
|
435
|
+
range.deleteContents()
|
|
436
|
+
|
|
437
|
+
// Place caret at deletion point
|
|
438
|
+
const sel = window.getSelection()
|
|
439
|
+
if (sel) {
|
|
440
|
+
range.collapse(true)
|
|
441
|
+
sel.removeAllRanges()
|
|
442
|
+
sel.addRange(range)
|
|
443
|
+
}
|
|
444
|
+
return true
|
|
445
|
+
}
|
|
446
|
+
charCount += nodeLen
|
|
447
|
+
}
|
|
448
|
+
return false
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/** Run one slash action as a balanced atomic history operation. */
|
|
452
|
+
#runBatch(operation) {
|
|
453
|
+
this.#events.emit(EditorEvent.UNDO_BATCH_START)
|
|
454
|
+
try {
|
|
455
|
+
return operation()
|
|
456
|
+
} finally {
|
|
457
|
+
this.#events.emit(EditorEvent.UNDO_BATCH_END)
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
#position() {
|
|
462
|
+
const block = this.#blocks.getCurrentBlock()
|
|
463
|
+
if (!block) return
|
|
464
|
+
|
|
465
|
+
const blockRect = block.element.getBoundingClientRect()
|
|
466
|
+
const editorRect = this.#rootEl.getBoundingClientRect()
|
|
467
|
+
const text = block.contentElement.textContent || ''
|
|
468
|
+
const commandRange = text.includes('/')
|
|
469
|
+
? createRangeFromLastTextMatch(block.contentElement, '/')
|
|
470
|
+
: null
|
|
471
|
+
const commandRect = commandRange
|
|
472
|
+
? (commandRange.getClientRects()[0] ?? commandRange.getBoundingClientRect())
|
|
473
|
+
: null
|
|
474
|
+
const anchorRect = commandRect && commandRect.height > 0 ? commandRect : blockRect
|
|
475
|
+
const menuWidth = this.#menuEl.offsetWidth || 240
|
|
476
|
+
const minimumLeft = -editorRect.left
|
|
477
|
+
const maximumLeft = Math.max(minimumLeft, window.innerWidth - editorRect.left - menuWidth)
|
|
478
|
+
const desiredLeft = anchorRect.left - editorRect.left
|
|
479
|
+
|
|
480
|
+
this.#menuEl.style.left = `${Math.min(maximumLeft, Math.max(minimumLeft, desiredLeft))}px`
|
|
481
|
+
positionPopup(this.#menuEl, anchorRect, editorRect)
|
|
482
|
+
}
|
|
483
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { acquireStyleUrls as injectStyleUrls } from "../shared/styleRegistry.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { acquireStyleUrls as injectStyleUrls } from '../shared/styleRegistry.js'
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export class Tooltip {
|
|
2
|
+
/**
|
|
3
|
+
* Show tooltip near an anchor element.
|
|
4
|
+
* @param {HTMLElement} anchor
|
|
5
|
+
* @param {string} label
|
|
6
|
+
* @param {string} [shortcut]
|
|
7
|
+
* @param {{ delay?: number }} [opts]
|
|
8
|
+
*/
|
|
9
|
+
show(anchor: HTMLElement, label: string, shortcut?: string, opts?: {
|
|
10
|
+
delay?: number;
|
|
11
|
+
}): void;
|
|
12
|
+
/** Hide the tooltip immediately. */
|
|
13
|
+
hide(): void;
|
|
14
|
+
/** Clean up. */
|
|
15
|
+
destroy(): void;
|
|
16
|
+
#private;
|
|
17
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export class Tooltip {
|
|
2
|
+
/** @type {HTMLElement} */
|
|
3
|
+
#el
|
|
4
|
+
|
|
5
|
+
/** @type {ReturnType<typeof setTimeout> | null} */
|
|
6
|
+
#timer = null
|
|
7
|
+
|
|
8
|
+
constructor() {
|
|
9
|
+
this.#el = document.createElement('div')
|
|
10
|
+
this.#el.className = 'oe-tooltip'
|
|
11
|
+
this.#el.style.display = 'none'
|
|
12
|
+
document.body.appendChild(this.#el)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Show tooltip near an anchor element.
|
|
17
|
+
* @param {HTMLElement} anchor
|
|
18
|
+
* @param {string} label
|
|
19
|
+
* @param {string} [shortcut]
|
|
20
|
+
* @param {{ delay?: number }} [opts]
|
|
21
|
+
*/
|
|
22
|
+
show(anchor, label, shortcut, opts = {}) {
|
|
23
|
+
this.hide()
|
|
24
|
+
const delay = opts.delay ?? 500
|
|
25
|
+
|
|
26
|
+
this.#timer = setTimeout(() => {
|
|
27
|
+
this.#el.textContent = ''
|
|
28
|
+
const labelSpan = document.createElement('span')
|
|
29
|
+
labelSpan.className = 'oe-tooltip__label'
|
|
30
|
+
labelSpan.textContent = label
|
|
31
|
+
this.#el.appendChild(labelSpan)
|
|
32
|
+
if (shortcut) {
|
|
33
|
+
const shortcutSpan = document.createElement('span')
|
|
34
|
+
shortcutSpan.className = 'oe-tooltip__shortcut'
|
|
35
|
+
shortcutSpan.textContent = shortcut
|
|
36
|
+
this.#el.appendChild(shortcutSpan)
|
|
37
|
+
}
|
|
38
|
+
this.#el.style.display = ''
|
|
39
|
+
|
|
40
|
+
const rect = anchor.getBoundingClientRect()
|
|
41
|
+
this.#el.style.left = `${rect.left + rect.width / 2}px`
|
|
42
|
+
this.#el.style.top = `${rect.bottom + 6}px`
|
|
43
|
+
}, delay)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Hide the tooltip immediately. */
|
|
47
|
+
hide() {
|
|
48
|
+
if (this.#timer) {
|
|
49
|
+
clearTimeout(this.#timer)
|
|
50
|
+
this.#timer = null
|
|
51
|
+
}
|
|
52
|
+
this.#el.style.display = 'none'
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Clean up. */
|
|
56
|
+
destroy() {
|
|
57
|
+
this.hide()
|
|
58
|
+
this.#el.remove()
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Listens for trigger characters (e.g. '@' for mentions) in contenteditable blocks
|
|
3
|
+
* and activates the corresponding inline plugin.
|
|
4
|
+
*/
|
|
5
|
+
export class TriggerManager {
|
|
6
|
+
/**
|
|
7
|
+
* @param {HTMLElement} rootEl
|
|
8
|
+
* @param {import('./types.js').IInlinePluginRegistry} registry
|
|
9
|
+
* @param {import('./types.js').InlinePluginContext} ctx
|
|
10
|
+
* @param {import('./types.js').IEventBus} events
|
|
11
|
+
*/
|
|
12
|
+
constructor(rootEl: HTMLElement, registry: import("./types.js").IInlinePluginRegistry, ctx: import("./types.js").InlinePluginContext, events: import("./types.js").IEventBus);
|
|
13
|
+
destroy(): void;
|
|
14
|
+
/** @returns {boolean} */
|
|
15
|
+
get isActive(): boolean;
|
|
16
|
+
#private;
|
|
17
|
+
}
|