@aquera/nile-elements 1.9.8 → 1.9.9
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 +3 -0
- package/dist/{index-249de90a.esm.js → index-289706c7.esm.js} +1 -1
- package/dist/{index-df196058.cjs.js → index-d7e6f1c6.cjs.js} +2 -2
- package/dist/index-d7e6f1c6.cjs.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1577 -1275
- package/dist/katex-44476ab4.esm.js +1 -0
- package/dist/katex-f4186f87.cjs.js +2 -0
- package/dist/katex-f4186f87.cjs.js.map +1 -0
- package/dist/nile-color-picker/index.cjs.js +1 -1
- package/dist/nile-color-picker/index.esm.js +1 -1
- package/dist/nile-color-picker/nile-color-picker.cjs.js +1 -1
- package/dist/nile-color-picker/nile-color-picker.cjs.js.map +1 -1
- package/dist/nile-color-picker/nile-color-picker.esm.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/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/keymap.cjs.js +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/math-view.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/math-view.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/style-block-view.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/style-block-view.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/style-block-view.esm.js +1 -0
- 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 +1 -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/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/math/katex-renderer.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/math/katex-renderer.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/math/katex-renderer.esm.js +1 -0
- 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 +22 -3
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +7 -6
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.esm.js +33 -54
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.esm.js +83 -95
- package/dist/nile-wysiwyg-editor/types.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/types.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/types.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-item.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/bubble-item.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/bubble-item.esm.js +1 -0
- 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 +23 -15
- 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 +3 -3
- 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/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 +0 -3
- package/dist/nile-wysiwyg-editor/ui/preview.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/preview.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/preview.esm.js +8 -0
- 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 +225 -24
- 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 +9 -9
- 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 +115 -13
- 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 +13 -12
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/nile-color-picker/nile-color-picker.d.ts +1 -0
- package/dist/src/nile-color-picker/nile-color-picker.js +1 -0
- package/dist/src/nile-color-picker/nile-color-picker.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/index.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/index.js +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/index.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js +3 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.d.ts +19 -4
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js +23 -18
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.d.ts +8 -3
- package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js +41 -4
- package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/style-block-view.d.ts +17 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/style-block-view.js +174 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/style-block-view.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js +33 -2
- package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/pm.test.js +49 -8
- package/dist/src/nile-wysiwyg-editor/engine/pm.test.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.d.ts +12 -0
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.js +76 -8
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/schema.d.ts +2 -0
- package/dist/src/nile-wysiwyg-editor/engine/schema.js +154 -2
- package/dist/src/nile-wysiwyg-editor/engine/schema.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/index.d.ts +5 -0
- package/dist/src/nile-wysiwyg-editor/index.js +3 -0
- package/dist/src/nile-wysiwyg-editor/index.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/math/katex-renderer.d.ts +38 -0
- package/dist/src/nile-wysiwyg-editor/math/katex-renderer.js +40 -0
- package/dist/src/nile-wysiwyg-editor/math/katex-renderer.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js +22 -3
- 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 +36 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js +125 -8
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js +5 -2
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.d.ts +2 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.d.ts +55 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.js +79 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js +33 -54
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.d.ts +50 -2
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js +158 -102
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/types.d.ts +4 -2
- package/dist/src/nile-wysiwyg-editor/types.js +2 -2
- package/dist/src/nile-wysiwyg-editor/types.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/bubble-item.d.ts +48 -0
- package/dist/src/nile-wysiwyg-editor/ui/bubble-item.js +69 -0
- package/dist/src/nile-wysiwyg-editor/ui/bubble-item.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.d.ts +17 -2
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js +128 -35
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.d.ts +2 -1
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js +4 -3
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/math-panel.js +0 -3
- package/dist/src/nile-wysiwyg-editor/ui/math-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/preview.d.ts +20 -0
- package/dist/src/nile-wysiwyg-editor/ui/preview.js +44 -0
- package/dist/src/nile-wysiwyg-editor/ui/preview.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/source-view.d.ts +35 -3
- package/dist/src/nile-wysiwyg-editor/ui/source-view.js +337 -24
- package/dist/src/nile-wysiwyg-editor/ui/source-view.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js +9 -0
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.d.ts +13 -2
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js +166 -10
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/table-menu.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/table-menu.js +10 -8
- 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/dist/xml-25c4108a.esm.js +1 -0
- package/dist/xml-90fd974e.cjs.js +2 -0
- package/dist/xml-90fd974e.cjs.js.map +1 -0
- package/package.json +2 -1
- package/rollup.config.js +1 -0
- package/src/index.ts +8 -0
- package/src/nile-color-picker/nile-color-picker.ts +1 -0
- package/src/nile-wysiwyg-editor/engine/index.ts +1 -0
- package/src/nile-wysiwyg-editor/engine/plugins/embed-view.ts +3 -0
- package/src/nile-wysiwyg-editor/engine/plugins/embeds.ts +26 -20
- package/src/nile-wysiwyg-editor/engine/plugins/math-view.ts +45 -4
- package/src/nile-wysiwyg-editor/engine/plugins/style-block-view.ts +178 -0
- package/src/nile-wysiwyg-editor/engine/plugins/tables.ts +34 -2
- package/src/nile-wysiwyg-editor/engine/pm.test.ts +58 -8
- package/src/nile-wysiwyg-editor/engine/sanitize.ts +71 -8
- package/src/nile-wysiwyg-editor/engine/schema.ts +158 -7
- package/src/nile-wysiwyg-editor/index.ts +5 -0
- package/src/nile-wysiwyg-editor/math/katex-renderer.ts +59 -0
- package/src/nile-wysiwyg-editor/math/katex.d.ts +17 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.ts +22 -3
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.ts +5 -2
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.ts +142 -7
- package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.ts +2 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.ts +68 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.ts +33 -54
- package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.ts +202 -108
- package/src/nile-wysiwyg-editor/types.ts +6 -4
- package/src/nile-wysiwyg-editor/ui/bubble-item.ts +60 -0
- package/src/nile-wysiwyg-editor/ui/bubble-menu.ts +147 -40
- package/src/nile-wysiwyg-editor/ui/embed-panel.ts +4 -3
- package/src/nile-wysiwyg-editor/ui/math-panel.ts +0 -3
- package/src/nile-wysiwyg-editor/ui/preview.ts +42 -0
- package/src/nile-wysiwyg-editor/ui/source-view.ts +339 -31
- package/src/nile-wysiwyg-editor/ui/suggest-list.ts +10 -0
- package/src/nile-wysiwyg-editor/ui/table-grid-picker.ts +160 -10
- package/src/nile-wysiwyg-editor/ui/table-menu.ts +10 -8
- package/vscode-html-custom-data.json +75 -6
- package/dist/index-df196058.cjs.js.map +0 -1
|
@@ -5,13 +5,15 @@ import { EditorView } from 'prosemirror-view';
|
|
|
5
5
|
import { TextSelection } from 'prosemirror-state';
|
|
6
6
|
import NileElement from '../internal/nile-element';
|
|
7
7
|
import { styles } from './nile-wysiwyg-editor.css';
|
|
8
|
-
import { defaultSchema, createEditorState, computeToolbarState, htmlToDoc, htmlToSlice, docToHtml, docToText, docToMarkdown, markdownToHtml, docToJson, jsonToDoc, isDocEmpty, sanitizeHtml, getCommand, getMarkRange, flattenToSingleParagraph, imageUploadKey, findUploadPos, countWords, TaskItemView, ImageView, FigureView, EmbedView, MathView, isOfficeHtml, cleanOfficeHtml, toInlineStyledHtml, buildWordDocument, buildPrintDocument, isFormatPainterArmed, armFormatPainter, disarmFormatPainter, applyFormatPainter, getFindState, searchTr, findStepTr, clearFindTr, replaceActiveTr, replaceAllTr, } from './engine';
|
|
8
|
+
import { defaultSchema, createEditorState, computeToolbarState, htmlToDoc, htmlToSlice, docToHtml, docToText, docToMarkdown, markdownToHtml, docToJson, jsonToDoc, isDocEmpty, sanitizeHtml, getCommand, getMarkRange, flattenToSingleParagraph, imageUploadKey, findUploadPos, countWords, TaskItemView, ImageView, FigureView, EmbedView, StyleBlockView, MathView, isOfficeHtml, cleanOfficeHtml, toInlineStyledHtml, buildWordDocument, buildPrintDocument, isFormatPainterArmed, armFormatPainter, disarmFormatPainter, applyFormatPainter, getFindState, searchTr, findStepTr, clearFindTr, replaceActiveTr, replaceAllTr, } from './engine';
|
|
9
9
|
import { selectedImageInfo } from './engine/commands';
|
|
10
10
|
import { DEFAULT_TOOLBAR } from './types';
|
|
11
11
|
import { EMOJI } from './emoji';
|
|
12
12
|
import './nile-wysiwyg-toolbar/nile-wysiwyg-toolbar';
|
|
13
|
+
import './nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item';
|
|
13
14
|
import './ui/link-editor';
|
|
14
15
|
import './ui/bubble-menu';
|
|
16
|
+
import './ui/bubble-item';
|
|
15
17
|
import './ui/image-panel';
|
|
16
18
|
import './ui/table-menu';
|
|
17
19
|
import './ui/suggest-list';
|
|
@@ -165,6 +167,32 @@ let NileWysiwygEditor = class NileWysiwygEditor extends NileElement {
|
|
|
165
167
|
this.pendingChange = false;
|
|
166
168
|
/** Body overflow value before fullscreen locked it; null = not locked. */
|
|
167
169
|
this.previousBodyOverflow = null;
|
|
170
|
+
/**
|
|
171
|
+
* True while a drag-selection is in progress with the format painter armed.
|
|
172
|
+
* Suppresses the mid-drag auto-apply in {@link handleTransaction} so the
|
|
173
|
+
* copied formatting lands on the final, complete selection (on mouse-up).
|
|
174
|
+
*/
|
|
175
|
+
this.painterDragActive = false;
|
|
176
|
+
this.onPainterPointerDown = () => {
|
|
177
|
+
if (this.view && isFormatPainterArmed(this.view.state)) {
|
|
178
|
+
this.painterDragActive = true;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
this.onPainterPointerUp = () => {
|
|
182
|
+
if (!this.painterDragActive)
|
|
183
|
+
return;
|
|
184
|
+
this.painterDragActive = false;
|
|
185
|
+
// Defer a frame so ProseMirror has synced the final DOM selection.
|
|
186
|
+
requestAnimationFrame(() => {
|
|
187
|
+
if (!this.view)
|
|
188
|
+
return;
|
|
189
|
+
if (this.view.state.selection.empty || !isFormatPainterArmed(this.view.state))
|
|
190
|
+
return;
|
|
191
|
+
const applyTr = applyFormatPainter(this.view.state);
|
|
192
|
+
if (applyTr)
|
|
193
|
+
this.view.dispatch(applyTr);
|
|
194
|
+
});
|
|
195
|
+
};
|
|
168
196
|
/**
|
|
169
197
|
* Closes any open insert panel when the pointer goes down outside of it —
|
|
170
198
|
* whether elsewhere in the editor (e.g. the content area) or off the widget.
|
|
@@ -193,10 +221,32 @@ let NileWysiwygEditor = class NileWysiwygEditor extends NileElement {
|
|
|
193
221
|
}
|
|
194
222
|
// Close floating panels when the user clicks anywhere outside them.
|
|
195
223
|
document.addEventListener('pointerdown', this.onOutsidePointerDown, true);
|
|
224
|
+
// Format painter applies on pointer release so a drag-selection is painted
|
|
225
|
+
// whole, not on the first mid-drag selection change.
|
|
226
|
+
document.addEventListener('mouseup', this.onPainterPointerUp);
|
|
227
|
+
// Discover an author-supplied toolbar / bubble menu (light-DOM
|
|
228
|
+
// <nile-wysiwyg-toolbar-item> / <nile-wysiwyg-bubble-item> children) and
|
|
229
|
+
// keep them in sync as they change.
|
|
230
|
+
this.syncAuthoredToolbar();
|
|
231
|
+
this.syncAuthoredBubble();
|
|
232
|
+
if (!this.toolbarObserver) {
|
|
233
|
+
this.toolbarObserver = new MutationObserver(() => {
|
|
234
|
+
this.syncAuthoredToolbar();
|
|
235
|
+
this.syncAuthoredBubble();
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
this.toolbarObserver.observe(this, {
|
|
239
|
+
childList: true,
|
|
240
|
+
subtree: true,
|
|
241
|
+
attributes: true,
|
|
242
|
+
attributeFilter: ['name', 'label', 'icon', 'divider', 'overflow'],
|
|
243
|
+
});
|
|
196
244
|
}
|
|
197
245
|
disconnectedCallback() {
|
|
198
246
|
super.disconnectedCallback();
|
|
199
247
|
document.removeEventListener('pointerdown', this.onOutsidePointerDown, true);
|
|
248
|
+
document.removeEventListener('mouseup', this.onPainterPointerUp);
|
|
249
|
+
this.toolbarObserver?.disconnect();
|
|
200
250
|
if (this.changeTimer)
|
|
201
251
|
clearTimeout(this.changeTimer);
|
|
202
252
|
if (this.autosaveTimer)
|
|
@@ -210,8 +260,54 @@ let NileWysiwygEditor = class NileWysiwygEditor extends NileElement {
|
|
|
210
260
|
}
|
|
211
261
|
firstUpdated() {
|
|
212
262
|
this.defaultValue = this.value;
|
|
263
|
+
// Re-read now that light-DOM children are guaranteed parsed (the initial
|
|
264
|
+
// connectedCallback read can run mid-parse before children exist).
|
|
265
|
+
this.syncAuthoredToolbar();
|
|
266
|
+
this.syncAuthoredBubble();
|
|
213
267
|
this.mountView();
|
|
214
268
|
}
|
|
269
|
+
/**
|
|
270
|
+
* Reads `<nile-wysiwyg-toolbar-item>` children into a structured toolbar and
|
|
271
|
+
* stores it on {@link authoredToolbar}. Absent items clear the override
|
|
272
|
+
* (falling back to the `toolbar` string). No-ops when nothing changed to
|
|
273
|
+
* avoid needless re-renders.
|
|
274
|
+
*/
|
|
275
|
+
syncAuthoredToolbar() {
|
|
276
|
+
const nodes = this.querySelectorAll('nile-wysiwyg-toolbar-item');
|
|
277
|
+
const next = nodes.length
|
|
278
|
+
? Array.from(nodes)
|
|
279
|
+
.map(el => ({
|
|
280
|
+
name: el.hasAttribute('divider') ? '|' : el.getAttribute('name') || '',
|
|
281
|
+
label: el.getAttribute('label') || undefined,
|
|
282
|
+
icon: el.getAttribute('icon') || undefined,
|
|
283
|
+
overflow: el.hasAttribute('overflow') || undefined,
|
|
284
|
+
}))
|
|
285
|
+
.filter(item => item.name)
|
|
286
|
+
: undefined;
|
|
287
|
+
if (JSON.stringify(next) !== JSON.stringify(this.authoredToolbar)) {
|
|
288
|
+
this.authoredToolbar = next;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Reads `<nile-wysiwyg-bubble-item>` children into a structured bubble-menu
|
|
293
|
+
* item list stored on {@link authoredBubble}. Absent items clear the override
|
|
294
|
+
* (falling back to the built-in default). No-ops when nothing changed.
|
|
295
|
+
*/
|
|
296
|
+
syncAuthoredBubble() {
|
|
297
|
+
const nodes = this.querySelectorAll('nile-wysiwyg-bubble-item');
|
|
298
|
+
const next = nodes.length
|
|
299
|
+
? Array.from(nodes)
|
|
300
|
+
.map(el => ({
|
|
301
|
+
name: el.hasAttribute('divider') ? '|' : el.getAttribute('name') || '',
|
|
302
|
+
label: el.getAttribute('label') || undefined,
|
|
303
|
+
icon: el.getAttribute('icon') || undefined,
|
|
304
|
+
}))
|
|
305
|
+
.filter(item => item.name)
|
|
306
|
+
: undefined;
|
|
307
|
+
if (JSON.stringify(next) !== JSON.stringify(this.authoredBubble)) {
|
|
308
|
+
this.authoredBubble = next;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
215
311
|
updated(changed) {
|
|
216
312
|
if (changed.has('value') && this.view && !this.syncingValue) {
|
|
217
313
|
const current = docToHtml(this.view.state.doc);
|
|
@@ -383,9 +479,11 @@ let NileWysiwygEditor = class NileWysiwygEditor extends NileElement {
|
|
|
383
479
|
image: (node, view, getPos) => new ImageView(node, view, getPos),
|
|
384
480
|
figure: (node, view, getPos) => new FigureView(node, view, getPos),
|
|
385
481
|
embed: (node, view, getPos) => new EmbedView(node, view, getPos),
|
|
482
|
+
styleBlock: node => new StyleBlockView(node),
|
|
386
483
|
math: node => new MathView(node, this.mathRenderer),
|
|
387
484
|
},
|
|
388
485
|
});
|
|
486
|
+
this.view.dom.addEventListener('mousedown', this.onPainterPointerDown);
|
|
389
487
|
this.toolbarState = this.snapshotToolbar(this.view.state);
|
|
390
488
|
this.counter = countWords(this.view.state.doc);
|
|
391
489
|
this.syncFormValue(this.view.state.doc);
|
|
@@ -396,8 +494,15 @@ let NileWysiwygEditor = class NileWysiwygEditor extends NileElement {
|
|
|
396
494
|
const newState = this.view.state.apply(tr);
|
|
397
495
|
this.view.updateState(newState);
|
|
398
496
|
// Format painter: once armed, the next non-empty selection the user makes
|
|
399
|
-
// receives the copied formatting, then the painter disarms.
|
|
400
|
-
|
|
497
|
+
// receives the copied formatting, then the painter disarms. While a pointer
|
|
498
|
+
// drag is building the selection we defer to the mouse-up handler
|
|
499
|
+
// (onPainterPointerUp) so the whole range is painted, not just the first
|
|
500
|
+
// mid-drag character. Single-shot selections (double-click, Shift+End,
|
|
501
|
+
// programmatic) still apply here.
|
|
502
|
+
if (tr.selectionSet &&
|
|
503
|
+
!newState.selection.empty &&
|
|
504
|
+
isFormatPainterArmed(newState) &&
|
|
505
|
+
!this.painterDragActive) {
|
|
401
506
|
const applyTr = applyFormatPainter(newState);
|
|
402
507
|
if (applyTr) {
|
|
403
508
|
this.view.dispatch(applyTr);
|
|
@@ -1062,7 +1167,7 @@ let NileWysiwygEditor = class NileWysiwygEditor extends NileElement {
|
|
|
1062
1167
|
/** Toggles raw-HTML source editing. Content re-sanitizes on the way back. */
|
|
1063
1168
|
toggleSourceView() {
|
|
1064
1169
|
if (this.sourceMode) {
|
|
1065
|
-
this.applySourceView(this.sourceViewEl?.
|
|
1170
|
+
this.applySourceView(this.sourceViewEl?.currentValue ?? null);
|
|
1066
1171
|
}
|
|
1067
1172
|
else {
|
|
1068
1173
|
this.sourceMode = true;
|
|
@@ -1564,7 +1669,12 @@ let NileWysiwygEditor = class NileWysiwygEditor extends NileElement {
|
|
|
1564
1669
|
this.closeMarkdownPanel(refocus);
|
|
1565
1670
|
}
|
|
1566
1671
|
render() {
|
|
1567
|
-
const
|
|
1672
|
+
const hasAuthoredToolbar = (this.authoredToolbar?.length ?? 0) > 0;
|
|
1673
|
+
// Keep the toolbar mounted in source mode too, so the main menu stays put
|
|
1674
|
+
// above the split source/preview view instead of being replaced by it. It
|
|
1675
|
+
// is disabled there — formatting commands would target the hidden rich-text
|
|
1676
|
+
// view — and the source view's own Cancel/Done bar handles exiting.
|
|
1677
|
+
const showToolbar = (this.toolbar !== 'none' || hasAuthoredToolbar) && !this.readonly;
|
|
1568
1678
|
return html `
|
|
1569
1679
|
<div
|
|
1570
1680
|
class="nile-wysiwyg ${this.showBlocks ? 'nile-wysiwyg--show-blocks' : ''}"
|
|
@@ -1577,9 +1687,10 @@ let NileWysiwygEditor = class NileWysiwygEditor extends NileElement {
|
|
|
1577
1687
|
? html `
|
|
1578
1688
|
<nile-wysiwyg-toolbar
|
|
1579
1689
|
part="toolbar"
|
|
1580
|
-
exportparts="button, select, color"
|
|
1690
|
+
exportparts="button, select, color, overflow, overflow-panel"
|
|
1581
1691
|
config=${this.toolbar}
|
|
1582
|
-
|
|
1692
|
+
.items=${this.authoredToolbar}
|
|
1693
|
+
?disabled=${this.disabled || this.sourceMode}
|
|
1583
1694
|
.toolbarState=${this.toolbarState}
|
|
1584
1695
|
></nile-wysiwyg-toolbar>
|
|
1585
1696
|
`
|
|
@@ -1624,7 +1735,7 @@ let NileWysiwygEditor = class NileWysiwygEditor extends NileElement {
|
|
|
1624
1735
|
this.closeShortcutHelp();
|
|
1625
1736
|
}}
|
|
1626
1737
|
></nile-wysiwyg-shortcut-help>
|
|
1627
|
-
<nile-wysiwyg-bubble-menu></nile-wysiwyg-bubble-menu>
|
|
1738
|
+
<nile-wysiwyg-bubble-menu .items=${this.authoredBubble}></nile-wysiwyg-bubble-menu>
|
|
1628
1739
|
<nile-wysiwyg-table-menu></nile-wysiwyg-table-menu>
|
|
1629
1740
|
<nile-wysiwyg-code-menu></nile-wysiwyg-code-menu>
|
|
1630
1741
|
<nile-wysiwyg-image-menu></nile-wysiwyg-image-menu>
|
|
@@ -1803,6 +1914,12 @@ __decorate([
|
|
|
1803
1914
|
__decorate([
|
|
1804
1915
|
property({ type: String })
|
|
1805
1916
|
], NileWysiwygEditor.prototype, "toolbar", void 0);
|
|
1917
|
+
__decorate([
|
|
1918
|
+
state()
|
|
1919
|
+
], NileWysiwygEditor.prototype, "authoredToolbar", void 0);
|
|
1920
|
+
__decorate([
|
|
1921
|
+
state()
|
|
1922
|
+
], NileWysiwygEditor.prototype, "authoredBubble", void 0);
|
|
1806
1923
|
__decorate([
|
|
1807
1924
|
property({ type: Boolean, attribute: 'bubble-menu' })
|
|
1808
1925
|
], NileWysiwygEditor.prototype, "bubbleMenu", void 0);
|