@rg-dev/tinymce-helpers 1.0.9 → 1.0.11
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/index.d.mts +10 -5
- package/index.mjs +5 -0
- package/package.json +1 -1
package/index.d.mts
CHANGED
|
@@ -13,20 +13,25 @@ declare const skinsTable: {
|
|
|
13
13
|
type RemoveIndexSignature<T> = {
|
|
14
14
|
[K in keyof T as string extends K ? never : number extends K ? never : symbol extends K ? never : K]: T[K];
|
|
15
15
|
};
|
|
16
|
-
type
|
|
16
|
+
type RawEditorOptionsExtended = RawEditorOptions & {
|
|
17
|
+
quickbars_insert_toolbar?: string;
|
|
18
|
+
quickbars_selection_toolbar?: string;
|
|
19
|
+
};
|
|
20
|
+
type MyTinymceOpts = {
|
|
17
21
|
skin?: keyof typeof skinsTable;
|
|
18
22
|
direction?: 'rtl' | 'ltr';
|
|
19
23
|
customSetup?: (editor: Editor) => void;
|
|
20
24
|
overrides?: (defaultOpts: EditorOpts) => EditorOpts;
|
|
21
25
|
};
|
|
22
|
-
type EditorOpts = Omit<RemoveIndexSignature<
|
|
26
|
+
type EditorOpts = Omit<RemoveIndexSignature<RawEditorOptionsExtended>, 'setup' | 'target' | 'selector'> & Record<string, unknown>;
|
|
23
27
|
declare class tinymceHelpers {
|
|
24
28
|
private _editor;
|
|
25
29
|
private _lockButton?;
|
|
26
30
|
private originalContextMenu;
|
|
27
31
|
private constructor();
|
|
28
|
-
static initMce(el: HTMLElement, customOpts?:
|
|
29
|
-
|
|
32
|
+
static initMce(el: HTMLElement, customOpts?: MyTinymceOpts): Promise<tinymceHelpers>;
|
|
33
|
+
addImg(src: string): void;
|
|
34
|
+
_initMce(el: HTMLElement, customOpts?: MyTinymceOpts): Promise<this>;
|
|
30
35
|
private setContextMenu;
|
|
31
36
|
toggleReadOnly(lock?: 'yes' | 'no'): void;
|
|
32
37
|
isEditable(): boolean;
|
|
@@ -42,4 +47,4 @@ declare class tinymceHelpers {
|
|
|
42
47
|
destroy(): void;
|
|
43
48
|
}
|
|
44
49
|
|
|
45
|
-
export { tinymceHelpers };
|
|
50
|
+
export { type MyTinymceOpts, tinymceHelpers };
|
package/index.mjs
CHANGED
|
@@ -114,6 +114,9 @@ var tinymceHelpers = class _tinymceHelpers {
|
|
|
114
114
|
static async initMce(el, customOpts = Object()) {
|
|
115
115
|
return await new _tinymceHelpers()._initMce(el, customOpts);
|
|
116
116
|
}
|
|
117
|
+
addImg(src) {
|
|
118
|
+
this.editor.insertContent(`<img src="${src}" alt="">`);
|
|
119
|
+
}
|
|
117
120
|
async _initMce(el, customOpts = Object()) {
|
|
118
121
|
var _a, _b;
|
|
119
122
|
if (!(el instanceof HTMLElement)) {
|
|
@@ -335,6 +338,7 @@ var tinymceHelpers = class _tinymceHelpers {
|
|
|
335
338
|
extended_valid_elements: "img[drawio-diagram|contenteditable|style|class|src]",
|
|
336
339
|
font_family_formats: "Rubik=Rubik, Helvetica, Arial, sans-serif; Andale Mono=andale mono,times; Arial=arial,helvetica,sans-serif; Arial Black=arial black,avant garde; Book Antiqua=book antiqua,palatino; Comic Sans MS=comic sans ms,sans-serif; Courier New=courier new,courier; Georgia=georgia,palatino; Helvetica=helvetica; Impact=impact,chicago; Symbol=symbol; Tahoma=tahoma,arial,helvetica,sans-serif; Terminal=terminal,monaco; Times New Roman=times new roman,times; Trebuchet MS=trebuchet ms,geneva; Verdana=verdana,geneva; Webdings=webdings; Wingdings=wingdings,zapf dingbats; Afacad=afacad,sans-serif; Marcellus=marcellus,serif; Poppins=poppins,sans-serif; Raleway=raleway,sans-serif;",
|
|
337
340
|
"statusbar": false,
|
|
341
|
+
quickbars_insert_toolbar: "",
|
|
338
342
|
skin: theSkin.skin,
|
|
339
343
|
highlight_on_focus: false,
|
|
340
344
|
content_style: theSkin.css,
|
|
@@ -381,6 +385,7 @@ var tinymceHelpers = class _tinymceHelpers {
|
|
|
381
385
|
const mce = this._editor = await tinymce.init(opts).then((x) => x[0]);
|
|
382
386
|
this.originalContextMenu = mce.options.get("contextmenu");
|
|
383
387
|
const all = mce.ui.registry.getAll();
|
|
388
|
+
console.log(all);
|
|
384
389
|
const availableMenuItems = all.menuItems;
|
|
385
390
|
const availableButtons = all.buttons;
|
|
386
391
|
if (typeof opts.toolbar == "string") {
|