@aquera/nile-elements 1.9.5 → 1.9.7
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/README.md +9 -0
- package/dist/index-178e1e57.cjs.js +2 -0
- package/dist/index-178e1e57.cjs.js.map +1 -0
- package/dist/index-1faa963c.esm.js +1 -0
- package/dist/index-249de90a.esm.js +1 -0
- package/dist/index-353172ed.esm.js +1 -0
- package/dist/index-6f3fa4ab.esm.js +1 -0
- package/dist/index-89c520e9.cjs.js +5 -0
- package/dist/index-89c520e9.cjs.js.map +1 -0
- package/dist/index-920675c4.esm.js +1 -0
- package/dist/index-b387a9f4.cjs.js +2 -0
- package/dist/index-b387a9f4.cjs.js.map +1 -0
- package/dist/index-cc1385e0.cjs.js +2 -0
- package/dist/index-cc1385e0.cjs.js.map +1 -0
- package/dist/index-dedc38a6.esm.js +1 -0
- package/dist/index-df196058.cjs.js +2 -0
- package/dist/index-df196058.cjs.js.map +1 -0
- package/dist/index-f956f56d.cjs.js +7 -0
- package/dist/index-f956f56d.cjs.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +3802 -664
- package/dist/internal/glyph.cjs.js +2 -0
- package/dist/internal/glyph.cjs.js.map +1 -0
- package/dist/internal/glyph.esm.js +5 -0
- package/dist/nile-auto-complete/index.cjs.js +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.cjs.js +1 -1
- package/dist/nile-auto-complete/portal-manager.cjs.js +1 -1
- package/dist/nile-auto-complete/portal-utils.cjs.js +1 -1
- package/dist/nile-chip/nile-chip.css.cjs.js +1 -1
- package/dist/nile-chip/nile-chip.css.cjs.js.map +1 -1
- package/dist/nile-chip/nile-chip.css.esm.js +8 -1
- package/dist/nile-code-editor/extensionSetup.cjs.js +7 -7
- package/dist/nile-code-editor/extensionSetup.cjs.js.map +1 -1
- package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
- package/dist/nile-code-editor/index.cjs.js +1 -1
- package/dist/nile-code-editor/index.esm.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
- package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.esm.js +4 -4
- package/dist/nile-color-picker/index.cjs.js +1 -1
- package/dist/nile-color-picker/nile-color-picker.cjs.js +1 -1
- package/dist/nile-combobox/index.cjs.js +1 -1
- package/dist/nile-combobox/index.esm.js +1 -1
- package/dist/nile-combobox/nile-combobox.cjs.js +1 -1
- package/dist/nile-combobox/nile-combobox.esm.js +1 -1
- package/dist/nile-combobox/portal-manager.cjs.js +1 -1
- package/dist/nile-context-menu/index.cjs.js +1 -1
- package/dist/nile-context-menu/nile-context-menu.cjs.js +1 -1
- package/dist/nile-context-submenu/index.cjs.js +1 -1
- package/dist/nile-context-submenu/nile-context-submenu.cjs.js +1 -1
- package/dist/nile-detail/index.cjs.js +1 -1
- package/dist/nile-detail/index.esm.js +1 -1
- package/dist/nile-detail/nile-detail.cjs.js +1 -1
- package/dist/nile-detail/nile-detail.esm.js +1 -1
- package/dist/nile-dropdown/index.cjs.js +1 -1
- package/dist/nile-dropdown/nile-dropdown.cjs.js +1 -1
- package/dist/nile-dropdown/portal-manager.cjs.js +1 -1
- package/dist/nile-file-upload/index.cjs.js +1 -1
- package/dist/nile-file-upload/nile-file-upload.cjs.js +1 -1
- package/dist/nile-file-upload/nile-file-upload.template.cjs.js +1 -1
- package/dist/nile-floating-panel/index.cjs.js +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.cjs.js +1 -1
- package/dist/nile-hero/nile-hero.cjs.js +1 -1
- package/dist/nile-hero/nile-hero.cjs.js.map +1 -1
- package/dist/nile-hero/nile-hero.css.cjs.js +1 -1
- package/dist/nile-hero/nile-hero.css.cjs.js.map +1 -1
- package/dist/nile-hero/nile-hero.css.esm.js +14 -14
- package/dist/nile-hero/nile-hero.esm.js +1 -1
- package/dist/nile-hero-header/nile-hero-header.cjs.js +1 -1
- package/dist/nile-hero-header/nile-hero-header.cjs.js.map +1 -1
- package/dist/nile-hero-header/nile-hero-header.css.cjs.js +1 -1
- package/dist/nile-hero-header/nile-hero-header.css.cjs.js.map +1 -1
- package/dist/nile-hero-header/nile-hero-header.css.esm.js +11 -11
- package/dist/nile-hero-header/nile-hero-header.esm.js +3 -3
- package/dist/nile-lite-tooltip/index.cjs.js +1 -1
- package/dist/nile-lite-tooltip/nile-lite-tooltip.cjs.js +1 -1
- package/dist/nile-markdown-editor/index.cjs.js +1 -1
- package/dist/nile-markdown-editor/nile-markdown-editor.cjs.js +1 -1
- package/dist/nile-popover/index.cjs.js +1 -1
- package/dist/nile-popover/nile-popover.cjs.js +1 -1
- package/dist/nile-popover/portal-manager.cjs.js +1 -1
- package/dist/nile-popup/index.cjs.js +1 -1
- package/dist/nile-popup/nile-popup.cjs.js +1 -1
- package/dist/nile-rich-text-editor/index.cjs.js +1 -1
- package/dist/nile-rich-text-editor/index.esm.js +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js.map +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js.map +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.css.esm.js +70 -0
- package/dist/nile-rich-text-editor/nile-rich-text-editor.esm.js +1 -1
- package/dist/nile-rich-text-editor/nile-rte-image.cjs.js +3 -0
- package/dist/nile-rich-text-editor/nile-rte-image.cjs.js.map +1 -0
- package/dist/nile-rich-text-editor/nile-rte-image.esm.js +96 -0
- package/dist/nile-select/index.cjs.js +1 -1
- package/dist/nile-select/nile-select.cjs.js +1 -1
- package/dist/nile-select/portal-manager.cjs.js +1 -1
- package/dist/nile-side-bar-action/index.cjs.js +1 -1
- package/dist/nile-side-bar-action/nile-side-bar-action.cjs.js +1 -1
- package/dist/nile-side-bar-action/portal-manager.cjs.js +1 -1
- package/dist/nile-tooltip/index.cjs.js +1 -1
- package/dist/nile-tooltip/nile-tooltip.cjs.js +1 -1
- package/dist/nile-virtual-select/index.cjs.js +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.cjs.js +1 -1
- package/dist/nile-virtual-select/portal-manager.cjs.js +1 -1
- package/dist/nile-virtual-select/renderer.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/emoji.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/emoji.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/emoji.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/commands.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/commands.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/commands.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/create-state.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/export.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/export.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/export.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/index.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/index.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/index.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/inputrules.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/keymap.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/markdown-parse.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/markdown-parse.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/markdown-parse.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/markdown.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/markdown.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/markdown.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/office-paste.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/office-paste.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/office-paste.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/embeds.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/image-view.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/image-view.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/image-view.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/image.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/image.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/image.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/link.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/link.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/link.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/math-view.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/max-length.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/max-length.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/max-length.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/paste.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/paste.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/paste.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/single-line.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/single-line.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/single-line.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/tables.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/task-list.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/task-list.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/task-list.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/sanitize.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/schema.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/schema.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/schema.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/selection-state.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/serializer.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/serializer.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/serializer.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/index.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/index.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/index.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.esm.js +780 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +97 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.esm.js +244 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.esm.js +137 -0
- package/dist/nile-wysiwyg-editor/types.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/types.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/types.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/ui/bookmark-panel.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/bookmark-panel.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/bookmark-panel.esm.js +97 -0
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.esm.js +67 -0
- package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/code-block-menu.esm.js +65 -0
- package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/embed-menu.esm.js +64 -0
- package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/embed-panel.esm.js +68 -0
- package/dist/nile-wysiwyg-editor/ui/emoji-picker.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/emoji-picker.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/emoji-picker.esm.js +96 -0
- package/dist/nile-wysiwyg-editor/ui/find-replace.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/find-replace.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/find-replace.esm.js +112 -0
- package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/image-menu.esm.js +64 -0
- package/dist/nile-wysiwyg-editor/ui/image-panel.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/image-panel.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/image-panel.esm.js +171 -0
- package/dist/nile-wysiwyg-editor/ui/insert-menu.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/insert-menu.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/insert-menu.esm.js +90 -0
- package/dist/nile-wysiwyg-editor/ui/link-editor.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/link-editor.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/link-editor.esm.js +114 -0
- package/dist/nile-wysiwyg-editor/ui/markdown-panel.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/markdown-panel.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/markdown-panel.esm.js +80 -0
- package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/math-panel.esm.js +92 -0
- package/dist/nile-wysiwyg-editor/ui/shortcut-help.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/shortcut-help.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/shortcut-help.esm.js +147 -0
- package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/source-view.esm.js +79 -0
- package/dist/nile-wysiwyg-editor/ui/special-chars.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/special-chars.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/special-chars.esm.js +96 -0
- package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/suggest-list.esm.js +67 -0
- package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/table-grid-picker.esm.js +100 -0
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/table-menu.esm.js +58 -0
- package/dist/src/index.d.ts +24 -0
- package/dist/src/index.js +19 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal/glyph.d.ts +6 -0
- package/dist/src/internal/glyph.js +13 -0
- package/dist/src/internal/glyph.js.map +1 -0
- package/dist/src/nile-chip/nile-chip.css.js +8 -1
- package/dist/src/nile-chip/nile-chip.css.js.map +1 -1
- package/dist/src/nile-code-editor/nile-code-editor.js +3 -3
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/dist/src/nile-hero/nile-hero.css.js +12 -12
- package/dist/src/nile-hero/nile-hero.css.js.map +1 -1
- package/dist/src/nile-hero/nile-hero.js +1 -1
- package/dist/src/nile-hero/nile-hero.js.map +1 -1
- package/dist/src/nile-hero-header/nile-hero-header.css.js +9 -9
- package/dist/src/nile-hero-header/nile-hero-header.css.js.map +1 -1
- package/dist/src/nile-hero-header/nile-hero-header.js +1 -1
- package/dist/src/nile-hero-header/nile-hero-header.js.map +1 -1
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js +70 -0
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js.map +1 -1
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.d.ts +3 -0
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js +81 -3
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js.map +1 -1
- package/dist/src/nile-rich-text-editor/nile-rte-image.d.ts +87 -0
- package/dist/src/nile-rich-text-editor/nile-rte-image.js +1073 -0
- package/dist/src/nile-rich-text-editor/nile-rte-image.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/emoji.d.ts +5 -0
- package/dist/src/nile-wysiwyg-editor/emoji.js +138 -0
- package/dist/src/nile-wysiwyg-editor/emoji.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/commands.d.ts +69 -0
- package/dist/src/nile-wysiwyg-editor/engine/commands.js +863 -0
- package/dist/src/nile-wysiwyg-editor/engine/commands.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/create-state.d.ts +35 -0
- package/dist/src/nile-wysiwyg-editor/engine/create-state.js +67 -0
- package/dist/src/nile-wysiwyg-editor/engine/create-state.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/export.d.ts +38 -0
- package/dist/src/nile-wysiwyg-editor/engine/export.js +208 -0
- package/dist/src/nile-wysiwyg-editor/engine/export.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/export.test.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/export.test.js +96 -0
- package/dist/src/nile-wysiwyg-editor/engine/export.test.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/index.d.ts +37 -0
- package/dist/src/nile-wysiwyg-editor/engine/index.js +29 -0
- package/dist/src/nile-wysiwyg-editor/engine/index.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/inputrules.d.ts +12 -0
- package/dist/src/nile-wysiwyg-editor/engine/inputrules.js +144 -0
- package/dist/src/nile-wysiwyg-editor/engine/inputrules.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/keymap.d.ts +15 -0
- package/dist/src/nile-wysiwyg-editor/engine/keymap.js +94 -0
- package/dist/src/nile-wysiwyg-editor/engine/keymap.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.d.ts +22 -0
- package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.js +287 -0
- package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.test.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.test.js +106 -0
- package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.test.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/markdown.d.ts +10 -0
- package/dist/src/nile-wysiwyg-editor/engine/markdown.js +162 -0
- package/dist/src/nile-wysiwyg-editor/engine/markdown.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/office-paste.d.ts +13 -0
- package/dist/src/nile-wysiwyg-editor/engine/office-paste.js +182 -0
- package/dist/src/nile-wysiwyg-editor/engine/office-paste.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/code-highlight.d.ts +10 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/code-highlight.js +165 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/code-highlight.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.d.ts +17 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js +69 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.d.ts +17 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js +96 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/find-replace.d.ts +26 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/find-replace.js +123 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/find-replace.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/format-painter.d.ts +28 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/format-painter.js +72 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/format-painter.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.d.ts +41 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.js +176 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/image.d.ts +15 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/image.js +64 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/image.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/link.d.ts +11 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/link.js +42 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/link.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.d.ts +18 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js +46 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/max-length.d.ts +7 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/max-length.js +26 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/max-length.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.d.ts +31 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.js +55 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/placeholder.d.ts +7 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/placeholder.js +25 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/placeholder.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/single-line.d.ts +10 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/single-line.js +48 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/single-line.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/suggestions.d.ts +29 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/suggestions.js +87 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/suggestions.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.d.ts +8 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js +11 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/task-list.d.ts +16 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/task-list.js +49 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/task-list.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/pm.test.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/pm.test.js +883 -0
- package/dist/src/nile-wysiwyg-editor/engine/pm.test.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/productivity.test.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/productivity.test.js +129 -0
- package/dist/src/nile-wysiwyg-editor/engine/productivity.test.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.d.ts +13 -0
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.js +155 -0
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/schema.d.ts +20 -0
- package/dist/src/nile-wysiwyg-editor/engine/schema.js +823 -0
- package/dist/src/nile-wysiwyg-editor/engine/schema.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/selection-state.d.ts +70 -0
- package/dist/src/nile-wysiwyg-editor/engine/selection-state.js +138 -0
- package/dist/src/nile-wysiwyg-editor/engine/selection-state.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/serializer.d.ts +18 -0
- package/dist/src/nile-wysiwyg-editor/engine/serializer.js +63 -0
- package/dist/src/nile-wysiwyg-editor/engine/serializer.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/index.d.ts +3 -0
- package/dist/src/nile-wysiwyg-editor/index.js +3 -0
- package/dist/src/nile-wysiwyg-editor/index.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js +782 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.d.ts +364 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js +2038 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js +636 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js +2 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.d.ts +6 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js +251 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.d.ts +41 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js +700 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/types.d.ts +49 -0
- package/dist/src/nile-wysiwyg-editor/types.js +8 -0
- package/dist/src/nile-wysiwyg-editor/types.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.d.ts +20 -0
- package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.js +159 -0
- package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.d.ts +21 -0
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js +125 -0
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/code-block-menu.d.ts +18 -0
- package/dist/src/nile-wysiwyg-editor/ui/code-block-menu.js +107 -0
- package/dist/src/nile-wysiwyg-editor/ui/code-block-menu.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/embed-menu.d.ts +19 -0
- package/dist/src/nile-wysiwyg-editor/ui/embed-menu.js +123 -0
- package/dist/src/nile-wysiwyg-editor/ui/embed-menu.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.d.ts +27 -0
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js +146 -0
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.d.ts +21 -0
- package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.js +154 -0
- package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/find-replace.d.ts +26 -0
- package/dist/src/nile-wysiwyg-editor/ui/find-replace.js +178 -0
- package/dist/src/nile-wysiwyg-editor/ui/find-replace.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/image-menu.d.ts +18 -0
- package/dist/src/nile-wysiwyg-editor/ui/image-menu.js +129 -0
- package/dist/src/nile-wysiwyg-editor/ui/image-menu.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/image-panel.d.ts +56 -0
- package/dist/src/nile-wysiwyg-editor/ui/image-panel.js +349 -0
- package/dist/src/nile-wysiwyg-editor/ui/image-panel.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/insert-menu.d.ts +25 -0
- package/dist/src/nile-wysiwyg-editor/ui/insert-menu.js +142 -0
- package/dist/src/nile-wysiwyg-editor/ui/insert-menu.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/link-editor.d.ts +30 -0
- package/dist/src/nile-wysiwyg-editor/ui/link-editor.js +189 -0
- package/dist/src/nile-wysiwyg-editor/ui/link-editor.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.d.ts +24 -0
- package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.js +144 -0
- package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/math-panel.d.ts +31 -0
- package/dist/src/nile-wysiwyg-editor/ui/math-panel.js +172 -0
- package/dist/src/nile-wysiwyg-editor/ui/math-panel.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.d.ts +30 -0
- package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.js +296 -0
- package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/source-view.d.ts +19 -0
- package/dist/src/nile-wysiwyg-editor/ui/source-view.js +120 -0
- package/dist/src/nile-wysiwyg-editor/ui/source-view.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/special-chars.d.ts +20 -0
- package/dist/src/nile-wysiwyg-editor/ui/special-chars.js +199 -0
- package/dist/src/nile-wysiwyg-editor/ui/special-chars.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.d.ts +31 -0
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js +133 -0
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.d.ts +23 -0
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js +177 -0
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/table-menu.d.ts +16 -0
- package/dist/src/nile-wysiwyg-editor/ui/table-menu.js +101 -0
- package/dist/src/nile-wysiwyg-editor/ui/table-menu.js.map +1 -0
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -2
- package/src/index.ts +57 -1
- package/src/internal/glyph.ts +13 -0
- package/src/nile-chip/nile-chip.css.ts +8 -1
- package/src/nile-code-editor/nile-code-editor.ts +3 -3
- package/src/nile-hero/nile-hero.css.ts +12 -12
- package/src/nile-hero/nile-hero.ts +1 -1
- package/src/nile-hero-header/nile-hero-header.css.ts +9 -9
- package/src/nile-hero-header/nile-hero-header.ts +1 -1
- package/src/nile-rich-text-editor/nile-rich-text-editor.css.ts +70 -0
- package/src/nile-rich-text-editor/nile-rich-text-editor.ts +89 -3
- package/src/nile-rich-text-editor/nile-rte-image.ts +1132 -0
- package/src/nile-wysiwyg-editor/emoji.ts +137 -0
- package/src/nile-wysiwyg-editor/engine/commands.ts +1035 -0
- package/src/nile-wysiwyg-editor/engine/create-state.ts +117 -0
- package/src/nile-wysiwyg-editor/engine/export.test.ts +113 -0
- package/src/nile-wysiwyg-editor/engine/export.ts +242 -0
- package/src/nile-wysiwyg-editor/engine/index.ts +69 -0
- package/src/nile-wysiwyg-editor/engine/inputrules.ts +169 -0
- package/src/nile-wysiwyg-editor/engine/keymap.ts +146 -0
- package/src/nile-wysiwyg-editor/engine/markdown-parse.test.ts +148 -0
- package/src/nile-wysiwyg-editor/engine/markdown-parse.ts +337 -0
- package/src/nile-wysiwyg-editor/engine/markdown.ts +165 -0
- package/src/nile-wysiwyg-editor/engine/office-paste.ts +199 -0
- package/src/nile-wysiwyg-editor/engine/plugins/code-highlight.ts +173 -0
- package/src/nile-wysiwyg-editor/engine/plugins/embed-view.ts +85 -0
- package/src/nile-wysiwyg-editor/engine/plugins/embeds.ts +99 -0
- package/src/nile-wysiwyg-editor/engine/plugins/find-replace.ts +155 -0
- package/src/nile-wysiwyg-editor/engine/plugins/format-painter.ts +80 -0
- package/src/nile-wysiwyg-editor/engine/plugins/image-view.ts +220 -0
- package/src/nile-wysiwyg-editor/engine/plugins/image.ts +80 -0
- package/src/nile-wysiwyg-editor/engine/plugins/link.ts +42 -0
- package/src/nile-wysiwyg-editor/engine/plugins/math-view.ts +56 -0
- package/src/nile-wysiwyg-editor/engine/plugins/max-length.ts +24 -0
- package/src/nile-wysiwyg-editor/engine/plugins/paste.ts +74 -0
- package/src/nile-wysiwyg-editor/engine/plugins/placeholder.ts +24 -0
- package/src/nile-wysiwyg-editor/engine/plugins/single-line.ts +47 -0
- package/src/nile-wysiwyg-editor/engine/plugins/suggestions.ts +110 -0
- package/src/nile-wysiwyg-editor/engine/plugins/tables.ts +12 -0
- package/src/nile-wysiwyg-editor/engine/plugins/task-list.ts +65 -0
- package/src/nile-wysiwyg-editor/engine/pm.test.ts +1088 -0
- package/src/nile-wysiwyg-editor/engine/productivity.test.ts +163 -0
- package/src/nile-wysiwyg-editor/engine/sanitize.ts +156 -0
- package/src/nile-wysiwyg-editor/engine/schema.ts +859 -0
- package/src/nile-wysiwyg-editor/engine/selection-state.ts +210 -0
- package/src/nile-wysiwyg-editor/engine/serializer.ts +78 -0
- package/src/nile-wysiwyg-editor/index.ts +3 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.ts +782 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.ts +750 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.ts +2155 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.ts +1 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.ts +251 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.ts +772 -0
- package/src/nile-wysiwyg-editor/types.ts +83 -0
- package/src/nile-wysiwyg-editor/ui/bookmark-panel.ts +155 -0
- package/src/nile-wysiwyg-editor/ui/bubble-menu.ts +135 -0
- package/src/nile-wysiwyg-editor/ui/code-block-menu.ts +105 -0
- package/src/nile-wysiwyg-editor/ui/embed-menu.ts +133 -0
- package/src/nile-wysiwyg-editor/ui/embed-panel.ts +143 -0
- package/src/nile-wysiwyg-editor/ui/emoji-picker.ts +152 -0
- package/src/nile-wysiwyg-editor/ui/find-replace.ts +174 -0
- package/src/nile-wysiwyg-editor/ui/image-menu.ts +140 -0
- package/src/nile-wysiwyg-editor/ui/image-panel.ts +337 -0
- package/src/nile-wysiwyg-editor/ui/insert-menu.ts +142 -0
- package/src/nile-wysiwyg-editor/ui/link-editor.ts +180 -0
- package/src/nile-wysiwyg-editor/ui/markdown-panel.ts +143 -0
- package/src/nile-wysiwyg-editor/ui/math-panel.ts +169 -0
- package/src/nile-wysiwyg-editor/ui/shortcut-help.ts +311 -0
- package/src/nile-wysiwyg-editor/ui/source-view.ts +119 -0
- package/src/nile-wysiwyg-editor/ui/special-chars.ts +209 -0
- package/src/nile-wysiwyg-editor/ui/suggest-list.ts +138 -0
- package/src/nile-wysiwyg-editor/ui/table-grid-picker.ts +173 -0
- package/src/nile-wysiwyg-editor/ui/table-menu.ts +109 -0
- package/vscode-html-custom-data.json +491 -1
- package/web-dev-server.config.mjs +6 -2
- package/dist/index-5fef1a0d.esm.js +0 -1
- package/dist/index-8f38fae3.cjs.js +0 -2
- package/dist/index-8f38fae3.cjs.js.map +0 -1
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
2
|
+
import { Decoration, DecorationSet } from 'prosemirror-view';
|
|
3
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
4
|
+
import hljs from 'highlight.js/lib/core';
|
|
5
|
+
import javascript from 'highlight.js/lib/languages/javascript';
|
|
6
|
+
import typescript from 'highlight.js/lib/languages/typescript';
|
|
7
|
+
import json from 'highlight.js/lib/languages/json';
|
|
8
|
+
import xml from 'highlight.js/lib/languages/xml';
|
|
9
|
+
import css from 'highlight.js/lib/languages/css';
|
|
10
|
+
import scss from 'highlight.js/lib/languages/scss';
|
|
11
|
+
import sql from 'highlight.js/lib/languages/sql';
|
|
12
|
+
import python from 'highlight.js/lib/languages/python';
|
|
13
|
+
import java from 'highlight.js/lib/languages/java';
|
|
14
|
+
import bash from 'highlight.js/lib/languages/bash';
|
|
15
|
+
import shell from 'highlight.js/lib/languages/shell';
|
|
16
|
+
import markdown from 'highlight.js/lib/languages/markdown';
|
|
17
|
+
import plaintext from 'highlight.js/lib/languages/plaintext';
|
|
18
|
+
import c from 'highlight.js/lib/languages/c';
|
|
19
|
+
import cpp from 'highlight.js/lib/languages/cpp';
|
|
20
|
+
import csharp from 'highlight.js/lib/languages/csharp';
|
|
21
|
+
import go from 'highlight.js/lib/languages/go';
|
|
22
|
+
import rust from 'highlight.js/lib/languages/rust';
|
|
23
|
+
import php from 'highlight.js/lib/languages/php';
|
|
24
|
+
import ruby from 'highlight.js/lib/languages/ruby';
|
|
25
|
+
import kotlin from 'highlight.js/lib/languages/kotlin';
|
|
26
|
+
import swift from 'highlight.js/lib/languages/swift';
|
|
27
|
+
import yaml from 'highlight.js/lib/languages/yaml';
|
|
28
|
+
import dockerfile from 'highlight.js/lib/languages/dockerfile';
|
|
29
|
+
import diff from 'highlight.js/lib/languages/diff';
|
|
30
|
+
import graphql from 'highlight.js/lib/languages/graphql';
|
|
31
|
+
|
|
32
|
+
hljs.registerLanguage('javascript', javascript);
|
|
33
|
+
hljs.registerLanguage('typescript', typescript);
|
|
34
|
+
hljs.registerLanguage('json', json);
|
|
35
|
+
hljs.registerLanguage('xml', xml);
|
|
36
|
+
hljs.registerAliases(['html'], { languageName: 'xml' });
|
|
37
|
+
hljs.registerLanguage('css', css);
|
|
38
|
+
hljs.registerLanguage('scss', scss);
|
|
39
|
+
hljs.registerLanguage('sql', sql);
|
|
40
|
+
hljs.registerLanguage('python', python);
|
|
41
|
+
hljs.registerLanguage('java', java);
|
|
42
|
+
hljs.registerLanguage('bash', bash);
|
|
43
|
+
hljs.registerLanguage('shell', shell);
|
|
44
|
+
hljs.registerLanguage('markdown', markdown);
|
|
45
|
+
hljs.registerLanguage('plaintext', plaintext);
|
|
46
|
+
hljs.registerLanguage('c', c);
|
|
47
|
+
hljs.registerLanguage('cpp', cpp);
|
|
48
|
+
hljs.registerLanguage('csharp', csharp);
|
|
49
|
+
hljs.registerLanguage('go', go);
|
|
50
|
+
hljs.registerLanguage('rust', rust);
|
|
51
|
+
hljs.registerLanguage('php', php);
|
|
52
|
+
hljs.registerLanguage('ruby', ruby);
|
|
53
|
+
hljs.registerLanguage('kotlin', kotlin);
|
|
54
|
+
hljs.registerLanguage('swift', swift);
|
|
55
|
+
hljs.registerLanguage('yaml', yaml);
|
|
56
|
+
hljs.registerLanguage('dockerfile', dockerfile);
|
|
57
|
+
hljs.registerLanguage('diff', diff);
|
|
58
|
+
hljs.registerLanguage('graphql', graphql);
|
|
59
|
+
|
|
60
|
+
export const codeHighlightKey = new PluginKey<DecorationSet>('nileCodeHighlight');
|
|
61
|
+
|
|
62
|
+
/** Languages offered in the code block language picker. '' = auto-detect. */
|
|
63
|
+
export const CODE_LANGUAGES: { value: string; label: string }[] = [
|
|
64
|
+
{ value: '', label: 'Auto' },
|
|
65
|
+
{ value: 'plaintext', label: 'Plain text' },
|
|
66
|
+
{ value: 'javascript', label: 'JavaScript' },
|
|
67
|
+
{ value: 'typescript', label: 'TypeScript' },
|
|
68
|
+
{ value: 'json', label: 'JSON' },
|
|
69
|
+
{ value: 'html', label: 'HTML' },
|
|
70
|
+
{ value: 'css', label: 'CSS' },
|
|
71
|
+
{ value: 'scss', label: 'SCSS' },
|
|
72
|
+
{ value: 'sql', label: 'SQL' },
|
|
73
|
+
{ value: 'python', label: 'Python' },
|
|
74
|
+
{ value: 'java', label: 'Java' },
|
|
75
|
+
{ value: 'c', label: 'C' },
|
|
76
|
+
{ value: 'cpp', label: 'C++' },
|
|
77
|
+
{ value: 'csharp', label: 'C#' },
|
|
78
|
+
{ value: 'go', label: 'Go' },
|
|
79
|
+
{ value: 'rust', label: 'Rust' },
|
|
80
|
+
{ value: 'php', label: 'PHP' },
|
|
81
|
+
{ value: 'ruby', label: 'Ruby' },
|
|
82
|
+
{ value: 'kotlin', label: 'Kotlin' },
|
|
83
|
+
{ value: 'swift', label: 'Swift' },
|
|
84
|
+
{ value: 'bash', label: 'Bash' },
|
|
85
|
+
{ value: 'shell', label: 'Shell' },
|
|
86
|
+
{ value: 'yaml', label: 'YAML' },
|
|
87
|
+
{ value: 'dockerfile', label: 'Dockerfile' },
|
|
88
|
+
{ value: 'graphql', label: 'GraphQL' },
|
|
89
|
+
{ value: 'diff', label: 'Diff' },
|
|
90
|
+
{ value: 'markdown', label: 'Markdown' },
|
|
91
|
+
];
|
|
92
|
+
|
|
93
|
+
const AUTO_DETECT_SUBSET = [
|
|
94
|
+
'javascript', 'typescript', 'json', 'xml', 'css', 'sql', 'python', 'java',
|
|
95
|
+
'bash', 'go', 'rust', 'ruby',
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
const MAX_HIGHLIGHT_LENGTH = 20000;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Converts highlight.js' emitted HTML into inline decorations. hljs escapes
|
|
102
|
+
* but never reorders text, so parsed text offsets map 1:1 onto the node.
|
|
103
|
+
*/
|
|
104
|
+
function decorationsForCode(text: string, language: string | null, base: number): Decoration[] {
|
|
105
|
+
if (!text || text.length > MAX_HIGHLIGHT_LENGTH) return [];
|
|
106
|
+
let value: string;
|
|
107
|
+
try {
|
|
108
|
+
if (language && hljs.getLanguage(language)) {
|
|
109
|
+
value = hljs.highlight(text, { language }).value;
|
|
110
|
+
} else if (language === 'plaintext') {
|
|
111
|
+
return [];
|
|
112
|
+
} else {
|
|
113
|
+
value = hljs.highlightAuto(text, AUTO_DETECT_SUBSET).value;
|
|
114
|
+
}
|
|
115
|
+
} catch {
|
|
116
|
+
return [];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const template = document.createElement('template');
|
|
120
|
+
template.innerHTML = value;
|
|
121
|
+
const decorations: Decoration[] = [];
|
|
122
|
+
let offset = 0;
|
|
123
|
+
const walk = (node: globalThis.Node, classes: string[]): void => {
|
|
124
|
+
node.childNodes.forEach(child => {
|
|
125
|
+
if (child.nodeType === 3) {
|
|
126
|
+
const length = child.nodeValue?.length ?? 0;
|
|
127
|
+
if (classes.length && length) {
|
|
128
|
+
decorations.push(
|
|
129
|
+
Decoration.inline(base + offset, base + offset + length, {
|
|
130
|
+
class: classes.join(' '),
|
|
131
|
+
})
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
offset += length;
|
|
135
|
+
} else if (child.nodeType === 1) {
|
|
136
|
+
const el = child as Element;
|
|
137
|
+
walk(el, [...classes, ...el.className.split(/\s+/).filter(Boolean)]);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
walk(template.content, []);
|
|
142
|
+
return decorations;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function buildDecorations(doc: PMNode): DecorationSet {
|
|
146
|
+
const decorations: Decoration[] = [];
|
|
147
|
+
doc.descendants((node, pos) => {
|
|
148
|
+
if (node.type.name === 'code_block') {
|
|
149
|
+
decorations.push(
|
|
150
|
+
...decorationsForCode(node.textContent, node.attrs.language, pos + 1)
|
|
151
|
+
);
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
return true;
|
|
155
|
+
});
|
|
156
|
+
return decorations.length ? DecorationSet.create(doc, decorations) : DecorationSet.empty;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Syntax highlighting for code blocks, recomputed on document changes. */
|
|
160
|
+
export function codeHighlightPlugin(): Plugin<DecorationSet> {
|
|
161
|
+
return new Plugin<DecorationSet>({
|
|
162
|
+
key: codeHighlightKey,
|
|
163
|
+
state: {
|
|
164
|
+
init: (_config, state) => buildDecorations(state.doc),
|
|
165
|
+
apply: (tr, old) => (tr.docChanged ? buildDecorations(tr.doc) : old),
|
|
166
|
+
},
|
|
167
|
+
props: {
|
|
168
|
+
decorations(state) {
|
|
169
|
+
return codeHighlightKey.getState(state);
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
2
|
+
import { EditorView, NodeView } from 'prosemirror-view';
|
|
3
|
+
import { attachResizeHandles, isResizeEvent } from './image-view';
|
|
4
|
+
|
|
5
|
+
/** Below this a 16:9 player is unusable and its own controls stop fitting. */
|
|
6
|
+
const MIN_EMBED_WIDTH = 160;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Video embed (YouTube/Vimeo/Loom) with the same corner drag-resize handles
|
|
10
|
+
* as images. Only the width is dragged; the 16:9 aspect ratio comes from CSS,
|
|
11
|
+
* so the height follows automatically.
|
|
12
|
+
*/
|
|
13
|
+
export class EmbedView implements NodeView {
|
|
14
|
+
dom: HTMLDivElement;
|
|
15
|
+
|
|
16
|
+
private iframe: HTMLIFrameElement;
|
|
17
|
+
|
|
18
|
+
constructor(
|
|
19
|
+
private node: PMNode,
|
|
20
|
+
view: EditorView,
|
|
21
|
+
getPos: () => number | undefined
|
|
22
|
+
) {
|
|
23
|
+
this.dom = document.createElement('div');
|
|
24
|
+
this.dom.className = 'nile-wysiwyg__embed';
|
|
25
|
+
this.iframe = document.createElement('iframe');
|
|
26
|
+
this.iframe.setAttribute('frameborder', '0');
|
|
27
|
+
this.iframe.setAttribute('allowfullscreen', 'true');
|
|
28
|
+
this.iframe.setAttribute(
|
|
29
|
+
'allow',
|
|
30
|
+
'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture'
|
|
31
|
+
);
|
|
32
|
+
this.dom.appendChild(this.iframe);
|
|
33
|
+
this.applyAttrs(node);
|
|
34
|
+
|
|
35
|
+
attachResizeHandles(
|
|
36
|
+
this.dom,
|
|
37
|
+
this.dom,
|
|
38
|
+
width => {
|
|
39
|
+
const pos = getPos();
|
|
40
|
+
if (pos === undefined || !view.editable) return;
|
|
41
|
+
const current = view.state.doc.nodeAt(pos);
|
|
42
|
+
if (!current) return;
|
|
43
|
+
view.dispatch(
|
|
44
|
+
view.state.tr.setNodeMarkup(pos, undefined, { ...current.attrs, width })
|
|
45
|
+
);
|
|
46
|
+
},
|
|
47
|
+
MIN_EMBED_WIDTH
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private applyAttrs(node: PMNode): void {
|
|
52
|
+
const { src, provider, title, width, align } = node.attrs;
|
|
53
|
+
if (this.iframe.getAttribute('src') !== src) this.iframe.setAttribute('src', src);
|
|
54
|
+
this.dom.setAttribute('data-embed-provider', provider ?? 'generic');
|
|
55
|
+
if (title) this.iframe.title = title;
|
|
56
|
+
else this.iframe.removeAttribute('title');
|
|
57
|
+
if (width) {
|
|
58
|
+
this.dom.setAttribute('data-width', String(width));
|
|
59
|
+
this.dom.style.width = `${width}px`;
|
|
60
|
+
} else {
|
|
61
|
+
this.dom.removeAttribute('data-width');
|
|
62
|
+
this.dom.style.width = '';
|
|
63
|
+
}
|
|
64
|
+
// Block alignment via auto margins (mirrors the image figure).
|
|
65
|
+
if (align) this.dom.setAttribute('data-align', align);
|
|
66
|
+
else this.dom.removeAttribute('data-align');
|
|
67
|
+
this.dom.style.marginLeft = align === 'center' || align === 'right' ? 'auto' : '';
|
|
68
|
+
this.dom.style.marginRight = align === 'center' ? 'auto' : '';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
update(node: PMNode): boolean {
|
|
72
|
+
if (node.type !== this.node.type) return false;
|
|
73
|
+
this.node = node;
|
|
74
|
+
this.applyAttrs(node);
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
stopEvent(event: Event): boolean {
|
|
79
|
+
return isResizeEvent(event);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
ignoreMutation(): boolean {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Plugin } from 'prosemirror-state';
|
|
2
|
+
|
|
3
|
+
export interface EmbedTarget {
|
|
4
|
+
src: string;
|
|
5
|
+
provider: 'youtube' | 'vimeo' | 'loom';
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Converts share/watch URLs from supported providers into their embed URLs.
|
|
10
|
+
* Returns null for anything unrecognized — only these providers are allowed.
|
|
11
|
+
*/
|
|
12
|
+
export function toEmbedUrl(url: string): EmbedTarget | null {
|
|
13
|
+
let parsed: URL;
|
|
14
|
+
try {
|
|
15
|
+
parsed = new URL(url.trim());
|
|
16
|
+
} catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
if (parsed.protocol !== 'https:') return null;
|
|
20
|
+
const host = parsed.hostname.replace(/^www\./, '');
|
|
21
|
+
|
|
22
|
+
// YouTube: watch?v=ID, youtu.be/ID, shorts/ID, embed/ID
|
|
23
|
+
if (host === 'youtube.com' || host === 'youtube-nocookie.com' || host === 'youtu.be') {
|
|
24
|
+
let id = '';
|
|
25
|
+
if (host === 'youtu.be') id = parsed.pathname.slice(1).split('/')[0];
|
|
26
|
+
else if (parsed.pathname === '/watch') id = parsed.searchParams.get('v') ?? '';
|
|
27
|
+
else {
|
|
28
|
+
const match = /^\/(embed|shorts)\/([\w-]+)/.exec(parsed.pathname);
|
|
29
|
+
if (match) id = match[2];
|
|
30
|
+
}
|
|
31
|
+
if (/^[\w-]{6,20}$/.test(id)) {
|
|
32
|
+
return { src: `https://www.youtube-nocookie.com/embed/${id}`, provider: 'youtube' };
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Vimeo: vimeo.com/123456789, player.vimeo.com/video/123456789
|
|
38
|
+
if (host === 'vimeo.com' || host === 'player.vimeo.com') {
|
|
39
|
+
const match = /\/(?:video\/)?(\d{6,12})(?:$|[/?])/.exec(parsed.pathname);
|
|
40
|
+
if (match) {
|
|
41
|
+
return { src: `https://player.vimeo.com/video/${match[1]}`, provider: 'vimeo' };
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Loom: loom.com/share/ID or loom.com/embed/ID
|
|
47
|
+
if (host === 'loom.com') {
|
|
48
|
+
const match = /^\/(share|embed)\/([0-9a-f]{16,40})/.exec(parsed.pathname);
|
|
49
|
+
if (match) {
|
|
50
|
+
return { src: `https://www.loom.com/embed/${match[2]}`, provider: 'loom' };
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** True when a URL is already a permitted embed src (sanitizer check). */
|
|
59
|
+
export function isAllowedEmbedSrc(src: string): boolean {
|
|
60
|
+
let parsed: URL;
|
|
61
|
+
try {
|
|
62
|
+
parsed = new URL(src.trim());
|
|
63
|
+
} catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
if (parsed.protocol !== 'https:') return false;
|
|
67
|
+
const host = parsed.hostname.replace(/^www\./, '');
|
|
68
|
+
return (
|
|
69
|
+
((host === 'youtube.com' || host === 'youtube-nocookie.com') &&
|
|
70
|
+
parsed.pathname.startsWith('/embed/')) ||
|
|
71
|
+
(host === 'player.vimeo.com' && parsed.pathname.startsWith('/video/')) ||
|
|
72
|
+
(host === 'loom.com' && parsed.pathname.startsWith('/embed/'))
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Pasting a bare provider URL onto an empty selection inserts an embed
|
|
78
|
+
* instead of plain text. (Pasting over selected text still creates a link.)
|
|
79
|
+
*/
|
|
80
|
+
export function embedPastePlugin(): Plugin {
|
|
81
|
+
return new Plugin({
|
|
82
|
+
props: {
|
|
83
|
+
handlePaste(view, event) {
|
|
84
|
+
const { state } = view;
|
|
85
|
+
if (!state.selection.empty) return false;
|
|
86
|
+
const text = event.clipboardData?.getData('text/plain')?.trim();
|
|
87
|
+
if (!text || /\s/.test(text)) return false;
|
|
88
|
+
const target = toEmbedUrl(text);
|
|
89
|
+
if (!target) return false;
|
|
90
|
+
const embed = state.schema.nodes.embed.create({
|
|
91
|
+
src: target.src,
|
|
92
|
+
provider: target.provider,
|
|
93
|
+
});
|
|
94
|
+
view.dispatch(state.tr.replaceSelectionWith(embed).scrollIntoView());
|
|
95
|
+
return true;
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { Plugin, PluginKey, EditorState, Transaction } from 'prosemirror-state';
|
|
2
|
+
import { Decoration, DecorationSet } from 'prosemirror-view';
|
|
3
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
4
|
+
|
|
5
|
+
export const findReplaceKey = new PluginKey<FindState>('nileFindReplace');
|
|
6
|
+
|
|
7
|
+
export interface FindMatch {
|
|
8
|
+
from: number;
|
|
9
|
+
to: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface FindState {
|
|
13
|
+
query: string;
|
|
14
|
+
caseSensitive: boolean;
|
|
15
|
+
matches: FindMatch[];
|
|
16
|
+
activeIndex: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const EMPTY: FindState = { query: '', caseSensitive: false, matches: [], activeIndex: 0 };
|
|
20
|
+
|
|
21
|
+
type FindMeta =
|
|
22
|
+
| { type: 'search'; query: string; caseSensitive?: boolean }
|
|
23
|
+
| { type: 'next' }
|
|
24
|
+
| { type: 'prev' }
|
|
25
|
+
| { type: 'clear' };
|
|
26
|
+
|
|
27
|
+
function findMatches(doc: PMNode, query: string, caseSensitive: boolean): FindMatch[] {
|
|
28
|
+
if (!query) return [];
|
|
29
|
+
const matches: FindMatch[] = [];
|
|
30
|
+
const needle = caseSensitive ? query : query.toLowerCase();
|
|
31
|
+
doc.descendants((node, pos) => {
|
|
32
|
+
if (!node.isTextblock) return true;
|
|
33
|
+
const text = node.textBetween(0, node.content.size, '\0', '\0');
|
|
34
|
+
const haystack = caseSensitive ? text : text.toLowerCase();
|
|
35
|
+
let index = 0;
|
|
36
|
+
// eslint-disable-next-line no-cond-assign
|
|
37
|
+
while ((index = haystack.indexOf(needle, index)) !== -1) {
|
|
38
|
+
matches.push({ from: pos + 1 + index, to: pos + 1 + index + needle.length });
|
|
39
|
+
index += needle.length;
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
});
|
|
43
|
+
return matches;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function applyMeta(state: FindState, meta: FindMeta, doc: PMNode): FindState {
|
|
47
|
+
switch (meta.type) {
|
|
48
|
+
case 'search': {
|
|
49
|
+
const caseSensitive = meta.caseSensitive ?? state.caseSensitive;
|
|
50
|
+
return {
|
|
51
|
+
query: meta.query,
|
|
52
|
+
caseSensitive,
|
|
53
|
+
matches: findMatches(doc, meta.query, caseSensitive),
|
|
54
|
+
activeIndex: 0,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
case 'next':
|
|
58
|
+
return state.matches.length
|
|
59
|
+
? { ...state, activeIndex: (state.activeIndex + 1) % state.matches.length }
|
|
60
|
+
: state;
|
|
61
|
+
case 'prev':
|
|
62
|
+
return state.matches.length
|
|
63
|
+
? {
|
|
64
|
+
...state,
|
|
65
|
+
activeIndex:
|
|
66
|
+
(state.activeIndex - 1 + state.matches.length) % state.matches.length,
|
|
67
|
+
}
|
|
68
|
+
: state;
|
|
69
|
+
case 'clear':
|
|
70
|
+
default:
|
|
71
|
+
return EMPTY;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Find & replace: match highlighting with an active match, controlled via
|
|
77
|
+
* transaction meta. Replacement itself is a normal text transaction issued
|
|
78
|
+
* by the host (see findReplaceCommands).
|
|
79
|
+
*/
|
|
80
|
+
export function findReplacePlugin(): Plugin<FindState> {
|
|
81
|
+
return new Plugin<FindState>({
|
|
82
|
+
key: findReplaceKey,
|
|
83
|
+
|
|
84
|
+
state: {
|
|
85
|
+
init: () => EMPTY,
|
|
86
|
+
apply(tr, prev) {
|
|
87
|
+
const meta = tr.getMeta(findReplaceKey) as FindMeta | undefined;
|
|
88
|
+
if (meta) return applyMeta(prev, meta, tr.doc);
|
|
89
|
+
if (tr.docChanged && prev.query) {
|
|
90
|
+
const matches = findMatches(tr.doc, prev.query, prev.caseSensitive);
|
|
91
|
+
return {
|
|
92
|
+
...prev,
|
|
93
|
+
matches,
|
|
94
|
+
activeIndex: Math.min(prev.activeIndex, Math.max(0, matches.length - 1)),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
return prev;
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
props: {
|
|
102
|
+
decorations(state) {
|
|
103
|
+
const find = findReplaceKey.getState(state);
|
|
104
|
+
if (!find || !find.matches.length) return null;
|
|
105
|
+
return DecorationSet.create(
|
|
106
|
+
state.doc,
|
|
107
|
+
find.matches.map((match, index) =>
|
|
108
|
+
Decoration.inline(match.from, match.to, {
|
|
109
|
+
class:
|
|
110
|
+
index === find.activeIndex
|
|
111
|
+
? 'nile-wysiwyg__find-match nile-wysiwyg__find-active'
|
|
112
|
+
: 'nile-wysiwyg__find-match',
|
|
113
|
+
})
|
|
114
|
+
)
|
|
115
|
+
);
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function getFindState(state: EditorState): FindState {
|
|
122
|
+
return findReplaceKey.getState(state) ?? EMPTY;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export function searchTr(state: EditorState, query: string, caseSensitive?: boolean): Transaction {
|
|
126
|
+
return state.tr.setMeta(findReplaceKey, { type: 'search', query, caseSensitive });
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function findStepTr(state: EditorState, direction: 'next' | 'prev'): Transaction {
|
|
130
|
+
return state.tr.setMeta(findReplaceKey, { type: direction });
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function clearFindTr(state: EditorState): Transaction {
|
|
134
|
+
return state.tr.setMeta(findReplaceKey, { type: 'clear' });
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** Replaces the active match. Returns the transaction, or null when idle. */
|
|
138
|
+
export function replaceActiveTr(state: EditorState, replacement: string): Transaction | null {
|
|
139
|
+
const find = getFindState(state);
|
|
140
|
+
const match = find.matches[find.activeIndex];
|
|
141
|
+
if (!match) return null;
|
|
142
|
+
return state.tr.insertText(replacement, match.from, match.to);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** Replaces every match in one transaction. Returns null when idle. */
|
|
146
|
+
export function replaceAllTr(state: EditorState, replacement: string): Transaction | null {
|
|
147
|
+
const find = getFindState(state);
|
|
148
|
+
if (!find.matches.length) return null;
|
|
149
|
+
const tr = state.tr;
|
|
150
|
+
// Back to front so earlier positions stay valid.
|
|
151
|
+
for (const match of [...find.matches].reverse()) {
|
|
152
|
+
tr.insertText(replacement, match.from, match.to);
|
|
153
|
+
}
|
|
154
|
+
return tr;
|
|
155
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format painter: copy the inline formatting (marks) at the current selection,
|
|
3
|
+
* then apply it to the next selection the user makes — like the paint-roller
|
|
4
|
+
* tool in word processors. The plugin only holds the copied marks and an
|
|
5
|
+
* "armed" flag; the host drives arm/apply through the exported helpers.
|
|
6
|
+
*/
|
|
7
|
+
import { EditorState, Plugin, PluginKey, Transaction } from 'prosemirror-state';
|
|
8
|
+
import { Mark } from 'prosemirror-model';
|
|
9
|
+
|
|
10
|
+
interface FormatPainterState {
|
|
11
|
+
marks: readonly Mark[] | null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const formatPainterKey = new PluginKey<FormatPainterState>('nileFormatPainter');
|
|
15
|
+
|
|
16
|
+
type PainterMeta = { type: 'arm'; marks: readonly Mark[] } | { type: 'disarm' };
|
|
17
|
+
|
|
18
|
+
export function formatPainterPlugin(): Plugin<FormatPainterState> {
|
|
19
|
+
return new Plugin<FormatPainterState>({
|
|
20
|
+
key: formatPainterKey,
|
|
21
|
+
state: {
|
|
22
|
+
init: () => ({ marks: null }),
|
|
23
|
+
apply(tr, value) {
|
|
24
|
+
const meta = tr.getMeta(formatPainterKey) as PainterMeta | undefined;
|
|
25
|
+
if (meta?.type === 'arm') return { marks: meta.marks };
|
|
26
|
+
if (meta?.type === 'disarm') return { marks: null };
|
|
27
|
+
return value;
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
props: {
|
|
31
|
+
attributes: state =>
|
|
32
|
+
(formatPainterKey.getState(state)?.marks
|
|
33
|
+
? { class: 'nile-wysiwyg--painting' }
|
|
34
|
+
: {}) as Record<string, string>,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** True while the painter is armed (marks captured, waiting to apply). */
|
|
40
|
+
export function isFormatPainterArmed(state: EditorState): boolean {
|
|
41
|
+
return !!formatPainterKey.getState(state)?.marks;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** The inline marks to copy from the current selection/caret. */
|
|
45
|
+
function capturedMarks(state: EditorState): readonly Mark[] {
|
|
46
|
+
const { $from, empty } = state.selection;
|
|
47
|
+
if (empty) return state.storedMarks ?? $from.marks();
|
|
48
|
+
// Marks that hold across the selection start — the visible formatting.
|
|
49
|
+
return $from.marksAcross(state.selection.$to) ?? $from.marks();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Arms the painter, capturing the current formatting. Returns a transaction to
|
|
54
|
+
* dispatch, or null when there is nothing to copy.
|
|
55
|
+
*/
|
|
56
|
+
export function armFormatPainter(state: EditorState): Transaction | null {
|
|
57
|
+
const marks = capturedMarks(state);
|
|
58
|
+
return state.tr.setMeta(formatPainterKey, { type: 'arm', marks } as PainterMeta);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Disarms the painter without applying. */
|
|
62
|
+
export function disarmFormatPainter(state: EditorState): Transaction {
|
|
63
|
+
return state.tr.setMeta(formatPainterKey, { type: 'disarm' } as PainterMeta);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Applies the copied formatting to the current (non-empty) selection and
|
|
68
|
+
* disarms. Returns null when not armed or the selection is empty.
|
|
69
|
+
*/
|
|
70
|
+
export function applyFormatPainter(state: EditorState): Transaction | null {
|
|
71
|
+
const painter = formatPainterKey.getState(state);
|
|
72
|
+
if (!painter?.marks) return null;
|
|
73
|
+
const { from, to, empty } = state.selection;
|
|
74
|
+
if (empty) return null;
|
|
75
|
+
const tr = state.tr;
|
|
76
|
+
tr.removeMark(from, to, null);
|
|
77
|
+
for (const mark of painter.marks) tr.addMark(from, to, mark);
|
|
78
|
+
tr.setMeta(formatPainterKey, { type: 'disarm' } as PainterMeta);
|
|
79
|
+
return tr;
|
|
80
|
+
}
|