@ntlab/ntjs-assets 2.116.0 → 2.118.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/assets/js/cdn.json +2 -2
- package/assets/js/tinymce/CHANGELOG.md +24 -0
- package/assets/js/tinymce/models/dom/model.js +32 -37
- package/assets/js/tinymce/models/dom/model.min.js +1 -1
- package/assets/js/tinymce/plugins/accordion/plugin.js +27 -14
- package/assets/js/tinymce/plugins/accordion/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/advlist/plugin.js +7 -5
- package/assets/js/tinymce/plugins/advlist/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/anchor/plugin.js +1 -1
- package/assets/js/tinymce/plugins/autolink/plugin.js +3 -5
- package/assets/js/tinymce/plugins/autolink/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/autoresize/plugin.js +4 -6
- package/assets/js/tinymce/plugins/autoresize/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/autosave/plugin.js +4 -7
- package/assets/js/tinymce/plugins/autosave/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/charmap/plugin.js +8 -7
- package/assets/js/tinymce/plugins/charmap/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/code/plugin.js +1 -1
- package/assets/js/tinymce/plugins/codesample/plugin.js +9 -9
- package/assets/js/tinymce/plugins/codesample/plugin.min.js +2 -2
- package/assets/js/tinymce/plugins/directionality/plugin.js +8 -7
- package/assets/js/tinymce/plugins/directionality/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/emoticons/plugin.js +7 -5
- package/assets/js/tinymce/plugins/emoticons/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/fullscreen/plugin.js +10 -9
- package/assets/js/tinymce/plugins/fullscreen/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/help/plugin.js +10 -11
- package/assets/js/tinymce/plugins/help/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/image/plugin.js +21 -28
- package/assets/js/tinymce/plugins/image/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/importcss/plugin.js +4 -5
- package/assets/js/tinymce/plugins/importcss/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/insertdatetime/plugin.js +3 -3
- package/assets/js/tinymce/plugins/insertdatetime/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/langs8/it.js +1 -1
- package/assets/js/tinymce/plugins/langs8/zh-CN.js +4 -4
- package/assets/js/tinymce/plugins/link/plugin.js +15 -17
- package/assets/js/tinymce/plugins/link/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/lists/plugin.js +7 -5
- package/assets/js/tinymce/plugins/lists/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/media/plugin.js +15 -21
- package/assets/js/tinymce/plugins/media/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/nonbreaking/plugin.js +1 -1
- package/assets/js/tinymce/plugins/pagebreak/plugin.js +1 -1
- package/assets/js/tinymce/plugins/preview/plugin.js +88 -10
- package/assets/js/tinymce/plugins/preview/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/quickbars/plugin.js +9 -9
- package/assets/js/tinymce/plugins/quickbars/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/save/plugin.js +1 -1
- package/assets/js/tinymce/plugins/searchreplace/plugin.js +10 -11
- package/assets/js/tinymce/plugins/searchreplace/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/table/plugin.js +12 -13
- package/assets/js/tinymce/plugins/table/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/visualblocks/plugin.js +1 -1
- package/assets/js/tinymce/plugins/visualchars/plugin.js +9 -9
- package/assets/js/tinymce/plugins/visualchars/plugin.min.js +1 -1
- package/assets/js/tinymce/plugins/wordcount/plugin.js +1 -1
- package/assets/js/tinymce/skins/ui/oxide/content.css +32 -0
- package/assets/js/tinymce/skins/ui/oxide/content.inline.css +32 -0
- package/assets/js/tinymce/skins/ui/oxide/content.inline.js +1 -1
- package/assets/js/tinymce/skins/ui/oxide/content.inline.min.css +1 -1
- package/assets/js/tinymce/skins/ui/oxide/content.js +1 -1
- package/assets/js/tinymce/skins/ui/oxide/content.min.css +1 -1
- package/assets/js/tinymce/skins/ui/oxide/skin.css +52 -3
- package/assets/js/tinymce/skins/ui/oxide/skin.js +1 -1
- package/assets/js/tinymce/skins/ui/oxide/skin.min.css +1 -1
- package/assets/js/tinymce/skins/ui/oxide-dark/content.css +32 -0
- package/assets/js/tinymce/skins/ui/oxide-dark/content.inline.css +32 -0
- package/assets/js/tinymce/skins/ui/oxide-dark/content.inline.js +1 -1
- package/assets/js/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -1
- package/assets/js/tinymce/skins/ui/oxide-dark/content.js +1 -1
- package/assets/js/tinymce/skins/ui/oxide-dark/content.min.css +1 -1
- package/assets/js/tinymce/skins/ui/oxide-dark/skin.css +52 -3
- package/assets/js/tinymce/skins/ui/oxide-dark/skin.js +1 -1
- package/assets/js/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
- package/assets/js/tinymce/skins/ui/tinymce-5/content.css +32 -0
- package/assets/js/tinymce/skins/ui/tinymce-5/content.inline.css +32 -0
- package/assets/js/tinymce/skins/ui/tinymce-5/content.inline.js +1 -1
- package/assets/js/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -1
- package/assets/js/tinymce/skins/ui/tinymce-5/content.js +1 -1
- package/assets/js/tinymce/skins/ui/tinymce-5/content.min.css +1 -1
- package/assets/js/tinymce/skins/ui/tinymce-5/skin.css +52 -3
- package/assets/js/tinymce/skins/ui/tinymce-5/skin.js +1 -1
- package/assets/js/tinymce/skins/ui/tinymce-5/skin.min.css +1 -1
- package/assets/js/tinymce/skins/ui/tinymce-5-dark/content.css +32 -0
- package/assets/js/tinymce/skins/ui/tinymce-5-dark/content.inline.css +32 -0
- package/assets/js/tinymce/skins/ui/tinymce-5-dark/content.inline.js +1 -1
- package/assets/js/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -1
- package/assets/js/tinymce/skins/ui/tinymce-5-dark/content.js +1 -1
- package/assets/js/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -1
- package/assets/js/tinymce/skins/ui/tinymce-5-dark/skin.css +52 -3
- package/assets/js/tinymce/skins/ui/tinymce-5-dark/skin.js +1 -1
- package/assets/js/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -1
- package/assets/js/tinymce/themes/silver/theme.js +73 -88
- package/assets/js/tinymce/themes/silver/theme.min.js +1 -1
- package/assets/js/tinymce/tinymce.js +671 -449
- package/assets/js/tinymce/tinymce.min.js +2 -2
- package/package.json +1 -1
|
@@ -74,13 +74,13 @@ tinymce.addI18n("zh-CN", {
|
|
|
74
74
|
"Copy column": "\u590d\u5236\u5217",
|
|
75
75
|
"Copy row": "\u590d\u5236\u884c",
|
|
76
76
|
"Could not find the specified string.": "\u672a\u627e\u5230\u641c\u7d22\u5185\u5bb9\u3002",
|
|
77
|
-
"Could not load emojis": "\u65e0\u6cd5\u52a0\
|
|
77
|
+
"Could not load emojis": "\u65e0\u6cd5\u52a0\u8f7d\u8868\u60c5",
|
|
78
78
|
"Count": "\u8ba1\u6570",
|
|
79
79
|
"Currency": "\u8d27\u5e01",
|
|
80
80
|
"Current window": "\u5f53\u524d\u7a97\u53e3",
|
|
81
81
|
"Custom color": "\u81ea\u5b9a\u4e49\u989c\u8272",
|
|
82
82
|
"Custom...": "\u81ea\u5b9a\u4e49......",
|
|
83
|
-
"Cut": "
|
|
83
|
+
"Cut": "Cut",
|
|
84
84
|
"Cut column": "\u526a\u5207\u5217",
|
|
85
85
|
"Cut row": "\u526a\u5207\u884c",
|
|
86
86
|
"Dark Blue": "\u6df1\u84dd\u8272",
|
|
@@ -109,7 +109,7 @@ tinymce.addI18n("zh-CN", {
|
|
|
109
109
|
"Dropped file type is not supported": "\u6b64\u6587\u4ef6\u7c7b\u578b\u4e0d\u652f\u6301\u62d6\u653e",
|
|
110
110
|
"Edit": "\u7f16\u8f91",
|
|
111
111
|
"Embed": "\u5185\u5d4c",
|
|
112
|
-
"Emojis": "
|
|
112
|
+
"Emojis": "\u8868\u60c5\u7b26\u53f7",
|
|
113
113
|
"Emojis...": "Emojis...",
|
|
114
114
|
"Error": "\u9519\u8bef",
|
|
115
115
|
"Error: Form submit field collision.": "\u9519\u8bef: \u8868\u5355\u63d0\u4ea4\u5b57\u6bb5\u51b2\u7a81\u3002",
|
|
@@ -355,7 +355,7 @@ tinymce.addI18n("zh-CN", {
|
|
|
355
355
|
"Travel and Places": "\u65c5\u6e38\u548c\u5730\u70b9",
|
|
356
356
|
"Turquoise": "\u9752\u7eff\u8272",
|
|
357
357
|
"Underline": "\u4e0b\u5212\u7ebf",
|
|
358
|
-
"Undo": "
|
|
358
|
+
"Undo": "Undo",
|
|
359
359
|
"Upload": "\u4e0a\u4f20",
|
|
360
360
|
"Uploading image": "\u4e0a\u4f20\u56fe\u7247",
|
|
361
361
|
"Upper Alpha": "\u5927\u5199\u82f1\u6587\u5b57\u6bcd",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TinyMCE version 8.
|
|
2
|
+
* TinyMCE version 8.2.0 (2025-10-23)
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
(function () {
|
|
@@ -9,13 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
/* eslint-disable @typescript-eslint/no-wrapper-object-types */
|
|
11
11
|
const hasProto = (v, constructor, predicate) => {
|
|
12
|
-
var _a;
|
|
13
12
|
if (predicate(v, constructor.prototype)) {
|
|
14
13
|
return true;
|
|
15
14
|
}
|
|
16
15
|
else {
|
|
17
16
|
// String-based fallback time
|
|
18
|
-
return
|
|
17
|
+
return v.constructor?.name === constructor.name;
|
|
19
18
|
}
|
|
20
19
|
};
|
|
21
20
|
const typeOf = (x) => {
|
|
@@ -82,6 +81,11 @@
|
|
|
82
81
|
* strict-null-checks
|
|
83
82
|
*/
|
|
84
83
|
class Optional {
|
|
84
|
+
tag;
|
|
85
|
+
value;
|
|
86
|
+
// Sneaky optimisation: every instance of Optional.none is identical, so just
|
|
87
|
+
// reuse the same object
|
|
88
|
+
static singletonNone = new Optional(false);
|
|
85
89
|
// The internal representation has a `tag` and a `value`, but both are
|
|
86
90
|
// private: able to be console.logged, but not able to be accessed by code
|
|
87
91
|
constructor(tag, value) {
|
|
@@ -249,7 +253,7 @@
|
|
|
249
253
|
*/
|
|
250
254
|
getOrDie(message) {
|
|
251
255
|
if (!this.tag) {
|
|
252
|
-
throw new Error(message
|
|
256
|
+
throw new Error(message ?? 'Called getOrDie on None');
|
|
253
257
|
}
|
|
254
258
|
else {
|
|
255
259
|
return this.value;
|
|
@@ -313,9 +317,6 @@
|
|
|
313
317
|
return this.tag ? `some(${this.value})` : 'none()';
|
|
314
318
|
}
|
|
315
319
|
}
|
|
316
|
-
// Sneaky optimisation: every instance of Optional.none is identical, so just
|
|
317
|
-
// reuse the same object
|
|
318
|
-
Optional.singletonNone = new Optional(false);
|
|
319
320
|
|
|
320
321
|
const nativeSlice = Array.prototype.slice;
|
|
321
322
|
const nativeIndexOf = Array.prototype.indexOf;
|
|
@@ -588,9 +589,8 @@
|
|
|
588
589
|
};
|
|
589
590
|
const hasProtocol = (url) => /^\w+:/i.test(url);
|
|
590
591
|
const getHref = (elm) => {
|
|
591
|
-
var _a, _b;
|
|
592
592
|
// Returns the real href value not the resolved a.href value
|
|
593
|
-
return
|
|
593
|
+
return elm.getAttribute('data-mce-href') ?? elm.getAttribute('href') ?? '';
|
|
594
594
|
};
|
|
595
595
|
const applyRelTargetRules = (rel, isUnsafe) => {
|
|
596
596
|
const rules = ['noopener'];
|
|
@@ -801,22 +801,20 @@
|
|
|
801
801
|
editor.hasPlugin('rtc', true) ? editor.execCommand('unlink') : unlinkDomMutation(editor);
|
|
802
802
|
};
|
|
803
803
|
const unlinkImageFigure = (editor, fig) => {
|
|
804
|
-
var _a;
|
|
805
804
|
const img = editor.dom.select('img', fig)[0];
|
|
806
805
|
if (img) {
|
|
807
806
|
const a = editor.dom.getParents(img, 'a[href]', fig)[0];
|
|
808
807
|
if (a) {
|
|
809
|
-
|
|
808
|
+
a.parentNode?.insertBefore(img, a);
|
|
810
809
|
editor.dom.remove(a);
|
|
811
810
|
}
|
|
812
811
|
}
|
|
813
812
|
};
|
|
814
813
|
const linkImageFigure = (dom, fig, attrs) => {
|
|
815
|
-
var _a;
|
|
816
814
|
const img = dom.select('img', fig)[0];
|
|
817
815
|
if (img) {
|
|
818
816
|
const a = dom.create('a', attrs);
|
|
819
|
-
|
|
817
|
+
img.parentNode?.insertBefore(a, img);
|
|
820
818
|
a.appendChild(img);
|
|
821
819
|
}
|
|
822
820
|
};
|
|
@@ -903,8 +901,8 @@
|
|
|
903
901
|
text: initialData.text,
|
|
904
902
|
title: initialData.title
|
|
905
903
|
};
|
|
906
|
-
const getTitleFromUrlChange = (url) =>
|
|
907
|
-
const getTextFromUrlChange = (url) =>
|
|
904
|
+
const getTitleFromUrlChange = (url) => someIf(persistentData.title.length <= 0, Optional.from(url.meta?.title).getOr(''));
|
|
905
|
+
const getTextFromUrlChange = (url) => someIf(persistentData.text.length <= 0, Optional.from(url.meta?.text).getOr(url.value));
|
|
908
906
|
const onUrlChange = (data) => {
|
|
909
907
|
const text = getTextFromUrlChange(data.url);
|
|
910
908
|
const title = getTitleFromUrlChange(data.url);
|
|
@@ -1018,7 +1016,7 @@
|
|
|
1018
1016
|
try {
|
|
1019
1017
|
return Optional.some(JSON.parse(text));
|
|
1020
1018
|
}
|
|
1021
|
-
catch
|
|
1019
|
+
catch {
|
|
1022
1020
|
return Optional.none();
|
|
1023
1021
|
}
|
|
1024
1022
|
};
|
|
@@ -1265,7 +1263,7 @@
|
|
|
1265
1263
|
|
|
1266
1264
|
const register = (editor) => {
|
|
1267
1265
|
editor.addCommand('mceLink', (_ui, value) => {
|
|
1268
|
-
if (
|
|
1266
|
+
if (value?.dialog === true || !useQuickLink(editor)) {
|
|
1269
1267
|
open(editor);
|
|
1270
1268
|
}
|
|
1271
1269
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=o=e,(r=String).prototype.isPrototypeOf(n)||(null===(l=o.constructor)||void 0===l?void 0:l.name)===r.name)?"string":t;var n,o,r,l})(t)===e,n=e=>t=>typeof t===e,o=t("string"),r=t("object"),l=t("array"),s=e=>null===e;const a=n("boolean"),i=e=>!(e=>null==e)(e),c=n("function"),u=(e,t)=>{if(l(e)){for(let n=0,o=e.length;n<o;++n)if(!t(e[n]))return!1;return!0}return!1},g=()=>{},d=(e,t)=>e===t;class m{constructor(e,t){this.tag=e,this.value=t}static some(e){return new m(!0,e)}static none(){return m.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?m.some(e(this.value)):m.none()}bind(e){return this.tag?e(this.value):m.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:m.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return i(e)?m.some(e):m.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}m.singletonNone=new m(!1),Array.prototype.slice;const h=Array.prototype.indexOf,p=Array.prototype.push,f=e=>{const t=[];for(let n=0,o=e.length;n<o;++n){if(!l(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);p.apply(t,e[n])}return t};c(Array.from)&&Array.from;const k=(e,t)=>{for(let n=0;n<e.length;n++){const o=t(e[n],n);if(o.isSome())return o}return m.none()},v=Object.keys,y=Object.hasOwnProperty,b=(e,t)=>y.call(e,t),x=(e,t,n=d)=>e.exists((e=>n(e,t))),_=e=>{const t=[],n=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(n);return t},w=(e,t)=>e?m.some(t):m.none(),C=e=>t=>t.options.get(e),A=C("link_assume_external_targets"),O=C("link_context_toolbar"),S=C("link_list"),N=C("link_default_target"),E=C("link_default_protocol"),R=C("link_target_list"),T=C("link_rel_list"),L=C("link_class_list"),P=C("link_title"),M=C("allow_unsafe_link_target"),D=C("link_quicklink"),B=C("link_attributes_postprocess");var I=tinymce.util.Tools.resolve("tinymce.util.URI"),K=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),j=tinymce.util.Tools.resolve("tinymce.util.Tools");const U=e=>i(e)&&"a"===e.nodeName.toLowerCase(),q=e=>U(e)&&!!$(e),F=(e,t)=>{if(e.collapsed)return[];{const n=e.cloneContents(),o=n.firstChild,r=new K(o,n),l=[];let s=o;do{t(s)&&l.push(s)}while(s=r.next());return l}},V=e=>/^\w+:/i.test(e),$=e=>{var t,n;return null!==(n=null!==(t=e.getAttribute("data-mce-href"))&&void 0!==t?t:e.getAttribute("href"))&&void 0!==n?n:""},z=(e,t)=>{const n=["noopener"],o=e?e.split(/\s+/):[],r=e=>e.filter((e=>-1===j.inArray(n,e))),l=t?(e=>(e=r(e)).length>0?e.concat(n):n)(o):r(o);return l.length>0?(e=>j.trim(e.sort().join(" ")))(l):""},G=(e,t)=>(t=t||W(e.selection.getRng())[0]||e.selection.getNode(),Z(t)?m.from(e.dom.select("a[href]",t)[0]):m.from(e.dom.getParent(t,"a[href]"))),H=(e,t)=>G(e,t).isSome(),J=(e,t)=>t.fold((()=>e.getContent({format:"text"})),(e=>e.innerText||e.textContent||"")).replace(/\uFEFF/g,""),W=e=>F(e,q),Q=e=>j.grep(e,q),X=e=>Q(e).length>0,Y=e=>{const t=e.schema.getTextInlineElements();if(G(e).exists((e=>e.hasAttribute("data-mce-block"))))return!1;const n=e.selection.getRng();return!!n.collapsed||0===F(n,(e=>1===e.nodeType&&!U(e)&&!b(t,e.nodeName.toLowerCase()))).length},Z=e=>i(e)&&"FIGURE"===e.nodeName&&/\bimage\b/i.test(e.className),ee=(e,t,n)=>{const o=e.selection.getNode(),r=G(e,o),l=((e,t)=>{const n={...t};if(0===T(e).length&&!M(e)){const e=z(n.rel,"_blank"===n.target);n.rel=e||null}return m.from(n.target).isNone()&&!1===R(e)&&(n.target=N(e)),n.href=((e,t)=>"http"!==t&&"https"!==t||V(e)?e:t+"://"+e)(n.href,A(e)),n})(e,(e=>{return t=["title","rel","class","target"],n=(t,n)=>(e[n].each((e=>{t[n]=e.length>0?e:null})),t),o={href:e.href},((e,t)=>{for(let n=0,o=e.length;n<o;n++)t(e[n],n)})(t,((e,t)=>{o=n(o,e)})),o;var t,n,o})(n)),s=B(e);i(s)&&s(l),e.undoManager.transact((()=>{n.href===t.href&&t.attach(),r.fold((()=>{((e,t,n,o)=>{const r=e.dom;Z(t)?le(r,t,o):n.fold((()=>{e.execCommand("mceInsertLink",!1,o);const t=e.selection.getEnd(),n=r.createRng();n.setStartAfter(t),n.setEndAfter(t),e.selection.setRng(n)}),(t=>{e.insertContent(r.createHTML("a",o,r.encode(t)))}))})(e,o,n.text,l)}),(t=>{e.focus(),((e,t,n,o)=>{n.each((e=>{b(t,"innerText")?t.innerText=e:t.textContent=e})),e.dom.setAttribs(t,o);const r=e.dom.createRng();r.setStartAfter(t),r.setEndAfter(t),e.selection.setRng(r)})(e,t,n.text,l)}))}))},te=e=>{const{class:t,href:n,rel:o,target:r,text:l,title:a}=e;return(e=>{const t={};var n;return((e,t,n,o)=>{((e,t)=>{const n=v(e);for(let o=0,r=n.length;o<r;o++){const r=n[o];t(e[r],r)}})(e,((e,r)=>{(t(e,r)?n:o)(e,r)}))})(e,((e,t)=>!1===s(e)),(n=t,(e,t)=>{n[t]=e}),g),t})({class:t.getOrNull(),href:n,rel:o.getOrNull(),target:r.getOrNull(),text:l.getOrNull(),title:a.getOrNull()})},ne=(e,t,n)=>{const o=((e,t)=>{const n=e.options.get,o={allow_html_data_urls:n("allow_html_data_urls"),allow_script_urls:n("allow_script_urls"),allow_svg_data_urls:n("allow_svg_data_urls")},r=t.href;return{...t,href:I.isDomSafe(r,"a",o)?r:""}})(e,n);e.hasPlugin("rtc",!0)?e.execCommand("createlink",!1,te(o)):ee(e,t,o)},oe=e=>{e.hasPlugin("rtc",!0)?e.execCommand("unlink"):(e=>{e.undoManager.transact((()=>{const t=e.selection.getNode();Z(t)?re(e,t):(e=>{const t=e.dom,n=e.selection,o=n.getBookmark(),r=n.getRng().cloneRange(),l=t.getParent(r.startContainer,"a[href]",e.getBody()),s=t.getParent(r.endContainer,"a[href]",e.getBody());l&&r.setStartBefore(l),s&&r.setEndAfter(s),n.setRng(r),e.execCommand("unlink"),n.moveToBookmark(o)})(e),e.focus()}))})(e)},re=(e,t)=>{var n;const o=e.dom.select("img",t)[0];if(o){const r=e.dom.getParents(o,"a[href]",t)[0];r&&(null===(n=r.parentNode)||void 0===n||n.insertBefore(o,r),e.dom.remove(r))}},le=(e,t,n)=>{var o;const r=e.select("img",t)[0];if(r){const t=e.create("a",n);null===(o=r.parentNode)||void 0===o||o.insertBefore(t,r),t.appendChild(r)}},se=e=>o(e.value)?e.value:"",ae=(e,t)=>{const n=[];return j.each(e,(e=>{const r=(e=>o(e.text)?e.text:o(e.title)?e.title:"")(e);if(void 0!==e.menu){const o=ae(e.menu,t);n.push({text:r,items:o})}else{const o=t(e);n.push({text:r,value:o})}})),n},ie=(e=se)=>t=>m.from(t).map((t=>ae(t,e))),ce=e=>ie(se)(e),ue=ie,ge=(e,t)=>n=>({name:e,type:"listbox",label:t,items:n}),de=se,me=(e,t)=>k(t,(t=>(e=>{return b(t=e,n="items")&&void 0!==t[n]&&null!==t[n];var t,n})(t)?me(e,t.items):w(t.value===e,t))),he=(e,t)=>{const n={text:e.text,title:e.title},o=(e,o)=>{const r=(l=t,s=o,"link"===s?l.link:"anchor"===s?l.anchor:m.none()).getOr([]);var l,s;return((e,t,n,o)=>{const r=o[t],l=e.length>0;return void 0!==r?me(r,n).map((t=>({url:{value:t.value,meta:{text:l?e:t.text,attach:g}},text:l?e:t.text}))):m.none()})(n.text,o,r,e)};return{onChange:(e,t)=>{const r=t.name;return"url"===r?(e=>{const t=(o=e.url,w(n.text.length<=0,m.from(null===(r=o.meta)||void 0===r?void 0:r.text).getOr(o.value)));var o,r;const l=(e=>{var t;return w(n.title.length<=0,m.from(null===(t=e.meta)||void 0===t?void 0:t.title).getOr(""))})(e.url);return t.isSome()||l.isSome()?m.some({...t.map((e=>({text:e}))).getOr({}),...l.map((e=>({title:e}))).getOr({})}):m.none()})(e()):((e,t)=>h.call(e,t))(["anchor","link"],r)>-1?o(e(),r):"text"===r||"title"===r?(n[r]=e()[r],m.none()):m.none()}}};var pe=tinymce.util.Tools.resolve("tinymce.util.Delay");const fe=e=>{const t=e.href;return t.indexOf("@")>0&&-1===t.indexOf("/")&&-1===t.indexOf("mailto:")?m.some({message:"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",preprocess:e=>({...e,href:"mailto:"+t})}):m.none()},ke=(e,t)=>n=>{const o=n.href;return 1===e&&!V(o)||0===e&&/^\s*www(\.|\d\.)/i.test(o)?m.some({message:`The URL you entered seems to be an external link. Do you want to add the required ${t}:// prefix?`,preprocess:e=>({...e,href:t+"://"+o})}):m.none()},ve=e=>{const t=e.dom.select("a:not([href])"),n=f(((e,t)=>{const n=e.length,o=new Array(n);for(let r=0;r<n;r++){const n=e[r];o[r]=t(n,r)}return o})(t,(e=>{const t=e.name||e.id;return t?[{text:t,value:"#"+t}]:[]})));return n.length>0?m.some([{text:"None",value:""}].concat(n)):m.none()},ye=e=>{const t=L(e);return t.length>0?ce(t):m.none()},be=e=>{try{return m.some(JSON.parse(e))}catch(e){return m.none()}},xe=(e,t)=>{const n=T(e);if(n.length>0){const o=x(t,"_blank"),r=e=>z(de(e),o);return(!1===M(e)?ue(r):ce)(n)}return m.none()},_e=[{text:"Current window",value:""},{text:"New window",value:"_blank"}],we=e=>{const t=R(e);return l(t)?ce(t).orThunk((()=>m.some(_e))):!1===t?m.none():m.some(_e)},Ce=(e,t,n)=>{const o=e.getAttrib(t,n);return null!==o&&o.length>0?m.some(o):m.none()},Ae=(e,t)=>(e=>{const t=t=>e.convertURL(t.value||t.url||"","href"),n=S(e);return new Promise((e=>{o(n)?fetch(n).then((e=>e.ok?e.text().then(be):Promise.reject())).then(e,(()=>e(m.none()))):c(n)?n((t=>e(m.some(t)))):e(m.from(n))})).then((e=>e.bind(ue(t)).map((e=>e.length>0?[{text:"None",value:""}].concat(e):e))))})(e).then((n=>{const o=((e,t)=>{const n=e.dom,o=Y(e)?m.some(J(e.selection,t)):m.none(),r=t.bind((e=>m.from(n.getAttrib(e,"href")))),l=t.bind((e=>m.from(n.getAttrib(e,"target")))),s=t.bind((e=>Ce(n,e,"rel"))),a=t.bind((e=>Ce(n,e,"class")));return{url:r,text:o,title:t.bind((e=>Ce(n,e,"title"))),target:l,rel:s,linkClass:a}})(e,t);return{anchor:o,catalogs:{targets:we(e),rels:xe(e,o.target),classes:ye(e),anchor:ve(e),link:n},optNode:t,flags:{titleEnabled:P(e)}}})),Oe=e=>{const t=(e=>{const t=G(e);return Ae(e,t)})(e);t.then((t=>{const n=((e,t)=>n=>{const o=n.getData();if(!o.url.value)return oe(e),void n.close();const r=e=>m.from(o[e]).filter((n=>!x(t.anchor[e],n))),l={href:o.url.value,text:r("text"),target:r("target"),rel:r("rel"),class:r("linkClass"),title:r("title")},s={href:o.url.value,attach:void 0!==o.url.meta&&o.url.meta.attach?o.url.meta.attach:g};((e,t)=>k([fe,ke(A(e),E(e))],(e=>e(t))).fold((()=>Promise.resolve(t)),(n=>new Promise((o=>{((e,t,n)=>{const o=e.selection.getRng();pe.setEditorTimeout(e,(()=>{e.windowManager.confirm(t,(t=>{e.selection.setRng(o),n(t)}))}))})(e,n.message,(e=>{o(e?n.preprocess(t):t)}))})))))(e,l).then((t=>{ne(e,s,t)})),n.close()})(e,t);return((e,t,n)=>{const o=e.anchor.text.map((()=>({name:"text",type:"input",label:"Text to display"}))).toArray(),r=e.flags.titleEnabled?[{name:"title",type:"input",label:"Title"}]:[],l=((e,t)=>{const n=e.anchor,o=n.url.getOr("");return{url:{value:o,meta:{original:{value:o}}},text:n.text.getOr(""),title:n.title.getOr(""),anchor:o,link:o,rel:n.rel.getOr(""),target:n.target.or(t).getOr(""),linkClass:n.linkClass.getOr("")}})(e,m.from(N(n))),s=e.catalogs,a=he(l,s);return{title:"Insert/Edit Link",size:"normal",body:{type:"panel",items:f([[{name:"url",type:"urlinput",filetype:"file",label:"URL",picker_text:"Browse links"}],o,r,_([s.anchor.map(ge("anchor","Anchors")),s.rels.map(ge("rel","Rel")),s.targets.map(ge("target","Open link in...")),s.link.map(ge("link","Link list")),s.classes.map(ge("linkClass","Class"))])])},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:l,onChange:(e,{name:t})=>{a.onChange(e.getData,{name:t}).each((t=>{e.setData(t)}))},onSubmit:t}})(t,n,e)})).then((t=>{e.windowManager.open(t)}))};var Se=tinymce.util.Tools.resolve("tinymce.util.VK");const Ne=(e,t)=>{if(t){const o=$(t);if(/^#/.test(o)){const t=e.dom.select(`${o},[name="${n=o,((e,t)=>((e,t)=>""===t||e.length>=t.length&&e.substr(0,0+t.length)===t)(e,t))(n,"#")?(e=>e.substring(1))(n):n}"]`);t.length&&e.selection.scrollIntoView(t[0],!0)}else(e=>{const t=document.createElement("a");t.target="_blank",t.href=e,t.rel="noreferrer noopener";const n=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});document.dispatchEvent(n),((e,t)=>{document.body.appendChild(e),e.dispatchEvent(t),document.body.removeChild(e)})(t,n)})(t.href)}var n},Ee=(e,t)=>{const n=Q(e.dom.getParents(t));return w(1===n.length,n[0])},Re=e=>e.selection.isCollapsed()||(e=>{const t=e.selection.getRng(),n=t.startContainer;return q(n)&&t.startContainer===t.endContainer&&1===e.dom.select("img",n).length})(e)?Ee(e,e.selection.getStart()):(e=>{const t=W(e.selection.getRng());return w(t.length>0,t[0]).or(Ee(e,e.selection.getNode()))})(e),Te=e=>()=>{e.execCommand("mceLink",!1,{dialog:!0})},Le=(e,t)=>(e.on("NodeChange",t),()=>e.off("NodeChange",t)),Pe=e=>t=>{const n=()=>{t.setActive(!e.mode.isReadOnly()&&H(e,e.selection.getNode())),t.setEnabled(e.selection.isEditable())};return n(),Le(e,n)},Me=e=>t=>{const n=()=>{t.setEnabled(e.selection.isEditable())};return n(),Le(e,n)},De=e=>t=>{const n=e.dom.getParents(e.selection.getStart()),o=n=>{t.setEnabled((t=>{return X(t)||(n=e.selection.getRng(),W(n).length>0);var n})(n)&&e.selection.isEditable())};return o(n),Le(e,(e=>o(e.parents)))},Be=e=>{const t=(e=>{const t=(()=>{const e=(e=>{const t=(e=>{let t=e;return{get:()=>t,set:e=>{t=e}}})(m.none()),n=()=>t.get().each(e);return{clear:()=>{n(),t.set(m.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{n(),t.set(m.some(e))}}})(g);return{...e,on:t=>e.get().each(t)}})(),n=()=>t.get().or(Re(e));return e.on("contextmenu",(n=>{Ee(e,n.target).each(t.set)})),e.on("SelectionChange",(()=>{t.isSet()||Re(e).each(t.set)})),e.on("click",(n=>{t.clear();const o=Q(e.dom.getParents(n.target));1===o.length&&Se.metaKeyPressed(n)&&(n.preventDefault(),Ne(e,o[0]))})),e.on("keydown",(o=>{t.clear(),!o.isDefaultPrevented()&&13===o.keyCode&&(e=>!0===e.altKey&&!1===e.shiftKey&&!1===e.ctrlKey&&!1===e.metaKey)(o)&&n().each((t=>{o.preventDefault(),Ne(e,t)}))})),{gotoSelectedLink:()=>n().each((t=>Ne(e,t)))}})(e);((e,t)=>{e.ui.registry.addToggleButton("link",{icon:"link",tooltip:"Insert/edit link",shortcut:"Meta+K",onAction:Te(e),onSetup:Pe(e)}),e.ui.registry.addButton("openlink",{icon:"new-tab",tooltip:"Open link",onAction:t.gotoSelectedLink,onSetup:De(e)}),e.ui.registry.addButton("unlink",{icon:"unlink",tooltip:"Remove link",onAction:()=>oe(e),onSetup:De(e)})})(e,t),((e,t)=>{e.ui.registry.addMenuItem("openlink",{text:"Open link",icon:"new-tab",onAction:t.gotoSelectedLink,onSetup:De(e)}),e.ui.registry.addMenuItem("link",{icon:"link",text:"Link...",shortcut:"Meta+K",onAction:Te(e),onSetup:Me(e)}),e.ui.registry.addMenuItem("unlink",{icon:"unlink",text:"Remove link",onAction:()=>oe(e),onSetup:De(e)})})(e,t),(e=>{e.ui.registry.addContextMenu("link",{update:t=>e.dom.isEditable(t)?X(e.dom.getParents(t,"a"))?"link unlink openlink":"link":""})})(e),((e,t)=>{const n=t=>{const n=e.selection.getNode();return t.setEnabled(H(e,n)&&e.selection.isEditable()),g};e.ui.registry.addContextForm("quicklink",{launch:{type:"contextformtogglebutton",icon:"link",tooltip:"Link",onSetup:Pe(e)},label:"Link",predicate:t=>O(e)&&H(e,t),initValue:()=>G(e).fold((()=>""),$),commands:[{type:"contextformtogglebutton",icon:"link",tooltip:"Link",primary:!0,onSetup:t=>{const n=e.selection.getNode();return t.setActive(H(e,n)),Pe(e)(t)},onAction:t=>{const n=t.getValue(),o=(t=>{const n=G(e),o=Y(e);if(n.isNone()&&o){const o=J(e.selection,n);return w(0===o.length,t)}return m.none()})(n);ne(e,{href:n,attach:g},{href:n,text:o,title:m.none(),rel:m.none(),target:m.from(N(e)),class:m.none()}),(e=>{e.selection.collapse(!1)})(e),t.hide()}},{type:"contextformbutton",icon:"unlink",tooltip:"Remove link",onSetup:n,onAction:t=>{oe(e),t.hide()}},{type:"contextformbutton",icon:"new-tab",tooltip:"Open link",onSetup:n,onAction:e=>{t.gotoSelectedLink(),e.hide()}}]})})(e,t)};e.add("link",(e=>{(e=>{const t=e.options.register;t("link_assume_external_targets",{processor:e=>{const t=o(e)||a(e);return t?!0===e?{value:1,valid:t}:"http"===e||"https"===e?{value:e,valid:t}:{value:0,valid:t}:{valid:!1,message:"Must be a string or a boolean."}},default:!1}),t("link_context_toolbar",{processor:"boolean",default:!1}),t("link_list",{processor:e=>o(e)||c(e)||u(e,r)}),t("link_default_target",{processor:"string"}),t("link_default_protocol",{processor:"string",default:"https"}),t("link_target_list",{processor:e=>a(e)||u(e,r),default:!0}),t("link_rel_list",{processor:"object[]",default:[]}),t("link_class_list",{processor:"object[]",default:[]}),t("link_title",{processor:"boolean",default:!0}),t("allow_unsafe_link_target",{processor:"boolean",default:!1}),t("link_quicklink",{processor:"boolean",default:!1}),t("link_attributes_postprocess",{processor:"function"})})(e),(e=>{e.addCommand("mceLink",((t,n)=>{!0!==(null==n?void 0:n.dialog)&&D(e)?e.dispatch("contexttoolbar-show",{toolbarKey:"quicklink"}):Oe(e)}))})(e),Be(e),(e=>{e.addShortcut("Meta+K","",(()=>{e.execCommand("mceLink")}))})(e)}))}();
|
|
1
|
+
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=o=e,(r=String).prototype.isPrototypeOf(n)||o.constructor?.name===r.name)?"string":t;var n,o,r})(t)===e,n=e=>t=>typeof t===e,o=t("string"),r=t("object"),l=t("array"),s=e=>null===e;const a=n("boolean"),i=e=>!(e=>null==e)(e),c=n("function"),u=(e,t)=>{if(l(e)){for(let n=0,o=e.length;n<o;++n)if(!t(e[n]))return!1;return!0}return!1},g=()=>{},d=(e,t)=>e===t;class m{tag;value;static singletonNone=new m(!1);constructor(e,t){this.tag=e,this.value=t}static some(e){return new m(!0,e)}static none(){return m.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?m.some(e(this.value)):m.none()}bind(e){return this.tag?e(this.value):m.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:m.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(e??"Called getOrDie on None")}static from(e){return i(e)?m.some(e):m.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}Array.prototype.slice;const h=Array.prototype.indexOf,p=Array.prototype.push,f=e=>{const t=[];for(let n=0,o=e.length;n<o;++n){if(!l(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);p.apply(t,e[n])}return t};c(Array.from)&&Array.from;const k=(e,t)=>{for(let n=0;n<e.length;n++){const o=t(e[n],n);if(o.isSome())return o}return m.none()},v=Object.keys,y=Object.hasOwnProperty,b=(e,t)=>y.call(e,t),x=(e,t,n=d)=>e.exists((e=>n(e,t))),_=e=>{const t=[],n=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(n);return t},w=(e,t)=>e?m.some(t):m.none(),C=e=>t=>t.options.get(e),A=C("link_assume_external_targets"),O=C("link_context_toolbar"),S=C("link_list"),N=C("link_default_target"),E=C("link_default_protocol"),R=C("link_target_list"),T=C("link_rel_list"),L=C("link_class_list"),P=C("link_title"),M=C("allow_unsafe_link_target"),D=C("link_quicklink"),B=C("link_attributes_postprocess");var I=tinymce.util.Tools.resolve("tinymce.util.URI"),K=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),j=tinymce.util.Tools.resolve("tinymce.util.Tools");const U=e=>i(e)&&"a"===e.nodeName.toLowerCase(),q=e=>U(e)&&!!$(e),F=(e,t)=>{if(e.collapsed)return[];{const n=e.cloneContents(),o=n.firstChild,r=new K(o,n),l=[];let s=o;do{t(s)&&l.push(s)}while(s=r.next());return l}},V=e=>/^\w+:/i.test(e),$=e=>e.getAttribute("data-mce-href")??e.getAttribute("href")??"",z=(e,t)=>{const n=["noopener"],o=e?e.split(/\s+/):[],r=e=>e.filter((e=>-1===j.inArray(n,e))),l=t?(e=>(e=r(e)).length>0?e.concat(n):n)(o):r(o);return l.length>0?(e=>j.trim(e.sort().join(" ")))(l):""},G=(e,t)=>(t=t||W(e.selection.getRng())[0]||e.selection.getNode(),Z(t)?m.from(e.dom.select("a[href]",t)[0]):m.from(e.dom.getParent(t,"a[href]"))),H=(e,t)=>G(e,t).isSome(),J=(e,t)=>t.fold((()=>e.getContent({format:"text"})),(e=>e.innerText||e.textContent||"")).replace(/\uFEFF/g,""),W=e=>F(e,q),Q=e=>j.grep(e,q),X=e=>Q(e).length>0,Y=e=>{const t=e.schema.getTextInlineElements();if(G(e).exists((e=>e.hasAttribute("data-mce-block"))))return!1;const n=e.selection.getRng();return!!n.collapsed||0===F(n,(e=>1===e.nodeType&&!U(e)&&!b(t,e.nodeName.toLowerCase()))).length},Z=e=>i(e)&&"FIGURE"===e.nodeName&&/\bimage\b/i.test(e.className),ee=(e,t,n)=>{const o=e.selection.getNode(),r=G(e,o),l=((e,t)=>{const n={...t};if(0===T(e).length&&!M(e)){const e=z(n.rel,"_blank"===n.target);n.rel=e||null}return m.from(n.target).isNone()&&!1===R(e)&&(n.target=N(e)),n.href=((e,t)=>"http"!==t&&"https"!==t||V(e)?e:t+"://"+e)(n.href,A(e)),n})(e,(e=>{return t=["title","rel","class","target"],n=(t,n)=>(e[n].each((e=>{t[n]=e.length>0?e:null})),t),o={href:e.href},((e,t)=>{for(let n=0,o=e.length;n<o;n++)t(e[n],n)})(t,((e,t)=>{o=n(o,e)})),o;var t,n,o})(n)),s=B(e);i(s)&&s(l),e.undoManager.transact((()=>{n.href===t.href&&t.attach(),r.fold((()=>{((e,t,n,o)=>{const r=e.dom;Z(t)?le(r,t,o):n.fold((()=>{e.execCommand("mceInsertLink",!1,o);const t=e.selection.getEnd(),n=r.createRng();n.setStartAfter(t),n.setEndAfter(t),e.selection.setRng(n)}),(t=>{e.insertContent(r.createHTML("a",o,r.encode(t)))}))})(e,o,n.text,l)}),(t=>{e.focus(),((e,t,n,o)=>{n.each((e=>{b(t,"innerText")?t.innerText=e:t.textContent=e})),e.dom.setAttribs(t,o);const r=e.dom.createRng();r.setStartAfter(t),r.setEndAfter(t),e.selection.setRng(r)})(e,t,n.text,l)}))}))},te=e=>{const{class:t,href:n,rel:o,target:r,text:l,title:a}=e;return(e=>{const t={};var n;return((e,t,n,o)=>{((e,t)=>{const n=v(e);for(let o=0,r=n.length;o<r;o++){const r=n[o];t(e[r],r)}})(e,((e,r)=>{(t(e,r)?n:o)(e,r)}))})(e,((e,t)=>!1===s(e)),(n=t,(e,t)=>{n[t]=e}),g),t})({class:t.getOrNull(),href:n,rel:o.getOrNull(),target:r.getOrNull(),text:l.getOrNull(),title:a.getOrNull()})},ne=(e,t,n)=>{const o=((e,t)=>{const n=e.options.get,o={allow_html_data_urls:n("allow_html_data_urls"),allow_script_urls:n("allow_script_urls"),allow_svg_data_urls:n("allow_svg_data_urls")},r=t.href;return{...t,href:I.isDomSafe(r,"a",o)?r:""}})(e,n);e.hasPlugin("rtc",!0)?e.execCommand("createlink",!1,te(o)):ee(e,t,o)},oe=e=>{e.hasPlugin("rtc",!0)?e.execCommand("unlink"):(e=>{e.undoManager.transact((()=>{const t=e.selection.getNode();Z(t)?re(e,t):(e=>{const t=e.dom,n=e.selection,o=n.getBookmark(),r=n.getRng().cloneRange(),l=t.getParent(r.startContainer,"a[href]",e.getBody()),s=t.getParent(r.endContainer,"a[href]",e.getBody());l&&r.setStartBefore(l),s&&r.setEndAfter(s),n.setRng(r),e.execCommand("unlink"),n.moveToBookmark(o)})(e),e.focus()}))})(e)},re=(e,t)=>{const n=e.dom.select("img",t)[0];if(n){const o=e.dom.getParents(n,"a[href]",t)[0];o&&(o.parentNode?.insertBefore(n,o),e.dom.remove(o))}},le=(e,t,n)=>{const o=e.select("img",t)[0];if(o){const t=e.create("a",n);o.parentNode?.insertBefore(t,o),t.appendChild(o)}},se=e=>o(e.value)?e.value:"",ae=(e,t)=>{const n=[];return j.each(e,(e=>{const r=(e=>o(e.text)?e.text:o(e.title)?e.title:"")(e);if(void 0!==e.menu){const o=ae(e.menu,t);n.push({text:r,items:o})}else{const o=t(e);n.push({text:r,value:o})}})),n},ie=(e=se)=>t=>m.from(t).map((t=>ae(t,e))),ce=e=>ie(se)(e),ue=ie,ge=(e,t)=>n=>({name:e,type:"listbox",label:t,items:n}),de=se,me=(e,t)=>k(t,(t=>(e=>{return b(t=e,n="items")&&void 0!==t[n]&&null!==t[n];var t,n})(t)?me(e,t.items):w(t.value===e,t))),he=(e,t)=>{const n={text:e.text,title:e.title},o=(e,o)=>{const r=(l=t,s=o,"link"===s?l.link:"anchor"===s?l.anchor:m.none()).getOr([]);var l,s;return((e,t,n,o)=>{const r=o[t],l=e.length>0;return void 0!==r?me(r,n).map((t=>({url:{value:t.value,meta:{text:l?e:t.text,attach:g}},text:l?e:t.text}))):m.none()})(n.text,o,r,e)};return{onChange:(e,t)=>{const r=t.name;return"url"===r?(e=>{const t=(o=e.url,w(n.text.length<=0,m.from(o.meta?.text).getOr(o.value)));var o;const r=(e=>w(n.title.length<=0,m.from(e.meta?.title).getOr("")))(e.url);return t.isSome()||r.isSome()?m.some({...t.map((e=>({text:e}))).getOr({}),...r.map((e=>({title:e}))).getOr({})}):m.none()})(e()):((e,t)=>h.call(e,t))(["anchor","link"],r)>-1?o(e(),r):"text"===r||"title"===r?(n[r]=e()[r],m.none()):m.none()}}};var pe=tinymce.util.Tools.resolve("tinymce.util.Delay");const fe=e=>{const t=e.href;return t.indexOf("@")>0&&-1===t.indexOf("/")&&-1===t.indexOf("mailto:")?m.some({message:"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",preprocess:e=>({...e,href:"mailto:"+t})}):m.none()},ke=(e,t)=>n=>{const o=n.href;return 1===e&&!V(o)||0===e&&/^\s*www(\.|\d\.)/i.test(o)?m.some({message:`The URL you entered seems to be an external link. Do you want to add the required ${t}:// prefix?`,preprocess:e=>({...e,href:t+"://"+o})}):m.none()},ve=e=>{const t=e.dom.select("a:not([href])"),n=f(((e,t)=>{const n=e.length,o=new Array(n);for(let r=0;r<n;r++){const n=e[r];o[r]=t(n,r)}return o})(t,(e=>{const t=e.name||e.id;return t?[{text:t,value:"#"+t}]:[]})));return n.length>0?m.some([{text:"None",value:""}].concat(n)):m.none()},ye=e=>{const t=L(e);return t.length>0?ce(t):m.none()},be=e=>{try{return m.some(JSON.parse(e))}catch{return m.none()}},xe=(e,t)=>{const n=T(e);if(n.length>0){const o=x(t,"_blank"),r=e=>z(de(e),o);return(!1===M(e)?ue(r):ce)(n)}return m.none()},_e=[{text:"Current window",value:""},{text:"New window",value:"_blank"}],we=e=>{const t=R(e);return l(t)?ce(t).orThunk((()=>m.some(_e))):!1===t?m.none():m.some(_e)},Ce=(e,t,n)=>{const o=e.getAttrib(t,n);return null!==o&&o.length>0?m.some(o):m.none()},Ae=(e,t)=>(e=>{const t=t=>e.convertURL(t.value||t.url||"","href"),n=S(e);return new Promise((e=>{o(n)?fetch(n).then((e=>e.ok?e.text().then(be):Promise.reject())).then(e,(()=>e(m.none()))):c(n)?n((t=>e(m.some(t)))):e(m.from(n))})).then((e=>e.bind(ue(t)).map((e=>e.length>0?[{text:"None",value:""}].concat(e):e))))})(e).then((n=>{const o=((e,t)=>{const n=e.dom,o=Y(e)?m.some(J(e.selection,t)):m.none(),r=t.bind((e=>m.from(n.getAttrib(e,"href")))),l=t.bind((e=>m.from(n.getAttrib(e,"target")))),s=t.bind((e=>Ce(n,e,"rel"))),a=t.bind((e=>Ce(n,e,"class")));return{url:r,text:o,title:t.bind((e=>Ce(n,e,"title"))),target:l,rel:s,linkClass:a}})(e,t);return{anchor:o,catalogs:{targets:we(e),rels:xe(e,o.target),classes:ye(e),anchor:ve(e),link:n},optNode:t,flags:{titleEnabled:P(e)}}})),Oe=e=>{const t=(e=>{const t=G(e);return Ae(e,t)})(e);t.then((t=>{const n=((e,t)=>n=>{const o=n.getData();if(!o.url.value)return oe(e),void n.close();const r=e=>m.from(o[e]).filter((n=>!x(t.anchor[e],n))),l={href:o.url.value,text:r("text"),target:r("target"),rel:r("rel"),class:r("linkClass"),title:r("title")},s={href:o.url.value,attach:void 0!==o.url.meta&&o.url.meta.attach?o.url.meta.attach:g};((e,t)=>k([fe,ke(A(e),E(e))],(e=>e(t))).fold((()=>Promise.resolve(t)),(n=>new Promise((o=>{((e,t,n)=>{const o=e.selection.getRng();pe.setEditorTimeout(e,(()=>{e.windowManager.confirm(t,(t=>{e.selection.setRng(o),n(t)}))}))})(e,n.message,(e=>{o(e?n.preprocess(t):t)}))})))))(e,l).then((t=>{ne(e,s,t)})),n.close()})(e,t);return((e,t,n)=>{const o=e.anchor.text.map((()=>({name:"text",type:"input",label:"Text to display"}))).toArray(),r=e.flags.titleEnabled?[{name:"title",type:"input",label:"Title"}]:[],l=((e,t)=>{const n=e.anchor,o=n.url.getOr("");return{url:{value:o,meta:{original:{value:o}}},text:n.text.getOr(""),title:n.title.getOr(""),anchor:o,link:o,rel:n.rel.getOr(""),target:n.target.or(t).getOr(""),linkClass:n.linkClass.getOr("")}})(e,m.from(N(n))),s=e.catalogs,a=he(l,s);return{title:"Insert/Edit Link",size:"normal",body:{type:"panel",items:f([[{name:"url",type:"urlinput",filetype:"file",label:"URL",picker_text:"Browse links"}],o,r,_([s.anchor.map(ge("anchor","Anchors")),s.rels.map(ge("rel","Rel")),s.targets.map(ge("target","Open link in...")),s.link.map(ge("link","Link list")),s.classes.map(ge("linkClass","Class"))])])},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:l,onChange:(e,{name:t})=>{a.onChange(e.getData,{name:t}).each((t=>{e.setData(t)}))},onSubmit:t}})(t,n,e)})).then((t=>{e.windowManager.open(t)}))};var Se=tinymce.util.Tools.resolve("tinymce.util.VK");const Ne=(e,t)=>{if(t){const o=$(t);if(/^#/.test(o)){const t=e.dom.select(`${o},[name="${n=o,((e,t)=>((e,t)=>""===t||e.length>=t.length&&e.substr(0,0+t.length)===t)(e,t))(n,"#")?(e=>e.substring(1))(n):n}"]`);t.length&&e.selection.scrollIntoView(t[0],!0)}else(e=>{const t=document.createElement("a");t.target="_blank",t.href=e,t.rel="noreferrer noopener";const n=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});document.dispatchEvent(n),((e,t)=>{document.body.appendChild(e),e.dispatchEvent(t),document.body.removeChild(e)})(t,n)})(t.href)}var n},Ee=(e,t)=>{const n=Q(e.dom.getParents(t));return w(1===n.length,n[0])},Re=e=>e.selection.isCollapsed()||(e=>{const t=e.selection.getRng(),n=t.startContainer;return q(n)&&t.startContainer===t.endContainer&&1===e.dom.select("img",n).length})(e)?Ee(e,e.selection.getStart()):(e=>{const t=W(e.selection.getRng());return w(t.length>0,t[0]).or(Ee(e,e.selection.getNode()))})(e),Te=e=>()=>{e.execCommand("mceLink",!1,{dialog:!0})},Le=(e,t)=>(e.on("NodeChange",t),()=>e.off("NodeChange",t)),Pe=e=>t=>{const n=()=>{t.setActive(!e.mode.isReadOnly()&&H(e,e.selection.getNode())),t.setEnabled(e.selection.isEditable())};return n(),Le(e,n)},Me=e=>t=>{const n=()=>{t.setEnabled(e.selection.isEditable())};return n(),Le(e,n)},De=e=>t=>{const n=e.dom.getParents(e.selection.getStart()),o=n=>{t.setEnabled((t=>{return X(t)||(n=e.selection.getRng(),W(n).length>0);var n})(n)&&e.selection.isEditable())};return o(n),Le(e,(e=>o(e.parents)))},Be=e=>{const t=(e=>{const t=(()=>{const e=(e=>{const t=(e=>{let t=e;return{get:()=>t,set:e=>{t=e}}})(m.none()),n=()=>t.get().each(e);return{clear:()=>{n(),t.set(m.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{n(),t.set(m.some(e))}}})(g);return{...e,on:t=>e.get().each(t)}})(),n=()=>t.get().or(Re(e));return e.on("contextmenu",(n=>{Ee(e,n.target).each(t.set)})),e.on("SelectionChange",(()=>{t.isSet()||Re(e).each(t.set)})),e.on("click",(n=>{t.clear();const o=Q(e.dom.getParents(n.target));1===o.length&&Se.metaKeyPressed(n)&&(n.preventDefault(),Ne(e,o[0]))})),e.on("keydown",(o=>{t.clear(),!o.isDefaultPrevented()&&13===o.keyCode&&(e=>!0===e.altKey&&!1===e.shiftKey&&!1===e.ctrlKey&&!1===e.metaKey)(o)&&n().each((t=>{o.preventDefault(),Ne(e,t)}))})),{gotoSelectedLink:()=>n().each((t=>Ne(e,t)))}})(e);((e,t)=>{e.ui.registry.addToggleButton("link",{icon:"link",tooltip:"Insert/edit link",shortcut:"Meta+K",onAction:Te(e),onSetup:Pe(e)}),e.ui.registry.addButton("openlink",{icon:"new-tab",tooltip:"Open link",onAction:t.gotoSelectedLink,onSetup:De(e)}),e.ui.registry.addButton("unlink",{icon:"unlink",tooltip:"Remove link",onAction:()=>oe(e),onSetup:De(e)})})(e,t),((e,t)=>{e.ui.registry.addMenuItem("openlink",{text:"Open link",icon:"new-tab",onAction:t.gotoSelectedLink,onSetup:De(e)}),e.ui.registry.addMenuItem("link",{icon:"link",text:"Link...",shortcut:"Meta+K",onAction:Te(e),onSetup:Me(e)}),e.ui.registry.addMenuItem("unlink",{icon:"unlink",text:"Remove link",onAction:()=>oe(e),onSetup:De(e)})})(e,t),(e=>{e.ui.registry.addContextMenu("link",{update:t=>e.dom.isEditable(t)?X(e.dom.getParents(t,"a"))?"link unlink openlink":"link":""})})(e),((e,t)=>{const n=t=>{const n=e.selection.getNode();return t.setEnabled(H(e,n)&&e.selection.isEditable()),g};e.ui.registry.addContextForm("quicklink",{launch:{type:"contextformtogglebutton",icon:"link",tooltip:"Link",onSetup:Pe(e)},label:"Link",predicate:t=>O(e)&&H(e,t),initValue:()=>G(e).fold((()=>""),$),commands:[{type:"contextformtogglebutton",icon:"link",tooltip:"Link",primary:!0,onSetup:t=>{const n=e.selection.getNode();return t.setActive(H(e,n)),Pe(e)(t)},onAction:t=>{const n=t.getValue(),o=(t=>{const n=G(e),o=Y(e);if(n.isNone()&&o){const o=J(e.selection,n);return w(0===o.length,t)}return m.none()})(n);ne(e,{href:n,attach:g},{href:n,text:o,title:m.none(),rel:m.none(),target:m.from(N(e)),class:m.none()}),(e=>{e.selection.collapse(!1)})(e),t.hide()}},{type:"contextformbutton",icon:"unlink",tooltip:"Remove link",onSetup:n,onAction:t=>{oe(e),t.hide()}},{type:"contextformbutton",icon:"new-tab",tooltip:"Open link",onSetup:n,onAction:e=>{t.gotoSelectedLink(),e.hide()}}]})})(e,t)};e.add("link",(e=>{(e=>{const t=e.options.register;t("link_assume_external_targets",{processor:e=>{const t=o(e)||a(e);return t?!0===e?{value:1,valid:t}:"http"===e||"https"===e?{value:e,valid:t}:{value:0,valid:t}:{valid:!1,message:"Must be a string or a boolean."}},default:!1}),t("link_context_toolbar",{processor:"boolean",default:!1}),t("link_list",{processor:e=>o(e)||c(e)||u(e,r)}),t("link_default_target",{processor:"string"}),t("link_default_protocol",{processor:"string",default:"https"}),t("link_target_list",{processor:e=>a(e)||u(e,r),default:!0}),t("link_rel_list",{processor:"object[]",default:[]}),t("link_class_list",{processor:"object[]",default:[]}),t("link_title",{processor:"boolean",default:!0}),t("allow_unsafe_link_target",{processor:"boolean",default:!1}),t("link_quicklink",{processor:"boolean",default:!1}),t("link_attributes_postprocess",{processor:"function"})})(e),(e=>{e.addCommand("mceLink",((t,n)=>{!0!==n?.dialog&&D(e)?e.dispatch("contexttoolbar-show",{toolbarKey:"quicklink"}):Oe(e)}))})(e),Be(e),(e=>{e.addShortcut("Meta+K","",(()=>{e.execCommand("mceLink")}))})(e)}))}();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TinyMCE version 8.
|
|
2
|
+
* TinyMCE version 8.2.0 (2025-10-23)
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
(function () {
|
|
@@ -45,6 +45,11 @@
|
|
|
45
45
|
* strict-null-checks
|
|
46
46
|
*/
|
|
47
47
|
class Optional {
|
|
48
|
+
tag;
|
|
49
|
+
value;
|
|
50
|
+
// Sneaky optimisation: every instance of Optional.none is identical, so just
|
|
51
|
+
// reuse the same object
|
|
52
|
+
static singletonNone = new Optional(false);
|
|
48
53
|
// The internal representation has a `tag` and a `value`, but both are
|
|
49
54
|
// private: able to be console.logged, but not able to be accessed by code
|
|
50
55
|
constructor(tag, value) {
|
|
@@ -212,7 +217,7 @@
|
|
|
212
217
|
*/
|
|
213
218
|
getOrDie(message) {
|
|
214
219
|
if (!this.tag) {
|
|
215
|
-
throw new Error(message
|
|
220
|
+
throw new Error(message ?? 'Called getOrDie on None');
|
|
216
221
|
}
|
|
217
222
|
else {
|
|
218
223
|
return this.value;
|
|
@@ -276,9 +281,6 @@
|
|
|
276
281
|
return this.tag ? `some(${this.value})` : 'none()';
|
|
277
282
|
}
|
|
278
283
|
}
|
|
279
|
-
// Sneaky optimisation: every instance of Optional.none is identical, so just
|
|
280
|
-
// reuse the same object
|
|
281
|
-
Optional.singletonNone = new Optional(false);
|
|
282
284
|
|
|
283
285
|
const nativeSlice = Array.prototype.slice;
|
|
284
286
|
const exists = (xs, pred) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=t=>!(t=>null==t)(t),r=t=>"function"==typeof t;const s=(t,e)=>t===e,n=()=>false;class o{constructor(t,e){this.tag=t,this.value=e}static some(t){return new o(!0,t)}static none(){return o.singletonNone}fold(t,e){return this.tag?e(this.value):t()}isSome(){return this.tag}isNone(){return!this.tag}map(t){return this.tag?o.some(t(this.value)):o.none()}bind(t){return this.tag?t(this.value):o.none()}exists(t){return this.tag&&t(this.value)}forall(t){return!this.tag||t(this.value)}filter(t){return!this.tag||t(this.value)?this:o.none()}getOr(t){return this.tag?this.value:t}or(t){return this.tag?this:t}getOrThunk(t){return this.tag?this.value:t()}orThunk(t){return this.tag?this:t()}getOrDie(t){if(this.tag)return this.value;throw new Error(
|
|
1
|
+
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=t=>!(t=>null==t)(t),r=t=>"function"==typeof t;const s=(t,e)=>t===e,n=()=>false;class o{tag;value;static singletonNone=new o(!1);constructor(t,e){this.tag=t,this.value=e}static some(t){return new o(!0,t)}static none(){return o.singletonNone}fold(t,e){return this.tag?e(this.value):t()}isSome(){return this.tag}isNone(){return!this.tag}map(t){return this.tag?o.some(t(this.value)):o.none()}bind(t){return this.tag?t(this.value):o.none()}exists(t){return this.tag&&t(this.value)}forall(t){return!this.tag||t(this.value)}filter(t){return!this.tag||t(this.value)?this:o.none()}getOr(t){return this.tag?this.value:t}or(t){return this.tag?this:t}getOrThunk(t){return this.tag?this.value:t()}orThunk(t){return this.tag?this:t()}getOrDie(t){if(this.tag)return this.value;throw new Error(t??"Called getOrDie on None")}static from(t){return e(t)?o.some(t):o.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(t){this.tag&&t(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}const a=Array.prototype.slice,i=(t,e,r)=>{for(let s=0,n=t.length;s<n;s++){const n=t[s];if(e(n,s))return o.some(n);if(r(n,s))break}return o.none()};r(Array.from)&&Array.from;const l=(t,e,r=s)=>t.exists((t=>r(t,e))),u=(c=/^\s+|\s+$/g,t=>t.replace(c,""));var c;const d=t=>{const e=(t=>{const e=a.call(t,0);return e.reverse(),e})(u(t).split("")),r=((t,e)=>{const r=t.length,s=new Array(r);for(let n=0;n<r;n++){const r=t[n];s[n]=e(r,n)}return s})(e,((t,e)=>{const r=t.toUpperCase().charCodeAt(0)-"A".charCodeAt(0)+1;return Math.pow(26,e)*r}));return s=(t,e)=>t+e,n=0,((t,e)=>{for(let r=0,s=t.length;r<s;r++)e(t[r],r)})(r,((t,e)=>{n=s(n,t)})),n;var s,n},g=t=>{if(--t<0)return"";{const e=t%26,r=Math.floor(t/26);return g(r)+String.fromCharCode("A".charCodeAt(0)+e)}},m=t=>{const e=parseInt(t.start,10);return l(t.listStyleType,"upper-alpha")?g(e):l(t.listStyleType,"lower-alpha")?g(e).toLowerCase():t.start},h=t=>t.options.get("forced_root_block");const p=t=>r=>e(r)&&t.test(r.nodeName),y=p(/^(OL|UL|DL)$/),v=p(/^(TH|TD)$/),f=p(/^(LI|DT|DD)$/),b=(t,e)=>i(t,y,v).exists((t=>t.nodeName===e&&!(t=>/\btox\-/.test(t.className))(t))),L=(t,e)=>{const r=t.selection.getNode();return e({parents:t.dom.getParents(r),element:r}),t.on("NodeChange",e),()=>t.off("NodeChange",e)},S=(t,e)=>{const r=t.dom.getParent(e,"ol,ul,dl");return((t,e)=>null!==e&&!t.dom.isEditable(e))(t,r)||!t.selection.isEditable()},C=t=>e(t)&&"ol"===t.nodeName.toLowerCase(),A=["OL","UL","DL"],T=A.join(","),N=(t,e)=>{const r=e||t.selection.getStart(!0);return t.dom.getParent(r,T,w(t,r))},w=(t,e)=>{const r=t.dom.getParents(e,t.dom.isBlock),s=(o=e=>(e=>e.nodeName.toLowerCase()!==h(t))(e)&&O(t.schema,e),i(r,o,n));var o;return s.getOr(t.getBody())},O=(t,e)=>!y(e)&&!f(e)&&(r=>{for(let n=0,o=r.length;n<o;n++)if(s=r[n],t.isValidChild(e.nodeName,s))return!0;var s;return!1})(A),x=(t,e)=>r=>(r.setEnabled(t.selection.isEditable()),L(t,(s=>{r.setActive(b(s.parents,e)),r.setEnabled(!S(t,s.element)&&t.selection.isEditable())}))),D=(t,e)=>r=>L(t,(s=>r.setEnabled(b(s.parents,e)&&!S(t,s.element))));t.add("lists",(t=>((t=>{t.addCommand("mceListProps",(()=>{(t=>{const e=N(t);C(e)&&!S(t,e)&&t.windowManager.open({title:"List Properties",body:{type:"panel",items:[{type:"input",name:"start",label:"Start list at number",inputMode:"numeric"}]},initialData:{start:m({start:t.dom.getAttrib(e,"start","1"),listStyleType:o.from(t.dom.getStyle(e,"list-style-type"))})},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],onSubmit:e=>{(t=>{switch((t=>/^[0-9]+$/.test(t)?2:/^[A-Z]+$/.test(t)?0:/^[a-z]+$/.test(t)?1:t.length>0?4:3)(t)){case 2:return o.some({listStyleType:o.none(),start:t});case 0:return o.some({listStyleType:o.some("upper-alpha"),start:d(t).toString()});case 1:return o.some({listStyleType:o.some("lower-alpha"),start:d(t).toString()});case 3:return o.some({listStyleType:o.none(),start:""});case 4:return o.none()}})(e.getData().start).each((e=>{t.execCommand("mceListUpdate",!1,{attrs:{start:"1"===e.start?"":e.start},styles:{"list-style-type":e.listStyleType.getOr("")}})})),e.close()}})})(t)}))})(t),(t=>{const e=e=>()=>t.execCommand(e);t.hasPlugin("advlist")||(t.ui.registry.addToggleButton("numlist",{icon:"ordered-list",active:!1,tooltip:"Numbered list",onAction:e("InsertOrderedList"),onSetup:x(t,"OL")}),t.ui.registry.addToggleButton("bullist",{icon:"unordered-list",active:!1,tooltip:"Bullet list",onAction:e("InsertUnorderedList"),onSetup:x(t,"UL")}))})(t),(t=>{const e={text:"List properties...",icon:"ordered-list",onAction:()=>t.execCommand("mceListProps"),onSetup:D(t,"OL")};t.ui.registry.addMenuItem("listprops",e),t.ui.registry.addContextMenu("lists",{update:e=>{const r=N(t,e);return C(r)?["listprops"]:[]}})})(t),(t=>({backspaceDelete:e=>{t.execCommand("mceListBackspaceDelete",!1,e)}}))(t))))}();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TinyMCE version 8.
|
|
2
|
+
* TinyMCE version 8.2.0 (2025-10-23)
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
(function () {
|
|
@@ -9,13 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
/* eslint-disable @typescript-eslint/no-wrapper-object-types */
|
|
11
11
|
const hasProto = (v, constructor, predicate) => {
|
|
12
|
-
var _a;
|
|
13
12
|
if (predicate(v, constructor.prototype)) {
|
|
14
13
|
return true;
|
|
15
14
|
}
|
|
16
15
|
else {
|
|
17
16
|
// String-based fallback time
|
|
18
|
-
return
|
|
17
|
+
return v.constructor?.name === constructor.name;
|
|
19
18
|
}
|
|
20
19
|
};
|
|
21
20
|
const typeOf = (x) => {
|
|
@@ -58,6 +57,11 @@
|
|
|
58
57
|
* strict-null-checks
|
|
59
58
|
*/
|
|
60
59
|
class Optional {
|
|
60
|
+
tag;
|
|
61
|
+
value;
|
|
62
|
+
// Sneaky optimisation: every instance of Optional.none is identical, so just
|
|
63
|
+
// reuse the same object
|
|
64
|
+
static singletonNone = new Optional(false);
|
|
61
65
|
// The internal representation has a `tag` and a `value`, but both are
|
|
62
66
|
// private: able to be console.logged, but not able to be accessed by code
|
|
63
67
|
constructor(tag, value) {
|
|
@@ -225,7 +229,7 @@
|
|
|
225
229
|
*/
|
|
226
230
|
getOrDie(message) {
|
|
227
231
|
if (!this.tag) {
|
|
228
|
-
throw new Error(message
|
|
232
|
+
throw new Error(message ?? 'Called getOrDie on None');
|
|
229
233
|
}
|
|
230
234
|
else {
|
|
231
235
|
return this.value;
|
|
@@ -289,9 +293,6 @@
|
|
|
289
293
|
return this.tag ? `some(${this.value})` : 'none()';
|
|
290
294
|
}
|
|
291
295
|
}
|
|
292
|
-
// Sneaky optimisation: every instance of Optional.none is identical, so just
|
|
293
|
-
// reuse the same object
|
|
294
|
-
Optional.singletonNone = new Optional(false);
|
|
295
296
|
|
|
296
297
|
const nativeSlice = Array.prototype.slice;
|
|
297
298
|
const nativePush = Array.prototype.push;
|
|
@@ -474,7 +475,6 @@
|
|
|
474
475
|
};
|
|
475
476
|
|
|
476
477
|
const guess = (url) => {
|
|
477
|
-
var _a;
|
|
478
478
|
const mimes = {
|
|
479
479
|
mp3: 'audio/mpeg',
|
|
480
480
|
m4a: 'audio/x-m4a',
|
|
@@ -484,7 +484,7 @@
|
|
|
484
484
|
ogg: 'video/ogg',
|
|
485
485
|
swf: 'application/x-shockwave-flash'
|
|
486
486
|
};
|
|
487
|
-
const fileEnd =
|
|
487
|
+
const fileEnd = url.toLowerCase().split('.').pop() ?? '';
|
|
488
488
|
return get$1(mimes, fileEnd).getOr('');
|
|
489
489
|
};
|
|
490
490
|
|
|
@@ -731,10 +731,9 @@
|
|
|
731
731
|
}
|
|
732
732
|
};
|
|
733
733
|
const dataToHtml = (editor, dataIn) => {
|
|
734
|
-
var _a;
|
|
735
734
|
const data = global$5.extend({}, dataIn);
|
|
736
735
|
if (!data.source) {
|
|
737
|
-
global$5.extend(data, htmlToData(
|
|
736
|
+
global$5.extend(data, htmlToData(data.embed ?? '', editor.schema));
|
|
738
737
|
if (!data.source) {
|
|
739
738
|
return '';
|
|
740
739
|
}
|
|
@@ -967,11 +966,10 @@
|
|
|
967
966
|
return hasDimensionsChanged(prevData, newData) && isEmbedIframe(newData.source, prevData.type);
|
|
968
967
|
};
|
|
969
968
|
const submitForm = (prevData, newData, editor) => {
|
|
970
|
-
var _a;
|
|
971
969
|
newData.embed =
|
|
972
970
|
shouldInsertAsNewIframe(prevData, newData) && hasDimensions(editor)
|
|
973
971
|
? dataToHtml(editor, { ...newData, embed: '' })
|
|
974
|
-
: updateHtml(
|
|
972
|
+
: updateHtml(newData.embed ?? '', newData, false, editor.schema);
|
|
975
973
|
// Only fetch the embed HTML content if the URL has changed from what it previously was
|
|
976
974
|
if (newData.embed && (prevData.source === newData.source || isCached(newData.source))) {
|
|
977
975
|
handleInsert(editor, newData.embed);
|
|
@@ -998,9 +996,8 @@
|
|
|
998
996
|
}
|
|
999
997
|
};
|
|
1000
998
|
const handleEmbed = (api) => {
|
|
1001
|
-
var _a;
|
|
1002
999
|
const data = unwrap(api.getData());
|
|
1003
|
-
const dataFromEmbed = htmlToData(
|
|
1000
|
+
const dataFromEmbed = htmlToData(data.embed ?? '', editor.schema);
|
|
1004
1001
|
api.setData(wrap(dataFromEmbed));
|
|
1005
1002
|
};
|
|
1006
1003
|
const handleUpdate = (api, sourceInput, prevData) => {
|
|
@@ -1184,7 +1181,6 @@
|
|
|
1184
1181
|
return placeHolder;
|
|
1185
1182
|
};
|
|
1186
1183
|
const createPreviewNode = (editor, node) => {
|
|
1187
|
-
var _a;
|
|
1188
1184
|
const name = node.name;
|
|
1189
1185
|
const previewWrapper = new global$2('span', 1);
|
|
1190
1186
|
previewWrapper.attr({
|
|
@@ -1194,7 +1190,7 @@
|
|
|
1194
1190
|
'class': 'mce-preview-object mce-object-' + name
|
|
1195
1191
|
});
|
|
1196
1192
|
retainAttributesAndInnerHtml(editor, node, previewWrapper);
|
|
1197
|
-
const styles = editor.dom.parseStyle(
|
|
1193
|
+
const styles = editor.dom.parseStyle(node.attr('style') ?? '');
|
|
1198
1194
|
const previewNode = new global$2(name, 1);
|
|
1199
1195
|
setDimensions(node, previewNode, styles);
|
|
1200
1196
|
previewNode.attr({
|
|
@@ -1229,10 +1225,9 @@
|
|
|
1229
1225
|
return previewWrapper;
|
|
1230
1226
|
};
|
|
1231
1227
|
const retainAttributesAndInnerHtml = (editor, sourceNode, targetNode) => {
|
|
1232
|
-
var _a;
|
|
1233
1228
|
// Prefix all attributes except internal (data-mce-*), width, height and style since we
|
|
1234
1229
|
// will add these to the placeholder
|
|
1235
|
-
const attribs =
|
|
1230
|
+
const attribs = sourceNode.attributes ?? [];
|
|
1236
1231
|
let ai = attribs.length;
|
|
1237
1232
|
while (ai--) {
|
|
1238
1233
|
const attrName = attribs[ai].name;
|
|
@@ -1323,7 +1318,6 @@
|
|
|
1323
1318
|
parser.addNodeFilter('iframe,video,audio,object,embed', placeHolderConverter(editor));
|
|
1324
1319
|
// Replaces placeholder images with real elements for video, object, iframe etc
|
|
1325
1320
|
serializer.addAttributeFilter('data-mce-object', (nodes, name) => {
|
|
1326
|
-
var _a;
|
|
1327
1321
|
let i = nodes.length;
|
|
1328
1322
|
while (i--) {
|
|
1329
1323
|
const node = nodes[i];
|
|
@@ -1352,7 +1346,7 @@
|
|
|
1352
1346
|
style: node.attr('style')
|
|
1353
1347
|
});
|
|
1354
1348
|
// Unprefix all placeholder attributes
|
|
1355
|
-
const attribs =
|
|
1349
|
+
const attribs = node.attributes ?? [];
|
|
1356
1350
|
let ai = attribs.length;
|
|
1357
1351
|
while (ai--) {
|
|
1358
1352
|
const attrName = attribs[ai].name;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(r=o=e,(a=String).prototype.isPrototypeOf(r)||(null===(s=o.constructor)||void 0===s?void 0:s.name)===a.name)?"string":t;var r,o,a,s})(t)===e,r=t("string"),o=t("object"),a=t("array"),s=e=>!(e=>null==e)(e),i=e=>"function"==typeof e;class n{constructor(e,t){this.tag=e,this.value=t}static some(e){return new n(!0,e)}static none(){return n.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?n.some(e(this.value)):n.none()}bind(e){return this.tag?e(this.value):n.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:n.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return s(e)?n.some(e):n.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}n.singletonNone=new n(!1),Array.prototype.slice;const l=Array.prototype.push,c=(e,t)=>{for(let r=0,o=e.length;r<o;r++)t(e[r],r)},m=e=>{const t=[];for(let r=0,o=e.length;r<o;++r){if(!a(e[r]))throw new Error("Arr.flatten item "+r+" was not an array, input: "+e);l.apply(t,e[r])}return t};i(Array.from)&&Array.from;const u=Object.keys,d=Object.hasOwnProperty,h=(e,t)=>p(e,t)?n.from(e[t]):n.none(),p=(e,t)=>d.call(e,t),g=e=>t=>t.options.get(e),b=g("audio_template_callback"),w=g("video_template_callback"),f=g("iframe_template_callback"),v=g("media_live_embeds"),y=g("media_filter_html"),x=g("media_url_resolver"),_=g("media_alt_source"),k=g("media_poster"),j=g("media_dimensions");var A=tinymce.util.Tools.resolve("tinymce.util.Tools"),O=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),S=tinymce.util.Tools.resolve("tinymce.html.DomParser");const $=O.DOM,C=e=>e.replace(/px$/,""),T=e=>{const t=e.attr("style"),r=t?$.parseStyle(t):{};return{type:"ephox-embed-iri",source:e.attr("data-ephox-embed-iri"),altsource:"",poster:"",width:h(r,"max-width").map(C).getOr(""),height:h(r,"max-height").map(C).getOr("")}},z=(e,t)=>{let r={};for(let o=S({validate:!1,forced_root_block:!1},t).parse(e);o;o=o.walk())if(1===o.type){const e=o.name;if(o.attr("data-ephox-embed-iri")){r=T(o);break}r.source||"param"!==e||(r.source=o.attr("movie")),"iframe"!==e&&"object"!==e&&"embed"!==e&&"video"!==e&&"audio"!==e||(r.type||(r.type=e),r=A.extend(o.attributes.map,r)),"source"===e&&(r.source?r.altsource||(r.altsource=o.attr("src")):r.source=o.attr("src")),"img"!==e||r.poster||(r.poster=o.attr("src"))}return r.source=r.source||r.src||"",r.altsource=r.altsource||"",r.poster=r.poster||"",r},D=e=>{var t;const r=null!==(t=e.toLowerCase().split(".").pop())&&void 0!==t?t:"";return h({mp3:"audio/mpeg",m4a:"audio/x-m4a",wav:"audio/wav",mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",swf:"application/x-shockwave-flash"},r).getOr("")};var F=tinymce.util.Tools.resolve("tinymce.html.Node"),M=tinymce.util.Tools.resolve("tinymce.html.Serializer");const N=(e,t={})=>S({forced_root_block:!1,validate:!1,allow_conditional_comments:!0,...t},e),P=O.DOM,R=e=>/^[0-9.]+$/.test(e)?e+"px":e,E=(e,t)=>{const r=t.attr("style"),o=r?P.parseStyle(r):{};s(e.width)&&(o["max-width"]=R(e.width)),s(e.height)&&(o["max-height"]=R(e.height)),t.attr("style",P.serializeStyle(o))},U=["source","altsource"],L=(e,t,r,o)=>{let a=0,s=0;const i=N(o);i.addNodeFilter("source",(e=>a=e.length));const n=i.parse(e);for(let e=n;e;e=e.walk())if(1===e.type){const o=e.name;if(e.attr("data-ephox-embed-iri")){E(t,e);break}switch(o){case"video":case"object":case"embed":case"img":case"iframe":void 0!==t.height&&void 0!==t.width&&(e.attr("width",t.width),e.attr("height",t.height))}if(r)switch(o){case"video":e.attr("poster",t.poster),e.attr("src",null);for(let r=a;r<2;r++)if(t[U[r]]){const o=new F("source",1);o.attr("src",t[U[r]]),o.attr("type",t[U[r]+"mime"]||null),e.append(o)}break;case"iframe":e.attr("src",t.source);break;case"object":const r=e.getAll("img").length>0;if(t.poster&&!r){e.attr("src",t.poster);const r=new F("img",1);r.attr("src",t.poster),r.attr("width",t.width),r.attr("height",t.height),e.append(r)}break;case"source":if(s<2&&(e.attr("src",t[U[s]]),e.attr("type",t[U[s]+"mime"]||null),!t[U[s]])){e.remove();continue}s++;break;case"img":t.poster||e.remove()}}return M({},o).serialize(n)},I=[{regex:/youtu\.be\/([\w\-_\?&=.]+)/i,type:"iframe",w:560,h:314,url:"www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/youtube\.com(.+)v=([^&]+)(&([a-z0-9&=\-_]+))?/i,type:"iframe",w:560,h:314,url:"www.youtube.com/embed/$2?$4",allowFullscreen:!0},{regex:/youtube.com\/embed\/([a-z0-9\?&=\-_]+)/i,type:"iframe",w:560,h:314,url:"www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/vimeo\.com\/([0-9]+)\?h=(\w+)/,type:"iframe",w:425,h:350,url:"player.vimeo.com/video/$1?h=$2&title=0&byline=0&portrait=0&color=8dc7dc",allowFullscreen:!0},{regex:/vimeo\.com\/(.*)\/([0-9]+)\?h=(\w+)/,type:"iframe",w:425,h:350,url:"player.vimeo.com/video/$2?h=$3&title=0&byline=0",allowFullscreen:!0},{regex:/vimeo\.com\/([0-9]+)/,type:"iframe",w:425,h:350,url:"player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc",allowFullscreen:!0},{regex:/vimeo\.com\/(.*)\/([0-9]+)/,type:"iframe",w:425,h:350,url:"player.vimeo.com/video/$2?title=0&byline=0",allowFullscreen:!0},{regex:/maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/,type:"iframe",w:425,h:350,url:'maps.google.com/maps/ms?msid=$2&output=embed"',allowFullscreen:!1},{regex:/dailymotion\.com\/video\/([^_]+)/,type:"iframe",w:480,h:270,url:"www.dailymotion.com/embed/video/$1",allowFullscreen:!0},{regex:/dai\.ly\/([^_]+)/,type:"iframe",w:480,h:270,url:"www.dailymotion.com/embed/video/$1",allowFullscreen:!0}],B=(e,t)=>{const r=(e=>{const t=e.match(/^(https?:\/\/|www\.)(.+)$/i);return t&&t.length>1?"www."===t[1]?"https://":t[1]:"https://"})(t),o=e.regex.exec(t);let a=r+e.url;if(s(o))for(let e=0;e<o.length;e++)a=a.replace("$"+e,(()=>o[e]?o[e]:""));return a.replace(/\?$/,"")},G=e=>{const t=I.filter((t=>t.regex.test(e)));return t.length>0?A.extend({},t[0],{url:B(t[0],e)}):null},W=(e,t)=>{var r;const o=A.extend({},t);if(!o.source&&(A.extend(o,z(null!==(r=o.embed)&&void 0!==r?r:"",e.schema)),!o.source))return"";o.altsource||(o.altsource=""),o.poster||(o.poster=""),o.source=e.convertURL(o.source,"source"),o.altsource=e.convertURL(o.altsource,"source"),o.sourcemime=D(o.source),o.altsourcemime=D(o.altsource),o.poster=e.convertURL(o.poster,"poster");const a=G(o.source);if(a&&(o.source=a.url,o.type=a.type,o.allowfullscreen=a.allowFullscreen,o.width=o.width||String(a.w),o.height=o.height||String(a.h)),o.embed)return L(o.embed,o,!0,e.schema);{const t=b(e),r=w(e),a=f(e);return o.width=o.width||"300",o.height=o.height||"150",A.each(o,((t,r)=>{o[r]=e.dom.encode(""+t)})),"iframe"===o.type?((e,t)=>{if(t)return t(e);{const t=e.allowfullscreen?' allowFullscreen="1"':"";return'<iframe src="'+e.source+'" width="'+e.width+'" height="'+e.height+'"'+t+"></iframe>"}})(o,a):"application/x-shockwave-flash"===o.sourcemime?(e=>{let t='<object data="'+e.source+'" width="'+e.width+'" height="'+e.height+'" type="application/x-shockwave-flash">';return e.poster&&(t+='<img src="'+e.poster+'" width="'+e.width+'" height="'+e.height+'" />'),t+="</object>",t})(o):-1!==o.sourcemime.indexOf("audio")?((e,t)=>t?t(e):'<audio controls="controls" src="'+e.source+'">'+(e.altsource?'\n<source src="'+e.altsource+'"'+(e.altsourcemime?' type="'+e.altsourcemime+'"':"")+" />\n":"")+"</audio>")(o,t):((e,t)=>t?t(e):'<video width="'+e.width+'" height="'+e.height+'"'+(e.poster?' poster="'+e.poster+'"':"")+' controls="controls">\n<source src="'+e.source+'"'+(e.sourcemime?' type="'+e.sourcemime+'"':"")+" />\n"+(e.altsource?'<source src="'+e.altsource+'"'+(e.altsourcemime?' type="'+e.altsourcemime+'"':"")+" />\n":"")+"</video>")(o,r)}},q=e=>e.hasAttribute("data-mce-object")||e.hasAttribute("data-ephox-embed-iri"),H={},J=e=>t=>W(e,t),K=(e,t)=>{const r=x(e);return r?((e,t,r)=>new Promise(((o,a)=>{const s=r=>(r.html&&(H[e.source]=r),o({url:e.source,html:r.html?r.html:t(e)}));H[e.source]?s(H[e.source]):r({url:e.source}).then(s).catch(a)})))(t,J(e),r):((e,t)=>Promise.resolve({html:t(e),url:e.source}))(t,J(e))},Q=(e,t)=>{const r={};return h(e,"dimensions").each((e=>{c(["width","height"],(o=>{h(t,o).orThunk((()=>h(e,o))).each((e=>r[o]=e))}))})),r},V=(e,t)=>{const r=t&&"dimensions"!==t?((e,t)=>h(t,e).bind((e=>h(e,"meta"))))(t,e).getOr({}):{},a=((e,t,r)=>a=>{const s=()=>h(e,a),i=()=>h(t,a),l=e=>h(e,"value").bind((e=>e.length>0?n.some(e):n.none()));return{[a]:(a===r?s().bind((e=>o(e)?l(e).orThunk(i):i().orThunk((()=>n.from(e))))):i().orThunk((()=>s().bind((e=>o(e)?l(e):n.from(e)))))).getOr("")}})(e,r,t);return{...a("source"),...a("altsource"),...a("poster"),...a("embed"),...Q(e,r)}},X=e=>{const t={...e,source:{value:h(e,"source").getOr("")},altsource:{value:h(e,"altsource").getOr("")},poster:{value:h(e,"poster").getOr("")}};return c(["width","height"],(r=>{h(e,r).each((e=>{const o=t.dimensions||{};o[r]=e,t.dimensions=o}))})),t},Y=e=>t=>{const r=t&&t.msg?"Media embed handler error: "+t.msg:"Media embed handler threw unknown error.";e.notificationManager.open({type:"error",text:r})},Z=(e,t)=>o=>{if(r(o.url)&&o.url.trim().length>0){const r=o.html,a={...z(r,t.schema),source:o.url,embed:r};e.setData(X(a))}},ee=(e,t)=>{const r=e.dom.select("*[data-mce-object]");e.insertContent(t),((e,t)=>{const r=e.dom.select("*[data-mce-object]");for(let e=0;e<t.length;e++)for(let o=r.length-1;o>=0;o--)t[e]===r[o]&&r.splice(o,1);e.selection.select(r[0])})(e,r),e.nodeChanged()},te=(e,t)=>s(t)&&"ephox-embed-iri"===t&&s(G(e)),re=(e,t)=>((e,t)=>e.width!==t.width||e.height!==t.height)(e,t)&&te(t.source,e.type),oe=e=>{const t=(e=>{const t=e.selection.getNode(),r=q(t)?e.serializer.serialize(t,{selection:!0}):"",o=z(r,e.schema),a=(()=>{if(te(o.source,o.type)){const r=e.dom.getRect(t);return{width:r.w.toString().replace(/px$/,""),height:r.h.toString().replace(/px$/,"")}}return{}})();return{embed:r,...o,...a}})(e),r=(e=>{let t=e;return{get:()=>t,set:e=>{t=e}}})(t),o=X(t),a=j(e)?[{type:"sizeinput",name:"dimensions",label:"Constrain proportions",constrain:!0}]:[],s={title:"General",name:"general",items:m([[{name:"source",type:"urlinput",filetype:"media",label:"Source",picker_text:"Browse files"}],a])},i=[];_(e)&&i.push({name:"altsource",type:"urlinput",filetype:"media",label:"Alternative source URL"}),k(e)&&i.push({name:"poster",type:"urlinput",filetype:"image",label:"Media poster (Image URL)"});const n={title:"Advanced",name:"advanced",items:i},l=[s,{title:"Embed",items:[{type:"textarea",name:"embed",label:"Paste your embed code below:"}]}];i.length>0&&l.push(n);const c={type:"tabpanel",tabs:l},u=e.windowManager.open({title:"Insert/Edit Media",size:"normal",body:c,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],onSubmit:t=>{const o=V(t.getData());((e,t,r)=>{var o,a;t.embed=re(e,t)&&j(r)?W(r,{...t,embed:""}):L(null!==(o=t.embed)&&void 0!==o?o:"",t,!1,r.schema),t.embed&&(e.source===t.source||(a=t.source,p(H,a)))?ee(r,t.embed):K(r,t).then((e=>{ee(r,e.html)})).catch(Y(r))})(r.get(),o,e),t.close()},onChange:(t,o)=>{switch(o.name){case"source":((t,r)=>{const o=V(r.getData(),"source");t.source!==o.source&&(Z(u,e)({url:o.source,html:""}),K(e,o).then(Z(u,e)).catch(Y(e)))})(r.get(),t);break;case"embed":(t=>{var r;const o=V(t.getData()),a=z(null!==(r=o.embed)&&void 0!==r?r:"",e.schema);t.setData(X(a))})(t);break;case"dimensions":case"altsource":case"poster":((t,r,o)=>{const a=V(t.getData(),r),s=re(o,a)&&j(e)?{...a,embed:""}:a,i=W(e,s);t.setData(X({...s,embed:i}))})(t,o.name,r.get())}r.set(V(t.getData()))},initialData:o})};var ae=tinymce.util.Tools.resolve("tinymce.Env");const se=e=>{const t=e.name;return"iframe"===t||"video"===t||"audio"===t},ie=(e,t,r,o=null)=>{const a=e.attr(r);return s(a)?a:p(t,r)?null:o},ne=(e,t,r)=>{const o="img"===t.name||"video"===e.name,a=o?"300":null,s="audio"===e.name?"30":"150",i=o?s:null;t.attr({width:ie(e,r,"width",a),height:ie(e,r,"height",i)})},le=(e,t)=>{const r=t.name,o=new F("img",1);return me(e,t,o),ne(t,o,{}),o.attr({style:t.attr("style"),src:ae.transparentSrc,"data-mce-object":r,class:"mce-object mce-object-"+r}),o},ce=(e,t)=>{var r;const o=t.name,a=new F("span",1);a.attr({contentEditable:"false",style:t.attr("style"),"data-mce-object":o,class:"mce-preview-object mce-object-"+o}),me(e,t,a);const i=e.dom.parseStyle(null!==(r=t.attr("style"))&&void 0!==r?r:""),n=new F(o,1);if(ne(t,n,i),n.attr({src:t.attr("src"),style:t.attr("style"),class:t.attr("class")}),"iframe"===o)n.attr({allowfullscreen:t.attr("allowfullscreen"),frameborder:"0",sandbox:t.attr("sandbox"),referrerpolicy:t.attr("referrerpolicy")});else{c(["controls","crossorigin","currentTime","loop","muted","poster","preload"],(e=>{n.attr(e,t.attr(e))}));const r=a.attr("data-mce-html");s(r)&&((e,t,r,o)=>{const a=N(e.schema).parse(o,{context:t});for(;a.firstChild;)r.append(a.firstChild)})(e,o,n,unescape(r))}const l=new F("span",1);return l.attr("class","mce-shim"),a.append(n),a.append(l),a},me=(e,t,r)=>{var o;const a=null!==(o=t.attributes)&&void 0!==o?o:[];let s=a.length;for(;s--;){const t=a[s].name;let o=a[s].value;"width"===t||"height"===t||"style"===t||(n="data-mce-",(i=t).length>=9&&i.substr(0,9)===n)||("data"!==t&&"src"!==t||(o=e.convertURL(o,t)),r.attr("data-mce-p-"+t,o))}var i,n;const l=M({inner:!0},e.schema),m=new F("div",1);c(t.children(),(e=>m.append(e)));const u=l.serialize(m);u&&(r.attr("data-mce-html",escape(u)),r.empty())},ue=e=>{const t=e.attr("class");return r(t)&&/\btiny-pageembed\b/.test(t)},de=e=>{let t=e;for(;t=t.parent;)if(t.attr("data-ephox-embed-iri")||ue(t))return!0;return!1},he=(e,t,r)=>{const o=(0,e.options.get)("xss_sanitization"),a=y(e);return N(e.schema,{sanitize:o,validate:a}).parse(r,{context:t})},pe=e=>t=>{const r=()=>{t.setEnabled(e.selection.isEditable())};return e.on("NodeChange",r),r(),()=>{e.off("NodeChange",r)}};e.add("media",(e=>((e=>{const t=e.options.register;t("audio_template_callback",{processor:"function"}),t("video_template_callback",{processor:"function"}),t("iframe_template_callback",{processor:"function"}),t("media_live_embeds",{processor:"boolean",default:!0}),t("media_filter_html",{processor:"boolean",default:!0}),t("media_url_resolver",{processor:"function"}),t("media_alt_source",{processor:"boolean",default:!0}),t("media_poster",{processor:"boolean",default:!0}),t("media_dimensions",{processor:"boolean",default:!0})})(e),(e=>{e.addCommand("mceMedia",(()=>{oe(e)}))})(e),(e=>{const t=()=>e.execCommand("mceMedia");e.ui.registry.addToggleButton("media",{tooltip:"Insert/edit media",icon:"embed",onAction:t,onSetup:t=>{const r=e.selection;t.setActive(q(r.getNode()));const o=r.selectorChangedWithUnbind("img[data-mce-object],span[data-mce-object],div[data-ephox-embed-iri]",t.setActive).unbind,a=pe(e)(t);return()=>{o(),a()}}}),e.ui.registry.addMenuItem("media",{icon:"embed",text:"Media...",onAction:t,onSetup:pe(e)})})(e),(e=>{e.on("ResolveName",(e=>{let t;1===e.target.nodeType&&(t=e.target.getAttribute("data-mce-object"))&&(e.name=t)}))})(e),(e=>{e.on("PreInit",(()=>{const{schema:t,serializer:r,parser:o}=e,a=t.getBoolAttrs();c("webkitallowfullscreen mozallowfullscreen".split(" "),(e=>{a[e]={}})),((e,t)=>{const r=u(e);for(let o=0,a=r.length;o<a;o++){const a=r[o];t(e[a],a)}})({embed:["wmode"]},((e,r)=>{const o=t.getElementRule(r);o&&c(e,(e=>{o.attributes[e]={},o.attributesOrder.push(e)}))})),o.addNodeFilter("iframe,video,audio,object,embed",(e=>t=>{let r,o=t.length;for(;o--;)r=t[o],r.parent&&(r.parent.attr("data-mce-object")||(se(r)&&v(e)?de(r)||r.replace(ce(e,r)):de(r)||r.replace(le(e,r))))})(e)),r.addAttributeFilter("data-mce-object",((t,r)=>{var o;let a=t.length;for(;a--;){const s=t[a];if(!s.parent)continue;const i=s.attr(r),n=new F(i,1);if("audio"!==i){const e=s.attr("class");e&&-1!==e.indexOf("mce-preview-object")&&s.firstChild?n.attr({width:s.firstChild.attr("width"),height:s.firstChild.attr("height")}):n.attr({width:s.attr("width"),height:s.attr("height")})}n.attr({style:s.attr("style")});const l=null!==(o=s.attributes)&&void 0!==o?o:[];let m=l.length;for(;m--;){const e=l[m].name;0===e.indexOf("data-mce-p-")&&n.attr(e.substr(11),l[m].value)}const u=s.attr("data-mce-html");if(u){const t=he(e,i,unescape(u));c(t.children(),(e=>n.append(e)))}s.replace(n)}}))})),e.on("SetContent",(()=>{const t=e.dom;c(t.select("span.mce-preview-object"),(e=>{0===t.select("span.mce-shim",e).length&&t.add(e,"span",{class:"mce-shim"})}))}))})(e),(e=>{e.on("mousedown",(t=>{const r=e.dom.getParent(t.target,".mce-preview-object");r&&"2"===e.dom.getAttrib(r,"data-mce-selected")&&t.stopImmediatePropagation()})),e.on("click keyup touchend",(()=>{const t=e.selection.getNode();t&&e.dom.hasClass(t,"mce-preview-object")&&e.dom.getAttrib(t,"data-mce-selected")&&t.setAttribute("data-mce-selected","2")})),e.on("ObjectResized",(t=>{const r=t.target;if(r.getAttribute("data-mce-object")){let o=r.getAttribute("data-mce-html");o&&(o=unescape(o),r.setAttribute("data-mce-html",escape(L(o,{width:String(t.width),height:String(t.height)},!1,e.schema))))}}))})(e),(e=>({showDialog:()=>{oe(e)}}))(e))))}();
|
|
1
|
+
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(r=o=e,(a=String).prototype.isPrototypeOf(r)||o.constructor?.name===a.name)?"string":t;var r,o,a})(t)===e,r=t("string"),o=t("object"),a=t("array"),s=e=>!(e=>null==e)(e),i=e=>"function"==typeof e;class n{tag;value;static singletonNone=new n(!1);constructor(e,t){this.tag=e,this.value=t}static some(e){return new n(!0,e)}static none(){return n.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?n.some(e(this.value)):n.none()}bind(e){return this.tag?e(this.value):n.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:n.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(e??"Called getOrDie on None")}static from(e){return s(e)?n.some(e):n.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}Array.prototype.slice;const c=Array.prototype.push,l=(e,t)=>{for(let r=0,o=e.length;r<o;r++)t(e[r],r)},m=e=>{const t=[];for(let r=0,o=e.length;r<o;++r){if(!a(e[r]))throw new Error("Arr.flatten item "+r+" was not an array, input: "+e);c.apply(t,e[r])}return t};i(Array.from)&&Array.from;const u=Object.keys,d=Object.hasOwnProperty,h=(e,t)=>p(e,t)?n.from(e[t]):n.none(),p=(e,t)=>d.call(e,t),g=e=>t=>t.options.get(e),b=g("audio_template_callback"),w=g("video_template_callback"),f=g("iframe_template_callback"),y=g("media_live_embeds"),v=g("media_filter_html"),x=g("media_url_resolver"),_=g("media_alt_source"),k=g("media_poster"),j=g("media_dimensions");var A=tinymce.util.Tools.resolve("tinymce.util.Tools"),O=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),S=tinymce.util.Tools.resolve("tinymce.html.DomParser");const $=O.DOM,C=e=>e.replace(/px$/,""),T=e=>{const t=e.attr("style"),r=t?$.parseStyle(t):{};return{type:"ephox-embed-iri",source:e.attr("data-ephox-embed-iri"),altsource:"",poster:"",width:h(r,"max-width").map(C).getOr(""),height:h(r,"max-height").map(C).getOr("")}},z=(e,t)=>{let r={};for(let o=S({validate:!1,forced_root_block:!1},t).parse(e);o;o=o.walk())if(1===o.type){const e=o.name;if(o.attr("data-ephox-embed-iri")){r=T(o);break}r.source||"param"!==e||(r.source=o.attr("movie")),"iframe"!==e&&"object"!==e&&"embed"!==e&&"video"!==e&&"audio"!==e||(r.type||(r.type=e),r=A.extend(o.attributes.map,r)),"source"===e&&(r.source?r.altsource||(r.altsource=o.attr("src")):r.source=o.attr("src")),"img"!==e||r.poster||(r.poster=o.attr("src"))}return r.source=r.source||r.src||"",r.altsource=r.altsource||"",r.poster=r.poster||"",r},D=e=>{const t=e.toLowerCase().split(".").pop()??"";return h({mp3:"audio/mpeg",m4a:"audio/x-m4a",wav:"audio/wav",mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",swf:"application/x-shockwave-flash"},t).getOr("")};var F=tinymce.util.Tools.resolve("tinymce.html.Node"),M=tinymce.util.Tools.resolve("tinymce.html.Serializer");const N=(e,t={})=>S({forced_root_block:!1,validate:!1,allow_conditional_comments:!0,...t},e),P=O.DOM,R=e=>/^[0-9.]+$/.test(e)?e+"px":e,E=(e,t)=>{const r=t.attr("style"),o=r?P.parseStyle(r):{};s(e.width)&&(o["max-width"]=R(e.width)),s(e.height)&&(o["max-height"]=R(e.height)),t.attr("style",P.serializeStyle(o))},U=["source","altsource"],L=(e,t,r,o)=>{let a=0,s=0;const i=N(o);i.addNodeFilter("source",(e=>a=e.length));const n=i.parse(e);for(let e=n;e;e=e.walk())if(1===e.type){const o=e.name;if(e.attr("data-ephox-embed-iri")){E(t,e);break}switch(o){case"video":case"object":case"embed":case"img":case"iframe":void 0!==t.height&&void 0!==t.width&&(e.attr("width",t.width),e.attr("height",t.height))}if(r)switch(o){case"video":e.attr("poster",t.poster),e.attr("src",null);for(let r=a;r<2;r++)if(t[U[r]]){const o=new F("source",1);o.attr("src",t[U[r]]),o.attr("type",t[U[r]+"mime"]||null),e.append(o)}break;case"iframe":e.attr("src",t.source);break;case"object":const r=e.getAll("img").length>0;if(t.poster&&!r){e.attr("src",t.poster);const r=new F("img",1);r.attr("src",t.poster),r.attr("width",t.width),r.attr("height",t.height),e.append(r)}break;case"source":if(s<2&&(e.attr("src",t[U[s]]),e.attr("type",t[U[s]+"mime"]||null),!t[U[s]])){e.remove();continue}s++;break;case"img":t.poster||e.remove()}}return M({},o).serialize(n)},I=[{regex:/youtu\.be\/([\w\-_\?&=.]+)/i,type:"iframe",w:560,h:314,url:"www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/youtube\.com(.+)v=([^&]+)(&([a-z0-9&=\-_]+))?/i,type:"iframe",w:560,h:314,url:"www.youtube.com/embed/$2?$4",allowFullscreen:!0},{regex:/youtube.com\/embed\/([a-z0-9\?&=\-_]+)/i,type:"iframe",w:560,h:314,url:"www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/vimeo\.com\/([0-9]+)\?h=(\w+)/,type:"iframe",w:425,h:350,url:"player.vimeo.com/video/$1?h=$2&title=0&byline=0&portrait=0&color=8dc7dc",allowFullscreen:!0},{regex:/vimeo\.com\/(.*)\/([0-9]+)\?h=(\w+)/,type:"iframe",w:425,h:350,url:"player.vimeo.com/video/$2?h=$3&title=0&byline=0",allowFullscreen:!0},{regex:/vimeo\.com\/([0-9]+)/,type:"iframe",w:425,h:350,url:"player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc",allowFullscreen:!0},{regex:/vimeo\.com\/(.*)\/([0-9]+)/,type:"iframe",w:425,h:350,url:"player.vimeo.com/video/$2?title=0&byline=0",allowFullscreen:!0},{regex:/maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/,type:"iframe",w:425,h:350,url:'maps.google.com/maps/ms?msid=$2&output=embed"',allowFullscreen:!1},{regex:/dailymotion\.com\/video\/([^_]+)/,type:"iframe",w:480,h:270,url:"www.dailymotion.com/embed/video/$1",allowFullscreen:!0},{regex:/dai\.ly\/([^_]+)/,type:"iframe",w:480,h:270,url:"www.dailymotion.com/embed/video/$1",allowFullscreen:!0}],B=(e,t)=>{const r=(e=>{const t=e.match(/^(https?:\/\/|www\.)(.+)$/i);return t&&t.length>1?"www."===t[1]?"https://":t[1]:"https://"})(t),o=e.regex.exec(t);let a=r+e.url;if(s(o))for(let e=0;e<o.length;e++)a=a.replace("$"+e,(()=>o[e]?o[e]:""));return a.replace(/\?$/,"")},G=e=>{const t=I.filter((t=>t.regex.test(e)));return t.length>0?A.extend({},t[0],{url:B(t[0],e)}):null},W=(e,t)=>{const r=A.extend({},t);if(!r.source&&(A.extend(r,z(r.embed??"",e.schema)),!r.source))return"";r.altsource||(r.altsource=""),r.poster||(r.poster=""),r.source=e.convertURL(r.source,"source"),r.altsource=e.convertURL(r.altsource,"source"),r.sourcemime=D(r.source),r.altsourcemime=D(r.altsource),r.poster=e.convertURL(r.poster,"poster");const o=G(r.source);if(o&&(r.source=o.url,r.type=o.type,r.allowfullscreen=o.allowFullscreen,r.width=r.width||String(o.w),r.height=r.height||String(o.h)),r.embed)return L(r.embed,r,!0,e.schema);{const t=b(e),o=w(e),a=f(e);return r.width=r.width||"300",r.height=r.height||"150",A.each(r,((t,o)=>{r[o]=e.dom.encode(""+t)})),"iframe"===r.type?((e,t)=>{if(t)return t(e);{const t=e.allowfullscreen?' allowFullscreen="1"':"";return'<iframe src="'+e.source+'" width="'+e.width+'" height="'+e.height+'"'+t+"></iframe>"}})(r,a):"application/x-shockwave-flash"===r.sourcemime?(e=>{let t='<object data="'+e.source+'" width="'+e.width+'" height="'+e.height+'" type="application/x-shockwave-flash">';return e.poster&&(t+='<img src="'+e.poster+'" width="'+e.width+'" height="'+e.height+'" />'),t+="</object>",t})(r):-1!==r.sourcemime.indexOf("audio")?((e,t)=>t?t(e):'<audio controls="controls" src="'+e.source+'">'+(e.altsource?'\n<source src="'+e.altsource+'"'+(e.altsourcemime?' type="'+e.altsourcemime+'"':"")+" />\n":"")+"</audio>")(r,t):((e,t)=>t?t(e):'<video width="'+e.width+'" height="'+e.height+'"'+(e.poster?' poster="'+e.poster+'"':"")+' controls="controls">\n<source src="'+e.source+'"'+(e.sourcemime?' type="'+e.sourcemime+'"':"")+" />\n"+(e.altsource?'<source src="'+e.altsource+'"'+(e.altsourcemime?' type="'+e.altsourcemime+'"':"")+" />\n":"")+"</video>")(r,o)}},q=e=>e.hasAttribute("data-mce-object")||e.hasAttribute("data-ephox-embed-iri"),H={},J=e=>t=>W(e,t),K=(e,t)=>{const r=x(e);return r?((e,t,r)=>new Promise(((o,a)=>{const s=r=>(r.html&&(H[e.source]=r),o({url:e.source,html:r.html?r.html:t(e)}));H[e.source]?s(H[e.source]):r({url:e.source}).then(s).catch(a)})))(t,J(e),r):((e,t)=>Promise.resolve({html:t(e),url:e.source}))(t,J(e))},Q=(e,t)=>{const r={};return h(e,"dimensions").each((e=>{l(["width","height"],(o=>{h(t,o).orThunk((()=>h(e,o))).each((e=>r[o]=e))}))})),r},V=(e,t)=>{const r=t&&"dimensions"!==t?((e,t)=>h(t,e).bind((e=>h(e,"meta"))))(t,e).getOr({}):{},a=((e,t,r)=>a=>{const s=()=>h(e,a),i=()=>h(t,a),c=e=>h(e,"value").bind((e=>e.length>0?n.some(e):n.none()));return{[a]:(a===r?s().bind((e=>o(e)?c(e).orThunk(i):i().orThunk((()=>n.from(e))))):i().orThunk((()=>s().bind((e=>o(e)?c(e):n.from(e)))))).getOr("")}})(e,r,t);return{...a("source"),...a("altsource"),...a("poster"),...a("embed"),...Q(e,r)}},X=e=>{const t={...e,source:{value:h(e,"source").getOr("")},altsource:{value:h(e,"altsource").getOr("")},poster:{value:h(e,"poster").getOr("")}};return l(["width","height"],(r=>{h(e,r).each((e=>{const o=t.dimensions||{};o[r]=e,t.dimensions=o}))})),t},Y=e=>t=>{const r=t&&t.msg?"Media embed handler error: "+t.msg:"Media embed handler threw unknown error.";e.notificationManager.open({type:"error",text:r})},Z=(e,t)=>o=>{if(r(o.url)&&o.url.trim().length>0){const r=o.html,a={...z(r,t.schema),source:o.url,embed:r};e.setData(X(a))}},ee=(e,t)=>{const r=e.dom.select("*[data-mce-object]");e.insertContent(t),((e,t)=>{const r=e.dom.select("*[data-mce-object]");for(let e=0;e<t.length;e++)for(let o=r.length-1;o>=0;o--)t[e]===r[o]&&r.splice(o,1);e.selection.select(r[0])})(e,r),e.nodeChanged()},te=(e,t)=>s(t)&&"ephox-embed-iri"===t&&s(G(e)),re=(e,t)=>((e,t)=>e.width!==t.width||e.height!==t.height)(e,t)&&te(t.source,e.type),oe=e=>{const t=(e=>{const t=e.selection.getNode(),r=q(t)?e.serializer.serialize(t,{selection:!0}):"",o=z(r,e.schema),a=(()=>{if(te(o.source,o.type)){const r=e.dom.getRect(t);return{width:r.w.toString().replace(/px$/,""),height:r.h.toString().replace(/px$/,"")}}return{}})();return{embed:r,...o,...a}})(e),r=(e=>{let t=e;return{get:()=>t,set:e=>{t=e}}})(t),o=X(t),a=j(e)?[{type:"sizeinput",name:"dimensions",label:"Constrain proportions",constrain:!0}]:[],s={title:"General",name:"general",items:m([[{name:"source",type:"urlinput",filetype:"media",label:"Source",picker_text:"Browse files"}],a])},i=[];_(e)&&i.push({name:"altsource",type:"urlinput",filetype:"media",label:"Alternative source URL"}),k(e)&&i.push({name:"poster",type:"urlinput",filetype:"image",label:"Media poster (Image URL)"});const n={title:"Advanced",name:"advanced",items:i},c=[s,{title:"Embed",items:[{type:"textarea",name:"embed",label:"Paste your embed code below:"}]}];i.length>0&&c.push(n);const l={type:"tabpanel",tabs:c},u=e.windowManager.open({title:"Insert/Edit Media",size:"normal",body:l,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],onSubmit:t=>{const o=V(t.getData());((e,t,r)=>{var o;t.embed=re(e,t)&&j(r)?W(r,{...t,embed:""}):L(t.embed??"",t,!1,r.schema),t.embed&&(e.source===t.source||(o=t.source,p(H,o)))?ee(r,t.embed):K(r,t).then((e=>{ee(r,e.html)})).catch(Y(r))})(r.get(),o,e),t.close()},onChange:(t,o)=>{switch(o.name){case"source":((t,r)=>{const o=V(r.getData(),"source");t.source!==o.source&&(Z(u,e)({url:o.source,html:""}),K(e,o).then(Z(u,e)).catch(Y(e)))})(r.get(),t);break;case"embed":(t=>{const r=V(t.getData()),o=z(r.embed??"",e.schema);t.setData(X(o))})(t);break;case"dimensions":case"altsource":case"poster":((t,r,o)=>{const a=V(t.getData(),r),s=re(o,a)&&j(e)?{...a,embed:""}:a,i=W(e,s);t.setData(X({...s,embed:i}))})(t,o.name,r.get())}r.set(V(t.getData()))},initialData:o})};var ae=tinymce.util.Tools.resolve("tinymce.Env");const se=e=>{const t=e.name;return"iframe"===t||"video"===t||"audio"===t},ie=(e,t,r,o=null)=>{const a=e.attr(r);return s(a)?a:p(t,r)?null:o},ne=(e,t,r)=>{const o="img"===t.name||"video"===e.name,a=o?"300":null,s="audio"===e.name?"30":"150",i=o?s:null;t.attr({width:ie(e,r,"width",a),height:ie(e,r,"height",i)})},ce=(e,t)=>{const r=t.name,o=new F("img",1);return me(e,t,o),ne(t,o,{}),o.attr({style:t.attr("style"),src:ae.transparentSrc,"data-mce-object":r,class:"mce-object mce-object-"+r}),o},le=(e,t)=>{const r=t.name,o=new F("span",1);o.attr({contentEditable:"false",style:t.attr("style"),"data-mce-object":r,class:"mce-preview-object mce-object-"+r}),me(e,t,o);const a=e.dom.parseStyle(t.attr("style")??""),i=new F(r,1);if(ne(t,i,a),i.attr({src:t.attr("src"),style:t.attr("style"),class:t.attr("class")}),"iframe"===r)i.attr({allowfullscreen:t.attr("allowfullscreen"),frameborder:"0",sandbox:t.attr("sandbox"),referrerpolicy:t.attr("referrerpolicy")});else{l(["controls","crossorigin","currentTime","loop","muted","poster","preload"],(e=>{i.attr(e,t.attr(e))}));const a=o.attr("data-mce-html");s(a)&&((e,t,r,o)=>{const a=N(e.schema).parse(o,{context:t});for(;a.firstChild;)r.append(a.firstChild)})(e,r,i,unescape(a))}const n=new F("span",1);return n.attr("class","mce-shim"),o.append(i),o.append(n),o},me=(e,t,r)=>{const o=t.attributes??[];let a=o.length;for(;a--;){const t=o[a].name;let n=o[a].value;"width"===t||"height"===t||"style"===t||(i="data-mce-",(s=t).length>=9&&s.substr(0,9)===i)||("data"!==t&&"src"!==t||(n=e.convertURL(n,t)),r.attr("data-mce-p-"+t,n))}var s,i;const n=M({inner:!0},e.schema),c=new F("div",1);l(t.children(),(e=>c.append(e)));const m=n.serialize(c);m&&(r.attr("data-mce-html",escape(m)),r.empty())},ue=e=>{const t=e.attr("class");return r(t)&&/\btiny-pageembed\b/.test(t)},de=e=>{let t=e;for(;t=t.parent;)if(t.attr("data-ephox-embed-iri")||ue(t))return!0;return!1},he=(e,t,r)=>{const o=(0,e.options.get)("xss_sanitization"),a=v(e);return N(e.schema,{sanitize:o,validate:a}).parse(r,{context:t})},pe=e=>t=>{const r=()=>{t.setEnabled(e.selection.isEditable())};return e.on("NodeChange",r),r(),()=>{e.off("NodeChange",r)}};e.add("media",(e=>((e=>{const t=e.options.register;t("audio_template_callback",{processor:"function"}),t("video_template_callback",{processor:"function"}),t("iframe_template_callback",{processor:"function"}),t("media_live_embeds",{processor:"boolean",default:!0}),t("media_filter_html",{processor:"boolean",default:!0}),t("media_url_resolver",{processor:"function"}),t("media_alt_source",{processor:"boolean",default:!0}),t("media_poster",{processor:"boolean",default:!0}),t("media_dimensions",{processor:"boolean",default:!0})})(e),(e=>{e.addCommand("mceMedia",(()=>{oe(e)}))})(e),(e=>{const t=()=>e.execCommand("mceMedia");e.ui.registry.addToggleButton("media",{tooltip:"Insert/edit media",icon:"embed",onAction:t,onSetup:t=>{const r=e.selection;t.setActive(q(r.getNode()));const o=r.selectorChangedWithUnbind("img[data-mce-object],span[data-mce-object],div[data-ephox-embed-iri]",t.setActive).unbind,a=pe(e)(t);return()=>{o(),a()}}}),e.ui.registry.addMenuItem("media",{icon:"embed",text:"Media...",onAction:t,onSetup:pe(e)})})(e),(e=>{e.on("ResolveName",(e=>{let t;1===e.target.nodeType&&(t=e.target.getAttribute("data-mce-object"))&&(e.name=t)}))})(e),(e=>{e.on("PreInit",(()=>{const{schema:t,serializer:r,parser:o}=e,a=t.getBoolAttrs();l("webkitallowfullscreen mozallowfullscreen".split(" "),(e=>{a[e]={}})),((e,t)=>{const r=u(e);for(let o=0,a=r.length;o<a;o++){const a=r[o];t(e[a],a)}})({embed:["wmode"]},((e,r)=>{const o=t.getElementRule(r);o&&l(e,(e=>{o.attributes[e]={},o.attributesOrder.push(e)}))})),o.addNodeFilter("iframe,video,audio,object,embed",(e=>t=>{let r,o=t.length;for(;o--;)r=t[o],r.parent&&(r.parent.attr("data-mce-object")||(se(r)&&y(e)?de(r)||r.replace(le(e,r)):de(r)||r.replace(ce(e,r))))})(e)),r.addAttributeFilter("data-mce-object",((t,r)=>{let o=t.length;for(;o--;){const a=t[o];if(!a.parent)continue;const s=a.attr(r),i=new F(s,1);if("audio"!==s){const e=a.attr("class");e&&-1!==e.indexOf("mce-preview-object")&&a.firstChild?i.attr({width:a.firstChild.attr("width"),height:a.firstChild.attr("height")}):i.attr({width:a.attr("width"),height:a.attr("height")})}i.attr({style:a.attr("style")});const n=a.attributes??[];let c=n.length;for(;c--;){const e=n[c].name;0===e.indexOf("data-mce-p-")&&i.attr(e.substr(11),n[c].value)}const m=a.attr("data-mce-html");if(m){const t=he(e,s,unescape(m));l(t.children(),(e=>i.append(e)))}a.replace(i)}}))})),e.on("SetContent",(()=>{const t=e.dom;l(t.select("span.mce-preview-object"),(e=>{0===t.select("span.mce-shim",e).length&&t.add(e,"span",{class:"mce-shim"})}))}))})(e),(e=>{e.on("mousedown",(t=>{const r=e.dom.getParent(t.target,".mce-preview-object");r&&"2"===e.dom.getAttrib(r,"data-mce-selected")&&t.stopImmediatePropagation()})),e.on("click keyup touchend",(()=>{const t=e.selection.getNode();t&&e.dom.hasClass(t,"mce-preview-object")&&e.dom.getAttrib(t,"data-mce-selected")&&t.setAttribute("data-mce-selected","2")})),e.on("ObjectResized",(t=>{const r=t.target;if(r.getAttribute("data-mce-object")){let o=r.getAttribute("data-mce-html");o&&(o=unescape(o),r.setAttribute("data-mce-html",escape(L(o,{width:String(t.width),height:String(t.height)},!1,e.schema))))}}))})(e),(e=>({showDialog:()=>{oe(e)}}))(e))))}();
|