@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,13 @@
|
|
|
1
|
+
/** Toolbox icon, 16×16 — gallery (two stacked frames). */
|
|
2
|
+
export const 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=\"M7 5.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666\"/><path d=\"M4.012 7.26a2.005 2.005 0 0 0 -1.012 1.737v10c0 1.1 .9 2 2 2h10c.75 0 1.158 -.385 1.5 -1\"/><path d=\"M17 7h.01\"/><path d=\"M7 13l3.644 -3.644a1.21 1.21 0 0 1 1.712 0l3.644 3.644\"/><path d=\"M15 12l1.644 -1.644a1.21 1.21 0 0 1 1.712 0l2.644 2.644\"/></svg>";
|
|
3
|
+
/** Dropzone large icon, 48×48. */
|
|
4
|
+
export const ICON_SELECT: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"48\" height=\"48\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M7 5.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666\"/><path d=\"M4.012 7.26a2.005 2.005 0 0 0 -1.012 1.737v10c0 1.1 .9 2 2 2h10c.75 0 1.158 -.385 1.5 -1\"/><path d=\"M17 7h.01\"/><path d=\"M7 13l3.644 -3.644a1.21 1.21 0 0 1 1.712 0l3.644 3.644\"/><path d=\"M15 12l1.644 -1.644a1.21 1.21 0 0 1 1.712 0l2.644 2.644\"/></svg>";
|
|
5
|
+
export const ICON_UPLOAD: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2\"/><path d=\"M7 9l5 -5l5 5\"/><path d=\"M12 4v12\"/></svg>";
|
|
6
|
+
export const ICON_URL: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M9 15l6 -6\"/><path d=\"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464\"/><path d=\"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463\"/></svg>";
|
|
7
|
+
export const ICON_ADD_IMAGE: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M15 8h.01\"/><path d=\"M12.5 21h-6.5a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v6.5\"/><path d=\"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l4 4\"/><path d=\"M14 14l1 -1c.67 -.644 1.45 -.824 2.182 -.54\"/><path d=\"M16 19h6\"/><path d=\"M19 16v6\"/></svg>";
|
|
8
|
+
export const ICON_BACK: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M15 6l-6 6l6 6\"/></svg>";
|
|
9
|
+
export const ICON_CHEVRON_RIGHT: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M9 6l6 6l-6 6\"/></svg>";
|
|
10
|
+
export const ICON_TRASH: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"currentColor\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4 7h16\"/><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M10 11v6\"/><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M14 11v6\"/><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12\"/><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3\"/></svg>";
|
|
11
|
+
export const ICON_SETTINGS: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"currentColor\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065\"/><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0\"/></svg>";
|
|
12
|
+
/** @type {Record<string, string>} */
|
|
13
|
+
export const LAYOUT_ICONS: Record<string, string>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Tabler icons + layout thumbnails used by the Gallery plugin.
|
|
2
|
+
|
|
3
|
+
/** Toolbox icon, 16×16 — gallery (two stacked frames). */
|
|
4
|
+
export const 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="M7 5.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666"/><path d="M4.012 7.26a2.005 2.005 0 0 0 -1.012 1.737v10c0 1.1 .9 2 2 2h10c.75 0 1.158 -.385 1.5 -1"/><path d="M17 7h.01"/><path d="M7 13l3.644 -3.644a1.21 1.21 0 0 1 1.712 0l3.644 3.644"/><path d="M15 12l1.644 -1.644a1.21 1.21 0 0 1 1.712 0l2.644 2.644"/></svg>'
|
|
5
|
+
|
|
6
|
+
/** Dropzone large icon, 48×48. */
|
|
7
|
+
export const ICON_SELECT = '<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M7 5.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666"/><path d="M4.012 7.26a2.005 2.005 0 0 0 -1.012 1.737v10c0 1.1 .9 2 2 2h10c.75 0 1.158 -.385 1.5 -1"/><path d="M17 7h.01"/><path d="M7 13l3.644 -3.644a1.21 1.21 0 0 1 1.712 0l3.644 3.644"/><path d="M15 12l1.644 -1.644a1.21 1.21 0 0 1 1.712 0l2.644 2.644"/></svg>'
|
|
8
|
+
|
|
9
|
+
// Action bar icons, 14×14
|
|
10
|
+
export const ICON_UPLOAD = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"><path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"/><path d="M7 9l5 -5l5 5"/><path d="M12 4v12"/></svg>'
|
|
11
|
+
export const ICON_URL = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"><path d="M9 15l6 -6"/><path d="M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"/><path d="M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"/></svg>'
|
|
12
|
+
export const ICON_ADD_IMAGE = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"><path d="M15 8h.01"/><path d="M12.5 21h-6.5a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v6.5"/><path d="M3 16l5 -5c.928 -.893 2.072 -.893 3 0l4 4"/><path d="M14 14l1 -1c.67 -.644 1.45 -.824 2.182 -.54"/><path d="M16 19h6"/><path d="M19 16v6"/></svg>'
|
|
13
|
+
export const ICON_BACK = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"><path d="M15 6l-6 6l6 6"/></svg>'
|
|
14
|
+
export const ICON_CHEVRON_RIGHT = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"><path d="M9 6l6 6l-6 6"/></svg>'
|
|
15
|
+
export const ICON_TRASH = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M4 7h16"/><path stroke-linecap="round" stroke-linejoin="round" d="M10 11v6"/><path stroke-linecap="round" stroke-linejoin="round" d="M14 11v6"/><path stroke-linecap="round" stroke-linejoin="round" d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12"/><path stroke-linecap="round" stroke-linejoin="round" d="M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"/></svg>'
|
|
16
|
+
export const ICON_SETTINGS = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065"/><path stroke-linecap="round" stroke-linejoin="round" d="M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"/></svg>'
|
|
17
|
+
|
|
18
|
+
// Layout thumbnails (24×24 fill-based) — used in the layout picker grid.
|
|
19
|
+
const S = 'xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"'
|
|
20
|
+
const F = 'fill="currentColor"'
|
|
21
|
+
|
|
22
|
+
/** @type {Record<string, string>} */
|
|
23
|
+
export const LAYOUT_ICONS = {
|
|
24
|
+
auto: `<svg ${S}><rect x="3" y="3" width="8.5" height="8.5" rx="1" ${F}/><rect x="12.5" y="3" width="8.5" height="12" rx="1" ${F}/><rect x="3" y="12.5" width="8.5" height="8.5" rx="1" ${F}/></svg>`,
|
|
25
|
+
'1': `<svg ${S}><rect x="3" y="3" width="18" height="18" rx="2" ${F}/></svg>`,
|
|
26
|
+
'2': `<svg ${S}><rect x="3" y="3" width="8.5" height="18" rx="1" ${F}/><rect x="12.5" y="3" width="8.5" height="18" rx="1" ${F}/></svg>`,
|
|
27
|
+
'3a': `<svg ${S}><rect x="3" y="3" width="11" height="18" rx="1" ${F}/><rect x="15" y="3" width="6" height="8.5" rx="1" ${F}/><rect x="15" y="12.5" width="6" height="8.5" rx="1" ${F}/></svg>`,
|
|
28
|
+
'3b': `<svg ${S}><rect x="3" y="3" width="6" height="8.5" rx="1" ${F}/><rect x="3" y="12.5" width="6" height="8.5" rx="1" ${F}/><rect x="10" y="3" width="11" height="18" rx="1" ${F}/></svg>`,
|
|
29
|
+
'3c': `<svg ${S}><rect x="3" y="3" width="18" height="11" rx="1" ${F}/><rect x="3" y="15" width="8.5" height="6" rx="1" ${F}/><rect x="12.5" y="15" width="8.5" height="6" rx="1" ${F}/></svg>`,
|
|
30
|
+
'4a': `<svg ${S}><rect x="3" y="3" width="8.5" height="8.5" rx="1" ${F}/><rect x="12.5" y="3" width="8.5" height="8.5" rx="1" ${F}/><rect x="3" y="12.5" width="8.5" height="8.5" rx="1" ${F}/><rect x="12.5" y="12.5" width="8.5" height="8.5" rx="1" ${F}/></svg>`,
|
|
31
|
+
'4b': `<svg ${S}><rect x="3" y="3" width="11" height="18" rx="1" ${F}/><rect x="15" y="3" width="6" height="5.3" rx="1" ${F}/><rect x="15" y="9.3" width="6" height="5.3" rx="1" ${F}/><rect x="15" y="15.7" width="6" height="5.3" rx="1" ${F}/></svg>`,
|
|
32
|
+
'4c': `<svg ${S}><rect x="3" y="3" width="18" height="11" rx="1" ${F}/><rect x="3" y="15" width="5.3" height="6" rx="1" ${F}/><rect x="9.3" y="15" width="5.3" height="6" rx="1" ${F}/><rect x="15.7" y="15" width="5.3" height="6" rx="1" ${F}/></svg>`,
|
|
33
|
+
'5a': `<svg ${S}><rect x="3" y="3" width="8.5" height="10" rx="1" ${F}/><rect x="12.5" y="3" width="8.5" height="10" rx="1" ${F}/><rect x="3" y="14" width="5.3" height="7" rx="1" ${F}/><rect x="9.3" y="14" width="5.3" height="7" rx="1" ${F}/><rect x="15.7" y="14" width="5.3" height="7" rx="1" ${F}/></svg>`,
|
|
34
|
+
'5b': `<svg ${S}><rect x="3" y="3" width="10" height="18" rx="1" ${F}/><rect x="14" y="3" width="3" height="8.5" rx="1" ${F}/><rect x="18" y="3" width="3" height="8.5" rx="1" ${F}/><rect x="14" y="12.5" width="3" height="8.5" rx="1" ${F}/><rect x="18" y="12.5" width="3" height="8.5" rx="1" ${F}/></svg>`,
|
|
35
|
+
'5c': `<svg ${S}><rect x="3" y="3" width="18" height="11" rx="1" ${F}/><rect x="3" y="15" width="3.75" height="6" rx="1" ${F}/><rect x="7.75" y="15" width="3.75" height="6" rx="1" ${F}/><rect x="12.5" y="15" width="3.75" height="6" rx="1" ${F}/><rect x="17.25" y="15" width="3.75" height="6" rx="1" ${F}/></svg>`,
|
|
36
|
+
'6a': `<svg ${S}><rect x="3" y="3" width="5.3" height="10" rx="1" ${F}/><rect x="9.3" y="3" width="5.3" height="10" rx="1" ${F}/><rect x="15.7" y="3" width="5.3" height="10" rx="1" ${F}/><rect x="3" y="14" width="5.3" height="7" rx="1" ${F}/><rect x="9.3" y="14" width="5.3" height="7" rx="1" ${F}/><rect x="15.7" y="14" width="5.3" height="7" rx="1" ${F}/></svg>`,
|
|
37
|
+
'6b': `<svg ${S}><rect x="3" y="3" width="8.5" height="18" rx="1" ${F}/><rect x="12.5" y="3" width="8.5" height="5.3" rx="1" ${F}/><rect x="12.5" y="9.3" width="8.5" height="5.3" rx="1" ${F}/><rect x="12.5" y="15.7" width="2.5" height="5.3" rx="1" ${F}/><rect x="15.5" y="15.7" width="2.5" height="5.3" rx="1" ${F}/><rect x="18.5" y="15.7" width="2.5" height="5.3" rx="1" ${F}/></svg>`,
|
|
38
|
+
'6c': `<svg ${S}><rect x="3" y="3" width="8.5" height="10" rx="1" ${F}/><rect x="12.5" y="3" width="8.5" height="10" rx="1" ${F}/><rect x="3" y="14" width="3.75" height="7" rx="1" ${F}/><rect x="7.75" y="14" width="3.75" height="7" rx="1" ${F}/><rect x="12.5" y="14" width="3.75" height="7" rx="1" ${F}/><rect x="17.25" y="14" width="3.75" height="7" rx="1" ${F}/></svg>`,
|
|
39
|
+
triptych: `<svg ${S}><rect x="3" y="3" width="5.3" height="18" rx="1" ${F}/><rect x="9.3" y="3" width="5.3" height="18" rx="1" ${F}/><rect x="15.7" y="3" width="5.3" height="18" rx="1" ${F}/></svg>`,
|
|
40
|
+
masonry: `<svg ${S}><rect x="3" y="3" width="5.3" height="9" rx="1" ${F}/><rect x="3" y="13" width="5.3" height="8" rx="1" ${F}/><rect x="9.3" y="3" width="5.3" height="6" rx="1" ${F}/><rect x="9.3" y="10" width="5.3" height="11" rx="1" ${F}/><rect x="15.7" y="3" width="5.3" height="11" rx="1" ${F}/><rect x="15.7" y="15" width="5.3" height="6" rx="1" ${F}/></svg>`,
|
|
41
|
+
'poly-5': `<svg ${S}><rect x="3" y="7.5" width="2.8" height="9" rx=".7" ${F}/><rect x="6.3" y="5.5" width="3.3" height="13" rx=".7" ${F}/><rect x="10.1" y="3" width="3.8" height="18" rx=".7" ${F}/><rect x="14.4" y="5.5" width="3.3" height="13" rx=".7" ${F}/><rect x="18.2" y="7.5" width="2.8" height="9" rx=".7" ${F}/></svg>`,
|
|
42
|
+
'poly-3arch': `<svg ${S}><rect x="3" y="5.5" width="5.4" height="13" rx=".7" ${F}/><rect x="8.9" y="3" width="6.2" height="18" rx=".7" ${F}/><rect x="15.6" y="5.5" width="5.4" height="13" rx=".7" ${F}/></svg>`,
|
|
43
|
+
'poly-5flat': `<svg ${S}><rect x="3" y="3" width="2.8" height="10" rx=".7" ${F}/><rect x="6.3" y="3" width="3.3" height="13.5" rx=".7" ${F}/><rect x="10.1" y="3" width="3.8" height="18" rx=".7" ${F}/><rect x="14.4" y="3" width="3.3" height="13.5" rx=".7" ${F}/><rect x="18.2" y="3" width="2.8" height="10" rx=".7" ${F}/></svg>`,
|
|
44
|
+
'poly-3steps': `<svg ${S}><rect x="3" y="3" width="5.3" height="12" rx=".7" ${F}/><rect x="9.3" y="5" width="5.3" height="12" rx=".7" ${F}/><rect x="15.7" y="7" width="5.3" height="12" rx=".7" ${F}/></svg>`,
|
|
45
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type {} from './locale/keys.js'
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {(file: File, context: { signal: AbortSignal }) => Promise<{ url: string, alt?: string }>} UploadFn
|
|
4
|
+
*
|
|
5
|
+
* @typedef {Object} GalleryConfig
|
|
6
|
+
* @property {UploadFn} [uploadFile] Uploads one browser file. Without this callback the plugin reads each file into a data URL stored in the document.
|
|
7
|
+
* @property {Array<{ icon?: string, label: string, handler: (context: { signal: AbortSignal }) => Promise<Array<{url: string, alt?: string}> | null> }>} [actions] Additional application-owned image sources. `icon` is trusted application markup; never pass user-authored HTML.
|
|
8
|
+
* @property {boolean} [injectStyles=true] Whether the editor should load the built-in gallery stylesheet.
|
|
9
|
+
* @property {string} [css] Additional stylesheet URL, or the replacement URL when `injectStyles` is `false`.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Editable image gallery with upload-source extensions, ordering, and layout controls.
|
|
13
|
+
* Internal logic is split across:
|
|
14
|
+
* - `state.js` — per-block state container (replaces module WeakMap)
|
|
15
|
+
* - `uploader.js` — multi-file upload pipeline
|
|
16
|
+
* - `layout.js` — layout selection algorithms
|
|
17
|
+
* - `slot.js` — slot/overflow item DOM builders + drag handling
|
|
18
|
+
* - `view-empty.js`/ `view-filled.js` — DOM rendering for the two states
|
|
19
|
+
* - `settings.js` — settings dropdown form
|
|
20
|
+
* - `styles.js` — gallery-level inline style application
|
|
21
|
+
* @extends {BlockPluginAbstract<GalleryConfig>}
|
|
22
|
+
*/
|
|
23
|
+
export class Gallery extends BlockPluginAbstract<GalleryConfig> {
|
|
24
|
+
static isTextBlock: boolean;
|
|
25
|
+
static styles: string[];
|
|
26
|
+
/**
|
|
27
|
+
* Create a Gallery instance with the supplied consumer configuration.
|
|
28
|
+
* @param {GalleryConfig} [config]
|
|
29
|
+
*/
|
|
30
|
+
constructor(config?: GalleryConfig);
|
|
31
|
+
type: string;
|
|
32
|
+
icon: string;
|
|
33
|
+
inlineTools: boolean;
|
|
34
|
+
pasteConfig: {
|
|
35
|
+
files: string[];
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Return the localized toolbox label for this block.
|
|
39
|
+
* @returns {string}
|
|
40
|
+
*/
|
|
41
|
+
get title(): string;
|
|
42
|
+
/**
|
|
43
|
+
* Create the editable DOM owned by this block instance.
|
|
44
|
+
* @param {Record<string, unknown>} data
|
|
45
|
+
* @param {import('../../core/types.js').BlockMutationContext} context
|
|
46
|
+
* @returns {HTMLElement}
|
|
47
|
+
*/
|
|
48
|
+
render(data: Record<string, unknown>, context: import("../../core/types.js").BlockMutationContext): HTMLElement;
|
|
49
|
+
/**
|
|
50
|
+
* Serialize the current block DOM into document data.
|
|
51
|
+
* @param {HTMLElement} element
|
|
52
|
+
* @returns {Record<string, unknown>}
|
|
53
|
+
*/
|
|
54
|
+
save(element: HTMLElement): Record<string, unknown>;
|
|
55
|
+
/**
|
|
56
|
+
* Check whether serialized data satisfies this block's schema.
|
|
57
|
+
* @param {Record<string, unknown>} data
|
|
58
|
+
* @returns {boolean}
|
|
59
|
+
*/
|
|
60
|
+
validate(data: Record<string, unknown>): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Check whether the block has no meaningful user content.
|
|
63
|
+
* @param {HTMLElement} element
|
|
64
|
+
* @returns {boolean}
|
|
65
|
+
*/
|
|
66
|
+
isEmpty(element: HTMLElement): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Extract neutral text that can initialize another block type.
|
|
69
|
+
* @param {HTMLElement} element
|
|
70
|
+
* @returns {Record<string, unknown>}
|
|
71
|
+
*/
|
|
72
|
+
exportData(element: HTMLElement): Record<string, unknown>;
|
|
73
|
+
/**
|
|
74
|
+
* Handle supported pasted content for this block.
|
|
75
|
+
* @param {import('../../types.js').PasteEvent} event
|
|
76
|
+
* @returns {Record<string, unknown> | null}
|
|
77
|
+
*/
|
|
78
|
+
onPaste(event: import("../../types.js").PasteEvent): Record<string, unknown> | null;
|
|
79
|
+
/**
|
|
80
|
+
* Keep pasted files inside one undo transaction until upload completes.
|
|
81
|
+
* @param {HTMLElement} element
|
|
82
|
+
* @returns {Promise<void>}
|
|
83
|
+
*/
|
|
84
|
+
waitForPaste(element: HTMLElement): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Release listeners and resources owned by this block element.
|
|
87
|
+
* @param {HTMLElement} element
|
|
88
|
+
* @returns {void}
|
|
89
|
+
*/
|
|
90
|
+
destroy(element: HTMLElement): void;
|
|
91
|
+
#private;
|
|
92
|
+
}
|
|
93
|
+
export type UploadFn = (file: File, context: {
|
|
94
|
+
signal: AbortSignal;
|
|
95
|
+
}) => Promise<{
|
|
96
|
+
url: string;
|
|
97
|
+
alt?: string;
|
|
98
|
+
}>;
|
|
99
|
+
export type GalleryConfig = {
|
|
100
|
+
/**
|
|
101
|
+
* Uploads one browser file. Without this callback the plugin reads each file into a data URL stored in the document.
|
|
102
|
+
*/
|
|
103
|
+
uploadFile?: UploadFn;
|
|
104
|
+
/**
|
|
105
|
+
* Additional application-owned image sources. `icon` is trusted application markup; never pass user-authored HTML.
|
|
106
|
+
*/
|
|
107
|
+
actions?: Array<{
|
|
108
|
+
icon?: string;
|
|
109
|
+
label: string;
|
|
110
|
+
handler: (context: {
|
|
111
|
+
signal: AbortSignal;
|
|
112
|
+
}) => Promise<Array<{
|
|
113
|
+
url: string;
|
|
114
|
+
alt?: string;
|
|
115
|
+
}> | null>;
|
|
116
|
+
}>;
|
|
117
|
+
/**
|
|
118
|
+
* Whether the editor should load the built-in gallery stylesheet.
|
|
119
|
+
*/
|
|
120
|
+
injectStyles?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Additional stylesheet URL, or the replacement URL when `injectStyles` is `false`.
|
|
123
|
+
*/
|
|
124
|
+
css?: string;
|
|
125
|
+
};
|
|
126
|
+
import { BlockPluginAbstract } from '../BlockPluginAbstract.js';
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { resolvePath } from '../../shared/resolvePath.js'
|
|
2
|
+
import { isSupportedImageFile, triggerFileInput } from '../shared/fileInput.js'
|
|
3
|
+
import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
|
|
4
|
+
import { validateGalleryData } from '../../shared/blockDataValidators.js'
|
|
5
|
+
import { CSS } from './css.js'
|
|
6
|
+
import { ICON } from './icons.js'
|
|
7
|
+
import { GalleryState, normalizeGalleryData, emptyGalleryData } from './state.js'
|
|
8
|
+
import { GalleryUploader } from './uploader.js'
|
|
9
|
+
import { renderEmptyView } from './view-empty.js'
|
|
10
|
+
import { renderFilledView } from './view-filled.js'
|
|
11
|
+
import { sanitizeMediaUrl } from '../../shared/sanitize/sanitizeUrl.js'
|
|
12
|
+
|
|
13
|
+
const editorStyles = resolvePath('./gallery.css', import.meta.url)
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {(file: File, context: { signal: AbortSignal }) => Promise<{ url: string, alt?: string }>} UploadFn
|
|
17
|
+
*
|
|
18
|
+
* @typedef {Object} GalleryConfig
|
|
19
|
+
* @property {UploadFn} [uploadFile] Uploads one browser file. Without this callback the plugin reads each file into a data URL stored in the document.
|
|
20
|
+
* @property {Array<{ icon?: string, label: string, handler: (context: { signal: AbortSignal }) => Promise<Array<{url: string, alt?: string}> | null> }>} [actions] Additional application-owned image sources. `icon` is trusted application markup; never pass user-authored HTML.
|
|
21
|
+
* @property {boolean} [injectStyles=true] Whether the editor should load the built-in gallery stylesheet.
|
|
22
|
+
* @property {string} [css] Additional stylesheet URL, or the replacement URL when `injectStyles` is `false`.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Editable image gallery with upload-source extensions, ordering, and layout controls.
|
|
27
|
+
* Internal logic is split across:
|
|
28
|
+
* - `state.js` — per-block state container (replaces module WeakMap)
|
|
29
|
+
* - `uploader.js` — multi-file upload pipeline
|
|
30
|
+
* - `layout.js` — layout selection algorithms
|
|
31
|
+
* - `slot.js` — slot/overflow item DOM builders + drag handling
|
|
32
|
+
* - `view-empty.js`/ `view-filled.js` — DOM rendering for the two states
|
|
33
|
+
* - `settings.js` — settings dropdown form
|
|
34
|
+
* - `styles.js` — gallery-level inline style application
|
|
35
|
+
* @extends {BlockPluginAbstract<GalleryConfig>}
|
|
36
|
+
*/
|
|
37
|
+
export class Gallery extends BlockPluginAbstract {
|
|
38
|
+
static isTextBlock = false
|
|
39
|
+
static styles = [editorStyles]
|
|
40
|
+
|
|
41
|
+
type = 'gallery'
|
|
42
|
+
icon = ICON
|
|
43
|
+
inlineTools = false
|
|
44
|
+
|
|
45
|
+
pasteConfig = {
|
|
46
|
+
files: ['image/*'],
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
#uploader
|
|
50
|
+
/** Per-block state, encapsulated to this plugin instance. */
|
|
51
|
+
#states = /** @type {WeakMap<HTMLElement, GalleryState>} */ (new WeakMap())
|
|
52
|
+
/** @type {WeakMap<HTMLElement, import('../../core/types').BlockMutationContext>} */
|
|
53
|
+
#contexts = new WeakMap()
|
|
54
|
+
/**
|
|
55
|
+
* Create a Gallery instance with the supplied consumer configuration.
|
|
56
|
+
* @param {GalleryConfig} [config]
|
|
57
|
+
*/
|
|
58
|
+
constructor(config) {
|
|
59
|
+
super(config)
|
|
60
|
+
this.#uploader = new GalleryUploader(this._config)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Return the localized toolbox label for this block.
|
|
65
|
+
* @returns {string}
|
|
66
|
+
*/
|
|
67
|
+
get title() {
|
|
68
|
+
return this._t('title', 'Gallery')
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// ── BlockPlugin contract ───────────────────────────────────────────────────
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Create the editable DOM owned by this block instance.
|
|
75
|
+
* @param {Record<string, unknown>} data
|
|
76
|
+
* @param {import('../../core/types').BlockMutationContext} context
|
|
77
|
+
* @returns {HTMLElement}
|
|
78
|
+
*/
|
|
79
|
+
render(data, context) {
|
|
80
|
+
const blockData = normalizeGalleryData(data)
|
|
81
|
+
const pendingFile = /** @type {File | null} */ (/** @type {any} */ (data)?._pendingFile || null)
|
|
82
|
+
|
|
83
|
+
const wrapper = document.createElement('div')
|
|
84
|
+
wrapper.classList.add(CSS.wrapper)
|
|
85
|
+
wrapper.contentEditable = 'false'
|
|
86
|
+
wrapper.tabIndex = -1
|
|
87
|
+
|
|
88
|
+
const state = new GalleryState(blockData, pendingFile ? [pendingFile] : [])
|
|
89
|
+
this.#states.set(wrapper, state)
|
|
90
|
+
this.#contexts.set(wrapper, context)
|
|
91
|
+
|
|
92
|
+
if (blockData.images.length > 0) {
|
|
93
|
+
this.#renderFilled(wrapper)
|
|
94
|
+
} else {
|
|
95
|
+
this.#renderEmpty(wrapper)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (state.pendingFiles.length > 0 && !context.readOnly) {
|
|
99
|
+
const files = state.pendingFiles
|
|
100
|
+
state.pendingFiles = []
|
|
101
|
+
state.pendingUpload = this.#handleFiles(wrapper, files).finally(() => {
|
|
102
|
+
if (this.#states.get(wrapper) === state) state.pendingUpload = null
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return wrapper
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Serialize the current block DOM into document data.
|
|
111
|
+
* @param {HTMLElement} element
|
|
112
|
+
* @returns {Record<string, unknown>}
|
|
113
|
+
*/
|
|
114
|
+
save(element) {
|
|
115
|
+
const state = this.#states.get(element)
|
|
116
|
+
if (!state) return emptyGalleryData()
|
|
117
|
+
this.#syncCaptions(element)
|
|
118
|
+
return {
|
|
119
|
+
images: state.data.images.map((img) => ({ ...img })),
|
|
120
|
+
layout: state.data.layout,
|
|
121
|
+
styles: { ...state.data.styles },
|
|
122
|
+
options: { ...state.data.options },
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Check whether serialized data satisfies this block's schema.
|
|
128
|
+
* @param {Record<string, unknown>} data
|
|
129
|
+
* @returns {boolean}
|
|
130
|
+
*/
|
|
131
|
+
validate(data) {
|
|
132
|
+
return validateGalleryData(data)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Check whether the block has no meaningful user content.
|
|
137
|
+
* @param {HTMLElement} element
|
|
138
|
+
* @returns {boolean}
|
|
139
|
+
*/
|
|
140
|
+
isEmpty(element) {
|
|
141
|
+
const state = this.#states.get(element)
|
|
142
|
+
return !state || state.data.images.length === 0
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Extract neutral text that can initialize another block type.
|
|
147
|
+
* @param {HTMLElement} element
|
|
148
|
+
* @returns {Record<string, unknown>}
|
|
149
|
+
*/
|
|
150
|
+
exportData(element) {
|
|
151
|
+
const state = this.#states.get(element)
|
|
152
|
+
return { text: state?.data.images.map(image => image.caption).filter(Boolean).join(' ') || '' }
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Handle supported pasted content for this block.
|
|
157
|
+
* @param {import('../../types').PasteEvent} event
|
|
158
|
+
* @returns {Record<string, unknown> | null}
|
|
159
|
+
*/
|
|
160
|
+
onPaste(event) {
|
|
161
|
+
if (event.type === 'file') {
|
|
162
|
+
// Files dropped via paste — push immediately into the new block.
|
|
163
|
+
// Render path will then upload via the wrapper bound to this default data.
|
|
164
|
+
const data = /** @type {any} */ (emptyGalleryData())
|
|
165
|
+
data._pendingFile = event.file
|
|
166
|
+
return data
|
|
167
|
+
}
|
|
168
|
+
return null
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Keep pasted files inside one undo transaction until upload completes.
|
|
173
|
+
* @param {HTMLElement} element
|
|
174
|
+
* @returns {Promise<void>}
|
|
175
|
+
*/
|
|
176
|
+
waitForPaste(element) {
|
|
177
|
+
return this.#states.get(element)?.pendingUpload ?? Promise.resolve()
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Release listeners and resources owned by this block element.
|
|
182
|
+
* @param {HTMLElement} element
|
|
183
|
+
* @returns {void}
|
|
184
|
+
*/
|
|
185
|
+
destroy(element) {
|
|
186
|
+
const state = this.#states.get(element)
|
|
187
|
+
if (!state) return
|
|
188
|
+
state.dispose()
|
|
189
|
+
this.#states.delete(element)
|
|
190
|
+
this.#contexts.delete(element)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// ── Internal coordination ──────────────────────────────────────────────────
|
|
194
|
+
|
|
195
|
+
/** @param {string} key @param {string} fallback @returns {string} */
|
|
196
|
+
#t = (key, fallback) => this._t(key, fallback)
|
|
197
|
+
|
|
198
|
+
/** @param {HTMLElement} wrapper @param {() => void} operation @returns {void} */
|
|
199
|
+
#mutate = (wrapper, operation) => {
|
|
200
|
+
this.#contexts.get(wrapper)?.mutate(operation)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Flush in-flight contenteditable caption text into state before any
|
|
205
|
+
* mutation that would re-render and tear down the live caption nodes.
|
|
206
|
+
*
|
|
207
|
+
* @param {HTMLElement} wrapper
|
|
208
|
+
* @returns {void}
|
|
209
|
+
*/
|
|
210
|
+
#syncCaptions(wrapper) {
|
|
211
|
+
const state = this.#states.get(wrapper)
|
|
212
|
+
if (!state) return
|
|
213
|
+
const slots = wrapper.querySelectorAll(`.${CSS.slot}.${CSS.slotFilled}`)
|
|
214
|
+
slots.forEach((slotEl) => {
|
|
215
|
+
const slot = /** @type {HTMLElement} */ (slotEl)
|
|
216
|
+
const idx = parseInt(slot.dataset.slot || slot.dataset.index || '0', 10)
|
|
217
|
+
const img = state.data.images[idx]
|
|
218
|
+
if (img) {
|
|
219
|
+
const caption = slot.querySelector(`.${CSS.slotCaption}`)
|
|
220
|
+
img.caption = caption?.textContent?.trim() || ''
|
|
221
|
+
}
|
|
222
|
+
})
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** @param {HTMLElement} wrapper @returns {void} */
|
|
226
|
+
#renderEmpty(wrapper) {
|
|
227
|
+
const state = this.#states.get(wrapper)
|
|
228
|
+
if (!state) return
|
|
229
|
+
renderEmptyView(wrapper, state, {
|
|
230
|
+
t: this.#t,
|
|
231
|
+
readOnly: Boolean(this.#contexts.get(wrapper)?.readOnly),
|
|
232
|
+
onUploadClick: () => this.#triggerFileInput(wrapper),
|
|
233
|
+
onFilesDropped: (files) => { void this.#handleFiles(wrapper, files) },
|
|
234
|
+
customActions: this._config.actions || [],
|
|
235
|
+
runCustomAction: async (handler) => this.#runCustomAction(wrapper, handler),
|
|
236
|
+
})
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/** @param {HTMLElement} wrapper @returns {void} */
|
|
240
|
+
#renderFilled(wrapper) {
|
|
241
|
+
const state = this.#states.get(wrapper)
|
|
242
|
+
if (!state) return
|
|
243
|
+
renderFilledView(wrapper, state, {
|
|
244
|
+
t: this.#t,
|
|
245
|
+
readOnly: Boolean(this.#contexts.get(wrapper)?.readOnly),
|
|
246
|
+
syncCaptions: () => this.#syncCaptions(wrapper),
|
|
247
|
+
getState: () => this.#states.get(wrapper),
|
|
248
|
+
reRender: () => this.#renderFilled(wrapper),
|
|
249
|
+
renderEmpty: () => this.#renderEmpty(wrapper),
|
|
250
|
+
mutate: (operation) => this.#mutate(wrapper, operation),
|
|
251
|
+
onFilesDropped: (files) => { void this.#handleFiles(wrapper, files) },
|
|
252
|
+
onTriggerFileInput: () => this.#triggerFileInput(wrapper),
|
|
253
|
+
onPromptUrl: () => this.#promptUrl(wrapper),
|
|
254
|
+
onDeleteAll: () => this.#deleteAll(wrapper),
|
|
255
|
+
customActions: this._config.actions || [],
|
|
256
|
+
runCustomAction: async (handler) => this.#runCustomAction(wrapper, handler),
|
|
257
|
+
})
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/** @param {HTMLElement} wrapper @returns {void} */
|
|
261
|
+
#triggerFileInput(wrapper) {
|
|
262
|
+
if (this.#contexts.get(wrapper)?.readOnly) return
|
|
263
|
+
triggerFileInput({
|
|
264
|
+
accept: 'image/*',
|
|
265
|
+
multiple: true,
|
|
266
|
+
signal: this.#states.get(wrapper)?.abortController?.signal,
|
|
267
|
+
onFiles: (files) => void this.#handleFiles(wrapper, files),
|
|
268
|
+
})
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* @param {HTMLElement} wrapper
|
|
273
|
+
* @param {File[]} files
|
|
274
|
+
* @returns {Promise<void>}
|
|
275
|
+
*/
|
|
276
|
+
async #handleFiles(wrapper, files) {
|
|
277
|
+
const state = this.#states.get(wrapper)
|
|
278
|
+
const context = this.#contexts.get(wrapper)
|
|
279
|
+
if (!state || !context || context.readOnly) return
|
|
280
|
+
const accepted = files.filter(isSupportedImageFile)
|
|
281
|
+
if (accepted.length === 0) return
|
|
282
|
+
const controller = state.beginTask()
|
|
283
|
+
wrapper.classList.add(CSS.loading)
|
|
284
|
+
try {
|
|
285
|
+
await this.#uploader.handle(accepted, (added) => {
|
|
286
|
+
if (controller.signal.aborted || this.#states.get(wrapper) !== state) return
|
|
287
|
+
this.#mutate(wrapper, () => {
|
|
288
|
+
this.#syncCaptions(wrapper)
|
|
289
|
+
state.data.images.push(...added)
|
|
290
|
+
this.#renderFilled(wrapper)
|
|
291
|
+
})
|
|
292
|
+
}, controller.signal)
|
|
293
|
+
} finally {
|
|
294
|
+
if (state.finishTask(controller)) wrapper.classList.remove(CSS.loading)
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* @param {HTMLElement} wrapper
|
|
300
|
+
* @param {(context: { signal: AbortSignal }) => Promise<Array<{url: string, alt?: string}> | null>} handler
|
|
301
|
+
* @returns {Promise<void>}
|
|
302
|
+
*/
|
|
303
|
+
async #runCustomAction(wrapper, handler) {
|
|
304
|
+
const state = this.#states.get(wrapper)
|
|
305
|
+
if (!state || this.#contexts.get(wrapper)?.readOnly) return
|
|
306
|
+
const controller = state.beginTask()
|
|
307
|
+
wrapper.classList.add(CSS.loading)
|
|
308
|
+
try {
|
|
309
|
+
const result = await handler({ signal: controller.signal })
|
|
310
|
+
if (!controller.signal.aborted && this.#states.get(wrapper) === state && Array.isArray(result) && result.length > 0) {
|
|
311
|
+
const added = result.flatMap(item => {
|
|
312
|
+
const url = sanitizeMediaUrl(item?.url || '')
|
|
313
|
+
if (!url) return []
|
|
314
|
+
return [{ url, caption: typeof item?.alt === 'string' ? item.alt : '' }]
|
|
315
|
+
})
|
|
316
|
+
if (!added.length) return
|
|
317
|
+
this.#mutate(wrapper, () => {
|
|
318
|
+
this.#syncCaptions(wrapper)
|
|
319
|
+
state.data.images.push(...added)
|
|
320
|
+
this.#renderFilled(wrapper)
|
|
321
|
+
})
|
|
322
|
+
}
|
|
323
|
+
} catch {
|
|
324
|
+
// Action cancelled or failed.
|
|
325
|
+
} finally {
|
|
326
|
+
if (state.finishTask(controller)) wrapper.classList.remove(CSS.loading)
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/** @param {HTMLElement} wrapper @returns {void} */
|
|
331
|
+
#promptUrl(wrapper) {
|
|
332
|
+
const state = this.#states.get(wrapper)
|
|
333
|
+
if (!state || this.#contexts.get(wrapper)?.readOnly) return
|
|
334
|
+
const url = sanitizeMediaUrl(prompt(this.#t('urlPrompt', 'Image URL:')) || '')
|
|
335
|
+
if (url) {
|
|
336
|
+
this.#mutate(wrapper, () => {
|
|
337
|
+
this.#syncCaptions(wrapper)
|
|
338
|
+
state.data.images.push({ url, caption: '' })
|
|
339
|
+
this.#renderFilled(wrapper)
|
|
340
|
+
})
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/** @param {HTMLElement} wrapper @returns {void} */
|
|
345
|
+
#deleteAll(wrapper) {
|
|
346
|
+
const state = this.#states.get(wrapper)
|
|
347
|
+
if (!state) return
|
|
348
|
+
state.cancelTasks()
|
|
349
|
+
wrapper.classList.remove(CSS.loading)
|
|
350
|
+
this.#mutate(wrapper, () => {
|
|
351
|
+
state.data.images = []
|
|
352
|
+
this.#renderEmpty(wrapper)
|
|
353
|
+
})
|
|
354
|
+
}
|
|
355
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Return the number of visible slots provided by a gallery layout.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} layout
|
|
5
|
+
* @returns {number} number of slots, or `Infinity` for layouts that flow all images
|
|
6
|
+
*/
|
|
7
|
+
export function getSlotsCount(layout: string): number;
|
|
8
|
+
/**
|
|
9
|
+
* Pick a template based on image count + per-image orientations.
|
|
10
|
+
* Used after images load and we know each image's aspect ratio.
|
|
11
|
+
*
|
|
12
|
+
* @param {number} count
|
|
13
|
+
* @param {string[]} orientations array of 'L' (landscape) | 'P' (portrait) | 'S' (square)
|
|
14
|
+
* @returns {string}
|
|
15
|
+
*/
|
|
16
|
+
export function selectAutoTemplate(count: number, orientations: string[]): string;
|
|
17
|
+
/**
|
|
18
|
+
* Initial template guess for `auto` layout, before images are loaded
|
|
19
|
+
* (no orientation info available).
|
|
20
|
+
*
|
|
21
|
+
* @param {number} count
|
|
22
|
+
* @returns {string}
|
|
23
|
+
*/
|
|
24
|
+
export function pickInitialAutoTemplate(count: number): string;
|
|
25
|
+
/**
|
|
26
|
+
* Classify an image's orientation from its loaded dimensions.
|
|
27
|
+
* @param {number} width
|
|
28
|
+
* @param {number} height
|
|
29
|
+
* @returns {'L' | 'P' | 'S'}
|
|
30
|
+
*/
|
|
31
|
+
export function classifyOrientation(width: number, height: number): "L" | "P" | "S";
|
|
32
|
+
/** All known layout names (auto, '1'..'6c', triptych, masonry, poly-*). */
|
|
33
|
+
export const ALL_LAYOUTS: string[];
|
|
34
|
+
/** Maximum number of images visible in template-based layouts. */
|
|
35
|
+
export const MAX_VISIBLE: 6;
|