@novaprose/tinymce-compat 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/THIRD_PARTY_NOTICES.md +2 -0
- package/dist/ai-XVSDIIQI.js +127 -0
- package/dist/ai-XVSDIIQI.js.map +1 -0
- package/dist/dialog-3UZZZW6Y.js +300 -0
- package/dist/dialog-3UZZZW6Y.js.map +1 -0
- package/dist/index.cjs +1335 -409
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +92 -45
- package/dist/index.d.ts +92 -45
- package/dist/index.js +831 -366
- package/dist/index.js.map +1 -1
- package/dist/novaprose.css +376 -550
- package/dist/tinymce-chunks/a11ychecker-fe78c552.js +2 -0
- package/dist/tinymce-chunks/a11ychecker-fe78c552.js.map +7 -0
- package/dist/tinymce-chunks/accordion-ui-4272c63b.js +2 -0
- package/dist/tinymce-chunks/accordion-ui-4272c63b.js.map +7 -0
- package/dist/tinymce-chunks/advcode-840793ca.js +2 -0
- package/dist/tinymce-chunks/advcode-840793ca.js.map +7 -0
- package/dist/tinymce-chunks/advcode-editor-37bc0a02.js +26 -0
- package/dist/tinymce-chunks/advcode-editor-37bc0a02.js.map +7 -0
- package/dist/tinymce-chunks/advlist-67b98670.js +2 -0
- package/dist/tinymce-chunks/{advlist-7a360f16.js.map → advlist-67b98670.js.map} +2 -2
- package/dist/tinymce-chunks/advtable-ui-db2e667d.js +2 -0
- package/dist/tinymce-chunks/advtable-ui-db2e667d.js.map +7 -0
- package/dist/tinymce-chunks/ai-e0658729.js +6 -0
- package/dist/tinymce-chunks/ai-e0658729.js.map +7 -0
- package/dist/tinymce-chunks/ai2-ddf912a7.js +34 -0
- package/dist/tinymce-chunks/ai2-ddf912a7.js.map +7 -0
- package/dist/tinymce-chunks/anchor-ui-da0966bb.js +2 -0
- package/dist/tinymce-chunks/anchor-ui-da0966bb.js.map +7 -0
- package/dist/tinymce-chunks/autocorrect-907e1296.js +3 -0
- package/dist/tinymce-chunks/autocorrect-907e1296.js.map +7 -0
- package/dist/tinymce-chunks/autolink-897e8650.js +2 -0
- package/dist/tinymce-chunks/{autolink-7e2e7be2.js.map → autolink-897e8650.js.map} +2 -2
- package/dist/tinymce-chunks/autoresize-f8a4a52a.js +2 -0
- package/dist/tinymce-chunks/autoresize-f8a4a52a.js.map +7 -0
- package/dist/tinymce-chunks/autosave-60381295.js +2 -0
- package/dist/tinymce-chunks/autosave-60381295.js.map +7 -0
- package/dist/tinymce-chunks/bash-f3f8783a.js +2 -0
- package/dist/tinymce-chunks/bash-f3f8783a.js.map +7 -0
- package/dist/tinymce-chunks/c-8e3b278b.js +2 -0
- package/dist/tinymce-chunks/c-8e3b278b.js.map +7 -0
- package/dist/tinymce-chunks/casechange-8ad6a2c3.js +6 -0
- package/dist/tinymce-chunks/casechange-8ad6a2c3.js.map +7 -0
- package/dist/tinymce-chunks/charmap-5deb524c.js +2 -0
- package/dist/tinymce-chunks/charmap-5deb524c.js.map +7 -0
- package/dist/tinymce-chunks/checklist-5a0c95d3.js +2 -0
- package/dist/tinymce-chunks/checklist-5a0c95d3.js.map +7 -0
- package/dist/tinymce-chunks/codesample-b91dcd91.js +4 -0
- package/dist/tinymce-chunks/codesample-b91dcd91.js.map +7 -0
- package/dist/tinymce-chunks/comments-panel-152e9cbe.js +2 -0
- package/dist/tinymce-chunks/comments-panel-152e9cbe.js.map +7 -0
- package/dist/tinymce-chunks/core-f5b3fd3e.js +4 -0
- package/dist/tinymce-chunks/core-f5b3fd3e.js.map +7 -0
- package/dist/tinymce-chunks/cpp-525b2c81.js +2 -0
- package/dist/tinymce-chunks/cpp-525b2c81.js.map +7 -0
- package/dist/tinymce-chunks/csharp-b95db858.js +2 -0
- package/dist/tinymce-chunks/csharp-b95db858.js.map +7 -0
- package/dist/tinymce-chunks/css-bb736f0c.js +2 -0
- package/dist/tinymce-chunks/css-bb736f0c.js.map +7 -0
- package/dist/tinymce-chunks/de-21549c7e.js +2 -0
- package/dist/tinymce-chunks/de-21549c7e.js.map +7 -0
- package/dist/tinymce-chunks/dialog-126a0355.js +2 -0
- package/dist/tinymce-chunks/dialog-126a0355.js.map +7 -0
- package/dist/tinymce-chunks/diff-02578ed2.js +2 -0
- package/dist/tinymce-chunks/diff-02578ed2.js.map +7 -0
- package/dist/tinymce-chunks/directionality-185b3810.js +2 -0
- package/dist/tinymce-chunks/{directionality-60dba768.js.map → directionality-185b3810.js.map} +2 -2
- package/dist/tinymce-chunks/dockerfile-ff44475c.js +2 -0
- package/dist/tinymce-chunks/dockerfile-ff44475c.js.map +7 -0
- package/dist/tinymce-chunks/draghandle-a1d99987.js +4 -0
- package/dist/tinymce-chunks/draghandle-a1d99987.js.map +7 -0
- package/dist/tinymce-chunks/editimage-36199bc6.js +2 -0
- package/dist/tinymce-chunks/editimage-36199bc6.js.map +7 -0
- package/dist/tinymce-chunks/email-1926dd8a.js +62 -0
- package/dist/tinymce-chunks/email-1926dd8a.js.map +7 -0
- package/dist/tinymce-chunks/email2-e9c49586.js +2 -0
- package/dist/tinymce-chunks/email2-e9c49586.js.map +7 -0
- package/dist/tinymce-chunks/emoticons-a5ab437d.js +2 -0
- package/dist/tinymce-chunks/emoticons-a5ab437d.js.map +7 -0
- package/dist/tinymce-chunks/es-1de93a3f.js +2 -0
- package/dist/tinymce-chunks/es-1de93a3f.js.map +7 -0
- package/dist/tinymce-chunks/exportpdf-1dfcbddc.js +2 -0
- package/dist/tinymce-chunks/exportpdf-1dfcbddc.js.map +7 -0
- package/dist/tinymce-chunks/exportword-ad95abb4.js +2 -0
- package/dist/tinymce-chunks/exportword-ad95abb4.js.map +7 -0
- package/dist/tinymce-chunks/footnotes-ui-3f167c2c.js +2 -0
- package/dist/tinymce-chunks/footnotes-ui-3f167c2c.js.map +7 -0
- package/dist/tinymce-chunks/form-dialog-9eb62199.js +2 -0
- package/dist/tinymce-chunks/form-dialog-9eb62199.js.map +7 -0
- package/dist/tinymce-chunks/formatpainter-cbeeffa7.js +2 -0
- package/dist/tinymce-chunks/formatpainter-cbeeffa7.js.map +7 -0
- package/dist/tinymce-chunks/fr-6fbcca9f.js +2 -0
- package/dist/tinymce-chunks/fr-6fbcca9f.js.map +7 -0
- package/dist/tinymce-chunks/fullpagehtml-ui-9dd804af.js +2 -0
- package/dist/tinymce-chunks/fullpagehtml-ui-9dd804af.js.map +7 -0
- package/dist/tinymce-chunks/go-14612282.js +2 -0
- package/dist/tinymce-chunks/go-14612282.js.map +7 -0
- package/dist/tinymce-chunks/graphql-032121b4.js +2 -0
- package/dist/tinymce-chunks/graphql-032121b4.js.map +7 -0
- package/dist/tinymce-chunks/history-diff-a0db052c.js +2 -0
- package/dist/tinymce-chunks/history-diff-a0db052c.js.map +7 -0
- package/dist/tinymce-chunks/importcss-28610ab5.js +3 -0
- package/dist/tinymce-chunks/importcss-28610ab5.js.map +7 -0
- package/dist/tinymce-chunks/importword-d6c2636a.js +2 -0
- package/dist/tinymce-chunks/importword-d6c2636a.js.map +7 -0
- package/dist/tinymce-chunks/index-a1feed69.js +5 -0
- package/dist/tinymce-chunks/index-a1feed69.js.map +7 -0
- package/dist/tinymce-chunks/index2-610900bb.js +2 -0
- package/dist/tinymce-chunks/index2-610900bb.js.map +7 -0
- package/dist/tinymce-chunks/insertdatetime-a48ee6e0.js +2 -0
- package/dist/tinymce-chunks/{insertdatetime-e0dbcf63.js.map → insertdatetime-a48ee6e0.js.map} +2 -2
- package/dist/tinymce-chunks/it-ca70815f.js +2 -0
- package/dist/tinymce-chunks/it-ca70815f.js.map +7 -0
- package/dist/tinymce-chunks/java-e051279c.js +2 -0
- package/dist/tinymce-chunks/java-e051279c.js.map +7 -0
- package/dist/tinymce-chunks/javascript-d7a6fb3d.js +2 -0
- package/dist/tinymce-chunks/javascript-d7a6fb3d.js.map +7 -0
- package/dist/tinymce-chunks/json-08c0b631.js +2 -0
- package/dist/tinymce-chunks/json-08c0b631.js.map +7 -0
- package/dist/tinymce-chunks/kotlin-b34d5ff2.js +3 -0
- package/dist/tinymce-chunks/kotlin-b34d5ff2.js.map +7 -0
- package/dist/tinymce-chunks/linkchecker-820845fd.js +2 -0
- package/dist/tinymce-chunks/linkchecker-820845fd.js.map +7 -0
- package/dist/tinymce-chunks/lua-9b0ae20a.js +2 -0
- package/dist/tinymce-chunks/lua-9b0ae20a.js.map +7 -0
- package/dist/tinymce-chunks/markdown-5698ebec.js +34 -0
- package/dist/tinymce-chunks/markdown-5698ebec.js.map +7 -0
- package/dist/tinymce-chunks/markdown2-943bcf90.js +2 -0
- package/dist/tinymce-chunks/markdown2-943bcf90.js.map +7 -0
- package/dist/tinymce-chunks/math-ui-1b57f7eb.js +2 -0
- package/dist/tinymce-chunks/math-ui-1b57f7eb.js.map +7 -0
- package/dist/tinymce-chunks/media-ui-de819f11.js +2 -0
- package/dist/tinymce-chunks/media-ui-de819f11.js.map +7 -0
- package/dist/tinymce-chunks/mediaembed-ui-7be11324.js +2 -0
- package/dist/tinymce-chunks/mediaembed-ui-7be11324.js.map +7 -0
- package/dist/tinymce-chunks/mentions-ui-b1bb2d15.js +2 -0
- package/dist/tinymce-chunks/mentions-ui-b1bb2d15.js.map +7 -0
- package/dist/tinymce-chunks/mergetags-ui-f5bdd1f9.js +2 -0
- package/dist/tinymce-chunks/mergetags-ui-f5bdd1f9.js.map +7 -0
- package/dist/tinymce-chunks/nonbreaking-f15226ad.js +2 -0
- package/dist/tinymce-chunks/{nonbreaking-49bdb0d2.js.map → nonbreaking-f15226ad.js.map} +2 -2
- package/dist/tinymce-chunks/pagebreak-ui-7476f5c2.js +2 -0
- package/dist/tinymce-chunks/pagebreak-ui-7476f5c2.js.map +7 -0
- package/dist/tinymce-chunks/pageembed-ui-da39f1ee.js +2 -0
- package/dist/tinymce-chunks/pageembed-ui-da39f1ee.js.map +7 -0
- package/dist/tinymce-chunks/pagelayout-ui-01757669.js +2 -0
- package/dist/tinymce-chunks/pagelayout-ui-01757669.js.map +7 -0
- package/dist/tinymce-chunks/paste-office-4e8e9cb7.js +3 -0
- package/dist/tinymce-chunks/paste-office-4e8e9cb7.js.map +7 -0
- package/dist/tinymce-chunks/permanentpen-fc96f445.js +2 -0
- package/dist/tinymce-chunks/permanentpen-fc96f445.js.map +7 -0
- package/dist/tinymce-chunks/php-6b723470.js +3 -0
- package/dist/tinymce-chunks/php-6b723470.js.map +7 -0
- package/dist/tinymce-chunks/powershell-e6c3fdb8.js +2 -0
- package/dist/tinymce-chunks/powershell-e6c3fdb8.js.map +7 -0
- package/dist/tinymce-chunks/print-86762549.js +27 -0
- package/dist/tinymce-chunks/print-86762549.js.map +7 -0
- package/dist/tinymce-chunks/pt-BR-f6958ec0.js +2 -0
- package/dist/tinymce-chunks/pt-BR-f6958ec0.js.map +7 -0
- package/dist/tinymce-chunks/python-a20cacce.js +2 -0
- package/dist/tinymce-chunks/python-a20cacce.js.map +7 -0
- package/dist/tinymce-chunks/quickbars-35c87c0e.js +2 -0
- package/dist/tinymce-chunks/{quickbars-d937e10a.js.map → quickbars-35c87c0e.js.map} +3 -3
- package/dist/tinymce-chunks/revisionhistory-741dfb24.js +2 -0
- package/dist/tinymce-chunks/revisionhistory-741dfb24.js.map +7 -0
- package/dist/tinymce-chunks/ru-982f3476.js +2 -0
- package/dist/tinymce-chunks/ru-982f3476.js.map +7 -0
- package/dist/tinymce-chunks/ruby-93c325c7.js +2 -0
- package/dist/tinymce-chunks/ruby-93c325c7.js.map +7 -0
- package/dist/tinymce-chunks/rust-d80fbab5.js +2 -0
- package/dist/tinymce-chunks/rust-d80fbab5.js.map +7 -0
- package/dist/tinymce-chunks/save-a65e56cd.js +2 -0
- package/dist/tinymce-chunks/save-a65e56cd.js.map +7 -0
- package/dist/tinymce-chunks/scss-7cffeb15.js +2 -0
- package/dist/tinymce-chunks/scss-7cffeb15.js.map +7 -0
- package/dist/tinymce-chunks/search-bar-1c8ef2ee.js +3 -0
- package/dist/tinymce-chunks/search-bar-1c8ef2ee.js.map +7 -0
- package/dist/tinymce-chunks/spellchecker-91509fc1.js +6 -0
- package/dist/tinymce-chunks/spellchecker-91509fc1.js.map +7 -0
- package/dist/tinymce-chunks/sql-eeac1a81.js +2 -0
- package/dist/tinymce-chunks/sql-eeac1a81.js.map +7 -0
- package/dist/tinymce-chunks/suggestions-panel-c29362cf.js +2 -0
- package/dist/tinymce-chunks/suggestions-panel-c29362cf.js.map +7 -0
- package/dist/tinymce-chunks/suggestions-ui-c5f6bad4.js +2 -0
- package/dist/tinymce-chunks/suggestions-ui-c5f6bad4.js.map +7 -0
- package/dist/tinymce-chunks/swift-2b081f3e.js +2 -0
- package/dist/tinymce-chunks/swift-2b081f3e.js.map +7 -0
- package/dist/tinymce-chunks/table-4d43f60d.js +2 -0
- package/dist/tinymce-chunks/table-4d43f60d.js.map +7 -0
- package/dist/tinymce-chunks/table-dialogs-0445847c.js +2 -0
- package/dist/tinymce-chunks/table-dialogs-0445847c.js.map +7 -0
- package/dist/tinymce-chunks/tableofcontents-ui-01a9af06.js +2 -0
- package/dist/tinymce-chunks/tableofcontents-ui-01a9af06.js.map +7 -0
- package/dist/tinymce-chunks/temml-d637f801.js +97 -0
- package/dist/tinymce-chunks/temml-d637f801.js.map +7 -0
- package/dist/tinymce-chunks/template-b522c8ed.js +2 -0
- package/dist/tinymce-chunks/template-b522c8ed.js.map +7 -0
- package/dist/tinymce-chunks/typescript-fa085d66.js +2 -0
- package/dist/tinymce-chunks/typescript-fa085d66.js.map +7 -0
- package/dist/tinymce-chunks/typography-469ce11a.js +3 -0
- package/dist/tinymce-chunks/typography-469ce11a.js.map +7 -0
- package/dist/tinymce-chunks/visualblocks-8b7cba25.js +2 -0
- package/dist/tinymce-chunks/{visualblocks-58c88e5d.js.map → visualblocks-8b7cba25.js.map} +2 -2
- package/dist/tinymce-chunks/visualchars-7cda4c00.js +2 -0
- package/dist/tinymce-chunks/visualchars-7cda4c00.js.map +7 -0
- package/dist/tinymce-chunks/xml-77617a8f.js +2 -0
- package/dist/tinymce-chunks/xml-77617a8f.js.map +7 -0
- package/dist/tinymce-chunks/yaml-5bb3ad37.js +2 -0
- package/dist/tinymce-chunks/yaml-5bb3ad37.js.map +7 -0
- package/dist/tinymce.global.js +34 -27
- package/dist/tinymce.global.js.map +4 -4
- package/dist/tinymce.licenses.txt +1094 -0
- package/package.json +2 -2
- package/dist/tinymce-chunks/advlist-7a360f16.js +0 -2
- package/dist/tinymce-chunks/autolink-7e2e7be2.js +0 -2
- package/dist/tinymce-chunks/autoresize-d6c9537b.js +0 -2
- package/dist/tinymce-chunks/autoresize-d6c9537b.js.map +0 -7
- package/dist/tinymce-chunks/autosave-4fd46720.js +0 -2
- package/dist/tinymce-chunks/autosave-4fd46720.js.map +0 -7
- package/dist/tinymce-chunks/charmap-4b14307a.js +0 -2
- package/dist/tinymce-chunks/charmap-4b14307a.js.map +0 -7
- package/dist/tinymce-chunks/comments-panel-37cba890.js +0 -2
- package/dist/tinymce-chunks/comments-panel-37cba890.js.map +0 -7
- package/dist/tinymce-chunks/directionality-60dba768.js +0 -2
- package/dist/tinymce-chunks/emoticons-7e6da0b6.js +0 -2
- package/dist/tinymce-chunks/emoticons-7e6da0b6.js.map +0 -7
- package/dist/tinymce-chunks/form-dialog-9cde0ef7.js +0 -2
- package/dist/tinymce-chunks/form-dialog-9cde0ef7.js.map +0 -7
- package/dist/tinymce-chunks/insertdatetime-e0dbcf63.js +0 -2
- package/dist/tinymce-chunks/nonbreaking-49bdb0d2.js +0 -2
- package/dist/tinymce-chunks/paste-office-a38659d6.js +0 -3
- package/dist/tinymce-chunks/paste-office-a38659d6.js.map +0 -7
- package/dist/tinymce-chunks/quickbars-d937e10a.js +0 -2
- package/dist/tinymce-chunks/revisionhistory-d6306426.js +0 -2
- package/dist/tinymce-chunks/revisionhistory-d6306426.js.map +0 -7
- package/dist/tinymce-chunks/table-80284f6f.js +0 -2
- package/dist/tinymce-chunks/table-80284f6f.js.map +0 -7
- package/dist/tinymce-chunks/visualblocks-58c88e5d.js +0 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _novaprose_core from '@novaprose/core';
|
|
2
|
-
import { Editor, EditorOptions } from '@novaprose/core';
|
|
2
|
+
import { Editor, SelectionBookmark, EditorOptions } from '@novaprose/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* editor.windowManager.open(spec) —
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* editor.windowManager.open(spec) — a dialog from a description (as in the TinyMCE documentation):
|
|
6
|
+
* a panel or tabs, fields, buttons, initialData, onSubmit/onChange/onAction/onCancel/onClose and the
|
|
7
|
+
* api object. Built on the NovaProse dialog (focus, Esc, the mobile sheet); every label is textContent.
|
|
8
8
|
*/
|
|
9
9
|
type Data = Record<string, unknown>;
|
|
10
10
|
interface DialogItem {
|
|
@@ -80,9 +80,9 @@ interface DialogApi {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
83
|
+
* A NovaProse editor with the TinyMCE editor API (from its public documentation): the methods,
|
|
84
|
+
* events and control registry that existing integrations use. Everything goes through the public
|
|
85
|
+
* `Editor` API — ProseMirror is never touched directly (except inserting HTML via view.pasteHTML).
|
|
86
86
|
*/
|
|
87
87
|
type Handler = (event: Record<string, unknown>) => unknown;
|
|
88
88
|
type ButtonSpec = {
|
|
@@ -103,6 +103,11 @@ declare class CompatEditor {
|
|
|
103
103
|
readonly core: Editor;
|
|
104
104
|
readonly targetElm: HTMLElement;
|
|
105
105
|
readonly settings: Record<string, unknown>;
|
|
106
|
+
/**
|
|
107
|
+
* The plugins by their TinyMCE names (`editor.plugins.lists`): the listed ones that work here, and
|
|
108
|
+
* what your own plugins return. inlinecss has `getContent()`: the content with its styles inline.
|
|
109
|
+
*/
|
|
110
|
+
readonly plugins: Record<string, Record<string, unknown>>;
|
|
106
111
|
initialized: boolean;
|
|
107
112
|
removed: boolean;
|
|
108
113
|
private readonly handlers;
|
|
@@ -111,12 +116,14 @@ declare class CompatEditor {
|
|
|
111
116
|
constructor(core: Editor, target: HTMLElement, id: string, settings: Record<string, unknown>);
|
|
112
117
|
getContent(args?: {
|
|
113
118
|
format?: string;
|
|
119
|
+
prettify?: boolean;
|
|
120
|
+
fullpagehtml?: boolean;
|
|
114
121
|
}): string;
|
|
115
122
|
setContent(content: string, args?: Record<string, unknown>): string;
|
|
116
123
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
124
|
+
* Insert HTML in place of the selection. Blocks (<p>, lists, tables) go in as separate blocks (the
|
|
125
|
+
* paragraph is split), inline content into the current line. Parsed by the editor's schema: the
|
|
126
|
+
* same link and markup checks as when content is loaded.
|
|
120
127
|
*/
|
|
121
128
|
insertContent(content: string): void;
|
|
122
129
|
resetContent(content?: string): void;
|
|
@@ -126,9 +133,21 @@ declare class CompatEditor {
|
|
|
126
133
|
getContentAreaContainer(): HTMLElement;
|
|
127
134
|
getDoc(): Document;
|
|
128
135
|
getWin(): Window;
|
|
129
|
-
/**
|
|
136
|
+
/** The value of a command: for ToggleSidebar and ToggleView, the name of the open one. */
|
|
130
137
|
queryCommandValue(command: string): string;
|
|
131
138
|
execCommand(command: string, _ui?: boolean, value?: unknown): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* InsertAccordion / RemoveAccordion — like the accordion button (inside one, remove the frame;
|
|
141
|
+
* otherwise insert); ToggleAccordion / ToggleAllAccordions — value true expands, false collapses,
|
|
142
|
+
* no value toggles. Collapsing is a view, not an edit: it doesn't go into the undo history.
|
|
143
|
+
*/
|
|
144
|
+
private spellcheckCommand;
|
|
145
|
+
private accordionCommand;
|
|
146
|
+
/**
|
|
147
|
+
* A command of casechange, formatpainter or permanentpen: like its menu item or button.
|
|
148
|
+
* mceToggleStickyFormatPainter turns the painter on to stay (a double click on the button), or off.
|
|
149
|
+
*/
|
|
150
|
+
private pluginCommand;
|
|
132
151
|
queryCommandState(command: string): boolean;
|
|
133
152
|
queryCommandSupported(command: string): boolean;
|
|
134
153
|
private readonly commands;
|
|
@@ -137,16 +156,16 @@ declare class CompatEditor {
|
|
|
137
156
|
off(names?: string, handler?: Handler): this;
|
|
138
157
|
once(names: string, handler: Handler): this;
|
|
139
158
|
fire(name: string, event?: Record<string, unknown>): Record<string, unknown>;
|
|
140
|
-
/** DOM
|
|
159
|
+
/** A DOM event of the text (keydown, click…): handlers get the browser's event itself. */
|
|
141
160
|
fireNative(name: string, event: Event): void;
|
|
142
|
-
/**
|
|
161
|
+
/** An icon for buttons by name (tinymce.IconManager / editor.ui.registry.addIcon). */
|
|
143
162
|
static registerIcon(name: string, svg: string): void;
|
|
144
|
-
/**
|
|
163
|
+
/** The newer name of fire in recent versions of the API. */
|
|
145
164
|
dispatch(name: string, event?: Record<string, unknown>): Record<string, unknown>;
|
|
146
165
|
hasEventListeners(name: string): boolean;
|
|
147
166
|
isDirty(): boolean;
|
|
148
167
|
setDirty(state: boolean): void;
|
|
149
|
-
/**
|
|
168
|
+
/** Write the content into the original <textarea> (as on form submit). */
|
|
150
169
|
save(): string;
|
|
151
170
|
focus(): void;
|
|
152
171
|
hasFocus(): boolean;
|
|
@@ -162,7 +181,7 @@ declare class CompatEditor {
|
|
|
162
181
|
register: () => void;
|
|
163
182
|
};
|
|
164
183
|
readonly mode: {
|
|
165
|
-
get: () => "
|
|
184
|
+
get: () => "design" | "readonly";
|
|
166
185
|
set: (mode: string) => void;
|
|
167
186
|
isReadOnly: () => boolean;
|
|
168
187
|
};
|
|
@@ -176,20 +195,29 @@ declare class CompatEditor {
|
|
|
176
195
|
transact: (callback: () => void) => null;
|
|
177
196
|
ignore: (callback: () => void) => void;
|
|
178
197
|
};
|
|
198
|
+
/** TinyMCE's editor.selection, on top of the core's editor.selection. */
|
|
179
199
|
readonly selection: {
|
|
180
200
|
getContent: (args?: {
|
|
181
201
|
format?: string;
|
|
182
202
|
}) => string;
|
|
183
203
|
setContent: (content: string) => void;
|
|
184
|
-
getNode: () =>
|
|
185
|
-
getStart: () =>
|
|
186
|
-
getEnd: () =>
|
|
204
|
+
getNode: () => HTMLElement;
|
|
205
|
+
getStart: () => HTMLElement;
|
|
206
|
+
getEnd: () => HTMLElement;
|
|
187
207
|
isCollapsed: () => boolean;
|
|
188
208
|
collapse: (toStart?: boolean) => void;
|
|
189
|
-
/**
|
|
209
|
+
/** Put the cursor in a DOM node of the editor (at its start by default). */
|
|
190
210
|
setCursorLocation: (node?: Node, offset?: number) => void;
|
|
191
|
-
/**
|
|
211
|
+
/** Select an element: content = true — only its content. */
|
|
192
212
|
select: (node: Node, content?: boolean) => void;
|
|
213
|
+
/** The selection as a DOM Range. */
|
|
214
|
+
getRng: () => Range | null;
|
|
215
|
+
/** Select a DOM Range of the editing area. */
|
|
216
|
+
setRng: (range: Range) => void;
|
|
217
|
+
/** Remember the selection; moveToBookmark() puts it back, wherever later changes moved it. */
|
|
218
|
+
getBookmark: () => SelectionBookmark;
|
|
219
|
+
moveToBookmark: (bookmark: SelectionBookmark) => boolean;
|
|
220
|
+
scrollIntoView: () => void;
|
|
193
221
|
};
|
|
194
222
|
readonly notificationManager: {
|
|
195
223
|
open: (args: {
|
|
@@ -204,7 +232,7 @@ declare class CompatEditor {
|
|
|
204
232
|
confirm: (message: string, callback?: (state: boolean) => void) => void;
|
|
205
233
|
open: (spec: DialogSpec) => DialogApi;
|
|
206
234
|
};
|
|
207
|
-
/** editor.ui.registry —
|
|
235
|
+
/** editor.ui.registry — buttons and menu items in TinyMCE format on top of the NovaProse registry. */
|
|
208
236
|
readonly ui: {
|
|
209
237
|
registry: {
|
|
210
238
|
addIcon: (name: string, svg: string) => void;
|
|
@@ -217,8 +245,8 @@ declare class CompatEditor {
|
|
|
217
245
|
}) => void;
|
|
218
246
|
addMenuItem: (name: string, spec: MenuItemSpec) => void;
|
|
219
247
|
/**
|
|
220
|
-
*
|
|
221
|
-
* position: 'node' (
|
|
248
|
+
* A context toolbar: predicate(node) gets the element at the cursor, items are toolbar buttons.
|
|
249
|
+
* position: 'node' (above the element) or 'selection'/'line' (at the selection).
|
|
222
250
|
*/
|
|
223
251
|
addContextToolbar: (name: string, spec: {
|
|
224
252
|
predicate: (node: Element) => boolean;
|
|
@@ -227,8 +255,8 @@ declare class CompatEditor {
|
|
|
227
255
|
label?: string;
|
|
228
256
|
}) => void;
|
|
229
257
|
/**
|
|
230
|
-
*
|
|
231
|
-
*
|
|
258
|
+
* A sidebar: onSetup(api) draws the content into api.element() (once), onShow/onHide run when it
|
|
259
|
+
* is shown or hidden. A toggle button named after the sidebar is for the toolbar; ToggleSidebar is the command.
|
|
232
260
|
*/
|
|
233
261
|
addSidebar: (name: string, spec: {
|
|
234
262
|
tooltip?: string;
|
|
@@ -243,15 +271,33 @@ declare class CompatEditor {
|
|
|
243
271
|
element(): HTMLElement;
|
|
244
272
|
}) => void;
|
|
245
273
|
}) => void;
|
|
274
|
+
/**
|
|
275
|
+
* A view in place of the editor: buttons at its top, onShow/onHide get api.getContainer(), where it
|
|
276
|
+
* draws; ToggleView is the command.
|
|
277
|
+
*/
|
|
278
|
+
addView: (name: string, spec: {
|
|
279
|
+
buttons?: {
|
|
280
|
+
type?: string;
|
|
281
|
+
text?: string;
|
|
282
|
+
buttonType?: string;
|
|
283
|
+
onAction?: () => void;
|
|
284
|
+
}[];
|
|
285
|
+
onShow?: (api: {
|
|
286
|
+
getContainer(): HTMLElement;
|
|
287
|
+
}) => void;
|
|
288
|
+
onHide?: (api: {
|
|
289
|
+
getContainer(): HTMLElement;
|
|
290
|
+
}) => void;
|
|
291
|
+
}) => void;
|
|
246
292
|
addContextForm: () => void;
|
|
247
293
|
getAll: () => {};
|
|
248
294
|
};
|
|
249
295
|
};
|
|
250
296
|
private addButton;
|
|
251
297
|
/**
|
|
252
|
-
* editor.dom —
|
|
253
|
-
*
|
|
254
|
-
* formatter
|
|
298
|
+
* editor.dom — what makes sense on top of a document model: finding and reading. The text's DOM
|
|
299
|
+
* can't be changed directly (the editor redraws it from the model); use setContent, insertContent
|
|
300
|
+
* or formatter for edits — such calls log a warning.
|
|
255
301
|
*/
|
|
256
302
|
readonly dom: {
|
|
257
303
|
select: (selector: string, scope?: Element) => Element[];
|
|
@@ -265,7 +311,7 @@ declare class CompatEditor {
|
|
|
265
311
|
getRoot: () => HTMLElement;
|
|
266
312
|
encode: (text: string) => string;
|
|
267
313
|
decode: (html: string) => string;
|
|
268
|
-
/**
|
|
314
|
+
/** A new (not inserted) element: attributes via setAttribute, the content as text. */
|
|
269
315
|
create: (tag: string, attrs?: Record<string, string>, text?: string) => HTMLElement;
|
|
270
316
|
uniqueId: (prefix?: string) => string;
|
|
271
317
|
setAttrib: () => void;
|
|
@@ -275,8 +321,8 @@ declare class CompatEditor {
|
|
|
275
321
|
remove: () => void;
|
|
276
322
|
};
|
|
277
323
|
/**
|
|
278
|
-
* editor.formatter —
|
|
279
|
-
*
|
|
324
|
+
* editor.formatter — the built-in TinyMCE formats: apply/remove/toggle/match. Your own formats
|
|
325
|
+
* (register) are not supported yet.
|
|
280
326
|
*/
|
|
281
327
|
readonly formatter: {
|
|
282
328
|
apply: (name: string, vars?: {
|
|
@@ -294,15 +340,15 @@ declare class CompatEditor {
|
|
|
294
340
|
};
|
|
295
341
|
private blockMatches;
|
|
296
342
|
private applyFormat;
|
|
297
|
-
/**
|
|
343
|
+
/** Remove the editor and restore the original element (like editor.remove()). */
|
|
298
344
|
remove(): void;
|
|
299
345
|
destroy(): void;
|
|
300
346
|
}
|
|
301
347
|
|
|
302
348
|
/**
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
349
|
+
* Translates a `tinymce.init({...})` configuration into NovaProse options. Option names and their
|
|
350
|
+
* meaning come from TinyMCE's public documentation (a description of behavior); unknown options
|
|
351
|
+
* don't break initialization but are listed in a warning, so it's clear what isn't supported yet.
|
|
306
352
|
*/
|
|
307
353
|
type TinyConfig = Record<string, unknown> & {
|
|
308
354
|
selector?: string;
|
|
@@ -316,30 +362,30 @@ type TinyConfig = Record<string, unknown> & {
|
|
|
316
362
|
};
|
|
317
363
|
interface MappedOptions {
|
|
318
364
|
options: Omit<EditorOptions, 'element'>;
|
|
319
|
-
/**
|
|
365
|
+
/** Options NovaProse doesn't understand yet (for the warning). */
|
|
320
366
|
unknown: string[];
|
|
321
|
-
/**
|
|
367
|
+
/** Plugins found neither in the core nor in the catalog. */
|
|
322
368
|
missingPlugins: string[];
|
|
323
369
|
}
|
|
324
370
|
declare function mapOptions(config: TinyConfig): MappedOptions;
|
|
325
371
|
|
|
326
372
|
/**
|
|
327
|
-
*
|
|
373
|
+
* A compatibility layer with the `tinymce` API, to move to NovaProse without rewriting the integration:
|
|
328
374
|
*
|
|
329
375
|
* ```js
|
|
330
376
|
* import { tinymce } from '@novaprose/tinymce-compat';
|
|
331
377
|
* tinymce.init({ selector: 'textarea', plugins: 'lists link image', toolbar: 'undo redo | bold italic' });
|
|
332
378
|
* ```
|
|
333
379
|
*
|
|
334
|
-
*
|
|
335
|
-
*
|
|
380
|
+
* Or with a <script> tag (the CDN build sets window.tinymce and adds the styles itself).
|
|
381
|
+
* The behavior follows TinyMCE's public documentation; no TinyMCE code is used.
|
|
336
382
|
*/
|
|
337
383
|
type PluginFn = (editor: CompatEditor, url: string) => unknown;
|
|
338
384
|
interface TinyMCECompat {
|
|
339
|
-
/**
|
|
385
|
+
/** The API version this compatibility targets (some integrations check it). */
|
|
340
386
|
readonly majorVersion: string;
|
|
341
387
|
readonly minorVersion: string;
|
|
342
|
-
/**
|
|
388
|
+
/** A flag: this is NovaProse. */
|
|
343
389
|
readonly novaprose: true;
|
|
344
390
|
readonly activeEditor: CompatEditor | null;
|
|
345
391
|
readonly editors: CompatEditor[];
|
|
@@ -367,7 +413,8 @@ interface TinyMCECompat {
|
|
|
367
413
|
};
|
|
368
414
|
}
|
|
369
415
|
declare function createTinymce(): TinyMCECompat;
|
|
370
|
-
/**
|
|
416
|
+
/** The shared `tinymce` object for modules (the CDN build puts it into window.tinymce). */
|
|
371
417
|
declare const tinymce: TinyMCECompat;
|
|
372
418
|
|
|
373
|
-
export { CompatEditor,
|
|
419
|
+
export { CompatEditor, createTinymce, mapOptions, tinymce };
|
|
420
|
+
export type { TinyConfig, TinyMCECompat };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _novaprose_core from '@novaprose/core';
|
|
2
|
-
import { Editor, EditorOptions } from '@novaprose/core';
|
|
2
|
+
import { Editor, SelectionBookmark, EditorOptions } from '@novaprose/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* editor.windowManager.open(spec) —
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* editor.windowManager.open(spec) — a dialog from a description (as in the TinyMCE documentation):
|
|
6
|
+
* a panel or tabs, fields, buttons, initialData, onSubmit/onChange/onAction/onCancel/onClose and the
|
|
7
|
+
* api object. Built on the NovaProse dialog (focus, Esc, the mobile sheet); every label is textContent.
|
|
8
8
|
*/
|
|
9
9
|
type Data = Record<string, unknown>;
|
|
10
10
|
interface DialogItem {
|
|
@@ -80,9 +80,9 @@ interface DialogApi {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
83
|
+
* A NovaProse editor with the TinyMCE editor API (from its public documentation): the methods,
|
|
84
|
+
* events and control registry that existing integrations use. Everything goes through the public
|
|
85
|
+
* `Editor` API — ProseMirror is never touched directly (except inserting HTML via view.pasteHTML).
|
|
86
86
|
*/
|
|
87
87
|
type Handler = (event: Record<string, unknown>) => unknown;
|
|
88
88
|
type ButtonSpec = {
|
|
@@ -103,6 +103,11 @@ declare class CompatEditor {
|
|
|
103
103
|
readonly core: Editor;
|
|
104
104
|
readonly targetElm: HTMLElement;
|
|
105
105
|
readonly settings: Record<string, unknown>;
|
|
106
|
+
/**
|
|
107
|
+
* The plugins by their TinyMCE names (`editor.plugins.lists`): the listed ones that work here, and
|
|
108
|
+
* what your own plugins return. inlinecss has `getContent()`: the content with its styles inline.
|
|
109
|
+
*/
|
|
110
|
+
readonly plugins: Record<string, Record<string, unknown>>;
|
|
106
111
|
initialized: boolean;
|
|
107
112
|
removed: boolean;
|
|
108
113
|
private readonly handlers;
|
|
@@ -111,12 +116,14 @@ declare class CompatEditor {
|
|
|
111
116
|
constructor(core: Editor, target: HTMLElement, id: string, settings: Record<string, unknown>);
|
|
112
117
|
getContent(args?: {
|
|
113
118
|
format?: string;
|
|
119
|
+
prettify?: boolean;
|
|
120
|
+
fullpagehtml?: boolean;
|
|
114
121
|
}): string;
|
|
115
122
|
setContent(content: string, args?: Record<string, unknown>): string;
|
|
116
123
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
124
|
+
* Insert HTML in place of the selection. Blocks (<p>, lists, tables) go in as separate blocks (the
|
|
125
|
+
* paragraph is split), inline content into the current line. Parsed by the editor's schema: the
|
|
126
|
+
* same link and markup checks as when content is loaded.
|
|
120
127
|
*/
|
|
121
128
|
insertContent(content: string): void;
|
|
122
129
|
resetContent(content?: string): void;
|
|
@@ -126,9 +133,21 @@ declare class CompatEditor {
|
|
|
126
133
|
getContentAreaContainer(): HTMLElement;
|
|
127
134
|
getDoc(): Document;
|
|
128
135
|
getWin(): Window;
|
|
129
|
-
/**
|
|
136
|
+
/** The value of a command: for ToggleSidebar and ToggleView, the name of the open one. */
|
|
130
137
|
queryCommandValue(command: string): string;
|
|
131
138
|
execCommand(command: string, _ui?: boolean, value?: unknown): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* InsertAccordion / RemoveAccordion — like the accordion button (inside one, remove the frame;
|
|
141
|
+
* otherwise insert); ToggleAccordion / ToggleAllAccordions — value true expands, false collapses,
|
|
142
|
+
* no value toggles. Collapsing is a view, not an edit: it doesn't go into the undo history.
|
|
143
|
+
*/
|
|
144
|
+
private spellcheckCommand;
|
|
145
|
+
private accordionCommand;
|
|
146
|
+
/**
|
|
147
|
+
* A command of casechange, formatpainter or permanentpen: like its menu item or button.
|
|
148
|
+
* mceToggleStickyFormatPainter turns the painter on to stay (a double click on the button), or off.
|
|
149
|
+
*/
|
|
150
|
+
private pluginCommand;
|
|
132
151
|
queryCommandState(command: string): boolean;
|
|
133
152
|
queryCommandSupported(command: string): boolean;
|
|
134
153
|
private readonly commands;
|
|
@@ -137,16 +156,16 @@ declare class CompatEditor {
|
|
|
137
156
|
off(names?: string, handler?: Handler): this;
|
|
138
157
|
once(names: string, handler: Handler): this;
|
|
139
158
|
fire(name: string, event?: Record<string, unknown>): Record<string, unknown>;
|
|
140
|
-
/** DOM
|
|
159
|
+
/** A DOM event of the text (keydown, click…): handlers get the browser's event itself. */
|
|
141
160
|
fireNative(name: string, event: Event): void;
|
|
142
|
-
/**
|
|
161
|
+
/** An icon for buttons by name (tinymce.IconManager / editor.ui.registry.addIcon). */
|
|
143
162
|
static registerIcon(name: string, svg: string): void;
|
|
144
|
-
/**
|
|
163
|
+
/** The newer name of fire in recent versions of the API. */
|
|
145
164
|
dispatch(name: string, event?: Record<string, unknown>): Record<string, unknown>;
|
|
146
165
|
hasEventListeners(name: string): boolean;
|
|
147
166
|
isDirty(): boolean;
|
|
148
167
|
setDirty(state: boolean): void;
|
|
149
|
-
/**
|
|
168
|
+
/** Write the content into the original <textarea> (as on form submit). */
|
|
150
169
|
save(): string;
|
|
151
170
|
focus(): void;
|
|
152
171
|
hasFocus(): boolean;
|
|
@@ -162,7 +181,7 @@ declare class CompatEditor {
|
|
|
162
181
|
register: () => void;
|
|
163
182
|
};
|
|
164
183
|
readonly mode: {
|
|
165
|
-
get: () => "
|
|
184
|
+
get: () => "design" | "readonly";
|
|
166
185
|
set: (mode: string) => void;
|
|
167
186
|
isReadOnly: () => boolean;
|
|
168
187
|
};
|
|
@@ -176,20 +195,29 @@ declare class CompatEditor {
|
|
|
176
195
|
transact: (callback: () => void) => null;
|
|
177
196
|
ignore: (callback: () => void) => void;
|
|
178
197
|
};
|
|
198
|
+
/** TinyMCE's editor.selection, on top of the core's editor.selection. */
|
|
179
199
|
readonly selection: {
|
|
180
200
|
getContent: (args?: {
|
|
181
201
|
format?: string;
|
|
182
202
|
}) => string;
|
|
183
203
|
setContent: (content: string) => void;
|
|
184
|
-
getNode: () =>
|
|
185
|
-
getStart: () =>
|
|
186
|
-
getEnd: () =>
|
|
204
|
+
getNode: () => HTMLElement;
|
|
205
|
+
getStart: () => HTMLElement;
|
|
206
|
+
getEnd: () => HTMLElement;
|
|
187
207
|
isCollapsed: () => boolean;
|
|
188
208
|
collapse: (toStart?: boolean) => void;
|
|
189
|
-
/**
|
|
209
|
+
/** Put the cursor in a DOM node of the editor (at its start by default). */
|
|
190
210
|
setCursorLocation: (node?: Node, offset?: number) => void;
|
|
191
|
-
/**
|
|
211
|
+
/** Select an element: content = true — only its content. */
|
|
192
212
|
select: (node: Node, content?: boolean) => void;
|
|
213
|
+
/** The selection as a DOM Range. */
|
|
214
|
+
getRng: () => Range | null;
|
|
215
|
+
/** Select a DOM Range of the editing area. */
|
|
216
|
+
setRng: (range: Range) => void;
|
|
217
|
+
/** Remember the selection; moveToBookmark() puts it back, wherever later changes moved it. */
|
|
218
|
+
getBookmark: () => SelectionBookmark;
|
|
219
|
+
moveToBookmark: (bookmark: SelectionBookmark) => boolean;
|
|
220
|
+
scrollIntoView: () => void;
|
|
193
221
|
};
|
|
194
222
|
readonly notificationManager: {
|
|
195
223
|
open: (args: {
|
|
@@ -204,7 +232,7 @@ declare class CompatEditor {
|
|
|
204
232
|
confirm: (message: string, callback?: (state: boolean) => void) => void;
|
|
205
233
|
open: (spec: DialogSpec) => DialogApi;
|
|
206
234
|
};
|
|
207
|
-
/** editor.ui.registry —
|
|
235
|
+
/** editor.ui.registry — buttons and menu items in TinyMCE format on top of the NovaProse registry. */
|
|
208
236
|
readonly ui: {
|
|
209
237
|
registry: {
|
|
210
238
|
addIcon: (name: string, svg: string) => void;
|
|
@@ -217,8 +245,8 @@ declare class CompatEditor {
|
|
|
217
245
|
}) => void;
|
|
218
246
|
addMenuItem: (name: string, spec: MenuItemSpec) => void;
|
|
219
247
|
/**
|
|
220
|
-
*
|
|
221
|
-
* position: 'node' (
|
|
248
|
+
* A context toolbar: predicate(node) gets the element at the cursor, items are toolbar buttons.
|
|
249
|
+
* position: 'node' (above the element) or 'selection'/'line' (at the selection).
|
|
222
250
|
*/
|
|
223
251
|
addContextToolbar: (name: string, spec: {
|
|
224
252
|
predicate: (node: Element) => boolean;
|
|
@@ -227,8 +255,8 @@ declare class CompatEditor {
|
|
|
227
255
|
label?: string;
|
|
228
256
|
}) => void;
|
|
229
257
|
/**
|
|
230
|
-
*
|
|
231
|
-
*
|
|
258
|
+
* A sidebar: onSetup(api) draws the content into api.element() (once), onShow/onHide run when it
|
|
259
|
+
* is shown or hidden. A toggle button named after the sidebar is for the toolbar; ToggleSidebar is the command.
|
|
232
260
|
*/
|
|
233
261
|
addSidebar: (name: string, spec: {
|
|
234
262
|
tooltip?: string;
|
|
@@ -243,15 +271,33 @@ declare class CompatEditor {
|
|
|
243
271
|
element(): HTMLElement;
|
|
244
272
|
}) => void;
|
|
245
273
|
}) => void;
|
|
274
|
+
/**
|
|
275
|
+
* A view in place of the editor: buttons at its top, onShow/onHide get api.getContainer(), where it
|
|
276
|
+
* draws; ToggleView is the command.
|
|
277
|
+
*/
|
|
278
|
+
addView: (name: string, spec: {
|
|
279
|
+
buttons?: {
|
|
280
|
+
type?: string;
|
|
281
|
+
text?: string;
|
|
282
|
+
buttonType?: string;
|
|
283
|
+
onAction?: () => void;
|
|
284
|
+
}[];
|
|
285
|
+
onShow?: (api: {
|
|
286
|
+
getContainer(): HTMLElement;
|
|
287
|
+
}) => void;
|
|
288
|
+
onHide?: (api: {
|
|
289
|
+
getContainer(): HTMLElement;
|
|
290
|
+
}) => void;
|
|
291
|
+
}) => void;
|
|
246
292
|
addContextForm: () => void;
|
|
247
293
|
getAll: () => {};
|
|
248
294
|
};
|
|
249
295
|
};
|
|
250
296
|
private addButton;
|
|
251
297
|
/**
|
|
252
|
-
* editor.dom —
|
|
253
|
-
*
|
|
254
|
-
* formatter
|
|
298
|
+
* editor.dom — what makes sense on top of a document model: finding and reading. The text's DOM
|
|
299
|
+
* can't be changed directly (the editor redraws it from the model); use setContent, insertContent
|
|
300
|
+
* or formatter for edits — such calls log a warning.
|
|
255
301
|
*/
|
|
256
302
|
readonly dom: {
|
|
257
303
|
select: (selector: string, scope?: Element) => Element[];
|
|
@@ -265,7 +311,7 @@ declare class CompatEditor {
|
|
|
265
311
|
getRoot: () => HTMLElement;
|
|
266
312
|
encode: (text: string) => string;
|
|
267
313
|
decode: (html: string) => string;
|
|
268
|
-
/**
|
|
314
|
+
/** A new (not inserted) element: attributes via setAttribute, the content as text. */
|
|
269
315
|
create: (tag: string, attrs?: Record<string, string>, text?: string) => HTMLElement;
|
|
270
316
|
uniqueId: (prefix?: string) => string;
|
|
271
317
|
setAttrib: () => void;
|
|
@@ -275,8 +321,8 @@ declare class CompatEditor {
|
|
|
275
321
|
remove: () => void;
|
|
276
322
|
};
|
|
277
323
|
/**
|
|
278
|
-
* editor.formatter —
|
|
279
|
-
*
|
|
324
|
+
* editor.formatter — the built-in TinyMCE formats: apply/remove/toggle/match. Your own formats
|
|
325
|
+
* (register) are not supported yet.
|
|
280
326
|
*/
|
|
281
327
|
readonly formatter: {
|
|
282
328
|
apply: (name: string, vars?: {
|
|
@@ -294,15 +340,15 @@ declare class CompatEditor {
|
|
|
294
340
|
};
|
|
295
341
|
private blockMatches;
|
|
296
342
|
private applyFormat;
|
|
297
|
-
/**
|
|
343
|
+
/** Remove the editor and restore the original element (like editor.remove()). */
|
|
298
344
|
remove(): void;
|
|
299
345
|
destroy(): void;
|
|
300
346
|
}
|
|
301
347
|
|
|
302
348
|
/**
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
349
|
+
* Translates a `tinymce.init({...})` configuration into NovaProse options. Option names and their
|
|
350
|
+
* meaning come from TinyMCE's public documentation (a description of behavior); unknown options
|
|
351
|
+
* don't break initialization but are listed in a warning, so it's clear what isn't supported yet.
|
|
306
352
|
*/
|
|
307
353
|
type TinyConfig = Record<string, unknown> & {
|
|
308
354
|
selector?: string;
|
|
@@ -316,30 +362,30 @@ type TinyConfig = Record<string, unknown> & {
|
|
|
316
362
|
};
|
|
317
363
|
interface MappedOptions {
|
|
318
364
|
options: Omit<EditorOptions, 'element'>;
|
|
319
|
-
/**
|
|
365
|
+
/** Options NovaProse doesn't understand yet (for the warning). */
|
|
320
366
|
unknown: string[];
|
|
321
|
-
/**
|
|
367
|
+
/** Plugins found neither in the core nor in the catalog. */
|
|
322
368
|
missingPlugins: string[];
|
|
323
369
|
}
|
|
324
370
|
declare function mapOptions(config: TinyConfig): MappedOptions;
|
|
325
371
|
|
|
326
372
|
/**
|
|
327
|
-
*
|
|
373
|
+
* A compatibility layer with the `tinymce` API, to move to NovaProse without rewriting the integration:
|
|
328
374
|
*
|
|
329
375
|
* ```js
|
|
330
376
|
* import { tinymce } from '@novaprose/tinymce-compat';
|
|
331
377
|
* tinymce.init({ selector: 'textarea', plugins: 'lists link image', toolbar: 'undo redo | bold italic' });
|
|
332
378
|
* ```
|
|
333
379
|
*
|
|
334
|
-
*
|
|
335
|
-
*
|
|
380
|
+
* Or with a <script> tag (the CDN build sets window.tinymce and adds the styles itself).
|
|
381
|
+
* The behavior follows TinyMCE's public documentation; no TinyMCE code is used.
|
|
336
382
|
*/
|
|
337
383
|
type PluginFn = (editor: CompatEditor, url: string) => unknown;
|
|
338
384
|
interface TinyMCECompat {
|
|
339
|
-
/**
|
|
385
|
+
/** The API version this compatibility targets (some integrations check it). */
|
|
340
386
|
readonly majorVersion: string;
|
|
341
387
|
readonly minorVersion: string;
|
|
342
|
-
/**
|
|
388
|
+
/** A flag: this is NovaProse. */
|
|
343
389
|
readonly novaprose: true;
|
|
344
390
|
readonly activeEditor: CompatEditor | null;
|
|
345
391
|
readonly editors: CompatEditor[];
|
|
@@ -367,7 +413,8 @@ interface TinyMCECompat {
|
|
|
367
413
|
};
|
|
368
414
|
}
|
|
369
415
|
declare function createTinymce(): TinyMCECompat;
|
|
370
|
-
/**
|
|
416
|
+
/** The shared `tinymce` object for modules (the CDN build puts it into window.tinymce). */
|
|
371
417
|
declare const tinymce: TinyMCECompat;
|
|
372
418
|
|
|
373
|
-
export { CompatEditor,
|
|
419
|
+
export { CompatEditor, createTinymce, mapOptions, tinymce };
|
|
420
|
+
export type { TinyConfig, TinyMCECompat };
|