@aquera/nile-elements 2.0.16 → 2.0.18
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 +6 -0
- package/dist/{index-f6944844.cjs.js → index-0c0c869d.cjs.js} +2 -2
- package/dist/{index-f6944844.cjs.js.map → index-0c0c869d.cjs.js.map} +1 -1
- package/dist/{index-403841c7.cjs.js → index-129ef6fb.cjs.js} +3 -3
- package/dist/{index-403841c7.cjs.js.map → index-129ef6fb.cjs.js.map} +1 -1
- package/dist/{index-1faa963c.esm.js → index-36f2a6b5.esm.js} +1 -1
- package/dist/index-4df50481.esm.js +1 -0
- package/dist/index-5d34cff1.esm.js +1 -0
- package/dist/index-7ae95edd.cjs.js +2 -0
- package/dist/{index-3ca67627.cjs.js.map → index-7ae95edd.cjs.js.map} +1 -1
- package/dist/index-7ca72b78.esm.js +1 -0
- package/dist/index-bbe23ad8.cjs.js +2 -0
- package/dist/index-bbe23ad8.cjs.js.map +1 -0
- package/dist/index-ccc6a799.cjs.js +5 -0
- package/dist/index-ccc6a799.cjs.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +686 -464
- 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-code-editor/extensionSetup.cjs.js +2 -2
- package/dist/nile-code-editor/index.cjs.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js +1 -1
- package/dist/nile-code-editor/theme.cjs.js +1 -1
- 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/nile-combobox.cjs.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/nile-detail.cjs.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-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-minimap/index.cjs.js +2 -0
- package/dist/nile-minimap/index.cjs.js.map +1 -0
- package/dist/nile-minimap/index.esm.js +1 -0
- package/dist/nile-minimap/nile-minimap.cjs.js +2 -0
- package/dist/nile-minimap/nile-minimap.cjs.js.map +1 -0
- package/dist/nile-minimap/nile-minimap.css.cjs.js +2 -0
- package/dist/nile-minimap/nile-minimap.css.cjs.js.map +1 -0
- package/dist/nile-minimap/nile-minimap.css.esm.js +150 -0
- package/dist/nile-minimap/nile-minimap.esm.js +22 -0
- 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-segmented-progress-bar/index.cjs.js +1 -1
- package/dist/nile-segmented-progress-bar/nile-segmented-progress-bar.cjs.js +1 -1
- 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/engine/commands.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/commands.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/commands.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/create-state.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/email-css.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/email-css.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/email-css.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/email-render.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/email-render.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/email-render.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/html-detect.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/html-detect.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/html-detect.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/inputrules.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/keymap.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embeds.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/image-view.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/image-view.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/image-view.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/image.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/image.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/image.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/link.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/link.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/link.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/max-length.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/max-length.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/max-length.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/paste.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/paste.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/paste.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/single-line.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/single-line.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/single-line.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/tables.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js +2 -1
- package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/sanitize.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/schema.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/schema.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/schema.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/selection-state.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/serializer.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/serializer.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/serializer.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.esm.js +45 -4
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +2 -2
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bookmark-panel.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bookmark-panel.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/bookmark-panel.esm.js +2 -2
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.esm.js +5 -5
- package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/code-block-menu.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-menu.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-panel.esm.js +2 -2
- package/dist/nile-wysiwyg-editor/ui/emoji-picker.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/emoji-picker.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/emoji-picker.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/find-replace.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/find-replace.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/find-replace.esm.js +3 -3
- package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/image-menu.esm.js +3 -3
- package/dist/nile-wysiwyg-editor/ui/image-panel.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/image-panel.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/image-panel.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/insert-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/insert-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/insert-menu.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/link-editor.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/link-editor.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/link-editor.esm.js +9 -9
- package/dist/nile-wysiwyg-editor/ui/markdown-panel.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/markdown-panel.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/markdown-panel.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/math-panel.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/shortcut-help.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/shortcut-help.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/shortcut-help.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/source-view.esm.js +4 -4
- package/dist/nile-wysiwyg-editor/ui/special-chars.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/special-chars.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/special-chars.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/suggest-list.esm.js +23 -12
- package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-grid-picker.esm.js +7 -7
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-menu.esm.js +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/nile-minimap/index.d.ts +1 -0
- package/dist/src/nile-minimap/index.js +2 -0
- package/dist/src/nile-minimap/index.js.map +1 -0
- package/dist/src/nile-minimap/nile-minimap.css.d.ts +12 -0
- package/dist/src/nile-minimap/nile-minimap.css.js +162 -0
- package/dist/src/nile-minimap/nile-minimap.css.js.map +1 -0
- package/dist/src/nile-minimap/nile-minimap.d.ts +131 -0
- package/dist/src/nile-minimap/nile-minimap.js +704 -0
- package/dist/src/nile-minimap/nile-minimap.js.map +1 -0
- package/dist/src/nile-minimap/nile-minimap.test.d.ts +1 -0
- package/dist/src/nile-minimap/nile-minimap.test.js +785 -0
- package/dist/src/nile-minimap/nile-minimap.test.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/create-state.d.ts +5 -0
- package/dist/src/nile-wysiwyg-editor/engine/create-state.js +2 -0
- package/dist/src/nile-wysiwyg-editor/engine/create-state.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/email-css.d.ts +14 -0
- package/dist/src/nile-wysiwyg-editor/engine/email-css.js +140 -0
- package/dist/src/nile-wysiwyg-editor/engine/email-css.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/email-fidelity.test.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/email-fidelity.test.js +1045 -0
- package/dist/src/nile-wysiwyg-editor/engine/email-fidelity.test.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/email-render.d.ts +11 -0
- package/dist/src/nile-wysiwyg-editor/engine/email-render.js +93 -0
- package/dist/src/nile-wysiwyg-editor/engine/email-render.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/html-detect.d.ts +2 -0
- package/dist/src/nile-wysiwyg-editor/engine/html-detect.js +24 -0
- package/dist/src/nile-wysiwyg-editor/engine/html-detect.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/index.d.ts +4 -1
- package/dist/src/nile-wysiwyg-editor/engine/index.js +3 -1
- package/dist/src/nile-wysiwyg-editor/engine/index.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/inputrules.d.ts +0 -5
- package/dist/src/nile-wysiwyg-editor/engine/inputrules.js +19 -0
- package/dist/src/nile-wysiwyg-editor/engine/inputrules.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.js +3 -2
- package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/link.d.ts +4 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/link.js +56 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/link.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.d.ts +5 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.js +27 -6
- package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js +30 -7
- package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/pm.test.js +46 -0
- package/dist/src/nile-wysiwyg-editor/engine/pm.test.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.d.ts +9 -1
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.js +730 -7
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/schema.d.ts +3 -0
- package/dist/src/nile-wysiwyg-editor/engine/schema.js +215 -34
- package/dist/src/nile-wysiwyg-editor/engine/schema.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/selection-state.js +3 -1
- package/dist/src/nile-wysiwyg-editor/engine/selection-state.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/serializer.d.ts +12 -4
- package/dist/src/nile-wysiwyg-editor/engine/serializer.js +18 -8
- package/dist/src/nile-wysiwyg-editor/engine/serializer.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor-email-fidelity.test.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor-email-fidelity.test.js +287 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor-email-fidelity.test.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js +45 -4
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.d.ts +23 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js +113 -15
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js +213 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.js +2 -2
- package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/embed-menu.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/embed-menu.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/find-replace.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/find-replace.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/image-menu.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/image-menu.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/image-panel.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/image-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/insert-menu.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/insert-menu.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/link-editor.js +2 -2
- package/dist/src/nile-wysiwyg-editor/ui/link-editor.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/math-panel.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/math-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/source-view.js +2 -2
- package/dist/src/nile-wysiwyg-editor/ui/source-view.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/special-chars.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/special-chars.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js +14 -3
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js +2 -2
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/table-menu.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/table-menu.js.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/index.ts +1 -0
- package/src/nile-minimap/index.ts +1 -0
- package/src/nile-minimap/nile-minimap.css.ts +164 -0
- package/src/nile-minimap/nile-minimap.test.ts +924 -0
- package/src/nile-minimap/nile-minimap.ts +796 -0
- package/src/nile-wysiwyg-editor/engine/create-state.ts +7 -0
- package/src/nile-wysiwyg-editor/engine/email-css.ts +136 -0
- package/src/nile-wysiwyg-editor/engine/email-fidelity.test.ts +1347 -0
- package/src/nile-wysiwyg-editor/engine/email-render.ts +99 -0
- package/src/nile-wysiwyg-editor/engine/html-detect.ts +26 -0
- package/src/nile-wysiwyg-editor/engine/index.ts +10 -1
- package/src/nile-wysiwyg-editor/engine/inputrules.ts +18 -1
- package/src/nile-wysiwyg-editor/engine/plugins/image-view.ts +3 -2
- package/src/nile-wysiwyg-editor/engine/plugins/link.ts +58 -2
- package/src/nile-wysiwyg-editor/engine/plugins/paste.ts +31 -8
- package/src/nile-wysiwyg-editor/engine/plugins/tables.ts +29 -7
- package/src/nile-wysiwyg-editor/engine/pm.test.ts +73 -0
- package/src/nile-wysiwyg-editor/engine/sanitize.ts +729 -7
- package/src/nile-wysiwyg-editor/engine/schema.ts +206 -33
- package/src/nile-wysiwyg-editor/engine/selection-state.ts +3 -1
- package/src/nile-wysiwyg-editor/engine/serializer.ts +30 -8
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor-email-fidelity.test.ts +357 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.ts +45 -4
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.ts +258 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.ts +119 -12
- package/src/nile-wysiwyg-editor/ui/bookmark-panel.ts +2 -2
- package/src/nile-wysiwyg-editor/ui/bubble-menu.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/embed-menu.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/embed-panel.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/emoji-picker.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/find-replace.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/image-menu.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/image-panel.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/insert-menu.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/link-editor.ts +2 -2
- package/src/nile-wysiwyg-editor/ui/markdown-panel.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/math-panel.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/shortcut-help.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/source-view.ts +2 -2
- package/src/nile-wysiwyg-editor/ui/special-chars.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/suggest-list.ts +14 -3
- package/src/nile-wysiwyg-editor/ui/table-grid-picker.ts +2 -2
- package/src/nile-wysiwyg-editor/ui/table-menu.ts +1 -1
- package/vscode-html-custom-data.json +116 -25
- package/web-test-runner.config.mjs +4 -0
- package/dist/index-3ca67627.cjs.js +0 -2
- package/dist/index-6f3fa4ab.esm.js +0 -1
- package/dist/index-7b1c9857.esm.js +0 -1
- package/dist/index-89c520e9.cjs.js +0 -5
- package/dist/index-89c520e9.cjs.js.map +0 -1
- package/dist/index-ba47645d.esm.js +0 -1
- package/dist/index-c3210a9c.cjs.js +0 -2
- package/dist/index-c3210a9c.cjs.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as t,d as e,F as l,h as r,l as n,g as a,f as i,i as s,S as o,O as u,j as c}from"../../index-6f3fa4ab.esm.js";import{a as g}from"../../index-7b1c9857.esm.js";import{E as d,a as f}from"./plugins/embeds.esm.js";import"../../index-ba47645d.esm.js";import"../../index-920675c4.esm.js";const p=["ol",0],m=["ul",0],b=["li",0],y={attrs:{order:{default:1,validate:"number"}},parseDOM:[{tag:"ol",getAttrs:t=>({order:t.hasAttribute("start")?+t.getAttribute("start"):1})}],toDOM:t=>1==t.attrs.order?p:["ol",{start:t.attrs.order},0]},h={parseDOM:[{tag:"ul"}],toDOM:()=>m},M={parseDOM:[{tag:"li"}],toDOM:()=>b,defining:!0};function O(t,e){let l={};for(let e in t)l[e]=t[e];for(let t in e)l[t]=e[t];return l}function D(n,a=null){return function(o,u){let{$from:c,$to:g}=o.selection,d=c.blockRange(g);if(!d)return!1;let f=u?o.tr:null;return!!function(n,a,o,u=null){let c=!1,g=a,d=a.$from.doc;if(a.depth>=2&&a.$from.node(a.depth-1).type.compatibleContent(o)&&0==a.startIndex){if(0==a.$from.index(a.depth-1))return!1;let t=d.resolve(a.start-2);g=new r(t,t,a.depth),a.endIndex<a.parent.childCount&&(a=new r(a.$from,d.resolve(a.$to.end(a.depth)),a.depth)),c=!0}let f=i(g,o,u,a);if(!f)return!1;n&&function(r,n,a,i,o){let u=l.empty;for(let t=a.length-1;t>=0;t--)u=l.from(a[t].type.create(a[t].attrs,u));r.step(new t(n.start-(i?2:0),n.end,n.start,n.end,new e(u,0,0),a.length,!0));let c=0;for(let t=0;t<a.length;t++)a[t].type==o&&(c=t+1);let g=a.length-c,d=n.start+a.length-(i?2:0),f=n.parent;for(let t=n.startIndex,e=n.endIndex,l=!0;t<e;t++,l=!1)!l&&s(r.doc,d,g)&&(r.split(d,g),d+=2*g),d+=f.child(t).nodeSize}(n,a,f,c,o);return!0}(f,d,n,a)&&(u&&u(f.scrollIntoView()),!0)}}function k(t,r){return function(n,a){let{$from:i,$to:u,node:c}=n.selection;if(c&&c.isBlock||i.depth<2||!i.sameParent(u))return!1;let g=i.node(-1);if(g.type!=t)return!1;if(0==i.parent.content.size&&i.node(-1).childCount==i.indexAfter(-1)){if(3==i.depth||i.node(-3).type!=t||i.index(-2)!=i.node(-2).childCount-1)return!1;if(a){let r=l.empty,s=i.index(-1)?1:i.index(-2)?2:3;for(let t=i.depth-s;t>=i.depth-3;t--)r=l.from(i.node(t).copy(r));let u=i.indexAfter(-1)<i.node(-2).childCount?1:i.indexAfter(-2)<i.node(-3).childCount?2:3;r=r.append(l.from(t.createAndFill()));let c=i.before(i.depth-(s-1)),g=n.tr.replace(c,i.after(-u),new e(r,4-s,0)),d=-1;g.doc.nodesBetween(c,g.doc.content.size,((t,e)=>{if(d>-1)return!1;t.isTextblock&&0==t.content.size&&(d=e+1)})),d>-1&&g.setSelection(o.near(g.doc.resolve(d))),a(g.scrollIntoView())}return!0}let d=u.pos==i.end()?g.contentMatchAt(0).defaultType:null,f=n.tr.delete(i.pos,u.pos),p=d?[r?{type:t,attrs:r}:null,{type:d}]:void 0;return!!s(f.doc,i.pos,2,p)&&(a&&a(f.split(i.pos,2,p).scrollIntoView()),!0)}}function w(i){return function(s,o){let{$from:u,$to:c}=s.selection,g=u.blockRange(c,(t=>t.childCount>0&&t.firstChild.type==i));return!!g&&(!o||(u.node(g.depth-1).type==i?function(i,s,o,u){let c=i.tr,g=u.end,d=u.$to.end(u.depth);g<d&&(c.step(new t(g-1,d,g,d,new e(l.from(o.create(null,u.parent.copy())),1,0),1,!0)),u=new r(c.doc.resolve(u.$from.pos),c.doc.resolve(d),u.depth));const f=n(u);if(null==f)return!1;c.lift(u,f);let p=c.doc.resolve(c.mapping.map(g,-1)-1);a(c.doc,p.pos)&&p.nodeBefore.type==p.nodeAfter.type&&c.join(p.pos);return s(c.scrollIntoView()),!0}(s,o,i,g):function(r,n,a){let i=r.tr,s=a.parent;for(let t=a.end,e=a.endIndex-1,l=a.startIndex;e>l;e--)t-=s.child(e).nodeSize,i.delete(t-1,t+1);let o=i.doc.resolve(a.start),u=o.nodeAfter;if(i.mapping.map(a.end)!=a.start+o.nodeAfter.nodeSize)return!1;let c=0==a.startIndex,g=a.endIndex==s.childCount,d=o.node(-1),f=o.index(-1);if(!d.canReplace(f+(c?0:1),f+1,u.content.append(g?l.empty:l.from(s))))return!1;let p=o.pos,m=p+u.nodeSize;return i.step(new t(p-(c?1:0),m+(g?1:0),p+1,m-1,new e((c?l.empty:l.from(s.copy(l.empty))).append(g?l.empty:l.from(s.copy(l.empty))),c?0:1,g?0:1),c?0:1)),n(i.scrollIntoView()),!0}(s,o,g)))}}function _(r){return function(n,a){let{$from:i,$to:s}=n.selection,o=i.blockRange(s,(t=>t.childCount>0&&t.firstChild.type==r));if(!o)return!1;let u=o.startIndex;if(0==u)return!1;let c=o.parent,g=c.child(u-1);if(g.type!=r)return!1;if(a){let i=g.lastChild&&g.lastChild.type==c.type,s=l.from(i?r.create():null),u=new e(l.from(r.create(null,l.from(c.type.create(null,s)))),i?3:1,0),d=o.start,f=o.end;a(n.tr.step(new t(d-(i?3:1),f,d,f,u,1,!0)).scrollIntoView())}return!0}}const A=["left","center","right","justify"];function $(t){const e=t.style.textAlign||t.getAttribute("align")||"";return A.includes(e)?e:null}const x=8;function v(t){const e=t.style.marginInlineStart||t.style.marginLeft||"",l=parseFloat(e);return!Number.isFinite(l)||l<=0?0:Math.min(8,Math.round(l/40))}function j(t){const e=t.style.lineHeight.trim();if(!e||"normal"===e)return null;const l=parseFloat(e);return!Number.isFinite(l)||l<=0?null:e.endsWith("%")?String(l/100):e}function N(t){const e=[],l=function(t){return t?`text-align: ${t}`:null}(t.align??null);return l&&e.push(l),t.indent&&e.push(`margin-inline-start: ${40*t.indent}px`),t.lineHeight&&e.push(`line-height: ${t.lineHeight}`),e.length?e.join("; "):null}const F=/^(?:nile-wysiwyg|ProseMirror)/;function I(t){if(!t)return null;const e=t.split(/\s+/).filter((t=>t&&!F.test(t)));return e.length?e.join(" "):null}function z(t){return t&&!F.test(t)?t:null}const q={htmlClass:{default:null},htmlId:{default:null}};function C(t){return{htmlClass:I(t.getAttribute("class")),htmlId:z(t.getAttribute("id"))}}function S(t){if(!("tag"in t)||"style"in t)return t;const e=t.getAttrs;return{...t,getAttrs(t){const l=e?e(t):null;return!1!==l&&{...l??{},...C(t)}}}}function H(t){return{...t,attrs:{...t.attrs??{},...q},parseDOM:t.parseDOM?.map(S),toDOM:(e=t.toDOM,e?(t,...l)=>{const r=e(t,...l),n=t.attrs.htmlClass,a=t.attrs.htmlId;if(!Array.isArray(r)||!n&&!a)return r;const[i,...s]=r;let o={},u=s;return s.length&&s[0]&&"object"==typeof s[0]&&!Array.isArray(s[0])&&(o={...s[0]},u=s.slice(1)),n&&(o.class=o.class?`${o.class} ${n}`:n),a&&(o.id=a),[i,o,...u]}:e)};var e}const E=["paragraph","heading","blockquote","code_block","bullet_list","ordered_list","list_item","table","table_row","table_cell","table_header"],B=["link","bold","italic","underline","strike","code","subscript","superscript"],G={doc:{content:"block+"},paragraph:{content:"inline*",group:"block",attrs:{align:{default:null},indent:{default:0},lineHeight:{default:null}},parseDOM:[{tag:"p",getAttrs:t=>({align:$(t),indent:v(t),lineHeight:j(t)})}],toDOM(t){const e=N(t.attrs);return e?["p",{style:e},0]:["p",0]}},heading:{content:"inline*",group:"block",defining:!0,attrs:{level:{default:1},align:{default:null},indent:{default:0},lineHeight:{default:null}},parseDOM:[1,2,3,4,5,6].map((t=>({tag:`h${t}`,getAttrs:e=>({level:t,align:$(e),indent:v(e),lineHeight:j(e)})}))),toDOM(t){const e=N(t.attrs);return e?[`h${t.attrs.level}`,{style:e},0]:[`h${t.attrs.level}`,0]}},blockquote:{content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:()=>["hr"]},text:{group:"inline"},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM:()=>["br"]},code_block:{content:"text*",group:"block",marks:"",code:!0,defining:!0,attrs:{language:{default:null}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>({language:t.getAttribute("data-language")})}],toDOM(t){const e={class:"nile-wysiwyg__code-block"};return t.attrs.language&&(e["data-language"]=t.attrs.language),["pre",e,["code",0]]}},image:{inline:!0,group:"inline",draggable:!0,attrs:{src:{},alt:{default:null},title:{default:null},width:{default:null}},parseDOM:[{tag:"img[src]",getAttrs:t=>{const e=parseFloat(t.style.width),l=parseFloat(t.getAttribute("width")??""),r=Number.isFinite(e)?Math.round(e):Number.isFinite(l)?Math.round(l):null;return{src:t.getAttribute("src"),alt:t.getAttribute("alt"),title:t.getAttribute("title"),width:r&&r>0?r:null}}}],toDOM(t){const{src:e,alt:l,title:r,width:n}=t.attrs,a={src:e};return l&&(a.alt=l),r&&(a.title=r),n&&(a.style=`width: ${n}px`),["img",a]}},figure:{group:"block",content:"inline*",defining:!0,isolating:!0,attrs:{src:{},alt:{default:null},title:{default:null},width:{default:null},align:{default:null}},parseDOM:[{tag:"figure",contentElement:"figcaption",getAttrs:t=>{const e=t.querySelector("img[src]");if(!e)return!1;const l=parseFloat(e.style.width||t.style.width),r=t.getAttribute("data-align");return{src:e.getAttribute("src"),alt:e.getAttribute("alt"),title:e.getAttribute("title"),width:Number.isFinite(l)&&l>0?Math.round(l):null,align:"left"===r||"center"===r||"right"===r?r:null}}}],toDOM(t){const{src:e,alt:l,title:r,width:n,align:a}=t.attrs,i={class:"nile-wysiwyg__figure"};a&&(i["data-align"]=a);const s=[];n&&s.push(`width: ${n}px`),"center"===a?s.push("margin-left: auto; margin-right: auto"):"right"===a&&s.push("margin-left: auto; margin-right: 0"),s.length&&(i.style=s.join("; "));const o={src:e,style:"width: 100%"};return l&&(o.alt=l),r&&(o.title=r),["figure",i,["img",o],["figcaption",{class:"nile-wysiwyg__figcaption"},0]]}},task_list:{content:"task_item+",group:"block",parseDOM:[{tag:"ul[data-task-list]",priority:51}],toDOM:()=>["ul",{"data-task-list":"true",class:"nile-wysiwyg__task-list"},0]},task_item:{content:"paragraph block*",defining:!0,attrs:{checked:{default:!1}},parseDOM:[{tag:"li[data-task-item]",priority:51,getAttrs:t=>({checked:"true"===t.getAttribute("data-checked")})}],toDOM:t=>["li",{"data-task-item":"true","data-checked":String(t.attrs.checked),class:"nile-wysiwyg__task-item"},0]},embed:{group:"block",atom:!0,selectable:!0,draggable:!0,attrs:{src:{},provider:{default:null},title:{default:null},width:{default:null},align:{default:null}},parseDOM:[{tag:"div[data-embed-provider]",getAttrs:t=>{const e=t.querySelector("iframe[src]");if(!e)return!1;const l=t.getAttribute("data-width")??/^(\d+)px$/.exec(t.style.width)?.[1],r=l?parseInt(l,10):NaN,n=t.getAttribute("data-align");return{src:e.getAttribute("src"),provider:t.getAttribute("data-embed-provider"),title:e.getAttribute("title"),width:Number.isFinite(r)&&r>0?r:null,align:"left"===n||"center"===n||"right"===n?n:null}}},{tag:"iframe[src]",getAttrs:t=>{const e=parseInt(t.getAttribute("width")??"",10);return{src:t.getAttribute("src"),title:t.getAttribute("title"),width:Number.isFinite(e)&&e>0?e:null}}}],toDOM(t){const{src:e,provider:l,title:r,width:n,align:a}=t.attrs,i={src:e,frameborder:"0",allowfullscreen:"true",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",sandbox:d,referrerpolicy:f};r&&(i.title=r);const s={class:"nile-wysiwyg__embed","data-embed-provider":l??"generic"},o=[];return n&&(s["data-width"]=String(n),o.push(`width: ${n}px`,"max-width: 100%")),a&&(s["data-align"]=a,"center"===a?o.push("margin-left: auto","margin-right: auto"):"right"===a&&o.push("margin-left: auto","margin-right: 0")),o.length&&(s.style=o.join("; ")),["div",s,["iframe",i]]}},styleBlock:{group:"block",atom:!0,selectable:!0,attrs:{css:{default:""}},parseDOM:[{tag:"style",getAttrs:t=>({css:t.textContent??""})}],toDOM:t=>["style",t.attrs.css]},bookmark:{inline:!0,group:"inline",atom:!0,selectable:!0,attrs:{id:{}},parseDOM:[{tag:"a[data-bookmark]",priority:60,getAttrs:t=>{const e=t.getAttribute("id")||t.getAttribute("name");return!!e&&{id:e}}},{tag:"a[id]",getAttrs:t=>!t.hasAttribute("href")&&{id:t.getAttribute("id")}},{tag:"a[name]",getAttrs:t=>!t.hasAttribute("href")&&{id:t.getAttribute("name")}}],toDOM:t=>["a",{id:t.attrs.id,"data-bookmark":"true"}]},mention:{inline:!0,group:"inline",atom:!0,selectable:!0,attrs:{trigger:{default:"@"},key:{},label:{}},parseDOM:[{tag:"span[data-mention-key]",getAttrs:t=>({trigger:t.getAttribute("data-mention-trigger")||"@",key:t.getAttribute("data-mention-key"),label:t.getAttribute("data-mention-label")||t.textContent?.slice(1)||""})}],toDOM(t){const{trigger:e,key:l,label:r}=t.attrs;return["span",{class:"nile-wysiwyg__mention","data-mention-trigger":e,"data-mention-key":l,"data-mention-label":r},`${e}${r}`]}},merge_field:{inline:!0,group:"inline",atom:!0,selectable:!0,attrs:{id:{},label:{default:null}},parseDOM:[{tag:"span[data-merge-field]",getAttrs:t=>{const e=t.getAttribute("data-merge-field");return!!e&&{id:e,label:t.getAttribute("data-merge-label")||t.textContent||null}}}],toDOM(t){const{id:e,label:l}=t.attrs;return["span",{class:"nile-wysiwyg__merge-field","data-merge-field":e,"data-merge-label":l??""},l||`{{${e}}}`]}},math:{inline:!0,group:"inline",atom:!0,selectable:!0,attrs:{latex:{},display:{default:"inline"}},parseDOM:[{tag:"span[data-math]",getAttrs:t=>({latex:t.getAttribute("data-math")||t.textContent||"",display:"block"===t.getAttribute("data-math-display")?"block":"inline"})}],toDOM(t){const{latex:e,display:l}=t.attrs;return["span",{class:"nile-wysiwyg__math","data-math":e,"data-math-display":l},e]}}},P=g({tableGroup:"block",cellContent:"block+",cellAttributes:{background:{default:null,getFromDOM:t=>t.style.backgroundColor||null,setDOMAttr(t,e){t&&(e.style=`${e.style||""}background-color: ${t};`)}}}}),R=P.table,W={...R,attrs:{...R.attrs??{},layout:{default:!1}},parseDOM:[{tag:"table",getAttrs:t=>({layout:"presentation"===t.getAttribute("role")||t.hasAttribute("data-layout")})}],toDOM:t=>t.attrs.layout?["table",{role:"presentation","data-layout":"true"},["tbody",0]]:["table",["tbody",0]]},J={link:{attrs:{href:{},title:{default:null},target:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:t=>({href:t.getAttribute("href"),title:t.getAttribute("title"),target:t.getAttribute("target")})}],toDOM(t){const{href:e,title:l,target:r}=t.attrs,n={href:e};return l&&(n.title=l),r&&(n.target=r,"_blank"===r&&(n.rel="noopener noreferrer")),["a",n,0]}},bold:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:t=>"normal"!==t.style.fontWeight&&null},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM:()=>["strong",0]},italic:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"}],toDOM:()=>["em",0]},underline:{parseDOM:[{tag:"u"},{style:"text-decoration",getAttrs:t=>t.includes("underline")&&null},{style:"text-decoration-line",getAttrs:t=>t.includes("underline")&&null}],toDOM:()=>["u",0]},strike:{parseDOM:[{tag:"s"},{tag:"strike"},{tag:"del"},{style:"text-decoration",getAttrs:t=>t.includes("line-through")&&null},{style:"text-decoration-line",getAttrs:t=>t.includes("line-through")&&null}],toDOM:()=>["s",0]},subscript:{excludes:"subscript superscript",parseDOM:[{tag:"sub"},{style:"vertical-align=sub"}],toDOM:()=>["sub",0]},superscript:{excludes:"subscript superscript",parseDOM:[{tag:"sup"},{style:"vertical-align=super"}],toDOM:()=>["sup",0]},code:{parseDOM:[{tag:"code"}],toDOM:()=>["code",{class:"nile-wysiwyg__inline-code"},0]},html_span:{attrs:{htmlClass:{default:null},htmlId:{default:null}},parseDOM:[{tag:"span",priority:5,getAttrs:t=>{const e=I(t.getAttribute("class")),l=z(t.getAttribute("id"));return!(!e&&!l)&&{htmlClass:e,htmlId:l}}}],toDOM(t){const e={};return t.attrs.htmlClass&&(e.class=t.attrs.htmlClass),t.attrs.htmlId&&(e.id=t.attrs.htmlId),["span",e,0]}},text_color:{attrs:{color:{}},parseDOM:[{style:"color",getAttrs:t=>!!t&&{color:t}}],toDOM:t=>["span",{style:`color: ${t.attrs.color}`},0]},bg_color:{attrs:{color:{}},parseDOM:[{style:"background-color",getAttrs:t=>!(!t||"transparent"===t)&&{color:t}}],toDOM:t=>["span",{style:`background-color: ${t.attrs.color}`},0]},font_family:{attrs:{family:{}},parseDOM:[{style:"font-family",getAttrs:t=>!!t&&{family:t}}],toDOM:t=>["span",{style:`font-family: ${t.attrs.family}`},0]},font_size:{attrs:{size:{}},parseDOM:[{style:"font-size",getAttrs:t=>!!t&&{size:t}}],toDOM:t=>["span",{style:`font-size: ${t.attrs.size}`},0]}},K=["disc","circle","square"],L={1:"decimal",a:"lower-alpha",A:"upper-alpha",i:"lower-roman",I:"upper-roman"},Q=Object.fromEntries(Object.entries(L).map((([t,e])=>[e,t]))),T="multilevel",U={content:"list_item+",group:"block",attrs:{style:{default:null}},parseDOM:[{tag:"ul",getAttrs:t=>{const e=t.style.listStyleType;return{style:K.includes(e)?e:null}}}],toDOM:t=>t.attrs.style?["ul",{style:`list-style-type: ${t.attrs.style}`},0]:["ul",0]},V={content:"list_item+",group:"block",attrs:{order:{default:1},style:{default:null}},parseDOM:[{tag:"ol",getAttrs:t=>{const e=t.getAttribute("type")??"",l=t.style.listStyleType,r=t.getAttribute("data-list-style")===T?T:L[e]??(Object.values(L).includes(l)?l:null),n=Number(t.getAttribute("start"));return{order:Number.isFinite(n)&&n>0?n:1,style:r}}}],toDOM(t){const e={};return 1!==t.attrs.order&&(e.start=String(t.attrs.order)),t.attrs.style===T?e["data-list-style"]=T:t.attrs.style&&Q[t.attrs.style]&&(e.type=Q[t.attrs.style]),["ol",e,0]}};const X=function(){let t=function(t,e,l){return t.append({ordered_list:O(y,{content:"list_item+",group:l}),bullet_list:O(h,{content:"list_item+",group:l}),list_item:O(M,{content:e})})}(u.from(G),"paragraph block*","block").update("bullet_list",U).update("ordered_list",V).append(P).update("table",W);for(const e of E){const l=t.get(e);l&&(t=t.update(e,H(l)))}let e=u.from(J);for(const t of B){const l=e.get(t);l&&(e=e.update(t,H(l)))}return new c({nodes:t,marks:e})}();export{T as M,_ as a,x as b,X as d,w as l,k as s,D as w};
|
|
1
|
+
import{S as t,F as e,c as n,O as r,d as l}from"../../index-5d34cff1.esm.js";import{R as o,l as i,c as s,f as a,b as u,S as c,a as f,P as d,e as h,T as g,N as p,g as m}from"../../index-7ca72b78.esm.js";import{D as w,a as b}from"../../index-4df50481.esm.js";import{k as y,b as M}from"../../index-920675c4.esm.js";import{E as D,a as O}from"./plugins/embeds.esm.js";import{s as k}from"./email-css.esm.js";import{a as v}from"./sanitize.esm.js";const $=["ol",0],_=["ul",0],A=["li",0],x={attrs:{order:{default:1,validate:"number"}},parseDOM:[{tag:"ol",getAttrs:t=>({order:t.hasAttribute("start")?+t.getAttribute("start"):1})}],toDOM:t=>1==t.attrs.order?$:["ol",{start:t.attrs.order},0]},S={parseDOM:[{tag:"ul"}],toDOM:()=>_},N={parseDOM:[{tag:"li"}],toDOM:()=>A,defining:!0};function z(t,e){let n={};for(let e in t)n[e]=t[e];for(let t in e)n[t]=e[t];return n}function R(r,l=null){return function(i,s){let{$from:c,$to:f}=i.selection,d=c.blockRange(f);if(!d)return!1;let h=s?i.tr:null;return!!function(r,l,i,s=null){let c=!1,f=l,d=l.$from.doc;if(l.depth>=2&&l.$from.node(l.depth-1).type.compatibleContent(i)&&0==l.startIndex){if(0==l.$from.index(l.depth-1))return!1;let t=d.resolve(l.start-2);f=new n(t,t,l.depth),l.endIndex<l.parent.childCount&&(l=new n(l.$from,d.resolve(l.$to.end(l.depth)),l.depth)),c=!0}let h=a(f,i,s,l);if(!h)return!1;r&&function(n,r,l,i,s){let a=e.empty;for(let t=l.length-1;t>=0;t--)a=e.from(l[t].type.create(l[t].attrs,a));n.step(new o(r.start-(i?2:0),r.end,r.start,r.end,new t(a,0,0),l.length,!0));let c=0;for(let t=0;t<l.length;t++)l[t].type==s&&(c=t+1);let f=l.length-c,d=r.start+l.length-(i?2:0),h=r.parent;for(let t=r.startIndex,e=r.endIndex,l=!0;t<e;t++,l=!1)!l&&u(n.doc,d,f)&&(n.split(d,f),d+=2*f),d+=h.child(t).nodeSize}(r,l,h,c,i);return!0}(h,d,r,l)&&(s&&s(h.scrollIntoView()),!0)}}function E(n,r){return function(l,o){let{$from:i,$to:s,node:a}=l.selection;if(a&&a.isBlock||i.depth<2||!i.sameParent(s))return!1;let f=i.node(-1);if(f.type!=n)return!1;if(0==i.parent.content.size&&i.node(-1).childCount==i.indexAfter(-1)){if(3==i.depth||i.node(-3).type!=n||i.index(-2)!=i.node(-2).childCount-1)return!1;if(o){let r=e.empty,s=i.index(-1)?1:i.index(-2)?2:3;for(let t=i.depth-s;t>=i.depth-3;t--)r=e.from(i.node(t).copy(r));let a=i.indexAfter(-1)<i.node(-2).childCount?1:i.indexAfter(-2)<i.node(-3).childCount?2:3;r=r.append(e.from(n.createAndFill()));let u=i.before(i.depth-(s-1)),f=l.tr.replace(u,i.after(-a),new t(r,4-s,0)),d=-1;f.doc.nodesBetween(u,f.doc.content.size,((t,e)=>{if(d>-1)return!1;t.isTextblock&&0==t.content.size&&(d=e+1)})),d>-1&&f.setSelection(c.near(f.doc.resolve(d))),o(f.scrollIntoView())}return!0}let d=s.pos==i.end()?f.contentMatchAt(0).defaultType:null,h=l.tr.delete(i.pos,s.pos),g=d?[r?{type:n,attrs:r}:null,{type:d}]:void 0;return!!u(h.doc,i.pos,2,g)&&(o&&o(h.split(i.pos,2,g).scrollIntoView()),!0)}}function C(r){return function(l,a){let{$from:u,$to:c}=l.selection,f=u.blockRange(c,(t=>t.childCount>0&&t.firstChild.type==r));return!!f&&(!a||(u.node(f.depth-1).type==r?function(r,l,a,u){let c=r.tr,f=u.end,d=u.$to.end(u.depth);f<d&&(c.step(new o(f-1,d,f,d,new t(e.from(a.create(null,u.parent.copy())),1,0),1,!0)),u=new n(c.doc.resolve(u.$from.pos),c.doc.resolve(d),u.depth));const h=i(u);if(null==h)return!1;c.lift(u,h);let g=c.doc.resolve(c.mapping.map(f,-1)-1);s(c.doc,g.pos)&&g.nodeBefore.type==g.nodeAfter.type&&c.join(g.pos);return l(c.scrollIntoView()),!0}(l,a,r,f):function(n,r,l){let i=n.tr,s=l.parent;for(let t=l.end,e=l.endIndex-1,n=l.startIndex;e>n;e--)t-=s.child(e).nodeSize,i.delete(t-1,t+1);let a=i.doc.resolve(l.start),u=a.nodeAfter;if(i.mapping.map(l.end)!=l.start+a.nodeAfter.nodeSize)return!1;let c=0==l.startIndex,f=l.endIndex==s.childCount,d=a.node(-1),h=a.index(-1);if(!d.canReplace(h+(c?0:1),h+1,u.content.append(f?e.empty:e.from(s))))return!1;let g=a.pos,p=g+u.nodeSize;return i.step(new o(g-(c?1:0),p+(f?1:0),g+1,p-1,new t((c?e.empty:e.from(s.copy(e.empty))).append(f?e.empty:e.from(s.copy(e.empty))),c?0:1,f?0:1),c?0:1)),r(i.scrollIntoView()),!0}(l,a,f)))}}function j(n){return function(r,l){let{$from:i,$to:s}=r.selection,a=i.blockRange(s,(t=>t.childCount>0&&t.firstChild.type==n));if(!a)return!1;let u=a.startIndex;if(0==u)return!1;let c=a.parent,f=c.child(u-1);if(f.type!=n)return!1;if(l){let i=f.lastChild&&f.lastChild.type==c.type,s=e.from(i?n.create():null),u=new t(e.from(n.create(null,e.from(c.type.create(null,s)))),i?3:1,0),d=a.start,h=a.end;l(r.tr.step(new o(d-(i?3:1),h,d,h,u,1,!0)).scrollIntoView())}return!0}}const T="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),W="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function F(t){let e,n,r,l,o=t.split(/-(?!$)/),i=o[o.length-1];"Space"==i&&(i=" ");for(let t=0;t<o.length-1;t++){let i=o[t];if(/^(cmd|meta|m)$/i.test(i))l=!0;else if(/^a(lt)?$/i.test(i))e=!0;else if(/^(c|ctrl|control)$/i.test(i))n=!0;else if(/^s(hift)?$/i.test(i))r=!0;else{if(!/^mod$/i.test(i))throw new Error("Unrecognized modifier name: "+i);T?l=!0:n=!0}}return e&&(i="Alt-"+i),n&&(i="Ctrl-"+i),l&&(i="Meta-"+i),r&&(i="Shift-"+i),i}function B(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function L(t){return new f({props:{handleKeyDown:I(t)}})}function I(t){let e=function(t){let e=Object.create(null);for(let n in t)e[F(n)]=t[n];return e}(t);return function(t,n){let r,l=y(n),o=e[B(l,n)];if(o&&o(t.state,t.dispatch,t))return!0;if(1==l.length&&" "!=l){if(n.shiftKey){let r=e[B(l,n,!1)];if(r&&r(t.state,t.dispatch,t))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(W&&n.ctrlKey&&n.altKey)&&(r=M[n.keyCode])&&r!=l){let l=e[B(r,n)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}let q,H;if("undefined"!=typeof WeakMap){let t=new WeakMap;q=e=>t.get(e),H=(e,n)=>(t.set(e,n),n)}else{const t=[],e=10;let n=0;q=e=>{for(let n=0;n<t.length;n+=2)if(t[n]==e)return t[n+1]},H=(r,l)=>(n==e&&(n=0),t[n++]=r,t[n++]=l)}var P=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,l=e/this.width|0;let o=r+1,i=l+1;for(let t=1;o<this.width&&this.map[e+t]==n;t++)o++;for(let t=1;i<this.height&&this.map[e+this.width*t]==n;t++)i++;return{left:r,top:l,right:o,bottom:i}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:l,top:o,bottom:i}=this.findCell(t);return"horiz"==e?(n<0?0==r:l==this.width)?null:this.map[o*this.width+(n<0?r-1:l)]:(n<0?0==o:i==this.height)?null:this.map[r+this.width*(n<0?o-1:i)]}rectBetween(t,e){const{left:n,right:r,top:l,bottom:o}=this.findCell(t),{left:i,right:s,top:a,bottom:u}=this.findCell(e);return{left:Math.min(n,i),top:Math.min(l,a),right:Math.max(r,s),bottom:Math.max(o,u)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let l=t.left;l<t.right;l++){const o=r*this.width+l,i=this.map[o];n[i]||(n[i]=!0,l==t.left&&l&&this.map[o-1]==i||r==t.top&&r&&this.map[o-this.width]==i||e.push(i))}return e}positionAt(t,e,n){for(let r=0,l=0;;r++){const o=l+n.child(r).nodeSize;if(r==t){let n=e+t*this.width;const r=(t+1)*this.width;for(;n<r&&this.map[n]<l;)n++;return n==r?o-1:this.map[n]}l=o}}static get(t){return q(t)||H(t,function(t){if("table"!=t.type.spec.tableRole)throw new RangeError("Not a table node: "+t.type.name);const e=function(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const l=t.child(r);let o=0;if(n)for(let e=0;e<r;e++){const n=t.child(e);for(let t=0;t<n.childCount;t++){const l=n.child(t);e+l.attrs.rowspan>r&&(o+=l.attrs.colspan)}}for(let t=0;t<l.childCount;t++){const e=l.child(t);o+=e.attrs.colspan,e.attrs.rowspan>1&&(n=!0)}-1==e?e=o:e!=o&&(e=Math.max(e,o))}return e}(t),n=t.childCount,r=[];let l=0,o=null;const i=[];for(let t=0,l=e*n;t<l;t++)r[t]=0;for(let s=0,a=0;s<n;s++){const u=t.child(s);a++;for(let t=0;;t++){for(;l<r.length&&0!=r[l];)l++;if(t==u.childCount)break;const c=u.child(t),{colspan:f,rowspan:d,colwidth:h}=c.attrs;for(let t=0;t<d;t++){if(t+s>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:a,n:d-t});break}const u=l+t*e;for(let t=0;t<f;t++){0==r[u+t]?r[u+t]=a:(o||(o=[])).push({type:"collision",row:s,pos:a,n:f-t});const n=h&&h[t];if(n){const r=(u+t)%e*2,l=i[r];null==l||l!=n&&1==i[r+1]?(i[r]=n,i[r+1]=1):l==n&&i[r+1]++}}}l+=f,a+=c.nodeSize}const c=(s+1)*e;let f=0;for(;l<c;)0==r[l++]&&f++;f&&(o||(o=[])).push({type:"missing",row:s,n:f}),a++}0!==e&&0!==n||(o||(o=[])).push({type:"zero_sized"});const s=new P(e,n,r,o);let a=!1;for(let t=0;!a&&t<i.length;t+=2)null!=i[t]&&i[t+1]<n&&(a=!0);a&&function(t,e,n){t.problems||(t.problems=[]);const r={};for(let l=0;l<t.map.length;l++){const o=t.map[l];if(r[o])continue;r[o]=!0;const i=n.nodeAt(o);if(!i)throw new RangeError(`No cell with offset ${o} found`);let s=null;const a=i.attrs;for(let n=0;n<a.colspan;n++){const r=e[(l+n)%t.width*2];null==r||a.colwidth&&a.colwidth[n]==r||((s||(s=J(a)))[n]=r)}s&&t.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:s})}}(s,i,t);return s}(t))}};function J(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function U(t,e){if("string"==typeof t)return{};const n=t.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map((t=>Number(t))):null,l=Number(t.getAttribute("colspan")||1),o={colspan:l,rowspan:Number(t.getAttribute("rowspan")||1),colwidth:r&&r.length==l?r:null};for(const n in e){const r=e[n].getFromDOM,l=r&&r(t);null!=l&&(o[n]=l)}return o}function K(t,e){const n={};1!=t.attrs.colspan&&(n.colspan=t.attrs.colspan),1!=t.attrs.rowspan&&(n.rowspan=t.attrs.rowspan),t.attrs.colwidth&&(n["data-colwidth"]=t.attrs.colwidth.join(","));for(const r in e){const l=e[r].setDOMAttr;l&&l(t.attrs[r],n)}return n}function V(t){if(null!==t){if(!Array.isArray(t))throw new TypeError("colwidth must be null or an array");for(const e of t)if("number"!=typeof e)throw new TypeError("colwidth must be null or an array of numbers")}}function G(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],l=r.spec.tableRole;l&&(e[l]=r)}}return e}const X=new d("selectingCells");function Q(t){for(let e=t.depth-1;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return t.node(0).resolve(t.before(e+1));return null}function Y(t){const e=t.selection.$head;for(let t=e.depth;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return!0;return!1}function Z(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&"cell"==e.node.type.spec.tableRole)return e.$anchor;const n=Q(e.$head)||function(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if("cell"==r||"header_cell"==r)return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if("cell"==r||"header_cell"==r)return t.doc.resolve(n-e.nodeSize)}}(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function tt(t){return"row"==t.parent.type.spec.tableRole&&!!t.nodeAfter}function et(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function nt(t,e,n){const r=t.node(-1),l=P.get(r),o=t.start(-1),i=l.nextCell(t.pos-o,e,n);return null==i?null:t.node(0).resolve(o+i)}function rt(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some((t=>t>0))||(r.colwidth=null)),r}function lt(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let t=0;t<n;t++)r.colwidth.splice(e,0,0)}return r}var ot=class n extends c{constructor(t,e=t){const n=t.node(-1),r=P.get(n),l=t.start(-1),o=r.rectBetween(t.pos-l,e.pos-l),i=t.node(0),s=r.cellsInRect(o).filter((t=>t!=e.pos-l));s.unshift(e.pos-l);const a=s.map((t=>{const e=n.nodeAt(t);if(!e)throw new RangeError(`No cell with offset ${t} found`);const r=l+t+1;return new h(i.resolve(r),i.resolve(r+e.content.size))}));super(a[0].$from,a[0].$to,a),this.$anchorCell=t,this.$headCell=e}map(t,e){const r=t.resolve(e.map(this.$anchorCell.pos)),l=t.resolve(e.map(this.$headCell.pos));if(tt(r)&&tt(l)&&et(r,l)){const t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?n.rowSelection(r,l):t&&this.isColSelection()?n.colSelection(r,l):new n(r,l)}return g.between(r,l)}content(){const n=this.$anchorCell.node(-1),r=P.get(n),l=this.$anchorCell.start(-1),o=r.rectBetween(this.$anchorCell.pos-l,this.$headCell.pos-l),i={},s=[];for(let t=o.top;t<o.bottom;t++){const l=[];for(let e=t*r.width+o.left,s=o.left;s<o.right;s++,e++){const t=r.map[e];if(i[t])continue;i[t]=!0;const s=r.findCell(t);let a=n.nodeAt(t);if(!a)throw new RangeError(`No cell with offset ${t} found`);const u=o.left-s.left,c=s.right-o.right;if(u>0||c>0){let t=a.attrs;if(u>0&&(t=rt(t,0,u)),c>0&&(t=rt(t,t.colspan-c,c)),s.left<o.left){if(a=a.type.createAndFill(t),!a)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(t)}`)}else a=a.type.create(t,a.content)}if(s.top<o.top||s.bottom>o.bottom){const t={...a.attrs,rowspan:Math.min(s.bottom,o.bottom)-Math.max(s.top,o.top)};a=s.top<o.top?a.type.createAndFill(t):a.type.create(t,a.content)}l.push(a)}s.push(n.child(t).copy(e.from(l)))}const a=this.isColSelection()&&this.isRowSelection()?n:s;return new t(e.from(a),1,1)}replace(e,n=t.empty){const r=e.steps.length,l=this.ranges;for(let o=0;o<l.length;o++){const{$from:i,$to:s}=l[o],a=e.mapping.slice(r);e.replace(a.map(i.pos),a.map(s.pos),o?t.empty:n)}const o=c.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(n,r){this.replace(n,new t(e.from(r),0,0))}forEachCell(t){const e=this.$anchorCell.node(-1),n=P.get(e),r=this.$anchorCell.start(-1),l=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<l.length;n++)t(e.nodeAt(l[n]),r+l[n])}isColSelection(){const t=this.$anchorCell.index(-1),e=this.$headCell.index(-1);if(Math.min(t,e)>0)return!1;const n=t+this.$anchorCell.nodeAfter.attrs.rowspan,r=e+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,e=t){const r=t.node(-1),l=P.get(r),o=t.start(-1),i=l.findCell(t.pos-o),s=l.findCell(e.pos-o),a=t.node(0);return i.top<=s.top?(i.top>0&&(t=a.resolve(o+l.map[i.left])),s.bottom<l.height&&(e=a.resolve(o+l.map[l.width*(l.height-1)+s.right-1]))):(s.top>0&&(e=a.resolve(o+l.map[s.left])),i.bottom<l.height&&(t=a.resolve(o+l.map[l.width*(l.height-1)+i.right-1]))),new n(t,e)}isRowSelection(){const t=this.$anchorCell.node(-1),e=P.get(t),n=this.$anchorCell.start(-1),r=e.colCount(this.$anchorCell.pos-n),l=e.colCount(this.$headCell.pos-n);if(Math.min(r,l)>0)return!1;const o=r+this.$anchorCell.nodeAfter.attrs.colspan,i=l+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,i)==e.width}eq(t){return t instanceof n&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,e=t){const r=t.node(-1),l=P.get(r),o=t.start(-1),i=l.findCell(t.pos-o),s=l.findCell(e.pos-o),a=t.node(0);return i.left<=s.left?(i.left>0&&(t=a.resolve(o+l.map[i.top*l.width])),s.right<l.width&&(e=a.resolve(o+l.map[l.width*(s.top+1)-1]))):(s.left>0&&(e=a.resolve(o+l.map[s.top*l.width])),i.right<l.width&&(t=a.resolve(o+l.map[l.width*(i.top+1)-1]))),new n(t,e)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,e){return new n(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,r=e){return new n(t.resolve(e),t.resolve(r))}getBookmark(){return new it(this.$anchorCell.pos,this.$headCell.pos)}};ot.prototype.visible=!1,c.jsonID("cell",ot);var it=class t{constructor(t,e){this.anchor=t,this.head=e}map(e){return new t(e.map(this.anchor),e.map(this.head))}resolve(t){const e=t.resolve(this.anchor),n=t.resolve(this.head);return"row"==e.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&e.index()<e.parent.childCount&&n.index()<n.parent.childCount&&et(e,n)?new ot(e,n):c.near(n,1)}};function st(t){if(!(t.selection instanceof ot))return null;const e=[];return t.selection.forEachCell(((t,n)=>{e.push(b.node(n,n+t.nodeSize,{class:"selectedCell"}))})),w.create(t.doc,e)}const at=new d("fix-tables");function ut(t,e,n,r){const l=t.childCount,o=e.childCount;t:for(let i=0,s=0;i<o;i++){const o=e.child(i);for(let e=s,r=Math.min(l,i+3);e<r;e++)if(t.child(e)==o){s=e+1,n+=o.nodeSize;continue t}r(o,n),s<l&&t.child(s).sameMarkup(o)?ut(t.child(s),o,n+1,r):o.nodesBetween(0,o.content.size,r,n+1),n+=o.nodeSize}}function ct(t,e){let n;const r=(e,r)=>{"table"==e.type.spec.tableRole&&(n=function(t,e,n,r){const l=P.get(e);if(!l.problems)return r;r||(r=t.tr);const o=[];for(let t=0;t<l.height;t++)o.push(0);for(let t=0;t<l.problems.length;t++){const i=l.problems[t];if("collision"==i.type){const t=e.nodeAt(i.pos);if(!t)continue;const l=t.attrs;for(let t=0;t<l.rowspan;t++)o[i.row+t]+=i.n;r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,rt(l,l.colspan-i.n,i.n))}else if("missing"==i.type)o[i.row]+=i.n;else if("overlong_rowspan"==i.type){const t=e.nodeAt(i.pos);if(!t)continue;r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,{...t.attrs,rowspan:t.attrs.rowspan-i.n})}else if("colwidth mismatch"==i.type){const t=e.nodeAt(i.pos);if(!t)continue;r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,{...t.attrs,colwidth:i.colwidth})}else if("zero_sized"==i.type){const t=r.mapping.map(n);r.delete(t,t+e.nodeSize)}}let i,s;for(let t=0;t<o.length;t++)o[t]&&(null==i&&(i=t),s=t);for(let a=0,u=n+1;a<l.height;a++){const n=e.child(a),l=u+n.nodeSize,c=o[a];if(c>0){let e="cell";n.firstChild&&(e=n.firstChild.type.spec.tableRole);const o=[];for(let n=0;n<c;n++){const n=G(t.schema)[e].createAndFill();n&&o.push(n)}const f=0!=a&&i!=a-1||s!=a?l-1:u+1;r.insert(r.mapping.map(f),o)}u=l}return r.setMeta(at,{fixTables:!0})}(t,e,r,n))};return e?e.doc!=t.doc&&ut(e.doc,t.doc,0,r):t.doc.descendants(r),n}function ft(t){const e=t.selection,n=Z(t),r=n.node(-1),l=n.start(-1),o=P.get(r);return{...e instanceof ot?o.rectBetween(e.$anchorCell.pos-l,e.$headCell.pos-l):o.findCell(n.pos-l),tableStart:l,map:o,table:r}}function dt(t,{map:e,tableStart:n,table:r},l){let o=l>0?-1:0;(function(t,e,n){const r=G(e.type.schema).header_cell;for(let l=0;l<t.height;l++)if(e.nodeAt(t.map[n+l*t.width]).type!=r)return!1;return!0})(e,r,l+o)&&(o=0==l||l==e.width?null:0);for(let i=0;i<e.height;i++){const s=i*e.width+l;if(l>0&&l<e.width&&e.map[s-1]==e.map[s]){const o=e.map[s],a=r.nodeAt(o);t.setNodeMarkup(t.mapping.map(n+o),null,lt(a.attrs,l-e.colCount(o))),i+=a.attrs.rowspan-1}else{const a=null==o?G(r.type.schema).cell:r.nodeAt(e.map[s+o]).type,u=e.positionAt(i,l,r);t.insert(t.mapping.map(n+u),a.createAndFill())}}return t}function ht(t,e){if(!Y(t))return!1;if(e){const n=ft(t);e(dt(t.tr,n,n.left))}return!0}function gt(t,e){if(!Y(t))return!1;if(e){const n=ft(t);e(dt(t.tr,n,n.right))}return!0}function pt(t,{map:e,table:n,tableStart:r},l){const o=t.mapping.maps.length;for(let i=0;i<e.height;){const s=i*e.width+l,a=e.map[s],u=n.nodeAt(a),c=u.attrs;if(l>0&&e.map[s-1]==a||l<e.width-1&&e.map[s+1]==a)t.setNodeMarkup(t.mapping.slice(o).map(r+a),null,rt(c,l-e.colCount(a)));else{const e=t.mapping.slice(o).map(r+a);t.delete(e,e+u.nodeSize)}i+=c.rowspan}}function mt(t,e){if(!Y(t))return!1;if(e){const n=ft(t),r=t.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let t=n.right-1;pt(r,n,t),t!=n.left;t--){const t=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!t)throw new RangeError("No table found");n.table=t,n.map=P.get(t)}e(r)}return!0}function wt(t,{map:e,tableStart:n,table:r},l){let o=n;for(let t=0;t<l;t++)o+=r.child(t).nodeSize;const i=[];let s=l>0?-1:0;(function(t,e,n){var r;const l=G(e.type.schema).header_cell;for(let o=0;o<t.width;o++)if((null===(r=e.nodeAt(t.map[o+n*t.width]))||void 0===r?void 0:r.type)!=l)return!1;return!0})(e,r,l+s)&&(s=0==l||l==e.height?null:0);for(let o=0,u=e.width*l;o<e.width;o++,u++)if(l>0&&l<e.height&&e.map[u]==e.map[u-e.width]){const l=e.map[u],i=r.nodeAt(l).attrs;t.setNodeMarkup(n+l,null,{...i,rowspan:i.rowspan+1}),o+=i.colspan-1}else{var a;const t=null==s?G(r.type.schema).cell:null===(a=r.nodeAt(e.map[u+s*e.width]))||void 0===a?void 0:a.type,n=null==t?void 0:t.createAndFill();n&&i.push(n)}return t.insert(o,G(r.type.schema).row.create(null,i)),t}function bt(t,e){if(!Y(t))return!1;if(e){const n=ft(t);e(wt(t.tr,n,n.top))}return!0}function yt(t,e){if(!Y(t))return!1;if(e){const n=ft(t);e(wt(t.tr,n,n.bottom))}return!0}function Mt(t,{map:e,table:n,tableStart:r},l){let o=0;for(let t=0;t<l;t++)o+=n.child(t).nodeSize;const i=o+n.child(l).nodeSize,s=t.mapping.maps.length;t.delete(o+r,i+r);const a=new Set;for(let o=0,i=l*e.width;o<e.width;o++,i++){const u=e.map[i];if(!a.has(u))if(a.add(u),l>0&&u==e.map[i-e.width]){const e=n.nodeAt(u).attrs;t.setNodeMarkup(t.mapping.slice(s).map(u+r),null,{...e,rowspan:e.rowspan-1}),o+=e.colspan-1}else if(l<e.height&&u==e.map[i+e.width]){const i=n.nodeAt(u),a=i.attrs,c=i.type.create({...a,rowspan:i.attrs.rowspan-1},i.content),f=e.positionAt(l+1,o,n);t.insert(t.mapping.slice(s).map(r+f),c),o+=a.colspan-1}}}function Dt(t,e){if(!Y(t))return!1;if(e){const n=ft(t),r=t.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let t=n.bottom-1;Mt(r,n,t),t!=n.top;t--){const t=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!t)throw new RangeError("No table found");n.table=t,n.map=P.get(n.table)}e(r)}return!0}function Ot(t){const e=t.content;return 1==e.childCount&&e.child(0).isTextblock&&0==e.child(0).childCount}function kt(t,n){const r=t.selection;if(!(r instanceof ot)||r.$anchorCell.pos==r.$headCell.pos)return!1;const l=ft(t),{map:o}=l;if(function({width:t,height:e,map:n},r){let l=r.top*t+r.left,o=l,i=(r.bottom-1)*t+r.left,s=l+(r.right-r.left-1);for(let e=r.top;e<r.bottom;e++){if(r.left>0&&n[o]==n[o-1]||r.right<t&&n[s]==n[s+1])return!0;o+=t,s+=t}for(let o=r.left;o<r.right;o++){if(r.top>0&&n[l]==n[l-t]||r.bottom<e&&n[i]==n[i+t])return!0;l++,i++}return!1}(o,l))return!1;if(n){const r=t.tr,i={};let s,a,u=e.empty;for(let t=l.top;t<l.bottom;t++)for(let e=l.left;e<l.right;e++){const n=o.map[t*o.width+e],c=l.table.nodeAt(n);if(!i[n]&&c)if(i[n]=!0,null==s)s=n,a=c;else{Ot(c)||(u=u.append(c.content));const t=r.mapping.map(n+l.tableStart);r.delete(t,t+c.nodeSize)}}if(null==s||null==a)return!0;if(r.setNodeMarkup(s+l.tableStart,null,{...lt(a.attrs,a.attrs.colspan,l.right-l.left-a.attrs.colspan),rowspan:l.bottom-l.top}),u.size>0){const t=s+1+a.content.size,e=Ot(a)?s+1:t;r.replaceWith(e+l.tableStart,t+l.tableStart,u)}r.setSelection(new ot(r.doc.resolve(s+l.tableStart))),n(r)}return!0}function vt(t,e){const n=G(t.schema);return(r=({node:t})=>n[t.type.spec.tableRole],(t,e)=>{const n=t.selection;let l,o;if(n instanceof ot){if(n.$anchorCell.pos!=n.$headCell.pos)return!1;l=n.$anchorCell.nodeAfter,o=n.$anchorCell.pos}else{var i;if(l=function(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if("cell"===n||"header_cell"===n)return t.node(e)}return null}(n.$from),!l)return!1;o=null===(i=Q(n.$from))||void 0===i?void 0:i.pos}if(null==l||null==o)return!1;if(1==l.attrs.colspan&&1==l.attrs.rowspan)return!1;if(e){let i=l.attrs;const s=[],a=i.colwidth;i.rowspan>1&&(i={...i,rowspan:1}),i.colspan>1&&(i={...i,colspan:1});const u=ft(t),c=t.tr;for(let t=0;t<u.right-u.left;t++)s.push(a?{...i,colwidth:a&&a[t]?[a[t]]:null}:i);let f;for(let t=u.top;t<u.bottom;t++){let e=u.map.positionAt(t,u.left,u.table);t==u.top&&(e+=l.nodeSize);for(let n=u.left,o=0;n<u.right;n++,o++)n==u.left&&t==u.top||c.insert(f=c.mapping.map(e+u.tableStart,1),r({node:l,row:t,col:n}).createAndFill(s[o]))}c.setNodeMarkup(o,r({node:l,row:u.top,col:u.left}),s[0]),n instanceof ot&&c.setSelection(new ot(c.doc.resolve(n.$anchorCell.pos),f?c.doc.resolve(f):void 0)),e(c)}return!0})(t,e);var r}function $t(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:"row"==t?e.map.width:1,bottom:"column"==t?e.map.height:1});for(let t=0;t<r.length;t++){const l=e.table.nodeAt(r[t]);if(l&&l.type!==n.header_cell)return!1}return!0}function _t(t,e){return(e=e||{useDeprecatedLogic:!1}).useDeprecatedLogic?function(t){return function(e,n){if(!Y(e))return!1;if(n){const r=G(e.schema),l=ft(e),o=e.tr,i=l.map.cellsInRect("column"==t?{left:l.left,top:0,right:l.right,bottom:l.map.height}:"row"==t?{left:0,top:l.top,right:l.map.width,bottom:l.bottom}:l),s=i.map((t=>l.table.nodeAt(t)));for(let t=0;t<i.length;t++)s[t].type==r.header_cell&&o.setNodeMarkup(l.tableStart+i[t],r.cell,s[t].attrs);if(0===o.steps.length)for(let t=0;t<i.length;t++)o.setNodeMarkup(l.tableStart+i[t],r.header_cell,s[t].attrs);n(o)}return!0}}(t):function(e,n){if(!Y(e))return!1;if(n){const r=G(e.schema),l=ft(e),o=e.tr,i=$t("row",l,r),s=$t("column",l,r),a=("column"===t?i:"row"===t&&s)?1:0,u="column"==t?{left:0,top:a,right:1,bottom:l.map.height}:"row"==t?{left:a,top:0,right:l.map.width,bottom:1}:l,c="column"==t?s?r.cell:r.header_cell:"row"==t?i?r.cell:r.header_cell:r.cell;l.map.cellsInRect(u).forEach((t=>{const e=t+l.tableStart,n=o.doc.nodeAt(e);n&&o.setNodeMarkup(e,c,n.attrs)})),n(o)}return!0}}const At=_t("row",{useDeprecatedLogic:!0});function xt(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if("table"==n.node(r).type.spec.tableRole)return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function St(e,n){const r=e.selection;if(!(r instanceof ot))return!1;if(n){const l=e.tr,o=G(e.schema).cell.createAndFill().content;r.forEachCell(((e,n)=>{e.content.eq(o)||l.replace(l.mapping.map(n+1),l.mapping.map(n+e.nodeSize-1),new t(o,0,0))})),l.docChanged&&n(l)}return!0}function Nt(n){if(0===n.size)return null;let{content:r,openStart:l,openEnd:o}=n;for(;1==r.childCount&&(l>0&&o>0||"table"==r.child(0).type.spec.tableRole);)l--,o--,r=r.child(0).content;const i=r.child(0),s=i.type.spec.tableRole,a=i.type.schema,u=[];if("row"==s)for(let e=0;e<r.childCount;e++){let n=r.child(e).content;const i=e?0:Math.max(0,l-1),s=e<r.childCount-1?0:Math.max(0,o-1);(i||s)&&(n=zt(G(a).row,new t(n,i,s)).content),u.push(n)}else{if("cell"!=s&&"header_cell"!=s)return null;u.push(l||o?zt(G(a).row,new t(r,l,o)).content:r)}return function(t,n){const r=[];for(let t=0;t<n.length;t++){const e=n[t];for(let n=e.childCount-1;n>=0;n--){const{rowspan:l,colspan:o}=e.child(n).attrs;for(let e=t;e<t+l;e++)r[e]=(r[e]||0)+o}}let l=0;for(let t=0;t<r.length;t++)l=Math.max(l,r[t]);for(let o=0;o<r.length;o++)if(o>=n.length&&n.push(e.empty),r[o]<l){const i=G(t).cell.createAndFill(),s=[];for(let t=r[o];t<l;t++)s.push(i);n[o]=n[o].append(e.from(s))}return{height:n.length,width:l,rows:n}}(a,u)}function zt(t,e){const n=t.createAndFill();return new m(n).replace(0,n.content.size,e).doc}function Rt(t,e,n,r,l,o,i,s){if(0==i||i==e.height)return!1;let a=!1;for(let u=l;u<o;u++){const l=i*e.width+u,o=e.map[l];if(e.map[l-e.width]==o){a=!0;const l=n.nodeAt(o),{top:c,left:f}=e.findCell(o);t.setNodeMarkup(t.mapping.slice(s).map(o+r),null,{...l.attrs,rowspan:i-c}),t.insert(t.mapping.slice(s).map(e.positionAt(i,f,n)),l.type.createAndFill({...l.attrs,rowspan:c+l.attrs.rowspan-i})),u+=l.attrs.colspan-1}}return a}function Et(t,e,n,r,l,o,i,s){if(0==i||i==e.width)return!1;let a=!1;for(let u=l;u<o;u++){const l=u*e.width+i,o=e.map[l];if(e.map[l-1]==o){a=!0;const l=n.nodeAt(o),c=e.colCount(o),f=t.mapping.slice(s).map(o+r);t.setNodeMarkup(f,null,rt(l.attrs,i-c,l.attrs.colspan-(i-c))),t.insert(f+l.nodeSize,l.type.createAndFill(rt(l.attrs,0,i-c))),u+=l.attrs.rowspan-1}}return a}function Ct(n,r,l,o,i){let s=l?n.doc.nodeAt(l-1):n.doc;if(!s)throw new Error("No table found");let a=P.get(s);const{top:u,left:c}=o,f=c+i.width,d=u+i.height,h=n.tr;let g=0;function p(){if(s=l?h.doc.nodeAt(l-1):h.doc,!s)throw new Error("No table found");a=P.get(s),g=h.mapping.maps.length}(function(t,n,r,l,o,i,s){const a=G(t.doc.type.schema);let u,c;if(o>n.width)for(let e=0,i=0;e<n.height;e++){const f=r.child(e);i+=f.nodeSize;const d=[];let h;h=null==f.lastChild||f.lastChild.type==a.cell?u||(u=a.cell.createAndFill()):c||(c=a.header_cell.createAndFill());for(let t=n.width;t<o;t++)d.push(h);t.insert(t.mapping.slice(s).map(i-1+l),d)}if(i>n.height){const f=[];for(let t=0,e=(n.height-1)*n.width;t<Math.max(n.width,o);t++){const l=!(t>=n.width)&&r.nodeAt(n.map[e+t]).type==a.header_cell;f.push(l?c||(c=a.header_cell.createAndFill()):u||(u=a.cell.createAndFill()))}const d=a.row.create(null,e.from(f)),h=[];for(let t=n.height;t<i;t++)h.push(d);t.insert(t.mapping.slice(s).map(l+r.nodeSize-2),h)}return!(!u&&!c)})(h,a,s,l,f,d,g)&&p(),Rt(h,a,s,l,c,f,u,g)&&p(),Rt(h,a,s,l,c,f,d,g)&&p(),Et(h,a,s,l,u,d,c,g)&&p(),Et(h,a,s,l,u,d,f,g)&&p();for(let e=u;e<d;e++){const n=a.positionAt(e,c,s),r=a.positionAt(e,f,s);h.replace(h.mapping.slice(g).map(n+l),h.mapping.slice(g).map(r+l),new t(i.rows[e-u],0,0))}p(),h.setSelection(new ot(h.doc.resolve(l+a.positionAt(u,c,s)),h.doc.resolve(l+a.positionAt(d-1,f-1,s)))),r(h)}_t("column",{useDeprecatedLogic:!0}),_t("cell",{useDeprecatedLogic:!0});const jt=I({ArrowLeft:Wt("horiz",-1),ArrowRight:Wt("horiz",1),ArrowUp:Wt("vert",-1),ArrowDown:Wt("vert",1),"Shift-ArrowLeft":Ft("horiz",-1),"Shift-ArrowRight":Ft("horiz",1),"Shift-ArrowUp":Ft("vert",-1),"Shift-ArrowDown":Ft("vert",1),Backspace:St,"Mod-Backspace":St,Delete:St,"Mod-Delete":St});function Tt(t,e,n){return!n.eq(t.selection)&&(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Wt(t,e){return(n,r,l)=>{if(!l)return!1;const o=n.selection;if(o instanceof ot)return Tt(n,r,c.near(o.$headCell,e));if("horiz"!=t&&!o.empty)return!1;const i=qt(l,t,e);if(null==i)return!1;if("horiz"==t)return Tt(n,r,c.near(n.doc.resolve(o.head+e),e));{const l=n.doc.resolve(i),o=nt(l,t,e);let s;return s=o?c.near(o,1):e<0?c.near(n.doc.resolve(l.before(-1)),-1):c.near(n.doc.resolve(l.after(-1)),1),Tt(n,r,s)}}}function Ft(t,e){return(n,r,l)=>{if(!l)return!1;const o=n.selection;let i;if(o instanceof ot)i=o;else{const r=qt(l,t,e);if(null==r)return!1;i=new ot(n.doc.resolve(r))}const s=nt(i.$headCell,t,e);return!!s&&Tt(n,r,new ot(i.$anchorCell,s))}}function Bt(t,e){const n=Q(t.state.doc.resolve(e));return!!n&&(t.dispatch(t.state.tr.setSelection(new ot(n))),!0)}function Lt(t,n,r){if(!Y(t.state))return!1;let l=Nt(r);const o=t.state.selection;if(o instanceof ot){l||(l={width:1,height:1,rows:[e.from(zt(G(t.state.schema).cell,r))]});const n=o.$anchorCell.node(-1),i=o.$anchorCell.start(-1),s=P.get(n).rectBetween(o.$anchorCell.pos-i,o.$headCell.pos-i);return l=function({width:t,height:n,rows:r},l,o){if(t!=l){const n=[],o=[];for(let t=0;t<r.length;t++){const i=r[t],s=[];for(let e=n[t]||0,r=0;e<l;r++){let o=i.child(r%i.childCount);e+o.attrs.colspan>l&&(o=o.type.createChecked(rt(o.attrs,o.attrs.colspan,e+o.attrs.colspan-l),o.content)),s.push(o),e+=o.attrs.colspan;for(let e=1;e<o.attrs.rowspan;e++)n[t+e]=(n[t+e]||0)+o.attrs.colspan}o.push(e.from(s))}r=o,t=l}if(n!=o){const t=[];for(let l=0,i=0;l<o;l++,i++){const s=[],a=r[i%n];for(let t=0;t<a.childCount;t++){let e=a.child(t);l+e.attrs.rowspan>o&&(e=e.type.create({...e.attrs,rowspan:Math.max(1,o-e.attrs.rowspan)},e.content)),s.push(e)}t.push(e.from(s))}r=t,n=o}return{width:t,height:n,rows:r}}(l,s.right-s.left,s.bottom-s.top),Ct(t.state,t.dispatch,i,s,l),!0}if(l){const e=Z(t.state),n=e.start(-1);return Ct(t.state,t.dispatch,n,P.get(e.node(-1)).findCell(e.pos-n),l),!0}return!1}function It(t,e){var n;if(0!=e.button)return;if(e.ctrlKey||e.metaKey)return;const r=Ht(t,e.target);let l;if(e.shiftKey&&t.state.selection instanceof ot)o(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&null!=(l=Q(t.state.selection.$anchor))&&(null===(n=Pt(t,e))||void 0===n?void 0:n.pos)!=l.pos)o(l,e),e.preventDefault();else if(!r)return;function o(e,n){let r=Pt(t,n);const l=null==X.getState(t.state);if(!r||!et(e,r)){if(!l)return;r=e}const o=new ot(e,r);if(l||!t.state.selection.eq(o)){const n=t.state.tr.setSelection(o);l&&n.setMeta(X,e.pos),t.dispatch(n)}}function i(){t.root.removeEventListener("mouseup",i),t.root.removeEventListener("dragstart",i),t.root.removeEventListener("mousemove",s),null!=X.getState(t.state)&&t.dispatch(t.state.tr.setMeta(X,-1))}function s(n){const l=n,s=X.getState(t.state);let a;if(null!=s)a=t.state.doc.resolve(s);else if(Ht(t,l.target)!=r&&(a=Pt(t,e),!a))return i();a&&o(a,l)}t.root.addEventListener("mouseup",i),t.root.addEventListener("dragstart",i),t.root.addEventListener("mousemove",s)}function qt(t,e,n){if(!(t.state.selection instanceof g))return null;const{$head:r}=t.state.selection;for(let l=r.depth-1;l>=0;l--){const o=r.node(l);if((n<0?r.index(l):r.indexAfter(l))!=(n<0?0:o.childCount))return null;if("cell"==o.type.spec.tableRole||"header_cell"==o.type.spec.tableRole){const o=r.before(l),i="vert"==e?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(i)?o:null}}return null}function Ht(t,e){for(;e&&e!=t.dom;e=e.parentNode)if("TD"==e.nodeName||"TH"==e.nodeName)return e;return null}function Pt(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:l}=n;return r>=0&&Q(t.state.doc.resolve(r))||Q(t.state.doc.resolve(l))}var Jt=class{constructor(t,e){this.node=t,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Ut(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type==this.node.type&&(this.node=t,Ut(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return"attributes"==t.type&&(t.target==this.table||this.colgroup.contains(t.target))}};function Ut(t,e,n,r,l,o){let i=0,s=!0,a=e.firstChild;const u=t.firstChild;if(u){for(let t=0,n=0;t<u.childCount;t++){const{colspan:c,colwidth:f}=u.child(t).attrs;for(let t=0;t<c;t++,n++){const u=l==n?o:f&&f[t],c=u?u+"px":"";if(i+=u||r,u||(s=!1),a)a.style.width!=c&&(a.style.width=c),a=a.nextSibling;else{const t=document.createElement("col");t.style.width=c,e.appendChild(t)}}}for(;a;){var c;const t=a.nextSibling;null===(c=a.parentNode)||void 0===c||c.removeChild(a),a=t}s?(n.style.width=i+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=i+"px")}}const Kt=new d("tableColumnResizing");function Vt({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=Jt,lastColumnResizable:l=!0}={}){const o=new f({key:Kt,state:{init(t,e){var l;const i=null===(l=o.spec)||void 0===l||null===(l=l.props)||void 0===l?void 0:l.nodeViews,s=G(e.schema).table.name;return r&&i&&(i[s]=(t,e)=>new r(t,n,e)),new Gt(-1,!1)},apply:(t,e)=>e.apply(t)},props:{attributes:t=>{const e=Kt.getState(t);return e&&e.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(e,n)=>{!function(t,e,n,r){if(!t.editable)return;const l=Kt.getState(t.state);if(!l)return;if(!l.dragging){const o=function(t){for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}(e.target);let i=-1;if(o){const{left:r,right:l}=o.getBoundingClientRect();e.clientX-r<=n?i=Xt(t,e,"left",n):l-e.clientX<=n&&(i=Xt(t,e,"right",n))}if(i!=l.activeHandle){if(!r&&-1!==i){const e=t.state.doc.resolve(i),n=e.node(-1),r=P.get(n),l=e.start(-1);if(r.colCount(e.pos-l)+e.nodeAfter.attrs.colspan-1==r.width-1)return}Yt(t,i)}}}(e,n,t,l)},mouseleave:t=>{!function(t){if(!t.editable)return;const e=Kt.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Yt(t,-1)}(t)},mousedown:(t,r)=>{!function(t,e,n,r){var l;if(!t.editable)return!1;const o=null!==(l=t.dom.ownerDocument.defaultView)&&void 0!==l?l:window,i=Kt.getState(t.state);if(!i||-1==i.activeHandle||i.dragging)return!1;const s=t.state.doc.nodeAt(i.activeHandle),a=function(t,e,{colspan:n,colwidth:r}){const l=r&&r[r.length-1];if(l)return l;const o=t.domAtPos(e);let i=o.node.childNodes[o.offset].offsetWidth,s=n;if(r)for(let t=0;t<n;t++)r[t]&&(i-=r[t],s--);return i/s}(t,i.activeHandle,s.attrs);function u(e){o.removeEventListener("mouseup",u),o.removeEventListener("mousemove",c);const r=Kt.getState(t.state);(null==r?void 0:r.dragging)&&(!function(t,e,n){const r=t.state.doc.resolve(e),l=r.node(-1),o=P.get(l),i=r.start(-1),s=o.colCount(r.pos-i)+r.nodeAfter.attrs.colspan-1,a=t.state.tr;for(let t=0;t<o.height;t++){const e=t*o.width+s;if(t&&o.map[e]==o.map[e-o.width])continue;const r=o.map[e],u=l.nodeAt(r).attrs,c=1==u.colspan?0:s-o.colCount(r);if(u.colwidth&&u.colwidth[c]==n)continue;const f=u.colwidth?u.colwidth.slice():te(u.colspan);f[c]=n,a.setNodeMarkup(i+r,null,{...u,colwidth:f})}a.docChanged&&t.dispatch(a)}(t,r.activeHandle,Qt(r.dragging,e,n)),t.dispatch(t.state.tr.setMeta(Kt,{setDragging:null})))}function c(e){if(!e.which)return u(e);const l=Kt.getState(t.state);if(l&&l.dragging){const o=Qt(l.dragging,e,n);Zt(t,l.activeHandle,o,r)}}t.dispatch(t.state.tr.setMeta(Kt,{setDragging:{startX:e.clientX,startWidth:a}})),Zt(t,i.activeHandle,a,r),o.addEventListener("mouseup",u),o.addEventListener("mousemove",c),e.preventDefault()}(t,r,e,n)}},decorations:t=>{const e=Kt.getState(t);if(e&&e.activeHandle>-1)return function(t,e){const n=[],r=t.doc.resolve(e),l=r.node(-1);if(!l)return w.empty;const o=P.get(l),i=r.start(-1),s=o.colCount(r.pos-i)+r.nodeAfter.attrs.colspan-1;for(let e=0;e<o.height;e++){const r=s+e*o.width;if(!(s!=o.width-1&&o.map[r]==o.map[r+1]||0!=e&&o.map[r]==o.map[r-o.width])){var a;const e=o.map[r],s=i+e+l.nodeAt(e).nodeSize-1,u=document.createElement("div");u.className="column-resize-handle",(null===(a=Kt.getState(t))||void 0===a?void 0:a.dragging)&&n.push(b.node(i+e,i+e+l.nodeAt(e).nodeSize,{class:"column-resize-dragging"})),n.push(b.widget(s,u))}}return w.create(t.doc,n)}(t,e.activeHandle)},nodeViews:{}}});return o}var Gt=class t{constructor(t,e){this.activeHandle=t,this.dragging=e}apply(e){const n=this,r=e.getMeta(Kt);if(r&&null!=r.setHandle)return new t(r.setHandle,!1);if(r&&void 0!==r.setDragging)return new t(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let r=e.mapping.map(n.activeHandle,-1);return tt(e.doc.resolve(r))||(r=-1),new t(r,n.dragging)}return n}};function Xt(t,e,n,r){const l="right"==n?-r:r,o=t.posAtCoords({left:e.clientX+l,top:e.clientY});if(!o)return-1;const{pos:i}=o,s=Q(t.state.doc.resolve(i));if(!s)return-1;if("right"==n)return s.pos;const a=P.get(s.node(-1)),u=s.start(-1),c=a.map.indexOf(s.pos-u);return c%a.width==0?-1:u+a.map[c-1]}function Qt(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function Yt(t,e){t.dispatch(t.state.tr.setMeta(Kt,{setHandle:e}))}function Zt(t,e,n,r){const l=t.state.doc.resolve(e),o=l.node(-1),i=l.start(-1),s=P.get(o).colCount(l.pos-i)+l.nodeAfter.attrs.colspan-1;let a=t.domAtPos(l.start(-1)).node;for(;a&&"TABLE"!=a.nodeName;)a=a.parentNode;a&&Ut(o,a.firstChild,a,r,s,n)}function te(t){return Array(t).fill(0)}function ee({allowTableNodeSelection:t=!1}={}){return new f({key:X,state:{init:()=>null,apply(t,e){const n=t.getMeta(X);if(null!=n)return-1==n?null:n;if(null==e||!t.docChanged)return e;const{deleted:r,pos:l}=t.mapping.mapResult(e);return r?null:l}},props:{decorations:st,handleDOMEvents:{mousedown:It},createSelectionBetween:t=>null!=X.getState(t.state)?t.state.selection:null,handleTripleClick:Bt,handleKeyDown:jt,handlePaste:Lt},appendTransaction:(e,n,r)=>function(t,e,n){const r=(e||t).selection,l=(e||t).doc;let o,i;if(r instanceof p&&(i=r.node.type.spec.tableRole)){if("cell"==i||"header_cell"==i)o=ot.create(l,r.from);else if("row"==i){const t=l.resolve(r.from+1);o=ot.rowSelection(t,t)}else if(!n){const t=P.get(r.node),e=r.from+1,n=e+t.map[t.width*t.height-1];o=ot.create(l,e+1,n)}}else r instanceof g&&function({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,l=t.depth;for(;l>=0&&!(t.after(l+1)<t.end(l));l--,n++);for(let t=e.depth;t>=0&&!(e.before(t+1)>e.start(t));t--,r--);return n==r&&/row|table/.test(t.node(l).type.spec.tableRole)}(r)?o=g.create(l,r.from):r instanceof g&&function({$from:t,$to:e}){let n,r;for(let e=t.depth;e>0;e--){const r=t.node(e);if("cell"===r.type.spec.tableRole||"header_cell"===r.type.spec.tableRole){n=r;break}}for(let t=e.depth;t>0;t--){const n=e.node(t);if("cell"===n.type.spec.tableRole||"header_cell"===n.type.spec.tableRole){r=n;break}}return n!==r&&0===e.parentOffset}(r)&&(o=g.create(l,r.$from.start(),r.$from.end()));return o&&(e||(e=t.tr)).setSelection(o),e}(r,ct(r,n),t)})}const ne=["left","center","right","justify"],re=new Set(["left","center","right","justify","start","end"]);function le(t){const e=t.style.textAlign||t.getAttribute("align")||"";return ne.includes(e)?e:null}const oe=/^(\d{1,3}(?:\.\d{1,2})?)%$/;function ie(t){if("number"==typeof t)return t>0?`${t}px`:null;if("string"==typeof t){const e=oe.exec(t.trim());if(e){const n=parseFloat(e[1]);if(n>0&&n<=100)return t.trim()}}return null}function se(t,e){const n=t.trim();if(n.endsWith("%")){const t=oe.exec(n);if(t){const e=parseFloat(t[1]);if(e>0&&e<=100)return n}return null}const r=parseFloat(t),l=parseFloat(e??""),o=Number.isFinite(r)?Math.round(r):Number.isFinite(l)?Math.round(l):null;return o&&o>0?o:null}const ae=8;function ue(t){const e=t.style.marginInlineStart||t.style.marginLeft||"",n=parseFloat(e);return!Number.isFinite(n)||n<=0?0:Math.min(8,Math.round(n/40))}function ce(t){const e=t.style.lineHeight.trim();if(!e||"normal"===e)return null;const n=parseFloat(e);return!Number.isFinite(n)||n<=0?null:e.endsWith("%")?String(n/100):e}function fe(t){const e=t.style;if(e.margin)return`margin: ${e.margin}`;const n=[];return e.marginTop&&n.push(`margin-top: ${e.marginTop}`),e.marginBottom&&n.push(`margin-bottom: ${e.marginBottom}`),n.length?n.join("; "):null}function de(t){const e=[];t.margin&&e.push(t.margin);const n=function(t){return t?`text-align: ${t}`:null}(t.align??null);if(n&&e.push(n),t.indent&&e.push(`margin-inline-start: ${40*t.indent}px`),t.lineHeight&&e.push(`line-height: ${t.lineHeight}`),t.extraStyle){const n=k(t.extraStyle);n&&e.push(n)}return e.length?e.join("; "):null}const he=/^(?:nile-wysiwyg|ProseMirror)/;function ge(t){if(!t)return null;const e=t.split(/\s+/).filter((t=>t&&!he.test(t)));return e.length?e.join(" "):null}function pe(t){return t&&!he.test(t)?t:null}const me={htmlClass:{default:null},htmlId:{default:null}};function we(t){return{htmlClass:ge(t.getAttribute("class")),htmlId:pe(t.getAttribute("id"))}}function be(t){if(!("tag"in t)||"style"in t)return t;const e=t.getAttrs;return{...t,getAttrs(t){const n=e?e(t):null;return!1!==n&&{...n??{},...we(t)}}}}function ye(t){return{...t,attrs:{...t.attrs??{},...me},parseDOM:t.parseDOM?.map(be),toDOM:(e=t.toDOM,e?(t,...n)=>{const r=e(t,...n),l=t.attrs.htmlClass,o=t.attrs.htmlId;if(!Array.isArray(r)||!l&&!o)return r;const[i,...s]=r;let a={},u=s;return s.length&&s[0]&&"object"==typeof s[0]&&!Array.isArray(s[0])&&(a={...s[0]},u=s.slice(1)),l&&(a.class=a.class?`${a.class} ${l}`:l),o&&(a.id=o),[i,a,...u]}:e)};var e}const Me=["paragraph","heading","blockquote","code_block","bullet_list","ordered_list","list_item","table","table_row","table_cell","table_header"],De=["link","bold","italic","underline","strike","code","subscript","superscript"],Oe={doc:{content:"block+"},paragraph:{content:"inline*",group:"block",attrs:{align:{default:null},indent:{default:0},lineHeight:{default:null},margin:{default:null},extraStyle:{default:null}},parseDOM:[{tag:"p",getAttrs:t=>({align:le(t),indent:ue(t),lineHeight:ce(t),margin:fe(t),extraStyle:t.getAttribute("data-extra-style")})}],toDOM(t){const e=de(t.attrs);return e?["p",{style:e},0]:["p",0]}},heading:{content:"inline*",group:"block",defining:!0,attrs:{level:{default:1},align:{default:null},indent:{default:0},lineHeight:{default:null},margin:{default:null},extraStyle:{default:null}},parseDOM:[1,2,3,4,5,6].map((t=>({tag:`h${t}`,getAttrs:e=>({level:t,align:le(e),indent:ue(e),lineHeight:ce(e),margin:fe(e),extraStyle:e.getAttribute("data-extra-style")})}))),toDOM(t){const e=de(t.attrs);return e?[`h${t.attrs.level}`,{style:e},0]:[`h${t.attrs.level}`,0]}},blockquote:{content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:()=>["hr"]},text:{group:"inline"},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM:()=>["br"]},code_block:{content:"text*",group:"block",marks:"",code:!0,defining:!0,attrs:{language:{default:null}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>({language:t.getAttribute("data-language")})}],toDOM(t){const e={class:"nile-wysiwyg__code-block"};return t.attrs.language&&(e["data-language"]=t.attrs.language),["pre",e,["code",0]]}},image:{inline:!0,group:"inline",draggable:!0,attrs:{src:{},alt:{default:null},title:{default:null},width:{default:null}},parseDOM:[{tag:"img[src]",getAttrs:t=>({src:t.getAttribute("src"),alt:t.getAttribute("alt"),title:t.getAttribute("title"),width:se(t.style.width,t.getAttribute("width")??"")})}],toDOM(t){const{src:e,alt:n,title:r,width:l}=t.attrs,o={src:e};n&&(o.alt=n),r&&(o.title=r);const i=ie(l);return i&&(o.style=`width: ${i}`),["img",o]}},figure:{group:"block",content:"inline*",defining:!0,isolating:!0,attrs:{src:{},alt:{default:null},title:{default:null},width:{default:null},align:{default:null}},parseDOM:[{tag:"figure",contentElement:"figcaption",getAttrs:t=>{const e=t.querySelector("img[src]");if(!e)return!1;const n=t.getAttribute("data-align");return{src:e.getAttribute("src"),alt:e.getAttribute("alt"),title:e.getAttribute("title"),width:se(e.style.width||t.style.width),align:"left"===n||"center"===n||"right"===n?n:null}}}],toDOM(t){const{src:e,alt:n,title:r,width:l,align:o}=t.attrs,i={class:"nile-wysiwyg__figure"};o&&(i["data-align"]=o);const s=[],a=ie(l);a&&s.push(`width: ${a}`),"center"===o?s.push("margin-left: auto; margin-right: auto"):"right"===o&&s.push("margin-left: auto; margin-right: 0"),s.length&&(i.style=s.join("; "));const u={src:e,style:"width: 100%"};return n&&(u.alt=n),r&&(u.title=r),["figure",i,["img",u],["figcaption",{class:"nile-wysiwyg__figcaption"},0]]}},task_list:{content:"task_item+",group:"block",parseDOM:[{tag:"ul[data-task-list]",priority:51}],toDOM:()=>["ul",{"data-task-list":"true",class:"nile-wysiwyg__task-list"},0]},task_item:{content:"paragraph block*",defining:!0,attrs:{checked:{default:!1}},parseDOM:[{tag:"li[data-task-item]",priority:51,getAttrs:t=>({checked:"true"===t.getAttribute("data-checked")})}],toDOM:t=>["li",{"data-task-item":"true","data-checked":String(t.attrs.checked),class:"nile-wysiwyg__task-item"},0]},embed:{group:"block",atom:!0,selectable:!0,draggable:!0,attrs:{src:{},provider:{default:null},title:{default:null},width:{default:null},align:{default:null}},parseDOM:[{tag:"div[data-embed-provider]",getAttrs:t=>{const e=t.querySelector("iframe[src]");if(!e)return!1;const n=t.getAttribute("data-width")??/^(\d+)px$/.exec(t.style.width)?.[1],r=n?parseInt(n,10):NaN,l=t.getAttribute("data-align");return{src:e.getAttribute("src"),provider:t.getAttribute("data-embed-provider"),title:e.getAttribute("title"),width:Number.isFinite(r)&&r>0?r:null,align:"left"===l||"center"===l||"right"===l?l:null}}},{tag:"iframe[src]",getAttrs:t=>{const e=parseInt(t.getAttribute("width")??"",10);return{src:t.getAttribute("src"),title:t.getAttribute("title"),width:Number.isFinite(e)&&e>0?e:null}}}],toDOM(t){const{src:e,provider:n,title:r,width:l,align:o}=t.attrs,i={src:e,frameborder:"0",allowfullscreen:"true",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",sandbox:D,referrerpolicy:O};r&&(i.title=r);const s={class:"nile-wysiwyg__embed","data-embed-provider":n??"generic"},a=[];return l&&(s["data-width"]=String(l),a.push(`width: ${l}px`,"max-width: 100%")),o&&(s["data-align"]=o,"center"===o?a.push("margin-left: auto","margin-right: auto"):"right"===o&&a.push("margin-left: auto","margin-right: 0")),a.length&&(s.style=a.join("; ")),["div",s,["iframe",i]]}},styleBlock:{group:"block",atom:!0,selectable:!0,attrs:{css:{default:""}},parseDOM:[{tag:"style",getAttrs:t=>({css:t.textContent??""})}],toDOM:t=>["style",t.attrs.css]},bookmark:{inline:!0,group:"inline",atom:!0,selectable:!0,attrs:{id:{}},parseDOM:[{tag:"a[data-bookmark]",priority:60,getAttrs:t=>{const e=t.getAttribute("id")||t.getAttribute("name");return!!e&&{id:e}}},{tag:"a[id]",getAttrs:t=>!t.hasAttribute("href")&&{id:t.getAttribute("id")}},{tag:"a[name]",getAttrs:t=>!t.hasAttribute("href")&&{id:t.getAttribute("name")}}],toDOM:t=>["a",{id:t.attrs.id,"data-bookmark":"true"}]},mention:{inline:!0,group:"inline",atom:!0,selectable:!0,attrs:{trigger:{default:"@"},key:{},label:{}},parseDOM:[{tag:"span[data-mention-key]",getAttrs:t=>({trigger:t.getAttribute("data-mention-trigger")||"@",key:t.getAttribute("data-mention-key"),label:t.getAttribute("data-mention-label")||t.textContent?.slice(1)||""})}],toDOM(t){const{trigger:e,key:n,label:r}=t.attrs;return["span",{class:"nile-wysiwyg__mention","data-mention-trigger":e,"data-mention-key":n,"data-mention-label":r},`${e}${r}`]}},merge_field:{inline:!0,group:"inline",atom:!0,selectable:!0,attrs:{id:{},label:{default:null}},parseDOM:[{tag:"span[data-merge-field]",getAttrs:t=>{const e=t.getAttribute("data-merge-field");return!!e&&{id:e,label:t.getAttribute("data-merge-label")||t.textContent||null}}}],toDOM(t){const{id:e,label:n}=t.attrs;return["span",{class:"nile-wysiwyg__merge-field","data-merge-field":e,"data-merge-label":n??""},n||`{{${e}}}`]}},math:{inline:!0,group:"inline",atom:!0,selectable:!0,attrs:{latex:{},display:{default:"inline"}},parseDOM:[{tag:"span[data-math]",getAttrs:t=>({latex:t.getAttribute("data-math")||t.textContent||"",display:"block"===t.getAttribute("data-math-display")?"block":"inline"})}],toDOM(t){const{latex:e,display:n}=t.attrs;return["span",{class:"nile-wysiwyg__math","data-math":e,"data-math-display":n},e]}}};function ke(t){return{default:null,getFromDOM:e=>e.style.getPropertyValue(t)||null,setDOMAttr(e,n){e&&(n.style=`${n.style||""}${t}: ${e};`)}}}const ve=function(t){const e=t.cellAttributes||{},n={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:V}};for(const t in e)n[t]={default:e[t].default,validate:e[t].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:t.tableGroup,parseDOM:[{tag:"table"}],toDOM:()=>["table",["tbody",0]]},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM:()=>["tr",0]},table_cell:{content:t.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:t=>U(t,e)}],toDOM:t=>["td",K(t,e),0]},table_header:{content:t.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:t=>U(t,e)}],toDOM:t=>["th",K(t,e),0]}}}({tableGroup:"block",cellContent:"block+",cellAttributes:{background:{default:null,getFromDOM:t=>t.getAttribute("data-cell-bg")||t.style.backgroundColor||null,setDOMAttr(t,e){t&&(e.style=`${e.style||""}background-color: ${t};`)}},paddingTop:ke("padding-top"),paddingRight:ke("padding-right"),paddingBottom:ke("padding-bottom"),paddingLeft:ke("padding-left"),width:ke("width"),valign:ke("vertical-align"),borderTop:ke("border-top"),borderRight:ke("border-right"),borderBottom:ke("border-bottom"),borderLeft:ke("border-left"),borderRadius:ke("border-radius"),textStyle:{default:null,getFromDOM:t=>t.getAttribute("data-cell-text-style")||null,setDOMAttr(t,e){const n=v(t);n&&(e.style=`${e.style||""}${n};`)}},textAlign:{default:null,getFromDOM:t=>t.getAttribute("data-cell-align")||null,setDOMAttr(t,e){const n=String(t??"").toLowerCase();re.has(n)&&(e.style=`${e.style||""}text-align: ${n};`)}},extraStyle:{default:null,getFromDOM:t=>t.getAttribute("data-extra-style")||null,setDOMAttr(t,e){const n=k(t);n&&(e.style=`${e.style||""}${n};`)}}}}),$e=ve.table;function _e(t){const{width:e,maxWidth:n,background:r,border:l,align:o,textStyle:i,extraStyle:s}=t,a=[];if(e&&a.push(`width: ${e}`),n&&a.push(`max-width: ${n}`),r&&a.push(`background-color: ${r}`),l&&a.push(`border: ${l}`),"center"===o&&a.push("margin-left: auto","margin-right: auto"),i){const t=v(i);t&&a.push(t)}if(s){const t=k(s);t&&a.push(t)}return a}const Ae={...$e,attrs:{...$e.attrs??{},layout:{default:!1},width:{default:null},maxWidth:{default:null},background:{default:null},border:{default:null},align:{default:null},textStyle:{default:null},extraStyle:{default:null}},parseDOM:[{tag:"table",getAttrs:t=>({layout:"presentation"===t.getAttribute("role")||t.hasAttribute("data-layout"),width:t.style.width||null,maxWidth:t.style.maxWidth||null,extraStyle:t.getAttribute("data-extra-style")||null,textStyle:t.getAttribute("data-table-text-style")||null,background:t.getAttribute("data-table-bg")||null,border:t.style.border||null,align:"center"===t.getAttribute("data-table-align")||"auto"===t.style.marginLeft&&"auto"===t.style.marginRight?"center":null})}],toDOM(t){const e=_e(t.attrs),n=t.attrs.layout?{role:"presentation","data-layout":"true"}:{};return e.length&&(n.style=e.join("; ")),["table",n,["tbody",0]]}},xe={link:{attrs:{href:{},title:{default:null},target:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:t=>({href:t.getAttribute("href"),title:t.getAttribute("title"),target:t.getAttribute("target")})}],toDOM(t){const{href:e,title:n,target:r}=t.attrs,l={href:e};return n&&(l.title=n),r&&(l.target=r,"_blank"===r&&(l.rel="noopener noreferrer")),["a",l,0]}},bold:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:t=>"normal"!==t.style.fontWeight&&null},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM:()=>["strong",0]},italic:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"}],toDOM:()=>["em",0]},underline:{parseDOM:[{tag:"u"},{style:"text-decoration",getAttrs:t=>t.includes("underline")&&null},{style:"text-decoration-line",getAttrs:t=>t.includes("underline")&&null}],toDOM:()=>["u",0]},strike:{parseDOM:[{tag:"s"},{tag:"strike"},{tag:"del"},{style:"text-decoration",getAttrs:t=>t.includes("line-through")&&null},{style:"text-decoration-line",getAttrs:t=>t.includes("line-through")&&null}],toDOM:()=>["s",0]},subscript:{excludes:"subscript superscript",parseDOM:[{tag:"sub"},{style:"vertical-align=sub"}],toDOM:()=>["sub",0]},superscript:{excludes:"subscript superscript",parseDOM:[{tag:"sup"},{style:"vertical-align=super"}],toDOM:()=>["sup",0]},code:{parseDOM:[{tag:"code"}],toDOM:()=>["code",{class:"nile-wysiwyg__inline-code"},0]},html_span:{attrs:{htmlClass:{default:null},htmlId:{default:null}},parseDOM:[{tag:"span",priority:5,getAttrs:t=>{const e=ge(t.getAttribute("class")),n=pe(t.getAttribute("id"));return!(!e&&!n)&&{htmlClass:e,htmlId:n}}}],toDOM(t){const e={};return t.attrs.htmlClass&&(e.class=t.attrs.htmlClass),t.attrs.htmlId&&(e.id=t.attrs.htmlId),["span",e,0]}},text_color:{attrs:{color:{}},parseDOM:[{style:"color",getAttrs:t=>!!t&&{color:t}}],toDOM:t=>["span",{style:`color: ${t.attrs.color}`},0]},bg_color:{attrs:{color:{}},parseDOM:[{style:"background-color",getAttrs:t=>!(!t||"transparent"===t)&&{color:t}}],toDOM:t=>["span",{style:`background-color: ${t.attrs.color}`},0]},font_family:{attrs:{family:{}},parseDOM:[{style:"font-family",getAttrs:t=>!!t&&{family:t}}],toDOM:t=>["span",{style:`font-family: ${t.attrs.family}`},0]},font_size:{attrs:{size:{}},parseDOM:[{style:"font-size",getAttrs:t=>!!t&&{size:t}}],toDOM:t=>["span",{style:`font-size: ${t.attrs.size}`},0]}},Se=["disc","circle","square"],Ne={1:"decimal",a:"lower-alpha",A:"upper-alpha",i:"lower-roman",I:"upper-roman"},ze=Object.fromEntries(Object.entries(Ne).map((([t,e])=>[e,t]))),Re="multilevel",Ee={content:"list_item+",group:"block",attrs:{style:{default:null}},parseDOM:[{tag:"ul",getAttrs:t=>{const e=t.style.listStyleType;return{style:Se.includes(e)?e:null}}}],toDOM:t=>t.attrs.style?["ul",{style:`list-style-type: ${t.attrs.style}`},0]:["ul",0]},Ce={content:"list_item+",group:"block",attrs:{order:{default:1},style:{default:null}},parseDOM:[{tag:"ol",getAttrs:t=>{const e=t.getAttribute("type")??"",n=t.style.listStyleType,r=t.getAttribute("data-list-style")===Re?Re:Ne[e]??(Object.values(Ne).includes(n)?n:null),l=Number(t.getAttribute("start"));return{order:Number.isFinite(l)&&l>0?l:1,style:r}}}],toDOM(t){const e={};return 1!==t.attrs.order&&(e.start=String(t.attrs.order)),t.attrs.style===Re?e["data-list-style"]=Re:t.attrs.style&&ze[t.attrs.style]&&(e.type=ze[t.attrs.style]),["ol",e,0]}};const je=function(){let t=function(t,e,n){return t.append({ordered_list:z(x,{content:"list_item+",group:n}),bullet_list:z(S,{content:"list_item+",group:n}),list_item:z(N,{content:e})})}(r.from(Oe),"paragraph block*","block").update("bullet_list",Ee).update("ordered_list",Ce).append(ve).update("table",Ae);for(const e of Me){const n=t.get(e);n&&(t=t.update(e,ye(n)))}let e=r.from(xe);for(const t of De){const n=e.get(t);n&&(e=e.update(t,ye(n)))}return new l({nodes:t,marks:e})}();export{Re as M,Jt as T,j as a,_e as b,Vt as c,I as d,je as e,xt as f,At as g,vt as h,ie as i,mt as j,L as k,C as l,kt as m,Dt as n,gt as o,ht as p,yt as q,bt as r,E as s,ee as t,ae as u,R as w};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./commands.cjs.js","../../index-
|
|
1
|
+
System.register(["./commands.cjs.js","../../index-bbe23ad8.cjs.js","../../index-ccc6a799.cjs.js","./schema.cjs.js","../../index-7ae95edd.cjs.js","../../index-178e1e57.cjs.js","./plugins/embeds.cjs.js","./email-css.cjs.js","./sanitize.cjs.js"],function(_export,_context){"use strict";var l,n,e,t,i;function o(l,n){var _l$selection=l.selection,e=_l$selection.from,t=_l$selection.$from,i=_l$selection.to,o=_l$selection.empty;return o?!!n.isInSet(l.storedMarks||t.marks()):l.doc.rangeHasMark(e,i,n);}function s(l,n,e){var _l$selection2=l.selection,t=_l$selection2.$from,i=_l$selection2.from,o=_l$selection2.to,s=_l$selection2.empty;if(s){var _i$attrs$e;var _i=n.isInSet(l.storedMarks||t.marks());return _i?(_i$attrs$e=_i.attrs[e])!==null&&_i$attrs$e!==void 0?_i$attrs$e:null:null;}var c=null;return l.doc.nodesBetween(i,o,function(l){var _t$attrs$e;if(null!==c||!l.isText)return null===c;var t=n.isInSet(l.marks);return t&&(c=(_t$attrs$e=t.attrs[e])!==null&&_t$attrs$e!==void 0?_t$attrs$e:null),null===c;}),c;}function c(c){var _f$attrs$align,_f$attrs$lineHeight,_f$attrs$indent,_z$isFigure,_z$node$attrs$align,_A$node$attrs$align,_f$attrs$language;var u=c.schema,_c$selection=c.selection,r=_c$selection.$from,m=_c$selection.from,a=_c$selection.to,d=_c$selection.empty;var f=r.parent;if(!f.isTextblock){var _l=null;c.doc.nodesBetween(m,a,function(n){return!_l&&n.isTextblock&&(_l=n),!_l;}),_l&&(f=_l);}var p=f.type.name,j="heading"===p?f.attrs.level:null,g=f.type.spec.attrs&&"align"in f.type.spec.attrs?(_f$attrs$align=f.attrs.align)!==null&&_f$attrs$align!==void 0?_f$attrs$align:null:null;var b=!1,k=!1,y=!1,h=!1,x=!1,L=!1,S=null,B=null;for(var _l2=r.depth;_l2>0;_l2-=1){var _n$attrs$style,_n$attrs$style2,_n$attrs$order;var _n=r.node(_l2);_n.type===u.nodes.bullet_list?(b=!0,null===S&&(S=(_n$attrs$style=_n.attrs.style)!==null&&_n$attrs$style!==void 0?_n$attrs$style:null)):_n.type===u.nodes.ordered_list?(k=!0,null===S&&(S=(_n$attrs$style2=_n.attrs.style)!==null&&_n$attrs$style2!==void 0?_n$attrs$style2:null),null===B&&(B=(_n$attrs$order=_n.attrs.order)!==null&&_n$attrs$order!==void 0?_n$attrs$order:1)):_n.type===u.nodes.task_list?y=!0:_n.type===u.nodes.blockquote?h=!0:_n.type!==u.nodes.table||x||(x=!0,L=!!_n.attrs.layout);}var z=l(c),A=n(c),C=o(c,u.marks.link);var H=null;if(C&&(H=s(c,u.marks.link,"href"),null===H&&d)){var _l3=e(r,u.marks.link);if(_l3){var _n2=u.marks.link.isInSet(c.doc.resolve(_l3.from+1).marks());H=_n2?_n2.attrs.href:null;}}return{bold:o(c,u.marks.bold),italic:o(c,u.marks.italic),underline:o(c,u.marks.underline),strike:o(c,u.marks.strike),subscript:o(c,u.marks.subscript),superscript:o(c,u.marks.superscript),code:o(c,u.marks.code),blockType:p,headingLevel:j,align:g,lineHeight:f.type.spec.attrs&&"lineHeight"in f.type.spec.attrs?(_f$attrs$lineHeight=f.attrs.lineHeight)!==null&&_f$attrs$lineHeight!==void 0?_f$attrs$lineHeight:null:null,inBulletList:b,inOrderedList:k,inTaskList:y,inBlockquote:h,inTable:x,tableLayout:L,blockIndent:f.type.spec.attrs&&"indent"in f.type.spec.attrs?(_f$attrs$indent=f.attrs.indent)!==null&&_f$attrs$indent!==void 0?_f$attrs$indent:0:0,listStyle:S,listStart:B,imageSelected:null!==z,imageIsFigure:(_z$isFigure=z===null||z===void 0?void 0:z.isFigure)!==null&&_z$isFigure!==void 0?_z$isFigure:!1,imageAlign:z!==null&&z!==void 0&&z.isFigure?(_z$node$attrs$align=z.node.attrs.align)!==null&&_z$node$attrs$align!==void 0?_z$node$attrs$align:null:null,embedSelected:null!==A,embedAlign:(_A$node$attrs$align=A===null||A===void 0?void 0:A.node.attrs.align)!==null&&_A$node$attrs$align!==void 0?_A$node$attrs$align:null,inCodeBlock:"code_block"===p,codeBlockLanguage:"code_block"===p?(_f$attrs$language=f.attrs.language)!==null&&_f$attrs$language!==void 0?_f$attrs$language:null:null,canUndo:t(c),canRedo:i(c),linkActive:C,linkHref:H,textColor:s(c,u.marks.text_color,"color"),bgColor:s(c,u.marks.bg_color,"color"),fontFamily:s(c,u.marks.font_family,"family"),fontSize:s(c,u.marks.font_size,"size"),selectionEmpty:d};}_export("c",c);return{setters:[function(_commandsCjsJs){l=_commandsCjsJs.s;n=_commandsCjsJs.a;e=_commandsCjsJs.g;t=_commandsCjsJs.u;i=_commandsCjsJs.r;},function(_index00aCjsJs){},function(_index00bCjsJs){},function(_schemaCjsJs){},function(_index009CjsJs){},function(_index007CjsJs){},function(_pluginsEmbedsCjsJs){},function(_emailCssCjsJs){},function(_sanitizeCjsJs){}],execute:function execute(){}};});
|
|
2
2
|
//# sourceMappingURL=selection-state.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection-state.cjs.js","sources":["../../../../src/nile-wysiwyg-editor/engine/selection-state.ts"],"sourcesContent":["import { EditorState } from 'prosemirror-state';\nimport { MarkType, Node as PMNode } from 'prosemirror-model';\nimport { undo, redo } from 'prosemirror-history';\nimport type { Alignment } from './schema';\nimport { getMarkRange, selectedImageInfo, selectedEmbedInfo } from './commands';\n\n/**\n * Immutable snapshot of everything the toolbar needs to render. Computed once\n * per transaction in the host's dispatchTransaction and passed down as a\n * single reactive property.\n */\nexport interface ToolbarState {\n bold: boolean;\n italic: boolean;\n underline: boolean;\n strike: boolean;\n subscript: boolean;\n superscript: boolean;\n code: boolean;\n /** 'paragraph' | 'heading' for the innermost textblock at the cursor. */\n blockType: string;\n headingLevel: number | null;\n align: Alignment | null;\n /** Line height ('1.5') of the textblock at the cursor, null = default. */\n lineHeight: string | null;\n inBulletList: boolean;\n inOrderedList: boolean;\n inTaskList: boolean;\n inBlockquote: boolean;\n inTable: boolean;\n /** The surrounding table is a layout (presentation) table. */\n tableLayout: boolean;\n /** Margin-indent level (0..MAX_INDENT) of the textblock at the cursor. */\n blockIndent: number;\n /** list-style-type of the surrounding list ('' = default). */\n listStyle: string | null;\n /** Start number of the surrounding ordered list. */\n listStart: number | null;\n /** An image or figure is selected (or the cursor is in a caption). */\n imageSelected: boolean;\n /** The selected image is a captioned figure. */\n imageIsFigure: boolean;\n /** Alignment of the selected figure. */\n imageAlign: string | null;\n /** A video embed is selected. */\n embedSelected: boolean;\n /** Alignment of the selected embed. */\n embedAlign: string | null;\n inCodeBlock: boolean;\n /** Language attr of the surrounding code block ('' = auto). */\n codeBlockLanguage: string | null;\n canUndo: boolean;\n canRedo: boolean;\n linkActive: boolean;\n linkHref: string | null;\n textColor: string | null;\n bgColor: string | null;\n fontFamily: string | null;\n fontSize: string | null;\n /** True when the selection is a cursor (no range). */\n selectionEmpty: boolean;\n /**\n * Whether the host's \"paste as plain text\" toggle is on. Not derivable from\n * editor state, so the host injects it after computeToolbarState().\n */\n pasteAsPlainText?: boolean;\n /** Whether the host is in fullscreen mode. Injected like pasteAsPlainText. */\n fullscreen?: boolean;\n /** Whether block boundaries are outlined. Injected like pasteAsPlainText. */\n showBlocks?: boolean;\n /** Whether the format painter is armed. Injected like pasteAsPlainText. */\n formatPainter?: boolean;\n}\n\nfunction markActive(state: EditorState, type: MarkType): boolean {\n const { from, $from, to, empty } = state.selection;\n if (empty) return !!type.isInSet(state.storedMarks || $from.marks());\n return state.doc.rangeHasMark(from, to, type);\n}\n\nfunction markAttr(state: EditorState, type: MarkType, attr: string): string | null {\n const { $from, from, to, empty } = state.selection;\n if (empty) {\n const mark = type.isInSet(state.storedMarks || $from.marks());\n return mark ? ((mark.attrs[attr] as string) ?? null) : null;\n }\n // Range: report the first occurrence of the mark inside the selection.\n // (Boundary marks() lookups miss non-inclusive marks like link.)\n let found: string | null = null;\n state.doc.nodesBetween(from, to, node => {\n if (found !== null || !node.isText) return found === null;\n const mark = type.isInSet(node.marks);\n if (mark) found = (mark.attrs[attr] as string) ?? null;\n return found === null;\n });\n return found;\n}\n\nexport function computeToolbarState(state: EditorState): ToolbarState {\n const { schema } = state;\n const { $from, from, to, empty } = state.selection;\n\n // $from.parent is the doc (not a textblock) for AllSelection / block\n // NodeSelections; report the first textblock in the range instead so the\n // toolbar reflects what's actually selected.\n let parent = $from.parent;\n if (!parent.isTextblock) {\n let firstTextblock: PMNode | null = null;\n state.doc.nodesBetween(from, to, node => {\n if (!firstTextblock && node.isTextblock) firstTextblock = node;\n return !firstTextblock;\n });\n if (firstTextblock) parent = firstTextblock;\n }\n const blockType = parent.type.name;\n const headingLevel = blockType === 'heading' ? (parent.attrs.level as number) : null;\n const align =\n parent.type.spec.attrs && 'align' in parent.type.spec.attrs\n ? ((parent.attrs.align as Alignment) ?? null)\n : null;\n\n let inBulletList = false;\n let inOrderedList = false;\n let inTaskList = false;\n let inBlockquote = false;\n let inTable = false;\n let tableLayout = false;\n let listStyle: string | null = null;\n let listStart: number | null = null;\n for (let depth = $from.depth; depth > 0; depth -= 1) {\n const node = $from.node(depth);\n if (node.type === schema.nodes.bullet_list) {\n inBulletList = true;\n if (listStyle === null) listStyle = (node.attrs.style as string) ?? null;\n } else if (node.type === schema.nodes.ordered_list) {\n inOrderedList = true;\n if (listStyle === null) listStyle = (node.attrs.style as string) ?? null;\n if (listStart === null) listStart = (node.attrs.order as number) ?? 1;\n } else if (node.type === schema.nodes.task_list) inTaskList = true;\n else if (node.type === schema.nodes.blockquote) inBlockquote = true;\n else if (node.type === schema.nodes.table) {\n inTable = true;\n tableLayout = !!node.attrs.layout;\n }\n }\n\n const imageInfo = selectedImageInfo(state);\n const embedInfo = selectedEmbedInfo(state);\n\n const linkActive = markActive(state, schema.marks.link);\n let linkHref: string | null = null;\n if (linkActive) {\n linkHref = markAttr(state, schema.marks.link, 'href');\n if (linkHref === null && empty) {\n const range = getMarkRange($from, schema.marks.link);\n if (range) {\n const mark = schema.marks.link.isInSet(\n state.doc.resolve(range.from + 1).marks()\n );\n linkHref = mark ? (mark.attrs.href as string) : null;\n }\n }\n }\n\n return {\n bold: markActive(state, schema.marks.bold),\n italic: markActive(state, schema.marks.italic),\n underline: markActive(state, schema.marks.underline),\n strike: markActive(state, schema.marks.strike),\n subscript: markActive(state, schema.marks.subscript),\n superscript: markActive(state, schema.marks.superscript),\n code: markActive(state, schema.marks.code),\n blockType,\n headingLevel,\n align,\n lineHeight:\n parent.type.spec.attrs && 'lineHeight' in parent.type.spec.attrs\n ? ((parent.attrs.lineHeight as string) ?? null)\n : null,\n inBulletList,\n inOrderedList,\n inTaskList,\n inBlockquote,\n inTable,\n tableLayout,\n blockIndent:\n parent.type.spec.attrs && 'indent' in parent.type.spec.attrs\n ? ((parent.attrs.indent as number) ?? 0)\n : 0,\n listStyle,\n listStart,\n imageSelected: imageInfo !== null,\n imageIsFigure: imageInfo?.isFigure ?? false,\n imageAlign: imageInfo?.isFigure ? ((imageInfo.node.attrs.align as string) ?? null) : null,\n embedSelected: embedInfo !== null,\n embedAlign: (embedInfo?.node.attrs.align as string) ?? null,\n inCodeBlock: blockType === 'code_block',\n codeBlockLanguage:\n blockType === 'code_block' ? ((parent.attrs.language as string) ?? null) : null,\n canUndo: undo(state),\n canRedo: redo(state),\n linkActive,\n linkHref,\n textColor: markAttr(state, schema.marks.text_color, 'color'),\n bgColor: markAttr(state, schema.marks.bg_color, 'color'),\n fontFamily: markAttr(state, schema.marks.font_family, 'family'),\n fontSize: markAttr(state, schema.marks.font_size, 'size'),\n selectionEmpty: empty,\n };\n}\n"],"names":["markActive","state","type","_l$selection","selection","from","$from","to","empty","isInSet","storedMarks","marks","doc","rangeHasMark","markAttr","attr","_l$selection2","_i$attrs$e","mark","attrs","found","nodesBetween","node","_t$attrs$e","isText","computeToolbarState","_f$attrs$align","_f$attrs$lineHeight","_f$attrs$indent","_A$isFigure","_A$node$attrs$align","_C$node$attrs$align","_f$attrs$language","schema","parent","isTextblock","firstTextblock","blockType","name","headingLevel","level","align","spec","inBulletList","inOrderedList","inTaskList","inBlockquote","inTable","tableLayout","listStyle","listStart","depth","_n$attrs$style","_n$attrs$style2","_n$attrs$order","nodes","bullet_list","style","ordered_list","order","task_list","blockquote","table","layout","imageInfo","selectedImageInfo","embedInfo","selectedEmbedInfo","linkActive","link","linkHref","range","getMarkRange","resolve","href","bold","italic","underline","strike","subscript","superscript","code","lineHeight","blockIndent","indent","imageSelected","imageIsFigure","isFigure","imageAlign","embedSelected","embedAlign","inCodeBlock","codeBlockLanguage","language","canUndo","undo","canRedo","redo","textColor","text_color","bgColor","bg_color","fontFamily","font_family","fontSize","font_size","selectionEmpty"],"mappings":"gQA0EA,QAASA,CAAAA,CAAAA,CAAWC,CAAoBC,CAAAA,CAAAA,CAAAA,CACt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B,CAAAA,KAAAA,UAAAA,mBAAAA,UAAAA,mBAAAA,CAAoB,IACvDkD,CAAAA,WAAAA,CAA2B,YAAdtD,GAAAA,CAAAA,CACbuD,iBACgB,CAAA,YAAA,GAAdvD,CAA+BH,EAAAA,iBAAAA,CAAAA,CAAAA,CAAOf,KAAM0E,CAAAA,QAAAA,UAAAA,iBAAAA,UAAAA,iBAAAA,CAAuB,IAAQ,CAAA,IAAA,CAC7EC,OAASC,CAAAA,CAAAA,CAAK9F,CACd+F,CAAAA,CAAAA,OAAAA,CAASC,CAAKhG,CAAAA,CAAAA,CAAAA,CACdmE,UACAE,CAAAA,CAAAA,CAAAA,QAAAA,CAAAA,CAAAA,CACA4B,SAAWpF,CAAAA,CAAAA,CAASb,CAAOgC,CAAAA,CAAAA,CAAOtB,KAAMwF,CAAAA,UAAAA,CAAY,OACpDC,CAAAA,CAAAA,OAAAA,CAAStF,CAASb,CAAAA,CAAAA,CAAOgC,CAAOtB,CAAAA,KAAAA,CAAM0F,QAAU,CAAA,OAAA,CAAA,CAChDC,UAAYxF,CAAAA,CAAAA,CAASb,CAAOgC,CAAAA,CAAAA,CAAOtB,KAAM4F,CAAAA,WAAAA,CAAa,QACtDC,CAAAA,CAAAA,QAAAA,CAAU1F,CAASb,CAAAA,CAAAA,CAAOgC,CAAOtB,CAAAA,KAAAA,CAAM8F,SAAW,CAAA,MAAA,CAAA,CAClDC,cAAgBlG,CAAAA,CAAAA,CAEpB"}
|
|
1
|
+
{"version":3,"file":"selection-state.cjs.js","sources":["../../../../src/nile-wysiwyg-editor/engine/selection-state.ts"],"sourcesContent":["import { EditorState } from 'prosemirror-state';\nimport { MarkType, Node as PMNode } from 'prosemirror-model';\nimport { undo, redo } from 'prosemirror-history';\nimport type { Alignment } from './schema';\nimport { getMarkRange, selectedImageInfo, selectedEmbedInfo } from './commands';\n\n/**\n * Immutable snapshot of everything the toolbar needs to render. Computed once\n * per transaction in the host's dispatchTransaction and passed down as a\n * single reactive property.\n */\nexport interface ToolbarState {\n bold: boolean;\n italic: boolean;\n underline: boolean;\n strike: boolean;\n subscript: boolean;\n superscript: boolean;\n code: boolean;\n /** 'paragraph' | 'heading' for the innermost textblock at the cursor. */\n blockType: string;\n headingLevel: number | null;\n align: Alignment | null;\n /** Line height ('1.5') of the textblock at the cursor, null = default. */\n lineHeight: string | null;\n inBulletList: boolean;\n inOrderedList: boolean;\n inTaskList: boolean;\n inBlockquote: boolean;\n inTable: boolean;\n /** The surrounding table is a layout (presentation) table. */\n tableLayout: boolean;\n /** Margin-indent level (0..MAX_INDENT) of the textblock at the cursor. */\n blockIndent: number;\n /** list-style-type of the surrounding list ('' = default). */\n listStyle: string | null;\n /** Start number of the surrounding ordered list. */\n listStart: number | null;\n /** An image or figure is selected (or the cursor is in a caption). */\n imageSelected: boolean;\n /** The selected image is a captioned figure. */\n imageIsFigure: boolean;\n /** Alignment of the selected figure. */\n imageAlign: string | null;\n /** A video embed is selected. */\n embedSelected: boolean;\n /** Alignment of the selected embed. */\n embedAlign: string | null;\n inCodeBlock: boolean;\n /** Language attr of the surrounding code block ('' = auto). */\n codeBlockLanguage: string | null;\n canUndo: boolean;\n canRedo: boolean;\n linkActive: boolean;\n linkHref: string | null;\n textColor: string | null;\n bgColor: string | null;\n fontFamily: string | null;\n fontSize: string | null;\n /** True when the selection is a cursor (no range). */\n selectionEmpty: boolean;\n /**\n * Whether the host's \"paste as plain text\" toggle is on. Not derivable from\n * editor state, so the host injects it after computeToolbarState().\n */\n pasteAsPlainText?: boolean;\n /** Whether the host is in fullscreen mode. Injected like pasteAsPlainText. */\n fullscreen?: boolean;\n /** Whether block boundaries are outlined. Injected like pasteAsPlainText. */\n showBlocks?: boolean;\n /** Whether the format painter is armed. Injected like pasteAsPlainText. */\n formatPainter?: boolean;\n}\n\nfunction markActive(state: EditorState, type: MarkType): boolean {\n const { from, $from, to, empty } = state.selection;\n if (empty) return !!type.isInSet(state.storedMarks || $from.marks());\n return state.doc.rangeHasMark(from, to, type);\n}\n\nfunction markAttr(state: EditorState, type: MarkType, attr: string): string | null {\n const { $from, from, to, empty } = state.selection;\n if (empty) {\n const mark = type.isInSet(state.storedMarks || $from.marks());\n return mark ? ((mark.attrs[attr] as string) ?? null) : null;\n }\n // Range: report the first occurrence of the mark inside the selection.\n // (Boundary marks() lookups miss non-inclusive marks like link.)\n let found: string | null = null;\n state.doc.nodesBetween(from, to, node => {\n if (found !== null || !node.isText) return found === null;\n const mark = type.isInSet(node.marks);\n if (mark) found = (mark.attrs[attr] as string) ?? null;\n return found === null;\n });\n return found;\n}\n\nexport function computeToolbarState(state: EditorState): ToolbarState {\n const { schema } = state;\n const { $from, from, to, empty } = state.selection;\n\n // $from.parent is the doc (not a textblock) for AllSelection / block\n // NodeSelections; report the first textblock in the range instead so the\n // toolbar reflects what's actually selected.\n let parent = $from.parent;\n if (!parent.isTextblock) {\n let firstTextblock: PMNode | null = null;\n state.doc.nodesBetween(from, to, node => {\n if (!firstTextblock && node.isTextblock) firstTextblock = node;\n return !firstTextblock;\n });\n if (firstTextblock) parent = firstTextblock;\n }\n const blockType = parent.type.name;\n const headingLevel = blockType === 'heading' ? (parent.attrs.level as number) : null;\n const align =\n parent.type.spec.attrs && 'align' in parent.type.spec.attrs\n ? ((parent.attrs.align as Alignment) ?? null)\n : null;\n\n let inBulletList = false;\n let inOrderedList = false;\n let inTaskList = false;\n let inBlockquote = false;\n let inTable = false;\n let tableLayout = false;\n let listStyle: string | null = null;\n let listStart: number | null = null;\n for (let depth = $from.depth; depth > 0; depth -= 1) {\n const node = $from.node(depth);\n if (node.type === schema.nodes.bullet_list) {\n inBulletList = true;\n if (listStyle === null) listStyle = (node.attrs.style as string) ?? null;\n } else if (node.type === schema.nodes.ordered_list) {\n inOrderedList = true;\n if (listStyle === null) listStyle = (node.attrs.style as string) ?? null;\n if (listStart === null) listStart = (node.attrs.order as number) ?? 1;\n } else if (node.type === schema.nodes.task_list) inTaskList = true;\n else if (node.type === schema.nodes.blockquote) inBlockquote = true;\n else if (node.type === schema.nodes.table && !inTable) {\n // Innermost table wins: a data table nested in an email layout table\n // is not a layout table.\n inTable = true;\n tableLayout = !!node.attrs.layout;\n }\n }\n\n const imageInfo = selectedImageInfo(state);\n const embedInfo = selectedEmbedInfo(state);\n\n const linkActive = markActive(state, schema.marks.link);\n let linkHref: string | null = null;\n if (linkActive) {\n linkHref = markAttr(state, schema.marks.link, 'href');\n if (linkHref === null && empty) {\n const range = getMarkRange($from, schema.marks.link);\n if (range) {\n const mark = schema.marks.link.isInSet(\n state.doc.resolve(range.from + 1).marks()\n );\n linkHref = mark ? (mark.attrs.href as string) : null;\n }\n }\n }\n\n return {\n bold: markActive(state, schema.marks.bold),\n italic: markActive(state, schema.marks.italic),\n underline: markActive(state, schema.marks.underline),\n strike: markActive(state, schema.marks.strike),\n subscript: markActive(state, schema.marks.subscript),\n superscript: markActive(state, schema.marks.superscript),\n code: markActive(state, schema.marks.code),\n blockType,\n headingLevel,\n align,\n lineHeight:\n parent.type.spec.attrs && 'lineHeight' in parent.type.spec.attrs\n ? ((parent.attrs.lineHeight as string) ?? null)\n : null,\n inBulletList,\n inOrderedList,\n inTaskList,\n inBlockquote,\n inTable,\n tableLayout,\n blockIndent:\n parent.type.spec.attrs && 'indent' in parent.type.spec.attrs\n ? ((parent.attrs.indent as number) ?? 0)\n : 0,\n listStyle,\n listStart,\n imageSelected: imageInfo !== null,\n imageIsFigure: imageInfo?.isFigure ?? false,\n imageAlign: imageInfo?.isFigure ? ((imageInfo.node.attrs.align as string) ?? null) : null,\n embedSelected: embedInfo !== null,\n embedAlign: (embedInfo?.node.attrs.align as string) ?? null,\n inCodeBlock: blockType === 'code_block',\n codeBlockLanguage:\n blockType === 'code_block' ? ((parent.attrs.language as string) ?? null) : null,\n canUndo: undo(state),\n canRedo: redo(state),\n linkActive,\n linkHref,\n textColor: markAttr(state, schema.marks.text_color, 'color'),\n bgColor: markAttr(state, schema.marks.bg_color, 'color'),\n fontFamily: markAttr(state, schema.marks.font_family, 'family'),\n fontSize: markAttr(state, schema.marks.font_size, 'size'),\n selectionEmpty: empty,\n };\n}\n"],"names":["markActive","state","type","_l$selection","selection","from","$from","to","empty","isInSet","storedMarks","marks","doc","rangeHasMark","markAttr","attr","_l$selection2","_i$attrs$e","mark","attrs","found","nodesBetween","node","_t$attrs$e","isText","computeToolbarState","schema","parent","isTextblock","firstTextblock","blockType","name","headingLevel","level","align","spec","_f$attrs$align","inBulletList","inOrderedList","inTaskList","inBlockquote","inTable","tableLayout","listStyle","listStart","depth","_n$attrs$style","_n$attrs$style2","_n$attrs$order","nodes","bullet_list","style","ordered_list","order","task_list","blockquote","table","layout","imageInfo","selectedImageInfo","embedInfo","selectedEmbedInfo","linkActive","link","linkHref","range","getMarkRange","resolve","href","bold","italic","underline","strike","subscript","superscript","code","lineHeight","blockIndent","indent","_f$attrs$indent","imageSelected","imageIsFigure","isFigure","_z$isFigure","imageAlign","embedSelected","embedAlign","inCodeBlock","codeBlockLanguage","language","canUndo","undo","canRedo","redo","textColor","text_color","bgColor","bg_color","fontFamily","font_family","fontSize","font_size","selectionEmpty"],"mappings":"ySA0EA,QAASA,CAAAA,CAAAA,CAAWC,CAAoBC,CAAAA,CAAAA,CAAAA,CACtC,IAAAC,YAAA,CAAmCF,CAAAA,CAAMG,SACzC,CADQC,CAAIC,CAAAA,YAAAA,CAAND,IAAAA,CAAQC,CAAKC,CAAAA,YAAAA,CAAPD,KAAAA,CAASC,CAAEC,CAAAA,YAAAA,CAAJD,EAAAA,CAAMC,CAAUP,CAAAA,YAAAA,CAAZO,KAAAA,CACvB,MAAIA,CAAAA,IAAgBN,CAAKO,CAAAA,OAAAA,CAAQR,CAAMS,CAAAA,WAAAA,EAAeJ,CAAMK,CAAAA,KAAAA,CAAAA,CAAAA,CAAAA,CACrDV,CAAMW,CAAAA,GAAAA,CAAIC,YAAaR,CAAAA,CAAAA,CAAME,CAAIL,CAAAA,CAAAA,CAC1C,EAEA,QAASY,CAAAA,CAASb,CAAAA,CAAAA,C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yB,CAAAA,CAAAA,CAAOf,KAAMoF,CAAAA,UAAAA,CAAY,OACpDC,CAAAA,CAAAA,OAAAA,CAASlF,CAASb,CAAAA,CAAAA,CAAOyB,CAAOf,CAAAA,KAAAA,CAAMsF,QAAU,CAAA,OAAA,CAAA,CAChDC,UAAYpF,CAAAA,CAAAA,CAASb,CAAOyB,CAAAA,CAAAA,CAAOf,KAAMwF,CAAAA,WAAAA,CAAa,QACtDC,CAAAA,CAAAA,QAAAA,CAAUtF,CAASb,CAAAA,CAAAA,CAAOyB,CAAOf,CAAAA,KAAAA,CAAM0F,SAAW,CAAA,MAAA,CAAA,CAClDC,cAAgB9F,CAAAA,CAAAA,CAEpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as l,a as n,g as e,u as t,r as i}from"./commands.esm.js";import"../../index-
|
|
1
|
+
import{s as l,a as n,g as e,u as t,r as i}from"./commands.esm.js";import"../../index-7ca72b78.esm.js";import"../../index-5d34cff1.esm.js";import"./schema.esm.js";import"../../index-4df50481.esm.js";import"../../index-920675c4.esm.js";import"./plugins/embeds.esm.js";import"./email-css.esm.js";import"./sanitize.esm.js";function o(l,n){const{from:e,$from:t,to:i,empty:o}=l.selection;return o?!!n.isInSet(l.storedMarks||t.marks()):l.doc.rangeHasMark(e,i,n)}function s(l,n,e){const{$from:t,from:i,to:o,empty:s}=l.selection;if(s){const i=n.isInSet(l.storedMarks||t.marks());return i?i.attrs[e]??null:null}let u=null;return l.doc.nodesBetween(i,o,(l=>{if(null!==u||!l.isText)return null===u;const t=n.isInSet(l.marks);return t&&(u=t.attrs[e]??null),null===u})),u}function u(u){const{schema:r}=u,{$from:m,from:c,to:a,empty:d}=u.selection;let f=m.parent;if(!f.isTextblock){let l=null;u.doc.nodesBetween(c,a,(n=>(!l&&n.isTextblock&&(l=n),!l))),l&&(f=l)}const p=f.type.name,g="heading"===p?f.attrs.level:null,b=f.type.spec.attrs&&"align"in f.type.spec.attrs?f.attrs.align??null:null;let k=!1,j=!1,y=!1,h=!1,x=!1,L=!1,S=null,B=null;for(let l=m.depth;l>0;l-=1){const n=m.node(l);n.type===r.nodes.bullet_list?(k=!0,null===S&&(S=n.attrs.style??null)):n.type===r.nodes.ordered_list?(j=!0,null===S&&(S=n.attrs.style??null),null===B&&(B=n.attrs.order??1)):n.type===r.nodes.task_list?y=!0:n.type===r.nodes.blockquote?h=!0:n.type!==r.nodes.table||x||(x=!0,L=!!n.attrs.layout)}const z=l(u),A=n(u),C=o(u,r.marks.link);let H=null;if(C&&(H=s(u,r.marks.link,"href"),null===H&&d)){const l=e(m,r.marks.link);if(l){const n=r.marks.link.isInSet(u.doc.resolve(l.from+1).marks());H=n?n.attrs.href:null}}return{bold:o(u,r.marks.bold),italic:o(u,r.marks.italic),underline:o(u,r.marks.underline),strike:o(u,r.marks.strike),subscript:o(u,r.marks.subscript),superscript:o(u,r.marks.superscript),code:o(u,r.marks.code),blockType:p,headingLevel:g,align:b,lineHeight:f.type.spec.attrs&&"lineHeight"in f.type.spec.attrs?f.attrs.lineHeight??null:null,inBulletList:k,inOrderedList:j,inTaskList:y,inBlockquote:h,inTable:x,tableLayout:L,blockIndent:f.type.spec.attrs&&"indent"in f.type.spec.attrs?f.attrs.indent??0:0,listStyle:S,listStart:B,imageSelected:null!==z,imageIsFigure:z?.isFigure??!1,imageAlign:z?.isFigure?z.node.attrs.align??null:null,embedSelected:null!==A,embedAlign:A?.node.attrs.align??null,inCodeBlock:"code_block"===p,codeBlockLanguage:"code_block"===p?f.attrs.language??null:null,canUndo:t(u),canRedo:i(u),linkActive:C,linkHref:H,textColor:s(u,r.marks.text_color,"color"),bgColor:s(u,r.marks.bg_color,"color"),fontFamily:s(u,r.marks.font_family,"family"),fontSize:s(u,r.marks.font_size,"size"),selectionEmpty:d}}export{u as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["../../index-
|
|
1
|
+
System.register(["../../index-ccc6a799.cjs.js","./sanitize.cjs.js","./email-render.cjs.js","./plugins/embeds.cjs.js","../../index-bbe23ad8.cjs.js","./email-css.cjs.js"],function(_export,_context){"use strict";var n,t,r,s,e,a,o,c,i;function u(n){var r=c.get(n);return r||(r=t.fromSchema(n),c.set(n,r)),r;}function f(n,t){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;var a=arguments.length>3?arguments[3]:undefined;var o=r?s(t,a):t;(a===null||a===void 0?void 0:a.emailFidelity)&&(o=e(o));var c=new DOMParser().parseFromString("<body>".concat(o,"</body>"),"text/html");return u(n).parse(c.body);}function m(n,t){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;var a=arguments.length>3?arguments[3]:undefined;var o=r?s(t,a):t;(a===null||a===void 0?void 0:a.emailFidelity)&&(o=e(o));var c=new DOMParser().parseFromString("<body>".concat(o,"</body>"),"text/html");return u(n).parseSlice(c.body,{preserveWhitespace:!0});}function p(n,t){var s=n.type.schema,e=t?a(n,t):n,c=document.createElement("div");return c.appendChild(function(n){var t=i.get(n);return t||(t=r.fromSchema(n),i.set(n,t)),t;}(s).serializeFragment(e.content)),t&&o(c),c.innerHTML;}function j(n){return n.textBetween(0,n.content.size,"\n"," ");}function d(n){return n.toJSON();}function l(t,r){return n.fromJSON(t,r);}function b(n){var t=j(n);return{words:t.trim()?t.trim().split(/\s+/).length:0,characters:t.replace(/\n/g,"").length};}function h(n){if(n.childCount>1)return!1;var t=n.firstChild;return!t||"paragraph"===t.type.name&&0===t.content.size;}_export({a:m,b:p,c:b,d:j,e:d,h:f,i:h,j:l});return{setters:[function(_index00bCjsJs){n=_index00bCjsJs.N;t=_index00bCjsJs.D;r=_index00bCjsJs.a;},function(_sanitizeCjsJs){s=_sanitizeCjsJs.s;e=_sanitizeCjsJs.r;},function(_emailRenderCjsJs){a=_emailRenderCjsJs.a;o=_emailRenderCjsJs.f;},function(_pluginsEmbedsCjsJs){},function(_index00aCjsJs){},function(_emailCssCjsJs){}],execute:function execute(){c=new WeakMap(),i=new WeakMap();}};});
|
|
2
2
|
//# sourceMappingURL=serializer.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.cjs.js","sources":["../../../../src/nile-wysiwyg-editor/engine/serializer.ts"],"sourcesContent":["import {\n DOMParser as PMDOMParser,\n DOMSerializer,\n Node as PMNode,\n Schema,\n Slice,\n} from 'prosemirror-model';\nimport { sanitizeHtml } from './sanitize';\n\nconst parserCache = new WeakMap<Schema, PMDOMParser>();\nconst serializerCache = new WeakMap<Schema, DOMSerializer>();\n\nfunction getParser(schema: Schema): PMDOMParser {\n let parser = parserCache.get(schema);\n if (!parser) {\n parser = PMDOMParser.fromSchema(schema);\n parserCache.set(schema, parser);\n }\n return parser;\n}\n\nfunction getSerializer(schema: Schema): DOMSerializer {\n let serializer = serializerCache.get(schema);\n if (!serializer) {\n serializer = DOMSerializer.fromSchema(schema);\n serializerCache.set(schema, serializer);\n }\n return serializer;\n}\n\n/** Parses an HTML string into a document node, sanitizing by default. */\nexport function htmlToDoc(schema: Schema
|
|
1
|
+
{"version":3,"file":"serializer.cjs.js","sources":["../../../../src/nile-wysiwyg-editor/engine/serializer.ts"],"sourcesContent":["import {\n DOMParser as PMDOMParser,\n DOMSerializer,\n Node as PMNode,\n Schema,\n Slice,\n} from 'prosemirror-model';\nimport { sanitizeHtml, relocateEmailContainers } from './sanitize';\nimport { NormalizedAllowedStyles } from './email-css';\nimport {\n applyEmailRenderDefaults,\n finishEmailTables,\n EmailRenderDefaults,\n} from './email-render';\n\nconst parserCache = new WeakMap<Schema, PMDOMParser>();\nconst serializerCache = new WeakMap<Schema, DOMSerializer>();\n\nfunction getParser(schema: Schema): PMDOMParser {\n let parser = parserCache.get(schema);\n if (!parser) {\n parser = PMDOMParser.fromSchema(schema);\n parserCache.set(schema, parser);\n }\n return parser;\n}\n\nfunction getSerializer(schema: Schema): DOMSerializer {\n let serializer = serializerCache.get(schema);\n if (!serializer) {\n serializer = DOMSerializer.fromSchema(schema);\n serializerCache.set(schema, serializer);\n }\n return serializer;\n}\n\n/** Parses an HTML string into a document node, sanitizing by default. */\nexport function htmlToDoc(\n schema: Schema,\n html: string,\n sanitize = true,\n options?: { emailFidelity?: boolean; allowedStyles?: NormalizedAllowedStyles }\n): PMNode {\n let clean = sanitize ? sanitizeHtml(html, options) : html;\n // Lift carried container background/font declarations onto node-attr data\n // hooks so they don't become per-run marks (see relocateEmailContainers).\n if (options?.emailFidelity) clean = relocateEmailContainers(clean);\n const dom = new DOMParser().parseFromString(`<body>${clean}</body>`, 'text/html');\n return getParser(schema).parse(dom.body);\n}\n\n/** Parses an HTML string into a slice suitable for replaceSelection. */\nexport function htmlToSlice(\n schema: Schema,\n html: string,\n sanitize = true,\n options?: { emailFidelity?: boolean; allowedStyles?: NormalizedAllowedStyles }\n): Slice {\n let clean = sanitize ? sanitizeHtml(html, options) : html;\n if (options?.emailFidelity) clean = relocateEmailContainers(clean);\n const dom = new DOMParser().parseFromString(`<body>${clean}</body>`, 'text/html');\n return getParser(schema).parseSlice(dom.body, { preserveWhitespace: true });\n}\n\n/** Serializes a document to HTML; `emailDefaults` writes the editor's table rendering into it. */\nexport function docToHtml(doc: PMNode, emailDefaults?: EmailRenderDefaults): string {\n const schema = doc.type.schema;\n const source = emailDefaults ? applyEmailRenderDefaults(doc, emailDefaults) : doc;\n const container = document.createElement('div');\n container.appendChild(getSerializer(schema).serializeFragment(source.content));\n if (emailDefaults) finishEmailTables(container);\n return container.innerHTML;\n}\n\n/** Plain-text projection of the document (blocks joined by newlines). */\nexport function docToText(doc: PMNode): string {\n return doc.textBetween(0, doc.content.size, '\\n', ' ');\n}\n\nexport function docToJson(doc: PMNode): Record<string, unknown> {\n return doc.toJSON();\n}\n\nexport function jsonToDoc(schema: Schema, json: Record<string, unknown>): PMNode {\n return PMNode.fromJSON(schema, json);\n}\n\n/** Word and character counts over the document's text content. */\nexport function countWords(doc: PMNode): { words: number; characters: number } {\n const text = docToText(doc);\n const words = text.trim() ? text.trim().split(/\\s+/).length : 0;\n return { words, characters: text.replace(/\\n/g, '').length };\n}\n\n/** True when the document has no visible content. */\nexport function isDocEmpty(doc: PMNode): boolean {\n if (doc.childCount > 1) return false;\n const first = doc.firstChild;\n return !first || (first.type.name === 'paragraph' && first.content.size === 0);\n}\n"],"names":["getParser","schema","parser","parserCache","get","PMDOMParser","fromSchema","set","htmlToDoc","html","sanitize","options","clean","sanitizeHtml","emailFidelity","relocateEmailContainers","dom","DOMParser","parseFromString","parse","body","htmlToSlice","arguments","length","undefined","parseSlice","preserveWhitespace","docToHtml","doc","emailDefaults","type","source","applyEmailRenderDefaults","container","document","createElement","appendChild","serializer","serializerCache","DOMSerializer","getSerializer","serializeFragment","content","finishEmailTables","innerHTML","docToText","textBetween","size","docToJson","toJSON","jsonToDoc","json","PMNode","fromJSON","countWords","text","words","trim","split","characters","replace","isDocEmpty","childCount","first","firstChild","name","_export","a","WeakMap"],"mappings":"uOAkBA,QAASA,CAAAA,CAAAA,CAAUC,CACjB,CAAA,CAAA,GAAIC,CAAAA,CAASC,CAAAA,CAAAA,CAAYC,GAAIH,CAAAA,CAAAA,CAAAA,CAK7B,MAJKC,CAAAA,CAAAA,GACHA,EAASG,CAAYC,CAAAA,UAAAA,CAAWL,CAChCE,CAAAA,CAAAA,CAAAA,CAAYI,GAAIN,CAAAA,CAAAA,CAAQC,CAEnBA,CAAAA,CAAAA,CAAAA,CACT,EAYM,QAAUM,CAAAA,CACdP,CAAAA,CAAAA,CACAQ,CACAC,CACAC,IADAD,CAAAA,CAAAA,CAAAA,SAAAA,CAAAA,MAAAA,IAAAA,SAAAA,MAAAA,SAAAA,CAAAA,SAAAA,IAAAA,CAAW,CACXC,IAAAA,CAAAA,CAAAA,CAAAA,SAAAA,CAAAA,MAAAA,GAAAA,SAAAA,IAAAA,SAAAA,CAEA,GAAIC,CAAAA,CAAAA,CAAQF,CAAWG,CAAAA,CAAAA,CAAaJ,CAAME,CAAAA,CAAAA,CAAAA,CAAWF,CAGjDE,CAAAA,CAAAA,CAAAA,SAAAA,CAA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AAAA,CAAAA,CAAAA,CAAAA,CAAKE,IAAOC,CAAAA,CAAAA,CAAAA,KAAAA,CAAM,KAAOnC,CAAAA,CAAAA,MAAAA,CAAS,CAC9CoC,CAAAA,UAAAA,CAAYJ,CAAKK,CAAAA,OAAAA,CAAQ,KAAO,CAAA,EAAA,CAAA,CAAIrC,MACtD,CAAA,EAGM,QAAUsC,CAAAA,CAAAA,CAAWjC,CACzB,CAAA,CAAA,GAAIA,CAAIkC,CAAAA,UAAAA,CAAa,CAAG,CAAA,MAAA,CAAO,CAC/B,CAAA,GAAMC,CAAAA,CAAQnC,CAAAA,CAAAA,CAAIoC,UAClB,CAAA,MAAA,CAAQD,CAA8B,EAAA,WAAA,GAApBA,CAAMjC,CAAAA,IAAAA,CAAKmC,IAA+C,EAAA,CAAA,GAAvBF,CAAMrB,CAAAA,OAAAA,CAAQK,IACrE,EAAAmB,OAAA,EAAAC,CAAA,kYApFMhE,CAAc,CAAA,GAAIiE,CAAAA,OAClB9B,CAAAA,CAAAA,CAAAA,CAAAA,CAAkB,GAAI8B,CAAAA,OAAAA,CAAAA,CAAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{N as
|
|
1
|
+
import{N as e,D as n,a as t}from"../../index-5d34cff1.esm.js";import{s as r,r as s}from"./sanitize.esm.js";import{a,f as o}from"./email-render.esm.js";import"./plugins/embeds.esm.js";import"../../index-7ca72b78.esm.js";import"./email-css.esm.js";const i=new WeakMap,u=new WeakMap;function c(e){let t=i.get(e);return t||(t=n.fromSchema(e),i.set(e,t)),t}function m(e,n,t=!0,a){let o=t?r(n,a):n;a?.emailFidelity&&(o=s(o));const i=(new DOMParser).parseFromString(`<body>${o}</body>`,"text/html");return c(e).parse(i.body)}function f(e,n,t=!0,a){let o=t?r(n,a):n;a?.emailFidelity&&(o=s(o));const i=(new DOMParser).parseFromString(`<body>${o}</body>`,"text/html");return c(e).parseSlice(i.body,{preserveWhitespace:!0})}function p(e,n){const r=e.type.schema,s=n?a(e,n):e,i=document.createElement("div");return i.appendChild(function(e){let n=u.get(e);return n||(n=t.fromSchema(e),u.set(e,n)),n}(r).serializeFragment(s.content)),n&&o(i),i.innerHTML}function d(e){return e.textBetween(0,e.content.size,"\n"," ")}function l(e){return e.toJSON()}function b(n,t){return e.fromJSON(n,t)}function j(e){const n=d(e);return{words:n.trim()?n.trim().split(/\s+/).length:0,characters:n.replace(/\n/g,"").length}}function h(e){if(e.childCount>1)return!1;const n=e.firstChild;return!n||"paragraph"===n.type.name&&0===n.content.size}export{f as a,p as b,j as c,d,l as e,m as h,h as i,b as j};
|