@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
package/dist/core/uid.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
|
2
|
+
const ID_LENGTH = 6
|
|
3
|
+
// Largest multiple of 62 that fits in a byte (62 * 4 = 248)
|
|
4
|
+
const MAX_VALID = 247
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Generate a random block ID.
|
|
8
|
+
* Uses rejection sampling to eliminate modulo bias.
|
|
9
|
+
* @returns {string}
|
|
10
|
+
*/
|
|
11
|
+
export function uid() {
|
|
12
|
+
const bytes = crypto.getRandomValues(new Uint8Array(ID_LENGTH * 2))
|
|
13
|
+
let id = ''
|
|
14
|
+
for (let i = 0; i < bytes.length && id.length < ID_LENGTH; i++) {
|
|
15
|
+
const b = /** @type {number} */ (bytes[i])
|
|
16
|
+
if (b <= MAX_VALID) {
|
|
17
|
+
id += ALPHABET[b % ALPHABET.length]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
// Extremely unlikely fallback: if too many bytes rejected, generate more
|
|
21
|
+
while (id.length < ID_LENGTH) {
|
|
22
|
+
const extra = crypto.getRandomValues(new Uint8Array(1))
|
|
23
|
+
const b = /** @type {number} */ (extra[0])
|
|
24
|
+
if (b <= MAX_VALID) {
|
|
25
|
+
id += ALPHABET[b % ALPHABET.length]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return id
|
|
29
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './core/index.js'
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Inline plugins
|
|
2
|
+
|
|
3
|
+
Inline plugins store structured data inside text without turning it into opaque HTML. Rector persists a stable `{{widgetId}}` token in the text field and the corresponding `{ type, data }` record in the block-level `inline` map.
|
|
4
|
+
|
|
5
|
+
## Built-in plugins
|
|
6
|
+
|
|
7
|
+
| Plugin | Package entry | Purpose |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| [Color](./color/README.md) | `@shelamkoff/rector/inline-plugins/color` | Persisted color sample with an editable value |
|
|
10
|
+
| [Mention](./mention/README.md) | `@shelamkoff/rector/inline-plugins/mention` | Searchable entity mention with host-provided data |
|
|
11
|
+
|
|
12
|
+
## Register in the editor
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import { createEditor } from '@shelamkoff/rector'
|
|
16
|
+
import { createColorSwatchPlugin } from '@shelamkoff/rector/inline-plugins/color'
|
|
17
|
+
import { createMentionPlugin } from '@shelamkoff/rector/inline-plugins/mention'
|
|
18
|
+
|
|
19
|
+
const editor = createEditor({
|
|
20
|
+
holder,
|
|
21
|
+
plugins,
|
|
22
|
+
inlinePlugins: [
|
|
23
|
+
createColorSwatchPlugin(),
|
|
24
|
+
createMentionPlugin({
|
|
25
|
+
searchFunction: async query => searchPeople(query),
|
|
26
|
+
}),
|
|
27
|
+
],
|
|
28
|
+
})
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
A plugin owns `createWidget(data, id)` and `getData(element)`. It may additionally implement `hydrate`, `onEdit`, `onCommit`, `pasteConfig`, `destroy`, and a matching renderer widget. Preserve the id supplied to `createWidget`; changing it breaks the token-to-data relation.
|
|
32
|
+
|
|
33
|
+
Mounted changes must use the mutation context supplied by Rector so one completed interaction produces one undo step. Release popup DOM, timers, requests, listeners, and object URLs from the plugin lifecycle.
|
|
34
|
+
|
|
35
|
+
The VitePress extension guide documents the full contract, security rules, renderer counterpart, history boundary, and lifecycle requirements.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Внутристрочные плагины
|
|
2
|
+
|
|
3
|
+
Внутристрочные плагины сохраняют структурированные данные внутри текста, не превращая их в непрозрачный HTML. Rector записывает устойчивый заполнитель `{{widgetId}}` в текстовое поле и соответствующий объект `{ type, data }` в карту `inline` блока.
|
|
4
|
+
|
|
5
|
+
## Встроенные плагины
|
|
6
|
+
|
|
7
|
+
| Плагин | Точка входа | Назначение |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| [Образец цвета](./color/README.ru.md) | `@shelamkoff/rector/inline-plugins/color` | Сохраняемый образец с редактируемым значением цвета |
|
|
10
|
+
| [Упоминание](./mention/README.ru.md) | `@shelamkoff/rector/inline-plugins/mention` | Поиск и вставка сущности из источника приложения |
|
|
11
|
+
|
|
12
|
+
## Регистрация
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import { createEditor } from '@shelamkoff/rector'
|
|
16
|
+
import { createColorSwatchPlugin } from '@shelamkoff/rector/inline-plugins/color'
|
|
17
|
+
import { createMentionPlugin } from '@shelamkoff/rector/inline-plugins/mention'
|
|
18
|
+
|
|
19
|
+
const editor = createEditor({
|
|
20
|
+
holder,
|
|
21
|
+
plugins,
|
|
22
|
+
inlinePlugins: [
|
|
23
|
+
createColorSwatchPlugin(),
|
|
24
|
+
createMentionPlugin({
|
|
25
|
+
searchFunction: async query => searchPeople(query),
|
|
26
|
+
}),
|
|
27
|
+
],
|
|
28
|
+
})
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Плагин реализует `createWidget(data, id)` и `getData(element)`. Дополнительно доступны `hydrate`, `onEdit`, `onCommit`, `pasteConfig`, `destroy` и соответствующий виджет рендерера. Переданный в `createWidget` идентификатор необходимо сохранить: его замена разрывает связь токена с данными.
|
|
32
|
+
|
|
33
|
+
Интерактивные изменения выполняются через предоставленный Rector контекст изменения, чтобы одно завершённое действие создавало один шаг отмены. DOM всплывающего элемента, таймеры, запросы, обработчики событий и объектные URL освобождаются в жизненном цикле плагина.
|
|
34
|
+
|
|
35
|
+
Полный контракт, правила безопасности, соответствующий рендерер, граница истории и жизненный цикл описаны в последовательном руководстве VitePress.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Color swatch inline plugin
|
|
2
|
+
|
|
3
|
+
Persistent, atomic color sample embedded in a text block. It displays a dot and its color value; it does not format the surrounding text.
|
|
4
|
+
|
|
5
|
+
## Install and register
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @shelamkoff/rector @shelamkoff/color-picker
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { createEditor } from '@shelamkoff/rector'
|
|
13
|
+
import { Paragraph } from '@shelamkoff/rector/plugins/paragraph'
|
|
14
|
+
import { createColorSwatchPlugin } from '@shelamkoff/rector/inline-plugins/color'
|
|
15
|
+
import '@shelamkoff/rector/styles/editor.css'
|
|
16
|
+
import '@shelamkoff/color-picker/styles.css'
|
|
17
|
+
|
|
18
|
+
const editor = createEditor({
|
|
19
|
+
holder: document.querySelector('#editor'),
|
|
20
|
+
plugins: [new Paragraph()],
|
|
21
|
+
inlinePlugins: [createColorSwatchPlugin()],
|
|
22
|
+
})
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The plugin type is `color`. Register it only once per editor. Blocks that enable inline plugins can insert it from the inline-plugin menu; a pasted supported color literal can also be converted to a swatch.
|
|
26
|
+
|
|
27
|
+
## Stored data
|
|
28
|
+
|
|
29
|
+
The text field stores a stable placeholder while the block-level `inline` map owns the payload:
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"text": "Brand color: {{w_brand}}",
|
|
34
|
+
"inline": {
|
|
35
|
+
"w_brand": {
|
|
36
|
+
"type": "color",
|
|
37
|
+
"data": { "value": "#4357b4" }
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
| Field | Required | Meaning |
|
|
44
|
+
| --- | --- | --- |
|
|
45
|
+
| `value` | yes | CSS color displayed by the sample. A fresh menu insertion defaults to `#4357b4`; malformed legacy data falls back to `#000000` when read. |
|
|
46
|
+
|
|
47
|
+
The paste matcher recognizes 3-, 6-, and 8-digit hexadecimal colors plus `rgb()`, `rgba()`, `hsl()`, and `hsla()` forms. The picker converts an applied value to six-digit hexadecimal form. Existing accepted values remain readable even before the user opens the picker.
|
|
48
|
+
|
|
49
|
+
## Interaction and history
|
|
50
|
+
|
|
51
|
+
Clicking the sample opens `@shelamkoff/color-picker`. Picker movement is a temporary preview. Apply commits one widget-local command and therefore one undo/redo step; closing the popup without applying restores the previous value and creates no history entry. Insertion and removal use the editor's normal inline-widget commands.
|
|
52
|
+
|
|
53
|
+
In read-only mode the widget remains visible but does not open the picker. `editor.destroy()` closes the popup, destroys the picker, removes listeners, and releases reference-counted styles.
|
|
54
|
+
|
|
55
|
+
## Styles and document output
|
|
56
|
+
|
|
57
|
+
Import the color-picker stylesheet in addition to the Rector editor stylesheet. The widget root uses `.oe-ip.oe-ip--color`; its dot and label use `.oe-ip__dot` and `.oe-ip__label`. Scope host overrides under the editor or renderer container.
|
|
58
|
+
|
|
59
|
+
For document output, pass `createColorSwatchPlugin()` in `EditorRenderer`'s `inlinePlugins` array. The renderer uses its `createWidget()` and `getData()` subset; the picker is not mounted by the renderer.
|
|
60
|
+
|
|
61
|
+
The sequential VitePress guide explains the complete inline-plugin contract, placeholder storage, security rules, command boundary, and cleanup requirements.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Внутристрочный плагин образца цвета
|
|
2
|
+
|
|
3
|
+
Постоянный неделимый образец цвета внутри текстового блока. Он показывает точку и значение цвета, но не форматирует окружающий текст.
|
|
4
|
+
|
|
5
|
+
## Установка и регистрация
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @shelamkoff/rector @shelamkoff/color-picker
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { createEditor } from '@shelamkoff/rector'
|
|
13
|
+
import { Paragraph } from '@shelamkoff/rector/plugins/paragraph'
|
|
14
|
+
import { createColorSwatchPlugin } from '@shelamkoff/rector/inline-plugins/color'
|
|
15
|
+
import '@shelamkoff/rector/styles/editor.css'
|
|
16
|
+
import '@shelamkoff/color-picker/styles.css'
|
|
17
|
+
|
|
18
|
+
const editor = createEditor({
|
|
19
|
+
holder: document.querySelector('#editor'),
|
|
20
|
+
plugins: [new Paragraph()],
|
|
21
|
+
inlinePlugins: [createColorSwatchPlugin()],
|
|
22
|
+
})
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Тип плагина — `color`. Регистрируйте его один раз на экземпляр редактора. В поддерживающем внутристрочные плагины блоке образец вставляется через меню; вставленное из буфера распознанное значение цвета также можно преобразовать в образец.
|
|
26
|
+
|
|
27
|
+
## Сохраняемые данные
|
|
28
|
+
|
|
29
|
+
Текстовое поле содержит устойчивый заполнитель, а карта `inline` блока — данные виджета:
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"text": "Фирменный цвет: {{w_brand}}",
|
|
34
|
+
"inline": {
|
|
35
|
+
"w_brand": {
|
|
36
|
+
"type": "color",
|
|
37
|
+
"data": { "value": "#4357b4" }
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
| Поле | Обязательное | Назначение |
|
|
44
|
+
| --- | --- | --- |
|
|
45
|
+
| `value` | да | Цвет CSS, отображаемый образцом. При вставке из меню используется `#4357b4`; при чтении некорректных старых данных — `#000000`. |
|
|
46
|
+
|
|
47
|
+
При вставке распознаются трёх-, шести- и восьмизначные шестнадцатеричные цвета, а также формы `rgb()`, `rgba()`, `hsl()` и `hsla()`. Применённое в окне выбора значение преобразуется в шестизначную шестнадцатеричную форму. Ранее сохранённые распознанные формы остаются читаемыми до открытия окна выбора.
|
|
48
|
+
|
|
49
|
+
## Взаимодействие и история
|
|
50
|
+
|
|
51
|
+
Нажатие на образец открывает `@shelamkoff/color-picker`. Перемещение элементов управления показывает временный предварительный результат. Кнопка применения создаёт одну команду виджета и один шаг отмены и повтора; закрытие без применения восстанавливает прежнее значение и не меняет историю. Вставка и удаление используют обычные команды внутристрочных виджетов.
|
|
52
|
+
|
|
53
|
+
В режиме чтения образец отображается, но окно выбора не открывается. `editor.destroy()` закрывает окно, уничтожает его экземпляр, удаляет обработчики и освобождает стили с подсчётом владельцев.
|
|
54
|
+
|
|
55
|
+
## Стили и отображение документа
|
|
56
|
+
|
|
57
|
+
Кроме стилей редактора импортируйте таблицу стилей средства выбора цвета. Корневой элемент использует `.oe-ip.oe-ip--color`, а точка и подпись — `.oe-ip__dot` и `.oe-ip__label`. Ограничивайте переопределения контейнером редактора или рендерера.
|
|
58
|
+
|
|
59
|
+
Для отображения документа передайте `createColorSwatchPlugin()` в массив `inlinePlugins` конструктора `EditorRenderer`. Рендерер использует только `createWidget()` и `getData()`; окно выбора цвета в нём не подключается.
|
|
60
|
+
|
|
61
|
+
Последовательное руководство VitePress описывает полный контракт внутристрочного плагина, хранение заполнителей, безопасность, границы команд и освобождение ресурсов.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color swatch inline plugin.
|
|
3
|
+
* Renders as an atomic inline widget: ● #066fd1
|
|
4
|
+
* Click opens a full color picker popup.
|
|
5
|
+
*
|
|
6
|
+
* @returns {import('../types.js').InlinePlugin}
|
|
7
|
+
*/
|
|
8
|
+
export function createColorSwatchPlugin(): import("../types.js").InlinePlugin;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { ColorPicker } from '@shelamkoff/color-picker'
|
|
2
|
+
import { generateInlineId } from '../shared/inlineMarshal.js'
|
|
3
|
+
import { normalizeTextValue } from '../shared/textFormat.js'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Color swatch inline plugin.
|
|
7
|
+
* Renders as an atomic inline widget: ● #066fd1
|
|
8
|
+
* Click opens a full color picker popup.
|
|
9
|
+
*
|
|
10
|
+
* @returns {import('../types').InlinePlugin}
|
|
11
|
+
*/
|
|
12
|
+
export function createColorSwatchPlugin() {
|
|
13
|
+
/** @type {import('../core/types').IScopedI18n | null} */
|
|
14
|
+
let i18n = null
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
type: 'color',
|
|
18
|
+
get title() { return i18n?.has('title') ? i18n.t('title') : 'Color' },
|
|
19
|
+
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 21a9 9 0 0 1 0-18c4.97 0 9 3.582 9 8c0 1.06-.474 2.078-1.318 2.828S17.938 15 16.5 15H14a2 2 0 0 0-1 3.75A1.3 1.3 0 0 1 12 21"/><circle cx="7.5" cy="10.5" r=".5" fill="currentColor"/><circle cx="12" cy="7.5" r=".5" fill="currentColor"/><circle cx="16.5" cy="10.5" r=".5" fill="currentColor"/></svg>',
|
|
20
|
+
/** @param {import('../core/types').IScopedI18n} _i18n */
|
|
21
|
+
setI18n(_i18n) { i18n = _i18n },
|
|
22
|
+
pasteConfig: {
|
|
23
|
+
patterns: [
|
|
24
|
+
/^#[0-9a-fA-F]{3}$/,
|
|
25
|
+
/^#[0-9a-fA-F]{6}$/,
|
|
26
|
+
/^#[0-9a-fA-F]{8}$/,
|
|
27
|
+
/^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)$/,
|
|
28
|
+
/^rgba\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*[\d.]+\s*\)$/,
|
|
29
|
+
/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/,
|
|
30
|
+
/^hsla\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*,\s*[\d.]+\s*\)$/,
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
onPatternMatch(match) {
|
|
34
|
+
return { value: match }
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
createWidget(data, id) {
|
|
38
|
+
const value = normalizeTextValue(data.value).trim() || '#4357b4'
|
|
39
|
+
|
|
40
|
+
const span = document.createElement('span')
|
|
41
|
+
span.contentEditable = 'false'
|
|
42
|
+
span.setAttribute('data-inline-plugin', 'color')
|
|
43
|
+
span.setAttribute('data-id', id || generateInlineId())
|
|
44
|
+
span.setAttribute('data-value', value)
|
|
45
|
+
span.className = 'oe-ip oe-ip--color'
|
|
46
|
+
|
|
47
|
+
const dot = document.createElement('span')
|
|
48
|
+
dot.className = 'oe-ip__dot'
|
|
49
|
+
dot.style.backgroundColor = value
|
|
50
|
+
|
|
51
|
+
const label = document.createElement('span')
|
|
52
|
+
label.className = 'oe-ip__label'
|
|
53
|
+
label.textContent = value
|
|
54
|
+
|
|
55
|
+
span.appendChild(dot)
|
|
56
|
+
span.appendChild(label)
|
|
57
|
+
|
|
58
|
+
return span
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
hydrate(element, ctx) {
|
|
62
|
+
element.addEventListener('click', (e) => {
|
|
63
|
+
if (ctx.readOnly) return
|
|
64
|
+
e.preventDefault()
|
|
65
|
+
e.stopPropagation()
|
|
66
|
+
openColorPicker(element, ctx)
|
|
67
|
+
})
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
getData(element) {
|
|
71
|
+
return {
|
|
72
|
+
value: element.dataset.value || '#000000',
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Normalize any color value to a 6-digit hex string.
|
|
80
|
+
* @param {string} value
|
|
81
|
+
* @returns {string}
|
|
82
|
+
*/
|
|
83
|
+
function normalizeToHex6(value) {
|
|
84
|
+
// Short hex: #rgb → #rrggbb
|
|
85
|
+
const m3 = value.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/)
|
|
86
|
+
if (m3) return '#' + m3[1] + m3[1] + m3[2] + m3[2] + m3[3] + m3[3]
|
|
87
|
+
|
|
88
|
+
// 8-digit hex: strip alpha
|
|
89
|
+
const m8 = value.match(/^#([0-9a-fA-F]{6})[0-9a-fA-F]{2}$/)
|
|
90
|
+
if (m8) return '#' + m8[1]
|
|
91
|
+
|
|
92
|
+
// Already 6-digit hex
|
|
93
|
+
if (/^#[0-9a-fA-F]{6}$/.test(value)) return value
|
|
94
|
+
|
|
95
|
+
// Non-hex (rgb, hsl, etc.) — convert via DOM
|
|
96
|
+
const temp = document.createElement('span')
|
|
97
|
+
temp.style.color = value
|
|
98
|
+
document.body.appendChild(temp)
|
|
99
|
+
const computed = getComputedStyle(temp).color
|
|
100
|
+
temp.remove()
|
|
101
|
+
const m = computed.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/)
|
|
102
|
+
if (m) return '#' + [m[1], m[2], m[3]].map(n => Number(n).toString(16).padStart(2, '0')).join('')
|
|
103
|
+
|
|
104
|
+
return '#000000'
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @param {HTMLElement} widget
|
|
109
|
+
* @param {import('../types').InlinePluginContext} ctx
|
|
110
|
+
*/
|
|
111
|
+
function openColorPicker(widget, ctx) {
|
|
112
|
+
const current = normalizeToHex6(widget.dataset.value || '#000000')
|
|
113
|
+
const originalLabel = widget.querySelector('.oe-ip__label')?.textContent ?? current
|
|
114
|
+
let committed = false
|
|
115
|
+
|
|
116
|
+
const picker = new ColorPicker({
|
|
117
|
+
onApply(cssColor) {
|
|
118
|
+
const next = normalizeToHex6(cssColor)
|
|
119
|
+
restoreWidget(widget, current, originalLabel)
|
|
120
|
+
ctx.mutate(widget, () => updateWidget(widget, next))
|
|
121
|
+
committed = true
|
|
122
|
+
ctx.hidePopup()
|
|
123
|
+
},
|
|
124
|
+
onChange(cssColor) {
|
|
125
|
+
updateWidget(widget, normalizeToHex6(cssColor))
|
|
126
|
+
},
|
|
127
|
+
onFormatChange(formatted) {
|
|
128
|
+
updateWidgetLabel(widget, formatted)
|
|
129
|
+
},
|
|
130
|
+
showRemove: false,
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
const popupContent = picker.element
|
|
134
|
+
// Position picker as static inside popup (popup handles positioning)
|
|
135
|
+
popupContent.style.display = ''
|
|
136
|
+
popupContent.style.position = 'static'
|
|
137
|
+
popupContent.style.transform = 'none'
|
|
138
|
+
|
|
139
|
+
picker.open(current, 1)
|
|
140
|
+
|
|
141
|
+
ctx.showPopup(widget, popupContent, () => {
|
|
142
|
+
if (!committed) restoreWidget(widget, current, originalLabel)
|
|
143
|
+
picker.destroy()
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @param {HTMLElement} widget
|
|
149
|
+
* @param {string} value
|
|
150
|
+
*/
|
|
151
|
+
function updateWidget(widget, value) {
|
|
152
|
+
widget.dataset.value = value
|
|
153
|
+
|
|
154
|
+
const dot = /** @type {HTMLElement | null} */ (widget.querySelector('.oe-ip__dot'))
|
|
155
|
+
if (dot) dot.style.backgroundColor = value
|
|
156
|
+
|
|
157
|
+
const label = widget.querySelector('.oe-ip__label')
|
|
158
|
+
if (label) label.textContent = value
|
|
159
|
+
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Restore both the stored color and the human-readable label.
|
|
164
|
+
*
|
|
165
|
+
* @param {HTMLElement} widget
|
|
166
|
+
* @param {string} value
|
|
167
|
+
* @param {string} label
|
|
168
|
+
* @returns {void}
|
|
169
|
+
*/
|
|
170
|
+
function restoreWidget(widget, value, label) {
|
|
171
|
+
updateWidget(widget, value)
|
|
172
|
+
const labelElement = widget.querySelector('.oe-ip__label')
|
|
173
|
+
if (labelElement) labelElement.textContent = label
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Update only the label text (e.g. when format changes in picker).
|
|
178
|
+
* @param {HTMLElement} widget
|
|
179
|
+
* @param {string} formatted
|
|
180
|
+
*/
|
|
181
|
+
function updateWidgetLabel(widget, formatted) {
|
|
182
|
+
const label = widget.querySelector('.oe-ip__label')
|
|
183
|
+
if (label) label.textContent = formatted
|
|
184
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Mention inline plugin
|
|
2
|
+
|
|
3
|
+
Trigger-driven entity search with keyboard navigation, cursor pagination, custom result rendering, and stable saved widget identities.
|
|
4
|
+
|
|
5
|
+
## Register in the editor
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import { createEditor } from '@shelamkoff/rector'
|
|
9
|
+
import { Paragraph } from '@shelamkoff/rector/plugins/paragraph'
|
|
10
|
+
import { createMentionPlugin } from '@shelamkoff/rector/inline-plugins/mention'
|
|
11
|
+
import '@shelamkoff/rector/styles/editor.css'
|
|
12
|
+
|
|
13
|
+
const mention = createMentionPlugin({
|
|
14
|
+
async searchFunction(query, nextPageUrl, { signal }) {
|
|
15
|
+
const url = nextPageUrl ?? `/api/people?q=${encodeURIComponent(query)}`
|
|
16
|
+
const response = await fetch(url, { signal })
|
|
17
|
+
if (!response.ok) throw new Error(`Mention search failed: ${response.status}`)
|
|
18
|
+
return response.json()
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const editor = createEditor({
|
|
23
|
+
holder: document.querySelector('#editor'),
|
|
24
|
+
plugins: [new Paragraph()],
|
|
25
|
+
inlinePlugins: [mention],
|
|
26
|
+
})
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The plugin type is `mention`. The trigger must be exactly one Unicode code point. Typing it at the beginning of a text node or after a regular or non-breaking space opens search. `query` excludes the trigger. Arrow keys move the active result, Enter or Tab commits it, Escape closes the popup, and scrolling near the end requests `nextPageUrl` when supplied.
|
|
30
|
+
|
|
31
|
+
## Search contract
|
|
32
|
+
|
|
33
|
+
`searchFunction` returns either `MentionItem[]` or `{ items: MentionItem[], nextPageUrl?: string | null }`:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
interface MentionItem {
|
|
37
|
+
id: string | number
|
|
38
|
+
name: string
|
|
39
|
+
avatar?: string
|
|
40
|
+
details?: string
|
|
41
|
+
[applicationField: string]: unknown
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
For the first page, `nextPageUrl` passed to the callback is `null`. For later pages it is the opaque cursor previously returned by the application. Pass the supplied `AbortSignal` to the network or data client. A newer query, popup closure, or `editor.destroy()` aborts the current signal and stale responses are ignored even if the underlying client cannot cancel.
|
|
46
|
+
|
|
47
|
+
An omitted `searchFunction` is valid but yields no suggestions. Errors other than cancellation are written to `console.warn` and leave the current session without replacement results.
|
|
48
|
+
|
|
49
|
+
## Options
|
|
50
|
+
|
|
51
|
+
| Option | Type | Default and behavior |
|
|
52
|
+
| --- | --- | --- |
|
|
53
|
+
| `trigger` | `string` | `@`. Exactly one Unicode code point that starts and visually prefixes a mention; any other value throws during plugin creation. Multi-code-point grapheme clusters such as a flag are therefore rejected. |
|
|
54
|
+
| `searchFunction` | `MentionSearchFunction \| null` | `null`; no results until the host supplies a source. |
|
|
55
|
+
| `debounceDelay` | `number` | `300` ms for non-empty first-page queries. Empty and subsequent-page queries run immediately. |
|
|
56
|
+
| `noResultsText` | `string` | Current locale message (`No results found` in English). |
|
|
57
|
+
| `dropdownClass` | `string` | Empty string. Extra class on the popup root. |
|
|
58
|
+
| `onMentionSelect` | `({ id, name }) => void` | No callback. Observes a committed selection; callback exceptions do not roll back the commit. |
|
|
59
|
+
| `renderItem` | `(item, index, isActive) => HTMLElement \| null` | Built-in item with optional avatar and details. Return `null` or `undefined` to use it. |
|
|
60
|
+
| `renderNoResults` | `(text) => HTMLElement \| null` | Built-in empty-result row. |
|
|
61
|
+
| `renderLoading` | `() => HTMLElement \| null` | Built-in loading row. |
|
|
62
|
+
|
|
63
|
+
Extra item fields are available only to `renderItem`. They are not persisted and are not passed to `onMentionSelect`.
|
|
64
|
+
|
|
65
|
+
Each renderer must return a fresh, detached `HTMLElement` for that call. Rector adds the listbox classes, indices, ids, and ARIA attributes required for keyboard navigation to custom result rows. It also marks custom empty and loading rows as live status content. Returning `null`, `undefined`, or a non-element value selects the built-in row.
|
|
66
|
+
|
|
67
|
+
## Stored data and editing
|
|
68
|
+
|
|
69
|
+
The text field stores `{{widgetId}}`, while the block-level `inline` map stores only the stable entity identity and display name:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"text": "Owner: {{w_owner}}",
|
|
74
|
+
"inline": {
|
|
75
|
+
"w_owner": {
|
|
76
|
+
"type": "mention",
|
|
77
|
+
"data": { "id": "42", "name": "Ada Lovelace" }
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The saved `id` is normalized to a string. `onMentionSelect` receives the source item's original string or number id. Editing an existing pill starts a new query. Choosing a result updates the widget atomically; leaving without a choice converts the edited pill to ordinary visible text. If autosave occurs while that query is still in progress, the transient pill is likewise serialized as text rather than as an invalid mention.
|
|
84
|
+
|
|
85
|
+
## History, lifecycle, and styles
|
|
86
|
+
|
|
87
|
+
A fresh commit or replacement of an existing mention is one undo/redo step. Search text, active-row movement, loading state, and opening or closing the popup are transient UI state and do not create commands.
|
|
88
|
+
|
|
89
|
+
The plugin owns one popup, its document/window listeners, debounce timer, request controller, and a reference-counted stylesheet handle. `editor.destroy()` releases all of them. Register one separately created mention plugin per editor; mounting the same instance twice is rejected.
|
|
90
|
+
|
|
91
|
+
Use `.oe-ip--mention` for saved pills and `.oe-mention-dropdown` plus its child classes for the suggestion UI. `avatar` URLs pass the shared media URL policy, and built-in rows assign names/details through text-safe DOM operations.
|
|
92
|
+
|
|
93
|
+
## Document output
|
|
94
|
+
|
|
95
|
+
Pass `createMentionWidget()` in `EditorRenderer`'s `inlinePlugins` array. It contains only the widget DOM round-trip and does not include search, popup code, or editor listeners. If the editor uses a non-default trigger, pass that same character to the renderer factory, for example `createMentionWidget('#')`. The trigger is presentation configuration and is not repeated in every saved widget.
|
|
96
|
+
|
|
97
|
+
The sequential VitePress guide documents the complete inline-widget contract, storage format, history boundaries, custom plugin creation, security, and cleanup.
|