@novaprose/tinymce-compat 0.6.0 → 0.7.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 +10 -3
- package/dist/index.cjs +38 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -6
- package/dist/index.d.ts +20 -6
- package/dist/index.js +39 -1
- package/dist/index.js.map +1 -1
- package/dist/novaprose.css +187 -31
- package/dist/tinymce-chunks/advlist-7a360f16.js +2 -0
- package/dist/tinymce-chunks/advlist-7a360f16.js.map +7 -0
- package/dist/tinymce-chunks/autolink-7e2e7be2.js +2 -0
- package/dist/tinymce-chunks/autolink-7e2e7be2.js.map +7 -0
- package/dist/tinymce-chunks/autoresize-d6c9537b.js +2 -0
- package/dist/tinymce-chunks/autoresize-d6c9537b.js.map +7 -0
- package/dist/tinymce-chunks/autosave-4fd46720.js +2 -0
- package/dist/tinymce-chunks/autosave-4fd46720.js.map +7 -0
- package/dist/tinymce-chunks/charmap-4b14307a.js +2 -0
- package/dist/tinymce-chunks/charmap-4b14307a.js.map +7 -0
- package/dist/tinymce-chunks/comments-panel-37cba890.js +2 -0
- package/dist/tinymce-chunks/comments-panel-37cba890.js.map +7 -0
- package/dist/tinymce-chunks/directionality-60dba768.js +2 -0
- package/dist/tinymce-chunks/directionality-60dba768.js.map +7 -0
- package/dist/tinymce-chunks/emoticons-7e6da0b6.js +2 -0
- package/dist/tinymce-chunks/emoticons-7e6da0b6.js.map +7 -0
- package/dist/tinymce-chunks/form-dialog-9cde0ef7.js +2 -0
- package/dist/tinymce-chunks/form-dialog-9cde0ef7.js.map +7 -0
- package/dist/tinymce-chunks/insertdatetime-e0dbcf63.js +2 -0
- package/dist/tinymce-chunks/insertdatetime-e0dbcf63.js.map +7 -0
- package/dist/tinymce-chunks/nonbreaking-49bdb0d2.js +2 -0
- package/dist/tinymce-chunks/nonbreaking-49bdb0d2.js.map +7 -0
- package/dist/tinymce-chunks/paste-office-a38659d6.js +3 -0
- package/dist/tinymce-chunks/paste-office-a38659d6.js.map +7 -0
- package/dist/tinymce-chunks/quickbars-d937e10a.js +2 -0
- package/dist/tinymce-chunks/quickbars-d937e10a.js.map +7 -0
- package/dist/tinymce-chunks/revisionhistory-d6306426.js +2 -0
- package/dist/tinymce-chunks/revisionhistory-d6306426.js.map +7 -0
- package/dist/tinymce-chunks/table-80284f6f.js +2 -0
- package/dist/tinymce-chunks/table-80284f6f.js.map +7 -0
- package/dist/tinymce-chunks/visualblocks-58c88e5d.js +2 -0
- package/dist/tinymce-chunks/visualblocks-58c88e5d.js.map +7 -0
- package/dist/tinymce.global.js +23 -23
- package/dist/tinymce.global.js.map +7 -1
- package/package.json +11 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import * as _novaprose_core from '@novaprose/core';
|
|
2
2
|
import { Editor, EditorOptions } from '@novaprose/core';
|
|
3
3
|
|
|
4
|
-
interface NotificationHandle {
|
|
5
|
-
close(): void;
|
|
6
|
-
setText(text: string): void;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
4
|
/**
|
|
10
5
|
* editor.windowManager.open(spec) — диалог по описанию (как в документации TinyMCE): панель или
|
|
11
6
|
* вкладки, поля, кнопки, initialData, onSubmit/onChange/onAction/onCancel/onClose и объект api.
|
|
@@ -131,6 +126,8 @@ declare class CompatEditor {
|
|
|
131
126
|
getContentAreaContainer(): HTMLElement;
|
|
132
127
|
getDoc(): Document;
|
|
133
128
|
getWin(): Window;
|
|
129
|
+
/** Значение команды: ToggleSidebar — имя открытой боковой панели. */
|
|
130
|
+
queryCommandValue(command: string): string;
|
|
134
131
|
execCommand(command: string, _ui?: boolean, value?: unknown): boolean;
|
|
135
132
|
queryCommandState(command: string): boolean;
|
|
136
133
|
queryCommandSupported(command: string): boolean;
|
|
@@ -199,7 +196,7 @@ declare class CompatEditor {
|
|
|
199
196
|
text: string;
|
|
200
197
|
type?: "info" | "success" | "warning" | "error";
|
|
201
198
|
timeout?: number;
|
|
202
|
-
}) => NotificationHandle;
|
|
199
|
+
}) => _novaprose_core.NotificationHandle;
|
|
203
200
|
close: () => void;
|
|
204
201
|
};
|
|
205
202
|
readonly windowManager: {
|
|
@@ -229,6 +226,23 @@ declare class CompatEditor {
|
|
|
229
226
|
position?: string;
|
|
230
227
|
label?: string;
|
|
231
228
|
}) => void;
|
|
229
|
+
/**
|
|
230
|
+
* Боковая панель: onSetup(api) рисует содержимое в api.element() (один раз), onShow/onHide —
|
|
231
|
+
* при показе. Кнопка-переключатель с именем панели — для toolbar; ToggleSidebar — командой.
|
|
232
|
+
*/
|
|
233
|
+
addSidebar: (name: string, spec: {
|
|
234
|
+
tooltip?: string;
|
|
235
|
+
icon?: string;
|
|
236
|
+
onSetup?: (api: {
|
|
237
|
+
element(): HTMLElement;
|
|
238
|
+
}) => void | (() => void);
|
|
239
|
+
onShow?: (api: {
|
|
240
|
+
element(): HTMLElement;
|
|
241
|
+
}) => void;
|
|
242
|
+
onHide?: (api: {
|
|
243
|
+
element(): HTMLElement;
|
|
244
|
+
}) => void;
|
|
245
|
+
}) => void;
|
|
232
246
|
addContextForm: () => void;
|
|
233
247
|
getAll: () => {};
|
|
234
248
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import { createEditor } from "@novaprose/core";
|
|
2
|
+
import { createEditor, registerHtmlRules } from "@novaprose/core";
|
|
3
|
+
import { htmlRules } from "@novaprose/core/html-rules";
|
|
3
4
|
|
|
4
5
|
// src/options.ts
|
|
5
6
|
import {
|
|
@@ -87,6 +88,9 @@ var IGNORED = /* @__PURE__ */ new Set([
|
|
|
87
88
|
"paste_postprocess",
|
|
88
89
|
"invalid_elements",
|
|
89
90
|
"valid_elements",
|
|
91
|
+
"directionality",
|
|
92
|
+
"extended_valid_elements",
|
|
93
|
+
"custom_elements",
|
|
90
94
|
"valid_styles",
|
|
91
95
|
"toolbar_mode",
|
|
92
96
|
"toolbar_sticky",
|
|
@@ -258,6 +262,11 @@ function mapOptions(config) {
|
|
|
258
262
|
if (typeof config.invalid_elements === "string")
|
|
259
263
|
options.invalidElements = config.invalid_elements;
|
|
260
264
|
if (typeof config.valid_elements === "string") options.validElements = config.valid_elements;
|
|
265
|
+
if (typeof config.extended_valid_elements === "string")
|
|
266
|
+
options.extendedValidElements = config.extended_valid_elements;
|
|
267
|
+
if (typeof config.custom_elements === "string") options.customElements = config.custom_elements;
|
|
268
|
+
if (config.directionality === "rtl" || config.directionality === "ltr")
|
|
269
|
+
options.direction = config.directionality;
|
|
261
270
|
if (config.valid_styles) options.validStyles = config.valid_styles;
|
|
262
271
|
const fonts = parseFormats(config.font_family_formats);
|
|
263
272
|
if (fonts) options.fontFamilies = fonts;
|
|
@@ -853,6 +862,11 @@ var CompatEditor = class {
|
|
|
853
862
|
return this.core.root.ownerDocument.defaultView;
|
|
854
863
|
}
|
|
855
864
|
// ---------- команды ----------
|
|
865
|
+
/** Значение команды: ToggleSidebar — имя открытой боковой панели. */
|
|
866
|
+
queryCommandValue(command) {
|
|
867
|
+
if (command.toLowerCase() === "togglesidebar") return this.core.ui.sidebar.active ?? "";
|
|
868
|
+
return "";
|
|
869
|
+
}
|
|
856
870
|
execCommand(command, _ui, value) {
|
|
857
871
|
const name = command.toLowerCase();
|
|
858
872
|
let done = false;
|
|
@@ -863,6 +877,9 @@ var CompatEditor = class {
|
|
|
863
877
|
} else if (name === "mceinsertcontent" || name === "inserthtml") {
|
|
864
878
|
this.insertContent(String(value ?? ""));
|
|
865
879
|
done = true;
|
|
880
|
+
} else if (name === "togglesidebar") {
|
|
881
|
+
void this.core.ui.sidebar.toggle(String(value ?? ""));
|
|
882
|
+
done = true;
|
|
866
883
|
} else if (name === "mcesetcontent") {
|
|
867
884
|
this.setContent(String(value ?? ""));
|
|
868
885
|
done = true;
|
|
@@ -1149,6 +1166,26 @@ var CompatEditor = class {
|
|
|
1149
1166
|
}
|
|
1150
1167
|
});
|
|
1151
1168
|
},
|
|
1169
|
+
/**
|
|
1170
|
+
* Боковая панель: onSetup(api) рисует содержимое в api.element() (один раз), onShow/onHide —
|
|
1171
|
+
* при показе. Кнопка-переключатель с именем панели — для toolbar; ToggleSidebar — командой.
|
|
1172
|
+
*/
|
|
1173
|
+
addSidebar: (name, spec) => {
|
|
1174
|
+
let element = null;
|
|
1175
|
+
const api = { element: () => element };
|
|
1176
|
+
const icon = resolveIcon(spec.icon);
|
|
1177
|
+
this.core.ui.registry.addSidebar(name, {
|
|
1178
|
+
title: spec.tooltip ?? name,
|
|
1179
|
+
...icon ? { icon } : {},
|
|
1180
|
+
render: (container) => {
|
|
1181
|
+
element = container;
|
|
1182
|
+
const cleanup = spec.onSetup?.(api);
|
|
1183
|
+
return typeof cleanup === "function" ? cleanup : void 0;
|
|
1184
|
+
},
|
|
1185
|
+
onShow: () => spec.onShow?.(api),
|
|
1186
|
+
onHide: () => spec.onHide?.(api)
|
|
1187
|
+
});
|
|
1188
|
+
},
|
|
1152
1189
|
addContextForm: () => {
|
|
1153
1190
|
console.warn("[nova] tinymce-compat: addContextForm is not supported yet");
|
|
1154
1191
|
},
|
|
@@ -1343,6 +1380,7 @@ function warnOnce(message) {
|
|
|
1343
1380
|
var counter = 0;
|
|
1344
1381
|
var px = (value) => typeof value === "number" ? `${value}px` : String(value);
|
|
1345
1382
|
function createTinymce() {
|
|
1383
|
+
registerHtmlRules(htmlRules);
|
|
1346
1384
|
const all = [];
|
|
1347
1385
|
const plugins = /* @__PURE__ */ new Map();
|
|
1348
1386
|
let active = null;
|