@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,203 @@
|
|
|
1
|
+
if (!window.RTE_DefaultConfig) window.RTE_DefaultConfig = {};
|
|
2
|
+
|
|
3
|
+
// 2026-06-06 Typewriter scrolling + Focus mode. Two distraction-free writing
|
|
4
|
+
// modes, both purely presentational (no content/DOM mutation, nothing to
|
|
5
|
+
// serialize):
|
|
6
|
+
//
|
|
7
|
+
// Typewriter mode — as you type, the editor keeps the caret line pinned to a
|
|
8
|
+
// fixed vertical position (default: the middle of the
|
|
9
|
+
// viewport) by scrolling the editable, the way iA Writer /
|
|
10
|
+
// Typora / Ulysses do. The text moves up to meet a steady
|
|
11
|
+
// caret instead of the caret marching down the page.
|
|
12
|
+
//
|
|
13
|
+
// Focus mode — dims everything except the block (paragraph / heading /
|
|
14
|
+
// list-item) the caret is in, so the current sentence
|
|
15
|
+
// stands out. Notion / iA Writer "focus" behaviour.
|
|
16
|
+
//
|
|
17
|
+
// Both are runtime-only: focus mode toggles a single class on the editable
|
|
18
|
+
// (rte-focus-active) and a transient class on the active block
|
|
19
|
+
// (rte-focus-current); typewriter mode only scrolls. Saved markup is untouched,
|
|
20
|
+
// and getHTMLCode is wrapped to strip the transient focus class as a belt-and-
|
|
21
|
+
// braces guard in case a serialize fires mid-keystroke.
|
|
22
|
+
RTE_DefaultConfig.plugin_typewriter = RTE_Plugin_Typewriter;
|
|
23
|
+
if (typeof RTE_DefaultConfig.typewriterModeEnabled === "undefined") RTE_DefaultConfig.typewriterModeEnabled = false;
|
|
24
|
+
if (typeof RTE_DefaultConfig.focusModeEnabled === "undefined") RTE_DefaultConfig.focusModeEnabled = false;
|
|
25
|
+
// 0..1 fraction of the viewport height the caret line is held at (0.5 = middle).
|
|
26
|
+
if (typeof RTE_DefaultConfig.typewriterAnchor === "undefined") RTE_DefaultConfig.typewriterAnchor = 0.5;
|
|
27
|
+
|
|
28
|
+
function RTE_Plugin_Typewriter() {
|
|
29
|
+
var obj = this;
|
|
30
|
+
var config, editor;
|
|
31
|
+
var typewriter = false, focus = false;
|
|
32
|
+
var clickDoc = null, wrapped = false, raf = 0;
|
|
33
|
+
|
|
34
|
+
obj.PluginName = "Typewriter";
|
|
35
|
+
|
|
36
|
+
obj.InitConfig = function (argconfig) {
|
|
37
|
+
config = argconfig;
|
|
38
|
+
typewriter = !!config.typewriterModeEnabled;
|
|
39
|
+
focus = !!config.focusModeEnabled;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
obj.InitEditor = function (argeditor) {
|
|
43
|
+
editor = argeditor;
|
|
44
|
+
setup();
|
|
45
|
+
try { editor.attachEvent("ready", setup); } catch (e) {}
|
|
46
|
+
try { editor.attachEvent("aftersethtml", setup); } catch (e) {}
|
|
47
|
+
setTimeout(setup, 0); setTimeout(setup, 200);
|
|
48
|
+
|
|
49
|
+
// Public API.
|
|
50
|
+
editor.setTypewriterMode = function (on) { typewriter = !!on; apply(); return typewriter; };
|
|
51
|
+
editor.setFocusMode = function (on) { focus = !!on; apply(); return focus; };
|
|
52
|
+
editor.toggleTypewriterMode = function () { typewriter = !typewriter; apply(); return typewriter; };
|
|
53
|
+
editor.toggleFocusMode = function () { focus = !focus; apply(); return focus; };
|
|
54
|
+
editor.isTypewriterMode = function () { return typewriter; };
|
|
55
|
+
editor.isFocusMode = function () { return focus; };
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Re-runnable: the editor can recreate the document/body after init.
|
|
59
|
+
function setup() {
|
|
60
|
+
var doc = editor.getDocument();
|
|
61
|
+
if (doc) {
|
|
62
|
+
injectStyles(doc);
|
|
63
|
+
if (doc !== clickDoc) {
|
|
64
|
+
// One handler drives both modes off any caret movement.
|
|
65
|
+
doc.addEventListener("keyup", onActivity, true);
|
|
66
|
+
doc.addEventListener("mouseup", onActivity, true);
|
|
67
|
+
doc.addEventListener("input", onActivity, true);
|
|
68
|
+
clickDoc = doc;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
wrapSerializers();
|
|
72
|
+
apply();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function isBlock(n) {
|
|
76
|
+
return n && n.nodeType === 1 && /^(P|H[1-6]|LI|BLOCKQUOTE|PRE|DIV|TD|TH|FIGCAPTION)$/.test(n.nodeName);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function currentBlock() {
|
|
80
|
+
try {
|
|
81
|
+
var s = editor.getSelection(); if (!s || s.rangeCount === 0) return null;
|
|
82
|
+
var editable = editor.getEditable();
|
|
83
|
+
var n = s.getRangeAt(0).startContainer;
|
|
84
|
+
if (n && n.nodeType === 3) n = n.parentNode;
|
|
85
|
+
var last = null;
|
|
86
|
+
while (n && n !== editable) { if (isBlock(n)) last = n; n = n.parentNode; }
|
|
87
|
+
return last;
|
|
88
|
+
} catch (e) { return null; }
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function caretRect() {
|
|
92
|
+
try {
|
|
93
|
+
var s = editor.getSelection(); if (!s || s.rangeCount === 0) return null;
|
|
94
|
+
var r = s.getRangeAt(0).cloneRange();
|
|
95
|
+
var rect = r.getBoundingClientRect();
|
|
96
|
+
if (rect && (rect.top || rect.bottom || rect.height)) return rect;
|
|
97
|
+
// Collapsed range at a node boundary can yield an empty rect — fall
|
|
98
|
+
// back to the active block's rect.
|
|
99
|
+
var b = currentBlock();
|
|
100
|
+
return b ? b.getBoundingClientRect() : null;
|
|
101
|
+
} catch (e) { return null; }
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function onActivity() {
|
|
105
|
+
if (!typewriter && !focus) return;
|
|
106
|
+
if (raf) return;
|
|
107
|
+
var win = typeof requestAnimationFrame === "function" ? requestAnimationFrame : function (f) { return setTimeout(f, 16); };
|
|
108
|
+
raf = win(function () { raf = 0; if (focus) markFocus(); if (typewriter) scrollToCaret(); });
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function markFocus() {
|
|
112
|
+
var editable = editor.getEditable(); if (!editable) return;
|
|
113
|
+
var prev = editable.querySelectorAll(".rte-focus-current");
|
|
114
|
+
for (var i = 0; i < prev.length; i++) prev[i].classList.remove("rte-focus-current");
|
|
115
|
+
var b = currentBlock();
|
|
116
|
+
if (b) b.classList.add("rte-focus-current");
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function scrollToCaret() {
|
|
120
|
+
var doc = editor.getDocument(); if (!doc) return;
|
|
121
|
+
var rect = caretRect(); if (!rect) return;
|
|
122
|
+
var win = doc.defaultView || doc.parentWindow; if (!win) return;
|
|
123
|
+
var vh = win.innerHeight || doc.documentElement.clientHeight; if (!vh) return;
|
|
124
|
+
var anchor = vh * clamp(config.typewriterAnchor, 0.15, 0.85);
|
|
125
|
+
var caretMid = rect.top + rect.height / 2;
|
|
126
|
+
var delta = caretMid - anchor;
|
|
127
|
+
if (Math.abs(delta) < 2) return;
|
|
128
|
+
// Prefer the document scroller, but if the document itself doesn't scroll
|
|
129
|
+
// (the editable BODY has its own overflow), scroll the editable instead so
|
|
130
|
+
// the caret-pin actually moves the content.
|
|
131
|
+
var scroller = doc.scrollingElement || doc.documentElement || doc.body;
|
|
132
|
+
if (scroller && (scroller.scrollHeight - scroller.clientHeight) <= 4) {
|
|
133
|
+
var ed = editor.getEditable();
|
|
134
|
+
if (ed && (ed.scrollHeight - ed.clientHeight) > 4) scroller = ed;
|
|
135
|
+
}
|
|
136
|
+
if (scroller) scroller.scrollTop += delta;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function clamp(v, lo, hi) { v = (typeof v === "number" && !isNaN(v)) ? v : 0.5; return v < lo ? lo : (v > hi ? hi : v); }
|
|
140
|
+
|
|
141
|
+
function apply() {
|
|
142
|
+
var editable = editor.getEditable(); if (!editable) return;
|
|
143
|
+
if (focus) { editable.classList.add("rte-focus-active"); markFocus(); }
|
|
144
|
+
else {
|
|
145
|
+
editable.classList.remove("rte-focus-active");
|
|
146
|
+
var cur = editable.querySelectorAll(".rte-focus-current");
|
|
147
|
+
for (var i = 0; i < cur.length; i++) cur[i].classList.remove("rte-focus-current");
|
|
148
|
+
}
|
|
149
|
+
if (typewriter) {
|
|
150
|
+
editable.classList.add("rte-typewriter-active");
|
|
151
|
+
scrollToCaret();
|
|
152
|
+
} else {
|
|
153
|
+
editable.classList.remove("rte-typewriter-active");
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function injectStyles(doc) {
|
|
158
|
+
if (!doc || doc.getElementById("rte-typewriter-styles")) return;
|
|
159
|
+
var css =
|
|
160
|
+
// Focus mode: dim the body, restore full opacity on the active block.
|
|
161
|
+
".rte-focus-active p,.rte-focus-active h1,.rte-focus-active h2,.rte-focus-active h3," +
|
|
162
|
+
".rte-focus-active h4,.rte-focus-active h5,.rte-focus-active h6,.rte-focus-active li," +
|
|
163
|
+
".rte-focus-active blockquote,.rte-focus-active pre,.rte-focus-active figcaption{" +
|
|
164
|
+
"opacity:.28;transition:opacity .18s ease;}" +
|
|
165
|
+
".rte-focus-active .rte-focus-current,.rte-focus-active .rte-focus-current *{opacity:1 !important;}" +
|
|
166
|
+
// Typewriter mode: generous bottom padding so the last lines can still
|
|
167
|
+
// scroll up to the anchor position.
|
|
168
|
+
".rte-typewriter-active{padding-bottom:45vh !important;}" +
|
|
169
|
+
// Respect reduced-motion: drop the focus-dim opacity transition.
|
|
170
|
+
"@media (prefers-reduced-motion: reduce){.rte-focus-active p,.rte-focus-active h1,.rte-focus-active h2," +
|
|
171
|
+
".rte-focus-active h3,.rte-focus-active h4,.rte-focus-active h5,.rte-focus-active h6,.rte-focus-active li," +
|
|
172
|
+
".rte-focus-active blockquote,.rte-focus-active pre,.rte-focus-active figcaption{transition:none !important;}}";
|
|
173
|
+
var st = doc.createElement("style");
|
|
174
|
+
st.id = "rte-typewriter-styles";
|
|
175
|
+
st.appendChild(doc.createTextNode(css));
|
|
176
|
+
(doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement).appendChild(st);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Strip the transient focus class around any serialize so saved markup never
|
|
180
|
+
// carries it, even if a save fires mid-keystroke.
|
|
181
|
+
function stripFor() {
|
|
182
|
+
var ed = editor.getEditable(); if (!ed) return function () {};
|
|
183
|
+
var marked = ed.querySelectorAll(".rte-focus-current");
|
|
184
|
+
for (var i = 0; i < marked.length; i++) marked[i].classList.remove("rte-focus-current");
|
|
185
|
+
return function restore() { for (var j = 0; j < marked.length; j++) marked[j].classList.add("rte-focus-current"); };
|
|
186
|
+
}
|
|
187
|
+
function wrapSerializers() {
|
|
188
|
+
if (wrapped) return;
|
|
189
|
+
var names = ["getHTMLCode", "getJSON", "getHTMLContent"];
|
|
190
|
+
var did = false;
|
|
191
|
+
for (var i = 0; i < names.length; i++) {
|
|
192
|
+
(function (name) {
|
|
193
|
+
var orig = editor[name];
|
|
194
|
+
if (typeof orig !== "function" || orig.__rteTwWrapped) return;
|
|
195
|
+
var w = function () { var restore = stripFor(); try { return orig.apply(editor, arguments); } finally { restore(); } };
|
|
196
|
+
w.__rteTwWrapped = true;
|
|
197
|
+
editor[name] = w;
|
|
198
|
+
did = true;
|
|
199
|
+
})(names[i]);
|
|
200
|
+
}
|
|
201
|
+
if (did) wrapped = true;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
Binary file
|