@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,52 @@
|
|
|
1
|
+
import core from '../core/locale/ru.js'
|
|
2
|
+
import paragraph from '../plugins/paragraph/locale/ru.js'
|
|
3
|
+
import heading from '../plugins/heading/locale/ru.js'
|
|
4
|
+
import list from '../plugins/list/locale/ru.js'
|
|
5
|
+
import quote from '../plugins/quote/locale/ru.js'
|
|
6
|
+
import code from '../plugins/code/locale/ru.js'
|
|
7
|
+
import image from '../plugins/image/locale/ru.js'
|
|
8
|
+
import embed from '../plugins/embed/locale/ru.js'
|
|
9
|
+
import gallery from '../plugins/gallery/locale/ru.js'
|
|
10
|
+
import carousel from '../plugins/carousel/locale/ru.js'
|
|
11
|
+
import checklist from '../plugins/checklist/locale/ru.js'
|
|
12
|
+
import warning from '../plugins/warning/locale/ru.js'
|
|
13
|
+
import raw from '../plugins/raw/locale/ru.js'
|
|
14
|
+
import poll from '../plugins/poll/locale/ru.js'
|
|
15
|
+
import person from '../plugins/person/locale/ru.js'
|
|
16
|
+
import attaches from '../plugins/attaches/locale/ru.js'
|
|
17
|
+
import linkPreview from '../plugins/link-preview/locale/ru.js'
|
|
18
|
+
import toggle from '../plugins/toggle/locale/ru.js'
|
|
19
|
+
import columns from '../plugins/columns/locale/ru.js'
|
|
20
|
+
import spoiler from '../plugins/spoiler/locale/ru.js'
|
|
21
|
+
import delimiter from '../plugins/delimiter/locale/ru.js'
|
|
22
|
+
import table from '../plugins/table/locale/ru.js'
|
|
23
|
+
import color from '../inline-plugins/locale/ru.js'
|
|
24
|
+
import renderer from '../renderer/locale/ru.js'
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
__lang: 'ru',
|
|
28
|
+
...core,
|
|
29
|
+
...paragraph,
|
|
30
|
+
...heading,
|
|
31
|
+
...list,
|
|
32
|
+
...quote,
|
|
33
|
+
...code,
|
|
34
|
+
...image,
|
|
35
|
+
...embed,
|
|
36
|
+
...gallery,
|
|
37
|
+
...carousel,
|
|
38
|
+
...checklist,
|
|
39
|
+
...warning,
|
|
40
|
+
...raw,
|
|
41
|
+
...poll,
|
|
42
|
+
...person,
|
|
43
|
+
...attaches,
|
|
44
|
+
...linkPreview,
|
|
45
|
+
...toggle,
|
|
46
|
+
...columns,
|
|
47
|
+
...spoiler,
|
|
48
|
+
...delimiter,
|
|
49
|
+
...table,
|
|
50
|
+
...color,
|
|
51
|
+
...renderer,
|
|
52
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract base for block plugins.
|
|
3
|
+
*
|
|
4
|
+
* Implements the boilerplate that every plugin previously duplicated:
|
|
5
|
+
* - storing the i18n instance (a `ScopedI18n` wrapper auto-prefixed with
|
|
6
|
+
* `plugin.<type>.`, so plugin code can use short keys like `'title'`
|
|
7
|
+
* instead of `'plugin.heading.title'`)
|
|
8
|
+
* - protected `_t(key, fallback, params?)` for plain translations
|
|
9
|
+
* - protected `_p(key, count, params?)` for pluralized translations
|
|
10
|
+
* - storing the constructor config in `_config`
|
|
11
|
+
*
|
|
12
|
+
* Subclasses must implement the `BlockPlugin` contract proper:
|
|
13
|
+
* - `type`, `icon`, `render(data, context)`, `save(element)`
|
|
14
|
+
* - usually `static styles`, `static locale`, `static isTextBlock`
|
|
15
|
+
* - optional `validate`, `merge`, `renderSettings`, `onPaste`, etc.
|
|
16
|
+
*
|
|
17
|
+
* Not instantiable directly — `new BlockPluginAbstract()` throws.
|
|
18
|
+
*
|
|
19
|
+
* @template {object} [TConfig=Record<string, any>]
|
|
20
|
+
*/
|
|
21
|
+
export class BlockPluginAbstract<TConfig extends unknown = Record<string, any>> {
|
|
22
|
+
/** @param {TConfig} [config] */
|
|
23
|
+
constructor(config?: TConfig);
|
|
24
|
+
/** @type {TConfig} */
|
|
25
|
+
_config: TConfig;
|
|
26
|
+
/**
|
|
27
|
+
* Public accessor for plugin configuration.
|
|
28
|
+
* Used by the editor core to read config knobs (e.g. `injectStyles`, `css`).
|
|
29
|
+
* @returns {TConfig}
|
|
30
|
+
*/
|
|
31
|
+
getPluginConfig(): TConfig;
|
|
32
|
+
/**
|
|
33
|
+
* Receive the editor's i18n. `createEditor` passes a `ScopedI18n` wrapper
|
|
34
|
+
* already prefixed with `plugin.<type>.`, so subsequent `_t('foo')` calls
|
|
35
|
+
* resolve to `plugin.<type>.foo` in the underlying dictionary.
|
|
36
|
+
*
|
|
37
|
+
* Backward-compat: if a subclass calls `_t('plugin.heading.title')` with the
|
|
38
|
+
* full key, ScopedI18n detects the matching prefix and passes through
|
|
39
|
+
* untouched.
|
|
40
|
+
*
|
|
41
|
+
* @param {import('../core/types.js').IScopedI18n} i18n
|
|
42
|
+
* @returns {void}
|
|
43
|
+
*/
|
|
44
|
+
setI18n(i18n: import("../core/types.js").IScopedI18n): void;
|
|
45
|
+
/**
|
|
46
|
+
* Resolve a translation key, returning a fallback when i18n is missing
|
|
47
|
+
* or the key is not in the dictionary.
|
|
48
|
+
*
|
|
49
|
+
* Uses the explicit `has()` check rather than comparing the result to the
|
|
50
|
+
* key — that comparison gave a false positive when a translation message
|
|
51
|
+
* happened to literally equal the key string.
|
|
52
|
+
*
|
|
53
|
+
* @protected
|
|
54
|
+
* @param {string} key short key (auto-namespaced)
|
|
55
|
+
* @param {string} [fallback] value when i18n is absent or key missing
|
|
56
|
+
* @param {Record<string, string | number>} [params] `{name}` interpolation params
|
|
57
|
+
* @returns {string}
|
|
58
|
+
*/
|
|
59
|
+
protected _t(key: string, fallback?: string, params?: Record<string, string | number>): string;
|
|
60
|
+
/**
|
|
61
|
+
* Resolve a plural-form translation. The locale value can be:
|
|
62
|
+
* - a `PluralForms` object (`{ one, few, many, other }`) — selected by CLDR rules
|
|
63
|
+
* - a plain string with `{count}` placeholder — interpolated with count
|
|
64
|
+
*
|
|
65
|
+
* @protected
|
|
66
|
+
* @param {string} key
|
|
67
|
+
* @param {number} count
|
|
68
|
+
* @param {string} [fallback]
|
|
69
|
+
* @param {Record<string, string | number>} [params]
|
|
70
|
+
* @returns {string}
|
|
71
|
+
*/
|
|
72
|
+
protected _p(key: string, count: number, fallback?: string, params?: Record<string, string | number>): string;
|
|
73
|
+
/**
|
|
74
|
+
* Direct access to the i18n instance for cases where subclasses need to
|
|
75
|
+
* pass it to nested helpers.
|
|
76
|
+
*
|
|
77
|
+
* @protected
|
|
78
|
+
* @returns {import('../core/types.js').IScopedI18n | null}
|
|
79
|
+
*/
|
|
80
|
+
protected get _i18n(): import("../core/types.js").IScopedI18n | null;
|
|
81
|
+
#private;
|
|
82
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract base for block plugins.
|
|
3
|
+
*
|
|
4
|
+
* Implements the boilerplate that every plugin previously duplicated:
|
|
5
|
+
* - storing the i18n instance (a `ScopedI18n` wrapper auto-prefixed with
|
|
6
|
+
* `plugin.<type>.`, so plugin code can use short keys like `'title'`
|
|
7
|
+
* instead of `'plugin.heading.title'`)
|
|
8
|
+
* - protected `_t(key, fallback, params?)` for plain translations
|
|
9
|
+
* - protected `_p(key, count, params?)` for pluralized translations
|
|
10
|
+
* - storing the constructor config in `_config`
|
|
11
|
+
*
|
|
12
|
+
* Subclasses must implement the `BlockPlugin` contract proper:
|
|
13
|
+
* - `type`, `icon`, `render(data, context)`, `save(element)`
|
|
14
|
+
* - usually `static styles`, `static locale`, `static isTextBlock`
|
|
15
|
+
* - optional `validate`, `merge`, `renderSettings`, `onPaste`, etc.
|
|
16
|
+
*
|
|
17
|
+
* Not instantiable directly — `new BlockPluginAbstract()` throws.
|
|
18
|
+
*
|
|
19
|
+
* @template {object} [TConfig=Record<string, any>]
|
|
20
|
+
*/
|
|
21
|
+
export class BlockPluginAbstract {
|
|
22
|
+
/** @type {import('../core/types').IScopedI18n | null} */
|
|
23
|
+
#i18n = null
|
|
24
|
+
|
|
25
|
+
/** @type {TConfig} */
|
|
26
|
+
_config
|
|
27
|
+
|
|
28
|
+
/** @param {TConfig} [config] */
|
|
29
|
+
constructor(config) {
|
|
30
|
+
if (new.target === BlockPluginAbstract) {
|
|
31
|
+
throw new Error('BlockPluginAbstract is abstract — extend it')
|
|
32
|
+
}
|
|
33
|
+
// Freeze Rector's own shallow copy. Freezing the object supplied by the
|
|
34
|
+
// consumer would unexpectedly make application configuration immutable.
|
|
35
|
+
this._config = /** @type {TConfig} */ (Object.freeze({ ...(config || {}) }))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Public accessor for plugin configuration.
|
|
40
|
+
* Used by the editor core to read config knobs (e.g. `injectStyles`, `css`).
|
|
41
|
+
* @returns {TConfig}
|
|
42
|
+
*/
|
|
43
|
+
getPluginConfig() {
|
|
44
|
+
return this._config
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Receive the editor's i18n. `createEditor` passes a `ScopedI18n` wrapper
|
|
49
|
+
* already prefixed with `plugin.<type>.`, so subsequent `_t('foo')` calls
|
|
50
|
+
* resolve to `plugin.<type>.foo` in the underlying dictionary.
|
|
51
|
+
*
|
|
52
|
+
* Backward-compat: if a subclass calls `_t('plugin.heading.title')` with the
|
|
53
|
+
* full key, ScopedI18n detects the matching prefix and passes through
|
|
54
|
+
* untouched.
|
|
55
|
+
*
|
|
56
|
+
* @param {import('../core/types').IScopedI18n} i18n
|
|
57
|
+
* @returns {void}
|
|
58
|
+
*/
|
|
59
|
+
setI18n(i18n) {
|
|
60
|
+
this.#i18n = i18n
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Resolve a translation key, returning a fallback when i18n is missing
|
|
65
|
+
* or the key is not in the dictionary.
|
|
66
|
+
*
|
|
67
|
+
* Uses the explicit `has()` check rather than comparing the result to the
|
|
68
|
+
* key — that comparison gave a false positive when a translation message
|
|
69
|
+
* happened to literally equal the key string.
|
|
70
|
+
*
|
|
71
|
+
* @protected
|
|
72
|
+
* @param {string} key short key (auto-namespaced)
|
|
73
|
+
* @param {string} [fallback] value when i18n is absent or key missing
|
|
74
|
+
* @param {Record<string, string | number>} [params] `{name}` interpolation params
|
|
75
|
+
* @returns {string}
|
|
76
|
+
*/
|
|
77
|
+
_t(key, fallback = '', params) {
|
|
78
|
+
if (!this.#i18n) return fallback
|
|
79
|
+
if (!this.#i18n.has(key)) return fallback
|
|
80
|
+
return this.#i18n.t(key, params)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Resolve a plural-form translation. The locale value can be:
|
|
85
|
+
* - a `PluralForms` object (`{ one, few, many, other }`) — selected by CLDR rules
|
|
86
|
+
* - a plain string with `{count}` placeholder — interpolated with count
|
|
87
|
+
*
|
|
88
|
+
* @protected
|
|
89
|
+
* @param {string} key
|
|
90
|
+
* @param {number} count
|
|
91
|
+
* @param {string} [fallback]
|
|
92
|
+
* @param {Record<string, string | number>} [params]
|
|
93
|
+
* @returns {string}
|
|
94
|
+
*/
|
|
95
|
+
_p(key, count, fallback = '', params) {
|
|
96
|
+
if (!this.#i18n) return fallback
|
|
97
|
+
if (!this.#i18n.has(key)) return fallback
|
|
98
|
+
return this.#i18n.plural(key, count, params)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Direct access to the i18n instance for cases where subclasses need to
|
|
103
|
+
* pass it to nested helpers.
|
|
104
|
+
*
|
|
105
|
+
* @protected
|
|
106
|
+
* @returns {import('../core/types').IScopedI18n | null}
|
|
107
|
+
*/
|
|
108
|
+
get _i18n() {
|
|
109
|
+
return this.#i18n
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Block plugins
|
|
2
|
+
|
|
3
|
+
The package ships 21 editable block plugins. Import a single plugin from `@shelamkoff/rector/plugins/<path>`, the complete synchronous preset from `@shelamkoff/rector/plugins`, or a document-driven subset from `@shelamkoff/rector/plugins/async`.
|
|
4
|
+
|
|
5
|
+
| Plugin | Block type | Purpose |
|
|
6
|
+
| --- | --- | --- |
|
|
7
|
+
| [Paragraph](./paragraph/README.md) | `paragraph` | Editable rich-text paragraph with alignment, inline tools, inline widgets, merge, and block conversion support. |
|
|
8
|
+
| [Heading](./heading/README.md) | `heading` | Heading levels 2-6 with alignment, inline formatting, inline widgets, paste handling, and level controls. |
|
|
9
|
+
| [List](./list/README.md) | `list` | Ordered and unordered rich-text lists with item splitting, merging, block exit, and conversion of selected items. |
|
|
10
|
+
| [Quote](./quote/README.md) | `quote` | Quotation text with an optional caption. |
|
|
11
|
+
| [Code](./code/README.md) | `code` | Code block with a language selector and optional syntax highlighting. |
|
|
12
|
+
| [Image](./image/README.md) | `image` | Uploadable image with caption, sizing, border, background, and object-fit controls. |
|
|
13
|
+
| [Delimiter](./delimiter/README.md) | `delimiter` | A visual section separator with no content payload. |
|
|
14
|
+
| [Table](./table/README.md) | `table` | Editable table with an optional heading row. |
|
|
15
|
+
| [Checklist](./checklist/README.md) | `checklist` | Checklist with independently checked rich-text items. |
|
|
16
|
+
| [Warning](./warning/README.md) | `warning` | Callout block with editable title and message fields. |
|
|
17
|
+
| [Embed](./embed/README.md) | `embed` | YouTube and Vimeo embed block with caption, cover image, and preview metadata. |
|
|
18
|
+
| [Raw](./raw/README.md) | `raw` | Raw HTML authoring block. |
|
|
19
|
+
| [Gallery](./gallery/README.md) | `gallery` | Multi-image gallery with layouts, captions, appearance settings, reordering, and viewer options. |
|
|
20
|
+
| [CarouselBlock](./carousel/README.md) | `carousel` | Mixed image, video, and sanitized HTML slides with navigation, pagination, thumbnails, autoplay, and ordering controls. |
|
|
21
|
+
| [Attaches](./attaches/README.md) | `attaches` | One or more downloadable files with selectable presentation variants. |
|
|
22
|
+
| [LinkPreview](./link-preview/README.md) | `linkPreview` | Link preview card with seven visual templates and optional application-provided metadata. |
|
|
23
|
+
| [Toggle](./toggle/README.md) | `toggle` | Collapsible block with editable title, rich content, and persistent open state. |
|
|
24
|
+
| [Columns](./columns/README.md) | `columns` | Two- or three-column rich-content layouts. |
|
|
25
|
+
| [Spoiler](./spoiler/README.md) | `spoiler` | User-revealed hidden content with an editable label. |
|
|
26
|
+
| [Poll](./poll/README.md) | `poll` | Single- or multiple-choice poll with local results or an application-provided live data source. |
|
|
27
|
+
| [Person](./person/README.md) | `person` | One or more profile cards with cropped avatars, biography, role, and social links. |
|
|
28
|
+
|
|
29
|
+
## Loading only document types
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
import { createBlockPluginsAsync } from '@shelamkoff/rector/plugins/async'
|
|
33
|
+
|
|
34
|
+
const plugins = await createBlockPluginsAsync(documentData, {
|
|
35
|
+
image: { uploadFile },
|
|
36
|
+
gallery: { uploadFile },
|
|
37
|
+
})
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The async loader deduplicates imports and preserves the first-occurrence order from the supplied type list or document. When no source is supplied, it uses the built-in catalog order. Unknown types reject instead of being silently ignored.
|
|
41
|
+
|
|
42
|
+
## Authoring
|
|
43
|
+
|
|
44
|
+
The VitePress extension guide documents the required contract, optional capabilities, command boundaries, text-field mapping, styles, localization, lifecycle, security, and the matching renderer contract.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Блочные плагины
|
|
2
|
+
|
|
3
|
+
Пакет содержит 21 блок. Импортируйте один класс из `@shelamkoff/rector/plugins/<path>`, полный синхронный набор из `@shelamkoff/rector/plugins` или набор по типам документа из `@shelamkoff/rector/plugins/async`.
|
|
4
|
+
|
|
5
|
+
| Плагин | Тип | Назначение |
|
|
6
|
+
| --- | --- | --- |
|
|
7
|
+
| [Paragraph](./paragraph/README.ru.md) | `paragraph` | Абзац с форматированием, выравниванием, внутристрочными инструментами и виджетами. |
|
|
8
|
+
| [Heading](./heading/README.ru.md) | `heading` | Заголовок уровня 2–6 с выравниванием, форматированием, виджетами и выбором уровня. |
|
|
9
|
+
| [List](./list/README.ru.md) | `list` | Нумерованный или маркированный список с разделением и объединением пунктов, выходом из блока и преобразованием выделенных пунктов. |
|
|
10
|
+
| [Quote](./quote/README.ru.md) | `quote` | Цитата с текстом и необязательной подписью. |
|
|
11
|
+
| [Code](./code/README.ru.md) | `code` | Блок кода с выбором языка и необязательной подсветкой синтаксиса. |
|
|
12
|
+
| [Image](./image/README.ru.md) | `image` | Изображение с загрузкой, подписью, размерами, рамкой, фоном и режимом вписывания. |
|
|
13
|
+
| [Delimiter](./delimiter/README.ru.md) | `delimiter` | Визуальный разделитель без содержимого. |
|
|
14
|
+
| [Table](./table/README.ru.md) | `table` | Редактируемая таблица с необязательной строкой заголовков. |
|
|
15
|
+
| [Checklist](./checklist/README.ru.md) | `checklist` | Контрольный список с независимым состоянием каждого пункта. |
|
|
16
|
+
| [Warning](./warning/README.ru.md) | `warning` | Выделенный информационный блок с редактируемыми заголовком и сообщением. |
|
|
17
|
+
| [Embed](./embed/README.ru.md) | `embed` | Видео YouTube или Vimeo с подписью, обложкой и сведениями предварительного просмотра. |
|
|
18
|
+
| [Raw](./raw/README.ru.md) | `raw` | Блок для ввода произвольного HTML. |
|
|
19
|
+
| [Gallery](./gallery/README.ru.md) | `gallery` | Галерея изображений с макетами, подписями, настройками вида, сортировкой и параметрами просмотра. |
|
|
20
|
+
| [CarouselBlock](./carousel/README.ru.md) | `carousel` | Карусель из изображений, видео и очищенного HTML с навигацией, пагинацией, миниатюрами, автопрокруткой и управлением порядком. |
|
|
21
|
+
| [Attaches](./attaches/README.ru.md) | `attaches` | Один или несколько скачиваемых файлов с вариантами представления. |
|
|
22
|
+
| [LinkPreview](./link-preview/README.ru.md) | `linkPreview` | Предварительный просмотр ссылки с семью шаблонами и необязательными метаданными приложения. |
|
|
23
|
+
| [Toggle](./toggle/README.ru.md) | `toggle` | Сворачиваемый блок с заголовком, форматируемым содержимым и сохраняемым состоянием. |
|
|
24
|
+
| [Columns](./columns/README.ru.md) | `columns` | Двух- и трёхколоночные макеты для форматируемого содержимого. |
|
|
25
|
+
| [Spoiler](./spoiler/README.ru.md) | `spoiler` | Скрываемое содержимое с редактируемой подписью. |
|
|
26
|
+
| [Poll](./poll/README.ru.md) | `poll` | Опрос с одиночным или множественным выбором и локальными либо предоставленными приложением актуальными результатами. |
|
|
27
|
+
| [Person](./person/README.ru.md) | `person` | Одна или несколько карточек профиля с обрезанным аватаром, биографией, ролью и ссылками. |
|
|
28
|
+
|
|
29
|
+
## Загрузка типов документа
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
import { createBlockPluginsAsync } from '@shelamkoff/rector/plugins/async'
|
|
33
|
+
const plugins = await createBlockPluginsAsync(documentData, { image: { uploadFile }, gallery: { uploadFile } })
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Загрузчик удаляет дубликаты и сохраняет порядок первого появления типов в переданном списке или документе. Если источник не передан, используется порядок встроенного каталога. Неизвестные типы приводят к ошибке. Контракт плагина, история, стили, локализация, жизненный цикл и безопасность описаны в последовательном руководстве VitePress.
|
|
37
|
+
|
|
38
|
+
## Разработка плагинов
|
|
39
|
+
|
|
40
|
+
Последовательное руководство VitePress описывает обязательный контракт, необязательные возможности, границы команд, сопоставление текстовых полей, стили, локализацию, жизненный цикл, безопасность и контракт соответствующего рендерера.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Return every block type supported by the asynchronous plugin registry.
|
|
3
|
+
* @returns {import('../renderer/types.js').BlockType[]}
|
|
4
|
+
*/
|
|
5
|
+
export function getAsyncBlockPluginTypes(): import("../renderer/types.js").BlockType[];
|
|
6
|
+
/**
|
|
7
|
+
* Resolve one block plugin constructor without instantiating it.
|
|
8
|
+
* @param {string} type
|
|
9
|
+
* @returns {Promise<AsyncBlockPluginConstructor>}
|
|
10
|
+
*/
|
|
11
|
+
export function loadBlockPlugin(type: string): Promise<AsyncBlockPluginConstructor>;
|
|
12
|
+
/**
|
|
13
|
+
* Preload unique plugin constructors for a type list or an existing document.
|
|
14
|
+
* The input document remains untouched if a chunk fails to load.
|
|
15
|
+
* @param {readonly string[] | { blocks?: readonly { type: string }[] }} [source]
|
|
16
|
+
* @returns {Promise<Map<string, AsyncBlockPluginConstructor>>}
|
|
17
|
+
*/
|
|
18
|
+
export function preloadBlockPlugins(source?: readonly string[] | {
|
|
19
|
+
blocks?: readonly {
|
|
20
|
+
type: string;
|
|
21
|
+
}[];
|
|
22
|
+
}): Promise<Map<string, AsyncBlockPluginConstructor>>;
|
|
23
|
+
/**
|
|
24
|
+
* Create a deterministic plugin preset after every requested chunk loaded.
|
|
25
|
+
* @param {readonly string[] | { blocks?: readonly { type: string }[] }} [source]
|
|
26
|
+
* @param {Partial<Record<import('../renderer/types.js').BlockType, Record<string, unknown>>>} [configs]
|
|
27
|
+
* @returns {Promise<import('../core/types.js').BlockPlugin[]>}
|
|
28
|
+
*/
|
|
29
|
+
export function createBlockPluginsAsync(source?: readonly string[] | {
|
|
30
|
+
blocks?: readonly {
|
|
31
|
+
type: string;
|
|
32
|
+
}[];
|
|
33
|
+
}, configs?: Partial<Record<import("../renderer/types.js").BlockType, Record<string, unknown>>>): Promise<import("../core/types.js").BlockPlugin[]>;
|
|
34
|
+
export type AsyncBlockPluginConstructor = new (config?: Record<string, unknown>) => import("../core/types.js").BlockPlugin;
|
|
35
|
+
export type BlockPluginLoader = () => Promise<AsyncBlockPluginConstructor>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { BLOCK_TYPES } from '../shared/blockTypes.js'
|
|
3
|
+
|
|
4
|
+
/** @typedef {new (config?: Record<string, unknown>) => import('../core/types').BlockPlugin} AsyncBlockPluginConstructor */
|
|
5
|
+
/** @typedef {() => Promise<AsyncBlockPluginConstructor>} BlockPluginLoader */
|
|
6
|
+
|
|
7
|
+
/** @type {Record<import('../renderer/types').BlockType, BlockPluginLoader>} */
|
|
8
|
+
const pluginLoaders = {
|
|
9
|
+
paragraph: () => import('./paragraph/index.js').then(module => module.Paragraph),
|
|
10
|
+
heading: () => import('./heading/index.js').then(module => module.Heading),
|
|
11
|
+
list: () => import('./list/index.js').then(module => module.List),
|
|
12
|
+
quote: () => import('./quote/index.js').then(module => module.Quote),
|
|
13
|
+
code: () => import('./code/index.js').then(module => module.Code),
|
|
14
|
+
image: () => import('./image/index.js').then(module => module.Image),
|
|
15
|
+
delimiter: () => import('./delimiter/index.js').then(module => module.Delimiter),
|
|
16
|
+
table: () => import('./table/index.js').then(module => module.Table),
|
|
17
|
+
checklist: () => import('./checklist/index.js').then(module => module.Checklist),
|
|
18
|
+
warning: () => import('./warning/index.js').then(module => module.Warning),
|
|
19
|
+
embed: () => import('./embed/index.js').then(module => module.Embed),
|
|
20
|
+
raw: () => import('./raw/index.js').then(module => module.Raw),
|
|
21
|
+
gallery: () => import('./gallery/index.js').then(module => module.Gallery),
|
|
22
|
+
carousel: () => import('./carousel/index.js').then(module => module.CarouselBlock),
|
|
23
|
+
attaches: () => import('./attaches/index.js').then(module => module.Attaches),
|
|
24
|
+
linkPreview: () => import('./link-preview/index.js').then(module => module.LinkPreview),
|
|
25
|
+
toggle: () => import('./toggle/index.js').then(module => module.Toggle),
|
|
26
|
+
columns: () => import('./columns/index.js').then(module => module.Columns),
|
|
27
|
+
spoiler: () => import('./spoiler/index.js').then(module => module.Spoiler),
|
|
28
|
+
poll: () => import('./poll/index.js').then(module => module.Poll),
|
|
29
|
+
person: () => import('./person/index.js').then(module => module.Person),
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** @param {readonly string[] | { blocks?: readonly { type: string }[] } | undefined} source */
|
|
33
|
+
function requestedTypes(source) {
|
|
34
|
+
const document = /** @type {{ blocks?: readonly { type: string }[] } | undefined} */ (source)
|
|
35
|
+
const types = Array.isArray(source) ? source : document?.blocks?.map(block => block.type) ?? BLOCK_TYPES
|
|
36
|
+
return [...new Set(types)]
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Return every block type supported by the asynchronous plugin registry.
|
|
41
|
+
* @returns {import('../renderer/types').BlockType[]}
|
|
42
|
+
*/
|
|
43
|
+
export function getAsyncBlockPluginTypes() {
|
|
44
|
+
return [...BLOCK_TYPES]
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Resolve one block plugin constructor without instantiating it.
|
|
49
|
+
* @param {string} type
|
|
50
|
+
* @returns {Promise<AsyncBlockPluginConstructor>}
|
|
51
|
+
*/
|
|
52
|
+
export async function loadBlockPlugin(type) {
|
|
53
|
+
const loader = pluginLoaders[/** @type {import('../renderer/types').BlockType} */ (type)]
|
|
54
|
+
if (!loader) throw new RangeError(`Unknown editor block plugin type: ${type}`)
|
|
55
|
+
return loader()
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Preload unique plugin constructors for a type list or an existing document.
|
|
60
|
+
* The input document remains untouched if a chunk fails to load.
|
|
61
|
+
* @param {readonly string[] | { blocks?: readonly { type: string }[] }} [source]
|
|
62
|
+
* @returns {Promise<Map<string, AsyncBlockPluginConstructor>>}
|
|
63
|
+
*/
|
|
64
|
+
export async function preloadBlockPlugins(source) {
|
|
65
|
+
const types = requestedTypes(source)
|
|
66
|
+
const constructors = await Promise.all(types.map(loadBlockPlugin))
|
|
67
|
+
return new Map(types.map((type, index) => [type, constructors[index]]))
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Create a deterministic plugin preset after every requested chunk loaded.
|
|
72
|
+
* @param {readonly string[] | { blocks?: readonly { type: string }[] }} [source]
|
|
73
|
+
* @param {Partial<Record<import('../renderer/types').BlockType, Record<string, unknown>>>} [configs]
|
|
74
|
+
* @returns {Promise<import('../core/types').BlockPlugin[]>}
|
|
75
|
+
*/
|
|
76
|
+
export async function createBlockPluginsAsync(source, configs = {}) {
|
|
77
|
+
const constructors = await preloadBlockPlugins(source)
|
|
78
|
+
return [...constructors].map(([type, Plugin]) => new Plugin(configs[/** @type {import('../renderer/types').BlockType} */ (type)]))
|
|
79
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Attaches block plugin
|
|
2
|
+
|
|
3
|
+
One or more downloadable files with selectable presentation variants.
|
|
4
|
+
|
|
5
|
+
## Install and register
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @shelamkoff/rector
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { createEditor } from '@shelamkoff/rector'
|
|
13
|
+
import { Attaches } from '@shelamkoff/rector/plugins/attaches'
|
|
14
|
+
import '@shelamkoff/rector/styles/editor.css'
|
|
15
|
+
|
|
16
|
+
const editor = createEditor({
|
|
17
|
+
holder: document.querySelector('#editor'),
|
|
18
|
+
plugins: [new Attaches()],
|
|
19
|
+
})
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The registered block type is `attaches`. The class is also exported by the complete `@shelamkoff/rector/plugins` preset and can be loaded through `@shelamkoff/rector/plugins/async`.
|
|
23
|
+
|
|
24
|
+
## Data
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"files": [{ "url": "https://cdn.example/a.pdf", "name": "a.pdf", "size": 1024, "extension": "pdf" }],
|
|
29
|
+
"variant": "f"
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Field reference
|
|
34
|
+
|
|
35
|
+
| Field | Required | Meaning and constraints |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| `files` | yes | Non-empty array. Saves always use this plural form. |
|
|
38
|
+
| `files[].url` | yes | Canonical URL allowed by the download policy. |
|
|
39
|
+
| `files[].name`, `files[].extension` | yes | Strings used for the displayed file name and extension. |
|
|
40
|
+
| `files[].size` | yes | Finite non-negative byte count. |
|
|
41
|
+
| `variant` | no | Presentation variant `a`, `b`, `f`, or `g`; the plugin default is `f`. |
|
|
42
|
+
|
|
43
|
+
Legacy input may contain one `file` object instead of `files`; the next save normalizes it to the array contract. Callback URLs must pass the shared download URL policy. Without `uploadFile`, selected files use temporary object URLs; configure an uploader for data that must survive cleanup or page reload.
|
|
44
|
+
|
|
45
|
+
## Configuration
|
|
46
|
+
|
|
47
|
+
Every built-in block plugin accepts two style ownership options: `injectStyles?: boolean` defaults to `true`; set it to `false` when the host bundles that plugin's CSS. `css?: string` adds one host-provided stylesheet URL after the plugin default, or acts as the replacement URL when default injection is disabled.
|
|
48
|
+
|
|
49
|
+
`uploadFile?: (file: File, context: { signal: AbortSignal }) => Promise<{ url: string; size?: number }>` persists a selected browser file. `actions?: Array<{ icon?; label; handler({ signal }): Promise<Array<{ url; name; size?; extension? }> | null> }>` adds application file sources such as a media library. Both callbacks must respect the supplied abort signal.
|
|
50
|
+
|
|
51
|
+
## Application file sources
|
|
52
|
+
|
|
53
|
+
Use `uploadFile` for browser `File` objects and `actions` for existing downloads selected from a file library, cloud drive, or another application-owned catalog. An action may return several files in one selection.
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
const attaches = new Attaches({
|
|
57
|
+
actions: [{
|
|
58
|
+
label: 'File library',
|
|
59
|
+
async handler({ signal }) {
|
|
60
|
+
const assets = await openFileLibrary({ multiple: true, signal })
|
|
61
|
+
return assets?.map(asset => ({
|
|
62
|
+
url: asset.downloadUrl,
|
|
63
|
+
name: asset.name,
|
|
64
|
+
size: asset.size,
|
|
65
|
+
extension: asset.extension,
|
|
66
|
+
})) ?? null
|
|
67
|
+
},
|
|
68
|
+
}],
|
|
69
|
+
})
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`url` and `name` are required. `size` and `extension` are optional; the extension is inferred from `name` when omitted. Return `null` when selection is cancelled. The complete selection becomes one undo/redo step. See [File sources and media libraries](https://shelamkoff.github.io/editor/guide/file-sources) for upload, cancellation, validation, and reusable adapter guidance.
|
|
73
|
+
|
|
74
|
+
## Capabilities
|
|
75
|
+
|
|
76
|
+
Multiple files; device upload and application sources; editable names; presentation variants; listener/object-URL cleanup; stale results are ignored after disposal.
|
|
77
|
+
|
|
78
|
+
## Undo, lifecycle, and styles
|
|
79
|
+
|
|
80
|
+
User actions exposed by the plugin enter the command pipeline through the supplied `context.mutate()` capability, so each completed action is one undo/redo step. The editor reference-counts the plugin's declared stylesheet URLs. Removing a block calls its cleanup hook; removing the editor calls `destroy()` for every remaining block and then releases shared plugin resources.
|
|
81
|
+
|
|
82
|
+
Do not remove the editor holder without first calling `editor.destroy()`.
|
|
83
|
+
|
|
84
|
+
## Document output
|
|
85
|
+
|
|
86
|
+
Use the matching renderer from `@shelamkoff/rector/renderer/renderers/attaches`. The VitePress guide documents configuration, commands and history, extension contracts, document migrations, styling, security, and lifecycle in a sequential form.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Блочный плагин Attaches
|
|
2
|
+
|
|
3
|
+
Один или несколько скачиваемых файлов с вариантами представления.
|
|
4
|
+
|
|
5
|
+
## Установка и регистрация
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @shelamkoff/rector
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { createEditor } from '@shelamkoff/rector'
|
|
13
|
+
import { Attaches } from '@shelamkoff/rector/plugins/attaches'
|
|
14
|
+
import '@shelamkoff/rector/styles/editor.css'
|
|
15
|
+
|
|
16
|
+
const editor = createEditor({
|
|
17
|
+
holder: document.querySelector('#editor'),
|
|
18
|
+
plugins: [new Attaches()],
|
|
19
|
+
})
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Тип блока — `attaches`. Класс также экспортируется общей точкой входа `@shelamkoff/rector/plugins` и может загружаться по типу документа через `@shelamkoff/rector/plugins/async`.
|
|
23
|
+
|
|
24
|
+
## Данные
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"files": [{ "url": "https://cdn.example/a.pdf", "name": "a.pdf", "size": 1024, "extension": "pdf" }],
|
|
29
|
+
"variant": "f"
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Поля данных
|
|
34
|
+
|
|
35
|
+
| Поле | Обязательное | Назначение и ограничения |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| `files` | да | Непустой массив. Сохранение всегда использует эту форму во множественном числе. |
|
|
38
|
+
| `files[].url` | да | Канонический адрес, разрешённый политикой загрузок. |
|
|
39
|
+
| `files[].name`, `files[].extension` | да | Строки с отображаемым именем и расширением файла. |
|
|
40
|
+
| `files[].size` | да | Конечный неотрицательный размер в байтах. |
|
|
41
|
+
| `variant` | нет | Вариант представления `a`, `b`, `f` или `g`; по умолчанию плагин использует `f`. |
|
|
42
|
+
|
|
43
|
+
Старые данные могут содержать один объект `file` вместо `files`; следующее сохранение нормализует его в массив. Адреса из обработчиков должны пройти общую политику загрузок. Без `uploadFile` выбранные файлы используют временные объектные URL, поэтому для данных, которые должны пережить очистку или перезагрузку страницы, настройте постоянное хранилище.
|
|
44
|
+
|
|
45
|
+
## Конфигурация
|
|
46
|
+
|
|
47
|
+
Каждый встроенный блочный плагин принимает два параметра владения стилями: `injectStyles?: boolean` по умолчанию равен `true`; укажите `false`, если приложение само включает CSS этого плагина. `css?: string` добавляет URL таблицы стилей приложения после стандартной, а при отключённой стандартной инъекции служит URL замены.
|
|
48
|
+
|
|
49
|
+
`uploadFile(file, { signal })` сохраняет выбранный браузерный файл и возвращает `{ url, size? }`; исходное имя и определённое расширение сохраняются. `actions` добавляет источники приложения, например медиатеку, и возвращает массив `{ url, name, size?, extension? }` либо `null`. Оба вида обработчиков должны учитывать переданный `AbortSignal`, а возвращённые URL — пройти общую политику адресов загрузки.
|
|
50
|
+
|
|
51
|
+
## Источники файлов приложения
|
|
52
|
+
|
|
53
|
+
Используйте `uploadFile` для браузерных объектов `File`, а `actions` — для готовых файлов из файловой библиотеки, облачного диска или другого каталога приложения. Одно действие может вернуть несколько файлов.
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
const attaches = new Attaches({
|
|
57
|
+
actions: [{
|
|
58
|
+
label: 'Библиотека файлов',
|
|
59
|
+
async handler({ signal }) {
|
|
60
|
+
const assets = await openFileLibrary({ multiple: true, signal })
|
|
61
|
+
return assets?.map(asset => ({
|
|
62
|
+
url: asset.downloadUrl,
|
|
63
|
+
name: asset.name,
|
|
64
|
+
size: asset.size,
|
|
65
|
+
extension: asset.extension,
|
|
66
|
+
})) ?? null
|
|
67
|
+
},
|
|
68
|
+
}],
|
|
69
|
+
})
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Поля `url` и `name` обязательны. `size` и `extension` необязательны; если расширение пропущено, оно определяется из `name`. При отмене выбора верните `null`. Весь выбор становится одним шагом отмены и повтора. Загрузка, отмена, проверка данных и общий адаптер описаны в разделе [«Источники файлов и медиатека»](https://shelamkoff.github.io/editor/ru/guide/file-sources).
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
## Возможности
|
|
76
|
+
|
|
77
|
+
Несколько файлов; редактируемые имена; варианты представления; источники файлов приложения; освобождение обработчиков и объектных URL; защита от устаревшего результата загрузки.
|
|
78
|
+
|
|
79
|
+
## История, жизненный цикл и стили
|
|
80
|
+
|
|
81
|
+
Действия плагина входят в конвейер команд через предоставленный контекст `mutate()`, поэтому одно завершённое действие создаёт один шаг отмены и повтора. Редактор подсчитывает владельцев объявленных URL стилей. Удаление блока вызывает его метод освобождения ресурсов; `editor.destroy()` освобождает оставшиеся блоки и общие ресурсы.
|
|
82
|
+
|
|
83
|
+
Не удаляйте контейнер редактора до вызова `editor.destroy()`.
|
|
84
|
+
|
|
85
|
+
## Вывод документа
|
|
86
|
+
|
|
87
|
+
Используйте фабричную функцию из `@shelamkoff/rector/renderer/renderers/attaches`. Последовательное руководство VitePress описывает проверку данных, миграции, разработку расширений, диагностику, безопасность и стили.
|