@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
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
RTE_DefaultConfig.plugin_zz_richtextbox_dialog_style = RTE_Plugin_RichTextBoxDialogStyle;
|
|
2
|
+
|
|
3
|
+
function RTE_Plugin_RichTextBoxDialogStyle() {
|
|
4
|
+
var obj = this;
|
|
5
|
+
|
|
6
|
+
obj.PluginName = "RichTextBoxDialogStyle";
|
|
7
|
+
|
|
8
|
+
obj.InitConfig = function (config) {
|
|
9
|
+
if (!config.imageItems) {
|
|
10
|
+
config.imageItems = [];
|
|
11
|
+
}
|
|
12
|
+
if (!config.galleryImages) {
|
|
13
|
+
config.galleryImages = [];
|
|
14
|
+
}
|
|
15
|
+
if (!config.htmlTemplates) {
|
|
16
|
+
config.htmlTemplates = [];
|
|
17
|
+
}
|
|
18
|
+
if (!config.documentItems) {
|
|
19
|
+
config.documentItems = [];
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
obj.InitEditor = function () {
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
function append(parent, tagName, cssText, className) {
|
|
27
|
+
var tag = parent.ownerDocument.createElement(tagName);
|
|
28
|
+
if (cssText) {
|
|
29
|
+
tag.style.cssText = cssText;
|
|
30
|
+
}
|
|
31
|
+
if (className) {
|
|
32
|
+
tag.className = className;
|
|
33
|
+
}
|
|
34
|
+
parent.appendChild(tag);
|
|
35
|
+
return tag;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getUrlValue(input) {
|
|
39
|
+
return input && input.value ? input.value.replace(/^\s+|\s+$/g, "") : "";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function getUrlHost(value) {
|
|
43
|
+
try {
|
|
44
|
+
return new URL(value, window.location.href).hostname || "";
|
|
45
|
+
} catch (ex) {
|
|
46
|
+
return "";
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function getUrlFileName(value) {
|
|
51
|
+
var clean = String(value || "").split("#")[0].split("?")[0];
|
|
52
|
+
var slash = clean.lastIndexOf("/");
|
|
53
|
+
var fileName = slash >= 0 ? clean.substring(slash + 1) : clean;
|
|
54
|
+
try {
|
|
55
|
+
fileName = decodeURIComponent(fileName);
|
|
56
|
+
} catch (ex) {
|
|
57
|
+
}
|
|
58
|
+
return fileName || "";
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function getExtension(value) {
|
|
62
|
+
var fileName = getUrlFileName(value);
|
|
63
|
+
var dot = fileName.lastIndexOf(".");
|
|
64
|
+
if (dot < 0) {
|
|
65
|
+
return "LINK";
|
|
66
|
+
}
|
|
67
|
+
return fileName.substring(dot + 1).toUpperCase().substring(0, 4);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function ensureUploadIntro(panel, className, message) {
|
|
71
|
+
if (!panel || panel.querySelector("." + className)) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
var intro = append(panel, "div", "", className);
|
|
75
|
+
intro.innerText = message;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function bindInput(input, handler, flagName) {
|
|
79
|
+
if (input[flagName]) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (input.addEventListener) {
|
|
84
|
+
input.addEventListener("input", handler);
|
|
85
|
+
} else {
|
|
86
|
+
input.onkeyup = handler;
|
|
87
|
+
input.onchange = handler;
|
|
88
|
+
input.onpaste = handler;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
input[flagName] = true;
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function ensureImagePreview(panel, urlLine) {
|
|
96
|
+
if (!panel || !urlLine) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
var input = urlLine.querySelector("input[type='text']");
|
|
101
|
+
if (!input) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (!input.placeholder) {
|
|
106
|
+
input.placeholder = "https://example.com/image.jpg";
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
var preview = panel.querySelector(".rte-insertimage-preview");
|
|
110
|
+
if (!preview) {
|
|
111
|
+
preview = append(panel, "div", "", "rte-insertimage-preview is-empty");
|
|
112
|
+
var image = append(preview, "img", "", "rte-insertimage-preview-image");
|
|
113
|
+
image.alt = "Image preview";
|
|
114
|
+
append(preview, "div", "", "rte-insertimage-preview-caption");
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (input.__rteRichTextBoxImagePreviewBound) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
var previewImage = preview.querySelector(".rte-insertimage-preview-image");
|
|
122
|
+
var previewCaption = preview.querySelector(".rte-insertimage-preview-caption");
|
|
123
|
+
|
|
124
|
+
function updatePreview() {
|
|
125
|
+
var value = getUrlValue(input);
|
|
126
|
+
if (!value) {
|
|
127
|
+
preview.classList.add("is-empty");
|
|
128
|
+
preview.classList.remove("is-error");
|
|
129
|
+
previewImage.removeAttribute("src");
|
|
130
|
+
previewCaption.innerText = "Enter an image URL to preview it here.";
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
preview.classList.remove("is-empty");
|
|
135
|
+
preview.classList.remove("is-error");
|
|
136
|
+
previewCaption.innerText = "Loading preview...";
|
|
137
|
+
previewImage.src = value;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
previewImage.onload = function () {
|
|
141
|
+
preview.classList.remove("is-empty");
|
|
142
|
+
preview.classList.remove("is-error");
|
|
143
|
+
previewCaption.innerText = "Ready to insert this image.";
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
previewImage.onerror = function () {
|
|
147
|
+
preview.classList.remove("is-empty");
|
|
148
|
+
preview.classList.add("is-error");
|
|
149
|
+
previewCaption.innerText = "Preview unavailable for this URL.";
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
bindInput(input, updatePreview, "__rteRichTextBoxImagePreviewBound");
|
|
153
|
+
updatePreview();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function ensureDocumentPreview(panel, urlLine) {
|
|
157
|
+
if (!panel || !urlLine) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
var input = urlLine.querySelector("input[type='text']");
|
|
162
|
+
if (!input) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (!input.placeholder) {
|
|
167
|
+
input.placeholder = "https://example.com/files/proposal.pdf";
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
var preview = panel.querySelector(".rte-insertdocument-preview");
|
|
171
|
+
if (!preview) {
|
|
172
|
+
preview = append(panel, "div", "", "rte-insertdocument-preview is-empty");
|
|
173
|
+
var icon = append(preview, "div", "", "rte-insertdocument-preview-icon");
|
|
174
|
+
append(icon, "div", "", "rte-insertdocument-preview-ext");
|
|
175
|
+
var body = append(preview, "div", "", "rte-insertdocument-preview-body");
|
|
176
|
+
append(body, "div", "", "rte-insertdocument-preview-title");
|
|
177
|
+
append(body, "div", "", "rte-insertdocument-preview-meta");
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (input.__rteRichTextBoxDocumentPreviewBound) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
var ext = preview.querySelector(".rte-insertdocument-preview-ext");
|
|
185
|
+
var title = preview.querySelector(".rte-insertdocument-preview-title");
|
|
186
|
+
var meta = preview.querySelector(".rte-insertdocument-preview-meta");
|
|
187
|
+
|
|
188
|
+
function updatePreview() {
|
|
189
|
+
var value = getUrlValue(input);
|
|
190
|
+
if (!value) {
|
|
191
|
+
preview.classList.add("is-empty");
|
|
192
|
+
ext.innerText = "DOC";
|
|
193
|
+
title.innerText = "No document selected";
|
|
194
|
+
meta.innerText = "Enter a document URL to preview the inserted link.";
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
preview.classList.remove("is-empty");
|
|
199
|
+
ext.innerText = getExtension(value);
|
|
200
|
+
title.innerText = getUrlFileName(value) || value;
|
|
201
|
+
|
|
202
|
+
var host = getUrlHost(value);
|
|
203
|
+
meta.innerText = host
|
|
204
|
+
? ("Source: " + host + " | The editor inserts a clickable link.")
|
|
205
|
+
: "The editor inserts a clickable link at the current cursor position.";
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
bindInput(input, updatePreview, "__rteRichTextBoxDocumentPreviewBound");
|
|
209
|
+
updatePreview();
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function enhanceInsertImagePanels(root) {
|
|
213
|
+
var panels = [];
|
|
214
|
+
var i;
|
|
215
|
+
|
|
216
|
+
if (root.classList && root.classList.contains("rte-panel-insertimage")) {
|
|
217
|
+
panels.push(root);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (root.querySelectorAll) {
|
|
221
|
+
var nested = root.querySelectorAll(".rte-panel-insertimage");
|
|
222
|
+
for (i = 0; i < nested.length; i++) {
|
|
223
|
+
panels.push(nested[i]);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
for (i = 0; i < panels.length; i++) {
|
|
228
|
+
var panel = panels[i];
|
|
229
|
+
panel.classList.add("rte-richtextbox-dialog");
|
|
230
|
+
|
|
231
|
+
var uploadTab = panel.querySelector(".fileuploader-dragdrop");
|
|
232
|
+
if (uploadTab) {
|
|
233
|
+
ensureUploadIntro(uploadTab, "rte-insertimage-intro", "Drop an image here or click anywhere in this panel to browse.");
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
var urlTab = panel.querySelector(".rte_insertimage_byurl");
|
|
237
|
+
if (urlTab) {
|
|
238
|
+
ensureUploadIntro(urlTab, "rte-insertimage-intro", "Paste a hosted image URL and verify the preview before inserting.");
|
|
239
|
+
ensureImagePreview(urlTab, urlTab.querySelector(".rte-dialog-line-url"));
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
var actionButton = panel.querySelector(".rte-dialog-line-action .rte-dialog-button");
|
|
243
|
+
if (actionButton && actionButton.innerText === "Insert") {
|
|
244
|
+
actionButton.innerText = "Insert image";
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function enhanceInsertDocumentPanels(root) {
|
|
250
|
+
var panels = [];
|
|
251
|
+
var i;
|
|
252
|
+
|
|
253
|
+
if (root.classList && root.classList.contains("rte-panel-insertdocument")) {
|
|
254
|
+
panels.push(root);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (root.querySelectorAll) {
|
|
258
|
+
var nested = root.querySelectorAll(".rte-panel-insertdocument");
|
|
259
|
+
for (i = 0; i < nested.length; i++) {
|
|
260
|
+
panels.push(nested[i]);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
for (i = 0; i < panels.length; i++) {
|
|
265
|
+
var panel = panels[i];
|
|
266
|
+
panel.classList.add("rte-richtextbox-dialog");
|
|
267
|
+
|
|
268
|
+
var uploadTab = panel.querySelector(".fileuploader-dragdrop");
|
|
269
|
+
if (uploadTab) {
|
|
270
|
+
ensureUploadIntro(uploadTab, "rte-insertdocument-intro", "Upload a local file or drag it into the dialog to create a document link.");
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
var urlTab = panel.querySelector(".rte_insertdocument_byurl");
|
|
274
|
+
if (urlTab) {
|
|
275
|
+
ensureUploadIntro(urlTab, "rte-insertdocument-intro", "Paste a hosted file URL and review the link details before inserting.");
|
|
276
|
+
ensureDocumentPreview(urlTab, urlTab.querySelector(".rte-dialog-line-url"));
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
var actionLine = panel.querySelector(".rte-dialog-line-action");
|
|
280
|
+
if (actionLine) {
|
|
281
|
+
actionLine.classList.add("rte-insertdocument-actions");
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
var actionButton = panel.querySelector(".rte-dialog-line-action .rte-dialog-button");
|
|
285
|
+
if (actionButton && actionButton.innerText === "Insert") {
|
|
286
|
+
actionButton.innerText = "Insert document";
|
|
287
|
+
}
|
|
288
|
+
if (actionButton && actionButton.innerText === "Update") {
|
|
289
|
+
actionButton.innerText = "Update document";
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function patchTree(root) {
|
|
295
|
+
if (!root || root.nodeType !== 1) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
enhanceInsertImagePanels(root);
|
|
300
|
+
enhanceInsertDocumentPanels(root);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function start() {
|
|
304
|
+
patchTree(document.documentElement);
|
|
305
|
+
|
|
306
|
+
if (!window.MutationObserver) {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
var observer = new MutationObserver(function (mutations) {
|
|
311
|
+
var i;
|
|
312
|
+
var j;
|
|
313
|
+
for (i = 0; i < mutations.length; i++) {
|
|
314
|
+
for (j = 0; j < mutations[i].addedNodes.length; j++) {
|
|
315
|
+
patchTree(mutations[i].addedNodes[j]);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
observer.observe(document.documentElement, {
|
|
321
|
+
childList: true,
|
|
322
|
+
subtree: true
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (document.readyState === "loading") {
|
|
327
|
+
if (document.addEventListener) {
|
|
328
|
+
document.addEventListener("DOMContentLoaded", start);
|
|
329
|
+
} else {
|
|
330
|
+
window.attachEvent("onload", start);
|
|
331
|
+
}
|
|
332
|
+
} else {
|
|
333
|
+
start();
|
|
334
|
+
}
|
|
335
|
+
}
|