@richscripts/richtexteditor 2.4.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 +360 -0
- package/admin/index.d.ts +100 -0
- package/admin/index.js +94 -0
- package/angular/component.ts +284 -0
- package/angular/index.d.ts +80 -0
- package/angular/index.ts +24 -0
- package/headless/index.d.ts +65 -0
- package/headless/index.js +272 -0
- package/index.d.ts +1412 -0
- package/integrations/shared.d.ts +138 -0
- package/integrations/shared.js +5182 -0
- package/package.json +130 -0
- package/react/index.d.ts +104 -0
- package/react/index.js +310 -0
- package/richtexteditor/CHANGELOG.md +1876 -0
- package/richtexteditor/all_plugins.js +31125 -0
- package/richtexteditor/all_plugins.min.js +78 -0
- package/richtexteditor/lang/rte-lang-af.js +193 -0
- package/richtexteditor/lang/rte-lang-ar.js +193 -0
- package/richtexteditor/lang/rte-lang-bg.js +193 -0
- package/richtexteditor/lang/rte-lang-bn.js +193 -0
- package/richtexteditor/lang/rte-lang-bs.js +193 -0
- package/richtexteditor/lang/rte-lang-ca.js +193 -0
- package/richtexteditor/lang/rte-lang-cs.js +193 -0
- package/richtexteditor/lang/rte-lang-cy.js +193 -0
- package/richtexteditor/lang/rte-lang-da.js +193 -0
- package/richtexteditor/lang/rte-lang-de.js +193 -0
- package/richtexteditor/lang/rte-lang-el.js +193 -0
- package/richtexteditor/lang/rte-lang-en.js +6 -0
- package/richtexteditor/lang/rte-lang-es.js +193 -0
- package/richtexteditor/lang/rte-lang-et.js +193 -0
- package/richtexteditor/lang/rte-lang-fa.js +193 -0
- package/richtexteditor/lang/rte-lang-fi.js +193 -0
- package/richtexteditor/lang/rte-lang-fil.js +193 -0
- package/richtexteditor/lang/rte-lang-fj.js +193 -0
- package/richtexteditor/lang/rte-lang-fr.js +193 -0
- package/richtexteditor/lang/rte-lang-ga.js +193 -0
- package/richtexteditor/lang/rte-lang-gu.js +193 -0
- package/richtexteditor/lang/rte-lang-he.js +193 -0
- package/richtexteditor/lang/rte-lang-hi.js +193 -0
- package/richtexteditor/lang/rte-lang-hr.js +193 -0
- package/richtexteditor/lang/rte-lang-ht.js +193 -0
- package/richtexteditor/lang/rte-lang-hu.js +193 -0
- package/richtexteditor/lang/rte-lang-id.js +193 -0
- package/richtexteditor/lang/rte-lang-is.js +193 -0
- package/richtexteditor/lang/rte-lang-it.js +193 -0
- package/richtexteditor/lang/rte-lang-ja.js +193 -0
- package/richtexteditor/lang/rte-lang-kn.js +193 -0
- package/richtexteditor/lang/rte-lang-ko.js +193 -0
- package/richtexteditor/lang/rte-lang-lt.js +193 -0
- package/richtexteditor/lang/rte-lang-lv.js +193 -0
- package/richtexteditor/lang/rte-lang-mg.js +193 -0
- package/richtexteditor/lang/rte-lang-mi.js +193 -0
- package/richtexteditor/lang/rte-lang-ml.js +193 -0
- package/richtexteditor/lang/rte-lang-mr.js +193 -0
- package/richtexteditor/lang/rte-lang-ms.js +193 -0
- package/richtexteditor/lang/rte-lang-mt.js +193 -0
- package/richtexteditor/lang/rte-lang-mww.js +193 -0
- package/richtexteditor/lang/rte-lang-nb.js +193 -0
- package/richtexteditor/lang/rte-lang-nl.js +193 -0
- package/richtexteditor/lang/rte-lang-otq.js +193 -0
- package/richtexteditor/lang/rte-lang-pa.js +193 -0
- package/richtexteditor/lang/rte-lang-pl.js +193 -0
- package/richtexteditor/lang/rte-lang-pt-pt.js +193 -0
- package/richtexteditor/lang/rte-lang-pt.js +193 -0
- package/richtexteditor/lang/rte-lang-ro.js +193 -0
- package/richtexteditor/lang/rte-lang-ru.js +193 -0
- package/richtexteditor/lang/rte-lang-sk.js +193 -0
- package/richtexteditor/lang/rte-lang-sl.js +193 -0
- package/richtexteditor/lang/rte-lang-sm.js +193 -0
- package/richtexteditor/lang/rte-lang-sr-Cyrl.js +193 -0
- package/richtexteditor/lang/rte-lang-sr-Latn.js +193 -0
- package/richtexteditor/lang/rte-lang-sv.js +193 -0
- package/richtexteditor/lang/rte-lang-sw.js +193 -0
- package/richtexteditor/lang/rte-lang-ta.js +193 -0
- package/richtexteditor/lang/rte-lang-te.js +193 -0
- package/richtexteditor/lang/rte-lang-th.js +193 -0
- package/richtexteditor/lang/rte-lang-tlh-Latn.js +193 -0
- package/richtexteditor/lang/rte-lang-tlh-Piqd.js +193 -0
- package/richtexteditor/lang/rte-lang-to.js +193 -0
- package/richtexteditor/lang/rte-lang-tr.js +193 -0
- package/richtexteditor/lang/rte-lang-ty.js +193 -0
- package/richtexteditor/lang/rte-lang-uk.js +193 -0
- package/richtexteditor/lang/rte-lang-ur.js +193 -0
- package/richtexteditor/lang/rte-lang-vi.js +193 -0
- package/richtexteditor/lang/rte-lang-yua.js +193 -0
- package/richtexteditor/lang/rte-lang-zh-Hans.js +193 -0
- package/richtexteditor/lang/rte-lang-zh-Hant.js +193 -0
- package/richtexteditor/lang/rte-lang.js +1 -0
- package/richtexteditor/plugins/-combine-plugin.txt +2 -0
- package/richtexteditor/plugins/-combine-plugins.bat +20 -0
- package/richtexteditor/plugins/a11yenhance.js +90 -0
- package/richtexteditor/plugins/accessibilitychecker.js +579 -0
- package/richtexteditor/plugins/aitoolkit.css +15830 -0
- package/richtexteditor/plugins/aitoolkit.js +19171 -0
- package/richtexteditor/plugins/all_plugins.js +31125 -0
- package/richtexteditor/plugins/all_plugins.min.js +78 -0
- package/richtexteditor/plugins/autoembed.js +174 -0
- package/richtexteditor/plugins/blocktypes.js +175 -0
- package/richtexteditor/plugins/bookmarkcard.js +226 -0
- package/richtexteditor/plugins/charlimit.js +195 -0
- package/richtexteditor/plugins/comments.js +672 -0
- package/richtexteditor/plugins/contentminimap.js +369 -0
- package/richtexteditor/plugins/crdt-engine.js +8905 -0
- package/richtexteditor/plugins/crdt-engine.min.js +5 -0
- package/richtexteditor/plugins/dialoga11y.js +174 -0
- package/richtexteditor/plugins/dictation.js +268 -0
- package/richtexteditor/plugins/documentimport.js +369 -0
- package/richtexteditor/plugins/documentoutline.js +341 -0
- package/richtexteditor/plugins/emailtoolkit.js +165 -0
- package/richtexteditor/plugins/emojiautocomplete.js +241 -0
- package/richtexteditor/plugins/foldheadings.js +181 -0
- package/richtexteditor/plugins/ghostcomplete.js +297 -0
- package/richtexteditor/plugins/html2pdf.js +158 -0
- package/richtexteditor/plugins/imageeditor.js +159 -0
- package/richtexteditor/plugins/insertcode.js +319 -0
- package/richtexteditor/plugins/insertemoji.js +229 -0
- package/richtexteditor/plugins/insertgallery.js +362 -0
- package/richtexteditor/plugins/inserttemplate.js +261 -0
- package/richtexteditor/plugins/localdraft.js +213 -0
- package/richtexteditor/plugins/markdownexport.js +110 -0
- package/richtexteditor/plugins/mathdialog.js +153 -0
- package/richtexteditor/plugins/mentionplugin.js +534 -0
- package/richtexteditor/plugins/mermaiddiagram.js +294 -0
- package/richtexteditor/plugins/readabilitystats.js +148 -0
- package/richtexteditor/plugins/readaloud.js +243 -0
- package/richtexteditor/plugins/restrictedediting.js +208 -0
- package/richtexteditor/plugins/revisionhistory.js +670 -0
- package/richtexteditor/plugins/samples/insertcode_v1.js +76 -0
- package/richtexteditor/plugins/slashcommand.js +705 -0
- package/richtexteditor/plugins/smartchips.js +250 -0
- package/richtexteditor/plugins/spellcheck.js +181 -0
- package/richtexteditor/plugins/todolist.js +137 -0
- package/richtexteditor/plugins/trackedchanges.js +658 -0
- package/richtexteditor/plugins/tui.image-editor/fabric.min.js +8 -0
- package/richtexteditor/plugins/tui.image-editor/note.txt +5 -0
- package/richtexteditor/plugins/tui.image-editor/svg/icon-a.svg +235 -0
- package/richtexteditor/plugins/tui.image-editor/svg/icon-b.svg +224 -0
- package/richtexteditor/plugins/tui.image-editor/svg/icon-c.svg +224 -0
- package/richtexteditor/plugins/tui.image-editor/svg/icon-d.svg +224 -0
- package/richtexteditor/plugins/tui.image-editor/tui-code-snippet.min.js +7 -0
- package/richtexteditor/plugins/tui.image-editor/tui-color-picker.min.css +6 -0
- package/richtexteditor/plugins/tui.image-editor/tui-color-picker.min.js +7 -0
- package/richtexteditor/plugins/tui.image-editor/tui-image-editor.min.css +7 -0
- package/richtexteditor/plugins/tui.image-editor/tui-image-editor.min.js +15 -0
- package/richtexteditor/plugins/typewriter.js +203 -0
- package/richtexteditor/plugins/wordexport.js +0 -0
- package/richtexteditor/plugins/yjscollab.js +693 -0
- package/richtexteditor/plugins/zz_richtextbox_dialog_style.js +335 -0
- package/richtexteditor/rte-config.js +933 -0
- package/richtexteditor/rte.js +943 -0
- package/richtexteditor/rte_mobile.css +234 -0
- package/richtexteditor/rte_theme_default.css +4819 -0
- package/richtexteditor/runtime/colorpicker_more_ns.htm +2613 -0
- package/richtexteditor/runtime/help.htm +162 -0
- package/richtexteditor/runtime/images/1x1.gif +0 -0
- package/richtexteditor/runtime/images/cpie_Color.cur +0 -0
- package/richtexteditor/runtime/images/cpie_GradientPositionDark.gif +0 -0
- package/richtexteditor/runtime/images/cpie_GradientPositionLight.gif +0 -0
- package/richtexteditor/runtime/images/cpie_VerticalPosition.gif +0 -0
- package/richtexteditor/runtime/images/cpie_WebSafe.gif +0 -0
- package/richtexteditor/runtime/images/cpie_gradients.png +0 -0
- package/richtexteditor/runtime/images/cpns_Color.cur +0 -0
- package/richtexteditor/runtime/images/cpns_ColorSpace1.png +0 -0
- package/richtexteditor/runtime/images/cpns_ColorSpace2.png +0 -0
- package/richtexteditor/runtime/images/cpns_GradientPositionDark.gif +0 -0
- package/richtexteditor/runtime/images/cpns_GradientPositionLight.gif +0 -0
- package/richtexteditor/runtime/images/cpns_Vertical1.png +0 -0
- package/richtexteditor/runtime/images/cpns_Vertical2.png +0 -0
- package/richtexteditor/runtime/images/cpns_VerticalPosition.gif +0 -0
- package/richtexteditor/runtime/images/cpns_WebSafe.gif +0 -0
- package/richtexteditor/runtime/images/cpns_gradients.png +0 -0
- package/richtexteditor/runtime/images/cpns_hue2.png +0 -0
- package/richtexteditor/runtime/images/formbn.gif +0 -0
- package/richtexteditor/runtime/images/multiclavier.gif +0 -0
- package/richtexteditor/runtime/richtexteditor_content.css +362 -0
- package/richtexteditor/runtime/richtexteditor_preview.css +302 -0
- package/richtexteditor/runtime/richtexteditor_preview.js +1 -0
- package/server/index.d.ts +21 -0
- package/server/index.js +23 -0
- package/svelte/index.d.ts +19 -0
- package/svelte/index.js +59 -0
- package/vue/index.d.ts +94 -0
- package/vue/index.js +291 -0
package/vue/index.js
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
var vue = require("vue");
|
|
2
|
+
var shared = require("../integrations/shared");
|
|
3
|
+
var headless = require("../headless");
|
|
4
|
+
|
|
5
|
+
function editorMethodAccessor(editorRef, name, emptyValue) {
|
|
6
|
+
return function () {
|
|
7
|
+
var ed = editorRef.value;
|
|
8
|
+
if (!ed || typeof ed[name] !== "function") {
|
|
9
|
+
return emptyValue;
|
|
10
|
+
}
|
|
11
|
+
return ed[name].apply(ed, arguments);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
var RichTextEditorVue = vue.defineComponent({
|
|
16
|
+
name: "RichTextEditorVue",
|
|
17
|
+
inheritAttrs: false,
|
|
18
|
+
props: {
|
|
19
|
+
assetBasePath: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "/richtexteditor"
|
|
22
|
+
},
|
|
23
|
+
autoload: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: true
|
|
26
|
+
},
|
|
27
|
+
config: {
|
|
28
|
+
type: Object,
|
|
29
|
+
default: function () {
|
|
30
|
+
return {};
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
defaultValue: {
|
|
34
|
+
type: [String, Object],
|
|
35
|
+
default: undefined
|
|
36
|
+
},
|
|
37
|
+
modelValue: {
|
|
38
|
+
type: [String, Object],
|
|
39
|
+
default: undefined
|
|
40
|
+
},
|
|
41
|
+
tagName: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: "div"
|
|
44
|
+
},
|
|
45
|
+
valueFormat: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: "html"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
emits: ["change", "error", "ready", "update:modelValue"],
|
|
51
|
+
setup: function (props, context) {
|
|
52
|
+
var hostRef = vue.ref(null);
|
|
53
|
+
var editorRef = vue.ref(null);
|
|
54
|
+
var changeHandler = null;
|
|
55
|
+
|
|
56
|
+
function syncEditor(nextValue) {
|
|
57
|
+
if (!editorRef.value) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
var nextHtml = shared.normalizeStructuredContent(nextValue);
|
|
62
|
+
if (editorRef.value.getHTMLCode() !== nextHtml) {
|
|
63
|
+
shared.setEditorValue(editorRef.value, nextValue, props.valueFormat);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
vue.onMounted(async function () {
|
|
68
|
+
try {
|
|
69
|
+
if (props.autoload === false) {
|
|
70
|
+
shared.installStructuredContentBridge();
|
|
71
|
+
} else {
|
|
72
|
+
await shared.loadRichTextEditorAssets({ basePath: props.assetBasePath });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (!hostRef.value) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
var editor = shared.createEditor(hostRef.value, props.config || {});
|
|
80
|
+
editorRef.value = editor;
|
|
81
|
+
|
|
82
|
+
var initialValue = props.modelValue !== undefined ? props.modelValue : props.defaultValue;
|
|
83
|
+
if (initialValue !== undefined) {
|
|
84
|
+
shared.setEditorValue(editor, initialValue, props.valueFormat);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
changeHandler = function () {
|
|
88
|
+
var nextValue = shared.getEditorValue(editor, props.valueFormat);
|
|
89
|
+
context.emit("update:modelValue", nextValue);
|
|
90
|
+
context.emit("change", nextValue, editor);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
editor.attachEvent("change", changeHandler);
|
|
94
|
+
context.emit("ready", editor);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
context.emit("error", error);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
vue.watch(function () {
|
|
101
|
+
return props.modelValue;
|
|
102
|
+
}, function (nextValue) {
|
|
103
|
+
if (props.modelValue === undefined) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
syncEditor(nextValue);
|
|
108
|
+
}, { deep: true });
|
|
109
|
+
|
|
110
|
+
vue.watch(function () {
|
|
111
|
+
return props.valueFormat;
|
|
112
|
+
}, function () {
|
|
113
|
+
if (props.modelValue === undefined) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
syncEditor(props.modelValue);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
vue.onBeforeUnmount(function () {
|
|
121
|
+
var ed = editorRef.value;
|
|
122
|
+
if (ed) {
|
|
123
|
+
if (changeHandler && typeof ed.detachEvent === "function") {
|
|
124
|
+
ed.detachEvent("change", changeHandler);
|
|
125
|
+
}
|
|
126
|
+
if (typeof ed.destroy === "function") {
|
|
127
|
+
try { ed.destroy(); } catch (e) { /* ignore */ }
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (hostRef.value) {
|
|
132
|
+
hostRef.value.innerHTML = "";
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
editorRef.value = null;
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
function pluginAccessor(name) {
|
|
139
|
+
return function () {
|
|
140
|
+
var ed = editorRef.value;
|
|
141
|
+
if (!ed) return null;
|
|
142
|
+
return ed[name];
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
context.expose({
|
|
147
|
+
getEditor: function () {
|
|
148
|
+
return editorRef.value;
|
|
149
|
+
},
|
|
150
|
+
focus: function () {
|
|
151
|
+
if (editorRef.value) {
|
|
152
|
+
editorRef.value.focus();
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
getHTMLCode: function () {
|
|
156
|
+
return editorRef.value ? editorRef.value.getHTMLCode() : "";
|
|
157
|
+
},
|
|
158
|
+
setHTMLCode: function (value) {
|
|
159
|
+
if (editorRef.value) {
|
|
160
|
+
editorRef.value.setHTMLCode(value || "");
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
getJSON: function () {
|
|
164
|
+
return editorRef.value ? editorRef.value.getJSON() : null;
|
|
165
|
+
},
|
|
166
|
+
setJSON: function (value) {
|
|
167
|
+
if (editorRef.value) {
|
|
168
|
+
editorRef.value.setJSON(value);
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
getTextStatistics: editorMethodAccessor(editorRef, "getTextStatistics", null),
|
|
172
|
+
getSelectionStatistics: editorMethodAccessor(editorRef, "getSelectionStatistics", null),
|
|
173
|
+
getDocumentMetrics: editorMethodAccessor(editorRef, "getDocumentMetrics", null),
|
|
174
|
+
getDocumentPageSetup: editorMethodAccessor(editorRef, "getDocumentPageSetup", null),
|
|
175
|
+
setDocumentPageSetup: editorMethodAccessor(editorRef, "setDocumentPageSetup", null),
|
|
176
|
+
getDocumentOutline: function () {
|
|
177
|
+
if (!editorRef.value) {
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
180
|
+
return shared.getDocumentOutline(editorRef.value.getJSON());
|
|
181
|
+
},
|
|
182
|
+
getFootnotes: function () {
|
|
183
|
+
if (!editorRef.value) {
|
|
184
|
+
return [];
|
|
185
|
+
}
|
|
186
|
+
return shared.getFootnotes(editorRef.value.getJSON());
|
|
187
|
+
},
|
|
188
|
+
getTableOfContents: function (options) {
|
|
189
|
+
if (!editorRef.value) {
|
|
190
|
+
return [];
|
|
191
|
+
}
|
|
192
|
+
return shared.getTableOfContents(editorRef.value.getJSON(), options);
|
|
193
|
+
},
|
|
194
|
+
syncTableOfContents: function (options) {
|
|
195
|
+
if (!editorRef.value) {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
var documentModel = shared.syncTableOfContents(editorRef.value.getJSON(), options);
|
|
199
|
+
editorRef.value.setJSON(documentModel);
|
|
200
|
+
return documentModel;
|
|
201
|
+
},
|
|
202
|
+
auditAccessibility: function () {
|
|
203
|
+
if (!editorRef.value) {
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
return shared.auditAccessibility(editorRef.value.getJSON());
|
|
207
|
+
},
|
|
208
|
+
auditLinks: function (options) {
|
|
209
|
+
if (!editorRef.value) {
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
return shared.auditLinks(editorRef.value.getJSON(), options);
|
|
213
|
+
},
|
|
214
|
+
// v2.0 plugin convenience accessors. Each returns the underlying
|
|
215
|
+
// namespace, or `undefined` when the plugin isn't bundled.
|
|
216
|
+
getAiToolkit: pluginAccessor("aiToolkit"),
|
|
217
|
+
getDictation: pluginAccessor("dictation"),
|
|
218
|
+
getRevisionHistory: pluginAccessor("revisionHistory"),
|
|
219
|
+
getCollab: pluginAccessor("collab"),
|
|
220
|
+
getSlashCommands: pluginAccessor("slashCommands"),
|
|
221
|
+
getMentions: pluginAccessor("mentions"),
|
|
222
|
+
getComments: pluginAccessor("comments"),
|
|
223
|
+
getReviewLedger: pluginAccessor("reviewLedger")
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
return function () {
|
|
227
|
+
return vue.h(props.tagName, Object.assign({}, context.attrs, { ref: hostRef }));
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
// ---- Headless composable: bring-your-own-UI, Tiptap-style ----
|
|
233
|
+
// const { mountRef, editor, state } = useRichTextEditor({ value: "<p>Hi</p>" });
|
|
234
|
+
// <template>
|
|
235
|
+
// <button @mousedown.prevent="state.bold && 0; editor && editor.run('bold')"
|
|
236
|
+
// :class="{ 'is-active': state.bold }">B</button>
|
|
237
|
+
// <div ref="mountRef"></div>
|
|
238
|
+
// </template>
|
|
239
|
+
function useRichTextEditor(options) {
|
|
240
|
+
options = options || {};
|
|
241
|
+
var mountRef = vue.ref(null);
|
|
242
|
+
var editor = vue.shallowRef(null);
|
|
243
|
+
var state = vue.ref({});
|
|
244
|
+
var controller = null;
|
|
245
|
+
|
|
246
|
+
vue.onMounted(function () {
|
|
247
|
+
headless.createHeadlessEditor(mountRef.value, options)
|
|
248
|
+
.then(function (ctl) {
|
|
249
|
+
controller = ctl;
|
|
250
|
+
editor.value = ctl;
|
|
251
|
+
state.value = ctl.state();
|
|
252
|
+
ctl.on("update", function (snapshot) { state.value = snapshot; });
|
|
253
|
+
if (options.onReady) { options.onReady(ctl); }
|
|
254
|
+
})
|
|
255
|
+
.catch(function (error) {
|
|
256
|
+
if (options.onError) { options.onError(error); }
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
vue.onBeforeUnmount(function () {
|
|
261
|
+
if (controller) { controller.destroy(); }
|
|
262
|
+
controller = null;
|
|
263
|
+
editor.value = null;
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
return { mountRef: mountRef, editor: editor, state: state };
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
module.exports = {
|
|
270
|
+
auditAccessibility: shared.auditAccessibility,
|
|
271
|
+
auditLinks: shared.auditLinks,
|
|
272
|
+
createStructuredDocument: shared.createStructuredDocument,
|
|
273
|
+
RichTextEditor: RichTextEditorVue,
|
|
274
|
+
RichTextEditorVue: RichTextEditorVue,
|
|
275
|
+
useRichTextEditor: useRichTextEditor,
|
|
276
|
+
createHeadlessEditor: headless.createHeadlessEditor,
|
|
277
|
+
createStructuredContent: shared.createStructuredContent,
|
|
278
|
+
fromMarkdown: shared.fromMarkdown,
|
|
279
|
+
getDocumentPageSetup: shared.getDocumentPageSetup,
|
|
280
|
+
getDocumentMetrics: shared.getDocumentMetrics,
|
|
281
|
+
getDocumentOutline: shared.getDocumentOutline,
|
|
282
|
+
getFootnotes: shared.getFootnotes,
|
|
283
|
+
getTableOfContents: shared.getTableOfContents,
|
|
284
|
+
getTextStatistics: shared.getTextStatistics,
|
|
285
|
+
loadRichTextEditorAssets: shared.loadRichTextEditorAssets,
|
|
286
|
+
renderHTML: shared.renderHTML,
|
|
287
|
+
setDocumentPageSetup: shared.setDocumentPageSetup,
|
|
288
|
+
syncTableOfContents: shared.syncTableOfContents,
|
|
289
|
+
toMarkdown: shared.toMarkdown,
|
|
290
|
+
validateStructuredContent: shared.validateStructuredContent
|
|
291
|
+
};
|