@lotte-innovate/ui-component-test 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- package/_virtual/index.mjs +1 -1
- package/_virtual/index11.mjs +1 -1
- package/_virtual/index13.mjs +1 -1
- package/_virtual/index15.mjs +1 -1
- package/_virtual/index17.mjs +1 -1
- package/_virtual/index19.mjs +1 -1
- package/_virtual/index2.mjs +1 -1
- package/_virtual/index21.mjs +2 -0
- package/_virtual/index21.mjs.map +1 -0
- package/_virtual/index22.mjs +2 -0
- package/_virtual/index22.mjs.map +1 -0
- package/_virtual/index3.mjs +1 -1
- package/_virtual/index7.mjs +1 -1
- package/_virtual/index9.mjs +1 -1
- package/_virtual/jsx-runtime.mjs +2 -0
- package/_virtual/jsx-runtime.mjs.map +1 -0
- package/_virtual/jsx-runtime2.mjs +2 -0
- package/_virtual/jsx-runtime2.mjs.map +1 -0
- package/_virtual/react-jsx-runtime.development.mjs +2 -0
- package/_virtual/react-jsx-runtime.development.mjs.map +1 -0
- package/_virtual/react-jsx-runtime.production.min.mjs +2 -0
- package/_virtual/react-jsx-runtime.production.min.mjs.map +1 -0
- package/_virtual/react.development.mjs +2 -0
- package/_virtual/react.development.mjs.map +1 -0
- package/_virtual/react.production.min.mjs +2 -0
- package/_virtual/react.production.min.mjs.map +1 -0
- package/dist/lib/components/Editor/index.mjs +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/public/tinymce/icons/default/index.mjs +1 -1
- package/public/tinymce/icons/default/index.mjs.map +1 -1
- package/public/tinymce/models/dom/index.mjs +1 -1
- package/public/tinymce/plugins/advlist/index.mjs +1 -1
- package/public/tinymce/plugins/advlist/index.mjs.map +1 -1
- package/public/tinymce/plugins/advlist/plugin.mjs +1 -1
- package/public/tinymce/plugins/code/index.mjs +1 -1
- package/public/tinymce/plugins/code/plugin.mjs +1 -1
- package/public/tinymce/plugins/codesample/index.mjs +1 -1
- package/public/tinymce/plugins/image/index.mjs +1 -1
- package/public/tinymce/plugins/image/index.mjs.map +1 -1
- package/public/tinymce/plugins/image/plugin.mjs +1 -1
- package/public/tinymce/plugins/image/plugin.mjs.map +1 -1
- package/public/tinymce/plugins/link/index.mjs +1 -1
- package/public/tinymce/plugins/link/plugin.mjs +1 -1
- package/public/tinymce/plugins/lists/index.mjs +1 -1
- package/public/tinymce/plugins/lists/index.mjs.map +1 -1
- package/public/tinymce/plugins/lists/plugin.mjs +1 -1
- package/public/tinymce/plugins/lists/plugin.mjs.map +1 -1
- package/public/tinymce/plugins/table/index.mjs +1 -1
- package/public/tinymce/plugins/table/plugin.mjs +1 -1
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lotte-innovate/ui-component-test",
|
3
3
|
"description": "Lotte UI Library",
|
4
|
-
"version": "0.2.
|
4
|
+
"version": "0.2.4",
|
5
5
|
"private": false,
|
6
6
|
"type": "module",
|
7
7
|
"files": [
|
@@ -46,7 +46,7 @@
|
|
46
46
|
"build-storybook": "storybook build",
|
47
47
|
"clean": "rimraf dist && mkdir dist && rimraf .rollup.cache",
|
48
48
|
"compile:typescript": "npm run compile && node src/utils/post-compile.js && tsc-alias",
|
49
|
-
"bundle:rollup": "rollup -c && node src/utils/post-tinymce.js&& node src/utils/post-rollup.js",
|
49
|
+
"bundle:rollup": "rollup -c && node src/utils/post-tinymce-virtual.js && node src/utils/post-tinymce.js && node src/utils/post-rollup.js",
|
50
50
|
"build:css": "npx tailwindcss -i src/app/globals.css -o dist/globals.css --minify && node update-tailwind-import.js",
|
51
51
|
"build:test": "npm run clean && npm run compile:typescript && npm run bundle:rollup && npm run build:css",
|
52
52
|
"publish:dist": "npm publish",
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__exports as r}from"../../../../_virtual/
|
1
|
+
import{__exports as r}from"../../../../_virtual/index14.mjs";import{__require as e}from"./icons.mjs";var i;function o(){return i||(i=1,e()),r}export{o as __require};
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../../../public/tinymce/icons/default/index.js"],"sourcesContent":["// Exports the \"default\" icons for usage with module loaders\n// Usage:\n// CommonJS:\n// require('tinymce/icons/default')\n// ES2015:\n// import 'tinymce/icons/default'\nrequire('./icons.js');"],"names":["require$$0"],"mappings":"
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../../public/tinymce/icons/default/index.js"],"sourcesContent":["// Exports the \"default\" icons for usage with module loaders\n// Usage:\n// CommonJS:\n// require('tinymce/icons/default')\n// ES2015:\n// import 'tinymce/icons/default'\nrequire('./icons.js');"],"names":["require$$0"],"mappings":"uIAMqBA"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__exports as r}from"../../../../_virtual/
|
1
|
+
import{__exports as r}from"../../../../_virtual/index20.mjs";import{__require as e}from"./model.mjs";var o;function i(){return o||(o=1,e()),r}export{i as __require};
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__exports as r}from"../../../../_virtual/
|
1
|
+
import{__exports as r}from"../../../../_virtual/index8.mjs";import{__require as e}from"./plugin.mjs";var i;function o(){return i||(i=1,e()),r}export{o as __require};
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../../../public/tinymce/plugins/advlist/index.js"],"sourcesContent":["// Exports the \"advlist\" plugin for usage with module loaders\n// Usage:\n// CommonJS:\n// require('tinymce/plugins/advlist')\n// ES2015:\n// import 'tinymce/plugins/advlist'\nrequire('./plugin.js');"],"names":["require$$0"],"mappings":"
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../../public/tinymce/plugins/advlist/index.js"],"sourcesContent":["// Exports the \"advlist\" plugin for usage with module loaders\n// Usage:\n// CommonJS:\n// require('tinymce/plugins/advlist')\n// ES2015:\n// import 'tinymce/plugins/advlist'\nrequire('./plugin.js');"],"names":["require$$0"],"mappings":"uIAMsBA"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__exports as t}from"../../../../_virtual/
|
1
|
+
import{__exports as t}from"../../../../_virtual/plugin3.mjs";var e;function s(){return e||(e=1,function(){var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=(t,e,s)=>{const r="UL"===e?"InsertUnorderedList":"InsertOrderedList";t.execCommand(r,!1,!1===s?null:{"list-style-type":s})},s=t=>e=>e.options.get(t),r=s("advlist_number_styles"),n=s("advlist_bullet_styles"),i=t=>null==t,l=t=>!i(t);var o=tinymce.util.Tools.resolve("tinymce.util.Tools");class a{constructor(t,e){this.tag=t,this.value=e}static some(t){return new a(!0,t)}static none(){return a.singletonNone}fold(t,e){return this.tag?e(this.value):t()}isSome(){return this.tag}isNone(){return!this.tag}map(t){return this.tag?a.some(t(this.value)):a.none()}bind(t){return this.tag?t(this.value):a.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:a.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(null!=t?t:"Called getOrDie on None")}static from(t){return l(t)?a.some(t):a.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()"}}a.singletonNone=new a(!1);const u=t=>e=>l(e)&&t.test(e.nodeName),d=u(/^(OL|UL|DL)$/),g=u(/^(TH|TD)$/),c=(t,e,s)=>((t,e,s)=>{for(let r=0,n=t.length;r<n;r++){const n=t[r];if(e(n,r))return a.some(n);if(s(n,r))break}return a.none()})(e,(t=>d(t)&&!/\btox\-/.test(t.className)),g).exists((e=>e.nodeName===s&&((t,e)=>t.dom.isChildOf(e,t.getBody()))(t,e))),h=t=>i(t)||"default"===t?"":t,m=(t,e)=>s=>((t,e)=>{const s=t.selection.getNode();return e({parents:t.dom.getParents(s),element:s}),t.on("NodeChange",e),()=>t.off("NodeChange",e)})(t,(r=>((t,r)=>{const n=t.selection.getStart(!0);s.setActive(c(t,r,e)),s.setEnabled(!((t,e)=>{const s=t.dom.getParent(e,"ol,ul,dl");return((t,e)=>null!==e&&!t.dom.isEditable(e))(t,s)&&t.selection.isEditable()})(t,n)&&t.selection.isEditable())})(t,r.parents))),p=(t,s,r,n,i,l)=>{t.ui.registry.addSplitButton(s,{tooltip:r,icon:"OL"===i?"ordered-list":"unordered-list",presets:"listpreview",columns:3,fetch:t=>{t(o.map(l,(t=>{const e="OL"===i?"num":"bull",s="disc"===t||"decimal"===t?"default":t,r=h(t),n=(t=>t.replace(/\-/g," ").replace(/\b\w/g,(t=>t.toUpperCase())))(t);return{type:"choiceitem",value:r,icon:"list-"+e+"-"+s,text:n}})))},onAction:()=>t.execCommand(n),onItemAction:(s,r)=>{e(t,i,r)},select:e=>{const s=(t=>{const e=t.dom.getParent(t.selection.getNode(),"ol,ul"),s=t.dom.getStyle(e,"listStyleType");return a.from(s)})(t);return s.map((t=>e===t)).getOr(!1)},onSetup:m(t,i)})},v=(t,s,r,n,i,l)=>{l.length>1?p(t,s,r,n,i,l):((t,s,r,n,i,l)=>{t.ui.registry.addToggleButton(s,{active:!1,tooltip:r,icon:"OL"===i?"ordered-list":"unordered-list",onSetup:m(t,i),onAction:()=>t.queryCommandState(n)||""===l?t.execCommand(n):e(t,i,l)})})(t,s,r,n,i,h(l[0]))};t.add("advlist",(t=>{t.hasPlugin("lists")?((t=>{const e=t.options.register;e("advlist_number_styles",{processor:"string[]",default:"default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman".split(",")}),e("advlist_bullet_styles",{processor:"string[]",default:"default,circle,square".split(",")})})(t),(t=>{v(t,"numlist","Numbered list","InsertOrderedList","OL",r(t)),v(t,"bullist","Bullet list","InsertUnorderedList","UL",n(t))})(t),(t=>{t.addCommand("ApplyUnorderedListStyle",((s,r)=>{e(t,"UL",r["list-style-type"])})),t.addCommand("ApplyOrderedListStyle",((s,r)=>{e(t,"OL",r["list-style-type"])}))})(t)):console.error("Please use the Lists plugin together with the Advanced List plugin.")}))}()),t}export{s as __require};
|
2
2
|
//# sourceMappingURL=plugin.mjs.map
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__exports as r}from"../../../../_virtual/
|
1
|
+
import{__exports as r}from"../../../../_virtual/index18.mjs";import{__require as e}from"./plugin.mjs";var i;function o(){return i||(i=1,e()),r}export{o as __require};
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__exports as e}from"../../../../_virtual/
|
1
|
+
import{__exports as e}from"../../../../_virtual/plugin7.mjs";var o;function t(){return o||(o=1,tinymce.util.Tools.resolve("tinymce.PluginManager").add("code",(e=>((e=>{e.addCommand("mceCodeEditor",(()=>{(e=>{const o=(e=>e.getContent({source_view:!0}))(e);e.windowManager.open({title:"Source Code",size:"large",body:{type:"panel",items:[{type:"textarea",name:"code"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{code:o},onSubmit:o=>{((e,o)=>{e.focus(),e.undoManager.transact((()=>{e.setContent(o)})),e.selection.setCursorLocation(),e.nodeChanged()})(e,o.getData().code),o.close()}})})(e)}))})(e),(e=>{const o=()=>e.execCommand("mceCodeEditor");e.ui.registry.addButton("code",{icon:"sourcecode",tooltip:"Source code",onAction:o}),e.ui.registry.addMenuItem("code",{icon:"sourcecode",text:"Source code",onAction:o})})(e),{})))),e}export{t as __require};
|
2
2
|
//# sourceMappingURL=plugin.mjs.map
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__exports as r}from"../../../../_virtual/
|
1
|
+
import{__exports as r}from"../../../../_virtual/index6.mjs";import{__require as e}from"./plugin.mjs";var i;function o(){return i||(i=1,e()),r}export{o as __require};
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__exports as r}from"../../../../_virtual/
|
1
|
+
import{__exports as r}from"../../../../_virtual/index12.mjs";import{__require as e}from"./plugin.mjs";var i;function o(){return i||(i=1,e()),r}export{o as __require};
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../../../public/tinymce/plugins/image/index.js"],"sourcesContent":["// Exports the \"image\" plugin for usage with module loaders\n// Usage:\n// CommonJS:\n// require('tinymce/plugins/image')\n// ES2015:\n// import 'tinymce/plugins/image'\nrequire('./plugin.js');"],"names":["require$$0"],"mappings":"
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../../public/tinymce/plugins/image/index.js"],"sourcesContent":["// Exports the \"image\" plugin for usage with module loaders\n// Usage:\n// CommonJS:\n// require('tinymce/plugins/image')\n// ES2015:\n// import 'tinymce/plugins/image'\nrequire('./plugin.js');"],"names":["require$$0"],"mappings":"wIAMsBA"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__exports as e}from"../../../../_virtual/plugin.mjs";var t;function a(){return t||(t=1,function(){var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=Object.getPrototypeOf,a=(e,t,a)=>{var i;return!!a(e,t.prototype)||(null===(i=e.constructor)||void 0===i?void 0:i.name)===t.name},i=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&a(e,String,((e,t)=>t.isPrototypeOf(e)))?"string":t})(t)===e,o=e=>t=>typeof t===e,r=i("string"),s=i("object"),n=e=>((e,i)=>s(e)&&a(e,i,((e,a)=>t(e)===a)))(e,Object),l=i("array"),c=(m=null,e=>m===e);var m;const d=o("boolean"),g=e=>!(e=>null==e)(e),u=o("function"),p=o("number"),h=()=>{};class b{constructor(e,t){this.tag=e,this.value=t}static some(e){return new b(!0,e)}static none(){return b.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?b.some(e(this.value)):b.none()}bind(e){return this.tag?e(this.value):b.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:b.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 g(e)?b.some(e):b.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()"}}b.singletonNone=new b(!1);const v=Object.keys,y=Object.hasOwnProperty,f=(e,t,a,i)=>{((e,t)=>{const a=v(e);for(let i=0,o=a.length;i<o;i++){const o=a[i];t(e[o],o)}})(e,((e,o)=>{(t(e,o)?a:i)(e,o)}))},w=(e,t)=>y.call(e,t),A=Array.prototype.push,D=e=>{const t=[];for(let a=0,i=e.length;a<i;++a){if(!l(e[a]))throw new Error("Arr.flatten item "+a+" was not an array, input: "+e);A.apply(t,e[a])}return t},_=e=>((e,t)=>t>=0&&t<e.length?b.some(e[t]):b.none())(e,0);"undefined"!=typeof window?window:Function("return this;")();const C=(e,t,a)=>{((e,t,a)=>{if(!(r(a)||d(a)||p(a)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",a,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,a+"")})(e.dom,t,a)},x=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},I={fromHtml:(e,t)=>{const a=(t||document).createElement("div");if(a.innerHTML=e,!a.hasChildNodes()||a.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return x(a.childNodes[0])},fromTag:(e,t)=>{const a=(t||document).createElement(e);return x(a)},fromText:(e,t)=>{const a=(t||document).createTextNode(e);return x(a)},fromDom:x,fromPoint:(e,t,a)=>b.from(e.dom.elementFromPoint(t,a)).map(x)};var U=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),S=tinymce.util.Tools.resolve("tinymce.util.URI");const N=e=>e.length>0,T=e=>t=>t.options.get(e),E=e=>{const t=e.options.register;t("image_dimensions",{processor:"boolean",default:!0}),t("image_advtab",{processor:"boolean",default:!1}),t("image_uploadtab",{processor:"boolean",default:!0}),t("image_prepend_url",{processor:"string",default:""}),t("image_class_list",{processor:"object[]"}),t("image_description",{processor:"boolean",default:!0}),t("image_title",{processor:"boolean",default:!1}),t("image_caption",{processor:"boolean",default:!1}),t("image_list",{processor:e=>{const t=!1===e||r(e)||((e,t)=>{if(l(e)){for(let a=0,i=e.length;a<i;++a)if(!t(e[a]))return!1;return!0}return!1})(e,s)||u(e);return t?{value:e,valid:t}:{valid:!1,message:"Must be false, a string, an array or a function."}},default:!1})},L=T("image_dimensions"),O=T("image_advtab"),M=T("image_uploadtab"),j=T("image_prepend_url"),P=T("image_class_list"),R=T("image_description"),k=T("image_title"),z=T("image_caption"),B=T("image_list"),H=T("a11y_advanced_options"),F=T("automatic_uploads"),G=(e,t)=>Math.max(parseInt(e,10),parseInt(t,10)),W=e=>(e&&(e=e.replace(/px$/,"")),e),$=e=>(e.length>0&&/^[0-9]+$/.test(e)&&(e+="px"),e),V=e=>"IMG"===e.nodeName&&(e.hasAttribute("data-mce-object")||e.hasAttribute("data-mce-placeholder")),q=(e,t)=>{const a=e.options.get;return S.isDomSafe(t,"img",{allow_html_data_urls:a("allow_html_data_urls"),allow_script_urls:a("allow_script_urls"),allow_svg_data_urls:a("allow_svg_data_urls")})},K=U.DOM,Z=e=>e.style.marginLeft&&e.style.marginRight&&e.style.marginLeft===e.style.marginRight?W(e.style.marginLeft):"",J=e=>e.style.marginTop&&e.style.marginBottom&&e.style.marginTop===e.style.marginBottom?W(e.style.marginTop):"",Q=e=>e.style.borderWidth?W(e.style.borderWidth):"",X=(e,t)=>{var a;return e.hasAttribute(t)&&null!==(a=e.getAttribute(t))&&void 0!==a?a:""},Y=e=>null!==e.parentNode&&"FIGURE"===e.parentNode.nodeName,ee=(e,t,a)=>{""===a||null===a?e.removeAttribute(t):e.setAttribute(t,a)},te=e=>{Y(e)?(e=>{const t=e.parentNode;g(t)&&(K.insertAfter(e,t),K.remove(t))})(e):(e=>{const t=K.create("figure",{class:"image"});K.insertAfter(t,e),t.appendChild(e),t.appendChild(K.create("figcaption",{contentEditable:"true"},"Caption")),t.contentEditable="false"})(e)},ae=(e,t)=>{const a=e.getAttribute("style"),i=t(null!==a?a:"");i.length>0?(e.setAttribute("style",i),e.setAttribute("data-mce-style",i)):e.removeAttribute("style")},ie=(e,t)=>(e,a,i)=>{const o=e.style;o[a]?(o[a]=$(i),ae(e,t)):ee(e,a,i)},oe=(e,t)=>e.style[t]?W(e.style[t]):X(e,t),re=(e,t)=>{const a=$(t);e.style.marginLeft=a,e.style.marginRight=a},se=(e,t)=>{const a=$(t);e.style.marginTop=a,e.style.marginBottom=a},ne=(e,t)=>{const a=$(t);e.style.borderWidth=a},le=(e,t)=>{e.style.borderStyle=t},ce=e=>{var t;return null!==(t=e.style.borderStyle)&&void 0!==t?t:""},me=e=>g(e)&&"FIGURE"===e.nodeName,de=e=>0===K.getAttrib(e,"alt").length&&"presentation"===K.getAttrib(e,"role"),ge=e=>de(e)?"":X(e,"alt"),ue=(e,t)=>{var a;const i=document.createElement("img");return ee(i,"style",t.style),(Z(i)||""!==t.hspace)&&re(i,t.hspace),(J(i)||""!==t.vspace)&&se(i,t.vspace),(Q(i)||""!==t.border)&&ne(i,t.border),(ce(i)||""!==t.borderStyle)&&le(i,t.borderStyle),e(null!==(a=i.getAttribute("style"))&&void 0!==a?a:"")},pe=(e,t)=>({src:X(t,"src"),alt:ge(t),title:X(t,"title"),width:oe(t,"width"),height:oe(t,"height"),class:X(t,"class"),style:e(X(t,"style")),caption:Y(t),hspace:Z(t),vspace:J(t),border:Q(t),borderStyle:ce(t),isDecorative:de(t)}),he=(e,t,a,i,o)=>{a[i]!==t[i]&&o(e,i,String(a[i]))},be=(e,t,a)=>{if(a){K.setAttrib(e,"role","presentation");const t=I.fromDom(e);C(t,"alt","")}else{if(c(t)){const t=I.fromDom(e);i="alt",t.dom.removeAttribute(i)}else{const a=I.fromDom(e);C(a,"alt",t)}"presentation"===K.getAttrib(e,"role")&&K.setAttrib(e,"role","")}var i},ve=(e,t)=>(a,i,o)=>{e(a,o),ae(a,t)},ye=(e,t,a)=>{const i=pe(e,a);he(a,i,t,"caption",((e,t,a)=>te(e))),he(a,i,t,"src",ee),he(a,i,t,"title",ee),he(a,i,t,"width",ie(0,e)),he(a,i,t,"height",ie(0,e)),he(a,i,t,"class",ee),he(a,i,t,"style",ve(((e,t)=>ee(e,"style",t)),e)),he(a,i,t,"hspace",ve(re,e)),he(a,i,t,"vspace",ve(se,e)),he(a,i,t,"border",ve(ne,e)),he(a,i,t,"borderStyle",ve(le,e)),((e,t,a)=>{a.alt===t.alt&&a.isDecorative===t.isDecorative||be(e,a.alt,a.isDecorative)})(a,i,t)},fe=(e,t)=>{const a=(e=>{if(e.margin){const t=String(e.margin).split(" ");switch(t.length){case 1:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[0],e["margin-bottom"]=e["margin-bottom"]||t[0],e["margin-left"]=e["margin-left"]||t[0];break;case 2:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[0],e["margin-left"]=e["margin-left"]||t[1];break;case 3:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[2],e["margin-left"]=e["margin-left"]||t[1];break;case 4:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[2],e["margin-left"]=e["margin-left"]||t[3]}delete e.margin}return e})(e.dom.styles.parse(t)),i=e.dom.styles.parse(e.dom.styles.serialize(a));return e.dom.styles.serialize(i)},we=e=>{const t=e.selection.getNode(),a=e.dom.getParent(t,"figure.image");return a?e.dom.select("img",a)[0]:t&&("IMG"!==t.nodeName||V(t))?null:t},Ae=(e,t)=>{var a;const i=e.dom,o=((e,t)=>{const a={};var i;return f(e,t,(i=a,(e,t)=>{i[t]=e}),h),a})(e.schema.getTextBlockElements(),((t,a)=>!e.schema.isValidChild(a,"figure"))),r=i.getParent(t.parentNode,(e=>{return t=o,a=e.nodeName,w(t,a)&&void 0!==t[a]&&null!==t[a];var t,a}),e.getBody());return r&&null!==(a=i.split(r,t))&&void 0!==a?a:t},De=(e,t)=>{const a=((e,t)=>{const a=document.createElement("img");if(ye(e,{...t,caption:!1},a),be(a,t.alt,t.isDecorative),t.caption){const e=K.create("figure",{class:"image"});return e.appendChild(a),e.appendChild(K.create("figcaption",{contentEditable:"true"},"Caption")),e.contentEditable="false",e}return a})((t=>fe(e,t)),t);e.dom.setAttrib(a,"data-mce-id","__mcenew"),e.focus(),e.selection.setContent(a.outerHTML);const i=e.dom.select('*[data-mce-id="__mcenew"]')[0];if(e.dom.setAttrib(i,"data-mce-id",null),me(i)){const t=Ae(e,i);e.selection.select(t)}else e.selection.select(i)},_e=(e,t)=>{const a=we(e);if(a)if(ye((t=>fe(e,t)),t,a),((e,t)=>{e.dom.setAttrib(t,"src",t.getAttribute("src"))})(e,a),me(a.parentNode)){const t=a.parentNode;Ae(e,t),e.selection.select(a.parentNode)}else e.selection.select(a),((e,t,a)=>{const i=()=>{a.onload=a.onerror=null,e.selection&&(e.selection.select(a),e.nodeChanged())};a.onload=()=>{t.width||t.height||!L(e)||e.dom.setAttribs(a,{width:String(a.clientWidth),height:String(a.clientHeight)}),i()},a.onerror=i})(e,t,a)},Ce=(e,t)=>{const a=we(e);if(a){const i={...pe((t=>fe(e,t)),a),...t},o=((e,t)=>{const a=t.src;return{...t,src:q(e,a)?a:""}})(e,i);i.src?_e(e,o):((e,t)=>{if(t){const a=e.dom.is(t.parentNode,"figure.image")?t.parentNode:t;e.dom.remove(a),e.focus(),e.nodeChanged(),e.dom.isEmpty(e.getBody())&&(e.setContent(""),e.selection.setCursorLocation())}})(e,a)}else t.src&&De(e,{src:"",alt:"",title:"",width:"",height:"",class:"",style:"",caption:!1,hspace:"",vspace:"",border:"",borderStyle:"",isDecorative:!1,...t})},xe=(Ie=(e,t)=>n(e)&&n(t)?xe(e,t):t,(...e)=>{if(0===e.length)throw new Error("Can't merge zero objects");const t={};for(let a=0;a<e.length;a++){const i=e[a];for(const e in i)w(i,e)&&(t[e]=Ie(t[e],i[e]))}return t});var Ie,Ue=tinymce.util.Tools.resolve("tinymce.util.ImageUploader"),Se=tinymce.util.Tools.resolve("tinymce.util.Tools");const Ne=e=>r(e.value)?e.value:"",Te=(e,t)=>{const a=[];return Se.each(e,(e=>{const i=(e=>r(e.text)?e.text:r(e.title)?e.title:"")(e);if(void 0!==e.menu){const o=Te(e.menu,t);a.push({text:i,items:o})}else{const o=t(e);a.push({text:i,value:o})}})),a},Ee=(e=Ne)=>t=>t?b.from(t).map((t=>Te(t,e))):b.none(),Le=(e,t)=>((e,t)=>{for(let a=0;a<e.length;a++){const i=t(e[a],a);if(i.isSome())return i}return b.none()})(e,(e=>(e=>w(e,"items"))(e)?Le(e.items,t):e.value===t?b.some(e):b.none())),Oe=Ee,Me=e=>Ee(Ne)(e),je=(e,t)=>e.bind((e=>Le(e,t))),Pe=e=>({title:"Advanced",name:"advanced",items:[{type:"grid",columns:2,items:[{type:"input",label:"Vertical space",name:"vspace",inputMode:"numeric"},{type:"input",label:"Horizontal space",name:"hspace",inputMode:"numeric"},{type:"input",label:"Border width",name:"border",inputMode:"numeric"},{type:"listbox",name:"borderstyle",label:"Border style",items:[{text:"Select...",value:""},{text:"Solid",value:"solid"},{text:"Dotted",value:"dotted"},{text:"Dashed",value:"dashed"},{text:"Double",value:"double"},{text:"Groove",value:"groove"},{text:"Ridge",value:"ridge"},{text:"Inset",value:"inset"},{text:"Outset",value:"outset"},{text:"None",value:"none"},{text:"Hidden",value:"hidden"}]}]}]}),Re=e=>{const t=Oe((t=>e.convertURL(t.value||t.url||"","src"))),a=new Promise((a=>{((e,t)=>{const a=B(e);r(a)?fetch(a).then((e=>{e.ok&&e.json().then(t)})):u(a)?a(t):t(a)})(e,(e=>{a(t(e).map((e=>D([[{text:"None",value:""}],e]))))}))})),i=Me(P(e)),o=O(e),s=M(e),n=(e=>N(e.options.get("images_upload_url")))(e),l=(e=>g(e.options.get("images_upload_handler")))(e),c=(e=>{const t=we(e);return t?pe((t=>fe(e,t)),t):{src:"",alt:"",title:"",width:"",height:"",class:"",style:"",caption:!1,hspace:"",vspace:"",border:"",borderStyle:"",isDecorative:!1}})(e),m=R(e),d=k(e),p=L(e),h=z(e),v=H(e),y=F(e),f=b.some(j(e)).filter((e=>r(e)&&e.length>0));return a.then((e=>({image:c,imageList:e,classList:i,hasAdvTab:o,hasUploadTab:s,hasUploadUrl:n,hasUploadHandler:l,hasDescription:m,hasImageTitle:d,hasDimensions:p,hasImageCaption:h,prependURL:f,hasAccessibilityOptions:v,automaticUploads:y})))},ke=e=>{const t=e.imageList.map((e=>({name:"images",type:"listbox",label:"Image list",items:e}))),a={name:"alt",type:"input",label:"Alternative description",enabled:!(e.hasAccessibilityOptions&&e.image.isDecorative)},i=e.classList.map((e=>({name:"classes",type:"listbox",label:"Class",items:e})));return D([[{name:"src",type:"urlinput",filetype:"image",label:"Source",picker_text:"Browse files"}],t.toArray(),e.hasAccessibilityOptions&&e.hasDescription?[{type:"label",label:"Accessibility",items:[{name:"isDecorative",type:"checkbox",label:"Image is decorative"}]}]:[],e.hasDescription?[a]:[],e.hasImageTitle?[{name:"title",type:"input",label:"Image title"}]:[],e.hasDimensions?[{name:"dimensions",type:"sizeinput"}]:[],[{...(o=e.classList.isSome()&&e.hasImageCaption,o?{type:"grid",columns:2}:{type:"panel"}),items:D([i.toArray(),e.hasImageCaption?[{type:"label",label:"Caption",items:[{type:"checkbox",name:"caption",label:"Show caption"}]}]:[]])}]]);var o},ze=e=>({title:"General",name:"general",items:ke(e)}),Be=ke,He=e=>({title:"Upload",name:"upload",items:[{type:"dropzone",name:"fileinput"}]}),Fe=e=>({src:{value:e.src,meta:{}},images:e.src,alt:e.alt,title:e.title,dimensions:{width:e.width,height:e.height},classes:e.class,caption:e.caption,style:e.style,vspace:e.vspace,border:e.border,hspace:e.hspace,borderstyle:e.borderStyle,fileinput:[],isDecorative:e.isDecorative}),Ge=(e,t)=>({src:e.src.value,alt:null!==e.alt&&0!==e.alt.length||!t?e.alt:null,title:e.title,width:e.dimensions.width,height:e.dimensions.height,class:e.classes,style:e.style,caption:e.caption,hspace:e.hspace,vspace:e.vspace,border:e.border,borderStyle:e.borderstyle,isDecorative:e.isDecorative}),We=(e,t)=>{const a=t.getData();((e,t)=>/^(?:[a-zA-Z]+:)?\/\//.test(t)?b.none():e.prependURL.bind((e=>t.substring(0,e.length)!==e?b.some(e+t):b.none())))(e,a.src.value).each((e=>{t.setData({src:{value:e,meta:a.src.meta}})}))},$e=(e,t)=>{const a=t.getData(),i=a.src.meta;if(void 0!==i){const o=xe({},a);((e,t,a)=>{e.hasDescription&&r(a.alt)&&(t.alt=a.alt),e.hasAccessibilityOptions&&(t.isDecorative=a.isDecorative||t.isDecorative||!1),e.hasImageTitle&&r(a.title)&&(t.title=a.title),e.hasDimensions&&(r(a.width)&&(t.dimensions.width=a.width),r(a.height)&&(t.dimensions.height=a.height)),r(a.class)&&je(e.classList,a.class).each((e=>{t.classes=e.value})),e.hasImageCaption&&d(a.caption)&&(t.caption=a.caption),e.hasAdvTab&&(r(a.style)&&(t.style=a.style),r(a.vspace)&&(t.vspace=a.vspace),r(a.border)&&(t.border=a.border),r(a.hspace)&&(t.hspace=a.hspace),r(a.borderstyle)&&(t.borderstyle=a.borderstyle))})(e,o,i),t.setData(o)}},Ve=(e,t,a,i)=>{We(t,i),$e(t,i),((e,t,a,i)=>{const o=i.getData(),r=o.src.value,s=o.src.meta||{};s.width||s.height||!t.hasDimensions||(N(r)?e.imageSize(r).then((e=>{a.open&&i.setData({dimensions:e})})).catch((e=>console.error(e))):i.setData({dimensions:{width:"",height:""}}))})(e,t,a,i),((e,t,a)=>{const i=a.getData(),o=je(e.imageList,i.src.value);t.prevImage=o,a.setData({images:o.map((e=>e.value)).getOr("")})})(t,a,i)},qe=(e,t,a,i)=>{const o=i.getData();i.block("Uploading image"),_(o.fileinput).fold((()=>{i.unblock()}),(o=>{const r=URL.createObjectURL(o),s=()=>{i.unblock(),URL.revokeObjectURL(r)},n=o=>{i.setData({src:{value:o,meta:{}}}),i.showTab("general"),Ve(e,t,a,i)};var l;(l=o,new Promise(((e,t)=>{const a=new FileReader;a.onload=()=>{e(a.result)},a.onerror=()=>{var e;t(null===(e=a.error)||void 0===e?void 0:e.message)},a.readAsDataURL(l)}))).then((a=>{const l=e.createBlobCache(o,r,a);t.automaticUploads?e.uploadImage(l).then((e=>{n(e.url),s()})).catch((t=>{s(),e.alertErr(t)})):(e.addToBlobCache(l),n(l.blobUri()),i.unblock())}))}))},Ke=(e,t,a)=>(i,o)=>{"src"===o.name?Ve(e,t,a,i):"images"===o.name?((e,t,a,i)=>{const o=i.getData(),r=je(t.imageList,o.images);r.each((e=>{const t=""===o.alt||a.prevImage.map((e=>e.text===o.alt)).getOr(!1);t?""===e.value?i.setData({src:e,alt:a.prevAlt}):i.setData({src:e,alt:e.text}):i.setData({src:e})})),a.prevImage=r,Ve(e,t,a,i)})(e,t,a,i):"alt"===o.name?a.prevAlt=i.getData().alt:"fileinput"===o.name?qe(e,t,a,i):"isDecorative"===o.name&&i.setEnabled("alt",!i.getData().isDecorative)},Ze=e=>()=>{e.open=!1},Je=e=>{if(e.hasAdvTab||e.hasUploadUrl||e.hasUploadHandler){return{type:"tabpanel",tabs:D([[ze(e)],e.hasAdvTab?[Pe(e)]:[],e.hasUploadTab&&(e.hasUploadUrl||e.hasUploadHandler)?[He(e)]:[]])}}return{type:"panel",items:Be(e)}},Qe=(e,t,a)=>i=>{const o=xe(Fe(t.image),i.getData()),r={...o,style:ue(a.normalizeCss,Ge(o,!1))};e.execCommand("mceUpdateImage",!1,Ge(r,t.hasAccessibilityOptions)),e.editorUpload.uploadImagesAuto(),i.close()},Xe=e=>t=>q(e,t)?(e=>new Promise((t=>{const a=document.createElement("img"),i=e=>{a.onload=a.onerror=null,a.parentNode&&a.parentNode.removeChild(a),t(e)};a.onload=()=>{const e={width:G(a.width,a.clientWidth),height:G(a.height,a.clientHeight)};i(Promise.resolve(e))},a.onerror=()=>{i(Promise.reject(`Failed to get image dimensions for: ${e}`))};const o=a.style;o.visibility="hidden",o.position="fixed",o.bottom=o.left="0px",o.width=o.height="auto",document.body.appendChild(a),a.src=e})))(e.documentBaseURI.toAbsolute(t)).then((e=>({width:String(e.width),height:String(e.height)}))):Promise.resolve({width:"",height:""}),Ye=e=>(t,a,i)=>{var o;return e.editorUpload.blobCache.create({blob:t,blobUri:a,name:null===(o=t.name)||void 0===o?void 0:o.replace(/\.[^\.]+$/,""),filename:t.name,base64:i.split(",")[1]})},et=e=>t=>{e.editorUpload.blobCache.add(t)},tt=e=>t=>{e.windowManager.alert(t)},at=e=>t=>fe(e,t),it=e=>t=>e.dom.parseStyle(t),ot=e=>(t,a)=>e.dom.serializeStyle(t,a),rt=e=>t=>Ue(e).upload([t],!1).then((e=>{var t;return 0===e.length?Promise.reject("Failed to upload image"):!1===e[0].status?Promise.reject(null===(t=e[0].error)||void 0===t?void 0:t.message):e[0]})),st=e=>{const t={imageSize:Xe(e),addToBlobCache:et(e),createBlobCache:Ye(e),alertErr:tt(e),normalizeCss:at(e),parseStyle:it(e),serializeStyle:ot(e),uploadImage:rt(e)};return{open:()=>{Re(e).then((a=>{const i=(e=>({prevImage:je(e.imageList,e.image.src),prevAlt:e.image.alt,open:!0}))(a);return{title:"Insert/Edit Image",size:"normal",body:Je(a),buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:Fe(a.image),onSubmit:Qe(e,a,t),onChange:Ke(t,a,i),onClose:Ze(i)}})).then(e.windowManager.open)}}},nt=e=>{const t=e.attr("class");return g(t)&&/\bimage\b/.test(t)},lt=e=>t=>{let a=t.length;const i=t=>{t.attr("contenteditable",e?"true":null)};for(;a--;){const o=t[a];nt(o)&&(o.attr("contenteditable",e?"false":null),Se.each(o.getAll("figcaption"),i))}},ct=e=>t=>{const a=()=>{t.setEnabled(e.selection.isEditable())};return e.on("NodeChange",a),a(),()=>{e.off("NodeChange",a)}};e.add("image",(e=>{E(e),(e=>{e.on("PreInit",(()=>{e.parser.addNodeFilter("figure",lt(!0)),e.serializer.addNodeFilter("figure",lt(!1))}))})(e),(e=>{e.ui.registry.addToggleButton("image",{icon:"image",tooltip:"Insert/edit image",onAction:st(e).open,onSetup:t=>{t.setActive(g(we(e)));const a=e.selection.selectorChangedWithUnbind("img:not([data-mce-object]):not([data-mce-placeholder]),figure.image",t.setActive).unbind,i=ct(e)(t);return()=>{a(),i()}}}),e.ui.registry.addMenuItem("image",{icon:"image",text:"Image...",onAction:st(e).open,onSetup:ct(e)}),e.ui.registry.addContextMenu("image",{update:t=>e.selection.isEditable()&&(me(t)||"IMG"===t.nodeName&&!V(t))?["image"]:[]})})(e),(e=>{e.addCommand("mceImage",st(e).open),e.addCommand("mceUpdateImage",((t,a)=>{e.undoManager.transact((()=>Ce(e,a)))}))})(e)}))}()),e}export{a as __require};
|
1
|
+
import{__exports as e}from"../../../../_virtual/plugin5.mjs";var t;function a(){return t||(t=1,function(){var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=Object.getPrototypeOf,a=(e,t,a)=>{var i;return!!a(e,t.prototype)||(null===(i=e.constructor)||void 0===i?void 0:i.name)===t.name},i=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&a(e,String,((e,t)=>t.isPrototypeOf(e)))?"string":t})(t)===e,o=e=>t=>typeof t===e,r=i("string"),s=i("object"),n=e=>((e,i)=>s(e)&&a(e,i,((e,a)=>t(e)===a)))(e,Object),l=i("array"),c=(m=null,e=>m===e);var m;const d=o("boolean"),g=e=>!(e=>null==e)(e),u=o("function"),p=o("number"),h=()=>{};class b{constructor(e,t){this.tag=e,this.value=t}static some(e){return new b(!0,e)}static none(){return b.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?b.some(e(this.value)):b.none()}bind(e){return this.tag?e(this.value):b.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:b.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 g(e)?b.some(e):b.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()"}}b.singletonNone=new b(!1);const v=Object.keys,y=Object.hasOwnProperty,f=(e,t,a,i)=>{((e,t)=>{const a=v(e);for(let i=0,o=a.length;i<o;i++){const o=a[i];t(e[o],o)}})(e,((e,o)=>{(t(e,o)?a:i)(e,o)}))},w=(e,t)=>y.call(e,t),A=Array.prototype.push,D=e=>{const t=[];for(let a=0,i=e.length;a<i;++a){if(!l(e[a]))throw new Error("Arr.flatten item "+a+" was not an array, input: "+e);A.apply(t,e[a])}return t},_=e=>((e,t)=>t>=0&&t<e.length?b.some(e[t]):b.none())(e,0);"undefined"!=typeof window?window:Function("return this;")();const C=(e,t,a)=>{((e,t,a)=>{if(!(r(a)||d(a)||p(a)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",a,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,a+"")})(e.dom,t,a)},x=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},I={fromHtml:(e,t)=>{const a=(t||document).createElement("div");if(a.innerHTML=e,!a.hasChildNodes()||a.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return x(a.childNodes[0])},fromTag:(e,t)=>{const a=(t||document).createElement(e);return x(a)},fromText:(e,t)=>{const a=(t||document).createTextNode(e);return x(a)},fromDom:x,fromPoint:(e,t,a)=>b.from(e.dom.elementFromPoint(t,a)).map(x)};var U=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),S=tinymce.util.Tools.resolve("tinymce.util.URI");const N=e=>e.length>0,T=e=>t=>t.options.get(e),E=e=>{const t=e.options.register;t("image_dimensions",{processor:"boolean",default:!0}),t("image_advtab",{processor:"boolean",default:!1}),t("image_uploadtab",{processor:"boolean",default:!0}),t("image_prepend_url",{processor:"string",default:""}),t("image_class_list",{processor:"object[]"}),t("image_description",{processor:"boolean",default:!0}),t("image_title",{processor:"boolean",default:!1}),t("image_caption",{processor:"boolean",default:!1}),t("image_list",{processor:e=>{const t=!1===e||r(e)||((e,t)=>{if(l(e)){for(let a=0,i=e.length;a<i;++a)if(!t(e[a]))return!1;return!0}return!1})(e,s)||u(e);return t?{value:e,valid:t}:{valid:!1,message:"Must be false, a string, an array or a function."}},default:!1})},L=T("image_dimensions"),O=T("image_advtab"),M=T("image_uploadtab"),j=T("image_prepend_url"),P=T("image_class_list"),R=T("image_description"),k=T("image_title"),z=T("image_caption"),B=T("image_list"),H=T("a11y_advanced_options"),F=T("automatic_uploads"),G=(e,t)=>Math.max(parseInt(e,10),parseInt(t,10)),W=e=>(e&&(e=e.replace(/px$/,"")),e),$=e=>(e.length>0&&/^[0-9]+$/.test(e)&&(e+="px"),e),V=e=>"IMG"===e.nodeName&&(e.hasAttribute("data-mce-object")||e.hasAttribute("data-mce-placeholder")),q=(e,t)=>{const a=e.options.get;return S.isDomSafe(t,"img",{allow_html_data_urls:a("allow_html_data_urls"),allow_script_urls:a("allow_script_urls"),allow_svg_data_urls:a("allow_svg_data_urls")})},K=U.DOM,Z=e=>e.style.marginLeft&&e.style.marginRight&&e.style.marginLeft===e.style.marginRight?W(e.style.marginLeft):"",J=e=>e.style.marginTop&&e.style.marginBottom&&e.style.marginTop===e.style.marginBottom?W(e.style.marginTop):"",Q=e=>e.style.borderWidth?W(e.style.borderWidth):"",X=(e,t)=>{var a;return e.hasAttribute(t)&&null!==(a=e.getAttribute(t))&&void 0!==a?a:""},Y=e=>null!==e.parentNode&&"FIGURE"===e.parentNode.nodeName,ee=(e,t,a)=>{""===a||null===a?e.removeAttribute(t):e.setAttribute(t,a)},te=e=>{Y(e)?(e=>{const t=e.parentNode;g(t)&&(K.insertAfter(e,t),K.remove(t))})(e):(e=>{const t=K.create("figure",{class:"image"});K.insertAfter(t,e),t.appendChild(e),t.appendChild(K.create("figcaption",{contentEditable:"true"},"Caption")),t.contentEditable="false"})(e)},ae=(e,t)=>{const a=e.getAttribute("style"),i=t(null!==a?a:"");i.length>0?(e.setAttribute("style",i),e.setAttribute("data-mce-style",i)):e.removeAttribute("style")},ie=(e,t)=>(e,a,i)=>{const o=e.style;o[a]?(o[a]=$(i),ae(e,t)):ee(e,a,i)},oe=(e,t)=>e.style[t]?W(e.style[t]):X(e,t),re=(e,t)=>{const a=$(t);e.style.marginLeft=a,e.style.marginRight=a},se=(e,t)=>{const a=$(t);e.style.marginTop=a,e.style.marginBottom=a},ne=(e,t)=>{const a=$(t);e.style.borderWidth=a},le=(e,t)=>{e.style.borderStyle=t},ce=e=>{var t;return null!==(t=e.style.borderStyle)&&void 0!==t?t:""},me=e=>g(e)&&"FIGURE"===e.nodeName,de=e=>0===K.getAttrib(e,"alt").length&&"presentation"===K.getAttrib(e,"role"),ge=e=>de(e)?"":X(e,"alt"),ue=(e,t)=>{var a;const i=document.createElement("img");return ee(i,"style",t.style),(Z(i)||""!==t.hspace)&&re(i,t.hspace),(J(i)||""!==t.vspace)&&se(i,t.vspace),(Q(i)||""!==t.border)&&ne(i,t.border),(ce(i)||""!==t.borderStyle)&&le(i,t.borderStyle),e(null!==(a=i.getAttribute("style"))&&void 0!==a?a:"")},pe=(e,t)=>({src:X(t,"src"),alt:ge(t),title:X(t,"title"),width:oe(t,"width"),height:oe(t,"height"),class:X(t,"class"),style:e(X(t,"style")),caption:Y(t),hspace:Z(t),vspace:J(t),border:Q(t),borderStyle:ce(t),isDecorative:de(t)}),he=(e,t,a,i,o)=>{a[i]!==t[i]&&o(e,i,String(a[i]))},be=(e,t,a)=>{if(a){K.setAttrib(e,"role","presentation");const t=I.fromDom(e);C(t,"alt","")}else{if(c(t)){const t=I.fromDom(e);i="alt",t.dom.removeAttribute(i)}else{const a=I.fromDom(e);C(a,"alt",t)}"presentation"===K.getAttrib(e,"role")&&K.setAttrib(e,"role","")}var i},ve=(e,t)=>(a,i,o)=>{e(a,o),ae(a,t)},ye=(e,t,a)=>{const i=pe(e,a);he(a,i,t,"caption",((e,t,a)=>te(e))),he(a,i,t,"src",ee),he(a,i,t,"title",ee),he(a,i,t,"width",ie(0,e)),he(a,i,t,"height",ie(0,e)),he(a,i,t,"class",ee),he(a,i,t,"style",ve(((e,t)=>ee(e,"style",t)),e)),he(a,i,t,"hspace",ve(re,e)),he(a,i,t,"vspace",ve(se,e)),he(a,i,t,"border",ve(ne,e)),he(a,i,t,"borderStyle",ve(le,e)),((e,t,a)=>{a.alt===t.alt&&a.isDecorative===t.isDecorative||be(e,a.alt,a.isDecorative)})(a,i,t)},fe=(e,t)=>{const a=(e=>{if(e.margin){const t=String(e.margin).split(" ");switch(t.length){case 1:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[0],e["margin-bottom"]=e["margin-bottom"]||t[0],e["margin-left"]=e["margin-left"]||t[0];break;case 2:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[0],e["margin-left"]=e["margin-left"]||t[1];break;case 3:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[2],e["margin-left"]=e["margin-left"]||t[1];break;case 4:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[2],e["margin-left"]=e["margin-left"]||t[3]}delete e.margin}return e})(e.dom.styles.parse(t)),i=e.dom.styles.parse(e.dom.styles.serialize(a));return e.dom.styles.serialize(i)},we=e=>{const t=e.selection.getNode(),a=e.dom.getParent(t,"figure.image");return a?e.dom.select("img",a)[0]:t&&("IMG"!==t.nodeName||V(t))?null:t},Ae=(e,t)=>{var a;const i=e.dom,o=((e,t)=>{const a={};var i;return f(e,t,(i=a,(e,t)=>{i[t]=e}),h),a})(e.schema.getTextBlockElements(),((t,a)=>!e.schema.isValidChild(a,"figure"))),r=i.getParent(t.parentNode,(e=>{return t=o,a=e.nodeName,w(t,a)&&void 0!==t[a]&&null!==t[a];var t,a}),e.getBody());return r&&null!==(a=i.split(r,t))&&void 0!==a?a:t},De=(e,t)=>{const a=((e,t)=>{const a=document.createElement("img");if(ye(e,{...t,caption:!1},a),be(a,t.alt,t.isDecorative),t.caption){const e=K.create("figure",{class:"image"});return e.appendChild(a),e.appendChild(K.create("figcaption",{contentEditable:"true"},"Caption")),e.contentEditable="false",e}return a})((t=>fe(e,t)),t);e.dom.setAttrib(a,"data-mce-id","__mcenew"),e.focus(),e.selection.setContent(a.outerHTML);const i=e.dom.select('*[data-mce-id="__mcenew"]')[0];if(e.dom.setAttrib(i,"data-mce-id",null),me(i)){const t=Ae(e,i);e.selection.select(t)}else e.selection.select(i)},_e=(e,t)=>{const a=we(e);if(a)if(ye((t=>fe(e,t)),t,a),((e,t)=>{e.dom.setAttrib(t,"src",t.getAttribute("src"))})(e,a),me(a.parentNode)){const t=a.parentNode;Ae(e,t),e.selection.select(a.parentNode)}else e.selection.select(a),((e,t,a)=>{const i=()=>{a.onload=a.onerror=null,e.selection&&(e.selection.select(a),e.nodeChanged())};a.onload=()=>{t.width||t.height||!L(e)||e.dom.setAttribs(a,{width:String(a.clientWidth),height:String(a.clientHeight)}),i()},a.onerror=i})(e,t,a)},Ce=(e,t)=>{const a=we(e);if(a){const i={...pe((t=>fe(e,t)),a),...t},o=((e,t)=>{const a=t.src;return{...t,src:q(e,a)?a:""}})(e,i);i.src?_e(e,o):((e,t)=>{if(t){const a=e.dom.is(t.parentNode,"figure.image")?t.parentNode:t;e.dom.remove(a),e.focus(),e.nodeChanged(),e.dom.isEmpty(e.getBody())&&(e.setContent(""),e.selection.setCursorLocation())}})(e,a)}else t.src&&De(e,{src:"",alt:"",title:"",width:"",height:"",class:"",style:"",caption:!1,hspace:"",vspace:"",border:"",borderStyle:"",isDecorative:!1,...t})},xe=(Ie=(e,t)=>n(e)&&n(t)?xe(e,t):t,(...e)=>{if(0===e.length)throw new Error("Can't merge zero objects");const t={};for(let a=0;a<e.length;a++){const i=e[a];for(const e in i)w(i,e)&&(t[e]=Ie(t[e],i[e]))}return t});var Ie,Ue=tinymce.util.Tools.resolve("tinymce.util.ImageUploader"),Se=tinymce.util.Tools.resolve("tinymce.util.Tools");const Ne=e=>r(e.value)?e.value:"",Te=(e,t)=>{const a=[];return Se.each(e,(e=>{const i=(e=>r(e.text)?e.text:r(e.title)?e.title:"")(e);if(void 0!==e.menu){const o=Te(e.menu,t);a.push({text:i,items:o})}else{const o=t(e);a.push({text:i,value:o})}})),a},Ee=(e=Ne)=>t=>t?b.from(t).map((t=>Te(t,e))):b.none(),Le=(e,t)=>((e,t)=>{for(let a=0;a<e.length;a++){const i=t(e[a],a);if(i.isSome())return i}return b.none()})(e,(e=>(e=>w(e,"items"))(e)?Le(e.items,t):e.value===t?b.some(e):b.none())),Oe=Ee,Me=e=>Ee(Ne)(e),je=(e,t)=>e.bind((e=>Le(e,t))),Pe=e=>({title:"Advanced",name:"advanced",items:[{type:"grid",columns:2,items:[{type:"input",label:"Vertical space",name:"vspace",inputMode:"numeric"},{type:"input",label:"Horizontal space",name:"hspace",inputMode:"numeric"},{type:"input",label:"Border width",name:"border",inputMode:"numeric"},{type:"listbox",name:"borderstyle",label:"Border style",items:[{text:"Select...",value:""},{text:"Solid",value:"solid"},{text:"Dotted",value:"dotted"},{text:"Dashed",value:"dashed"},{text:"Double",value:"double"},{text:"Groove",value:"groove"},{text:"Ridge",value:"ridge"},{text:"Inset",value:"inset"},{text:"Outset",value:"outset"},{text:"None",value:"none"},{text:"Hidden",value:"hidden"}]}]}]}),Re=e=>{const t=Oe((t=>e.convertURL(t.value||t.url||"","src"))),a=new Promise((a=>{((e,t)=>{const a=B(e);r(a)?fetch(a).then((e=>{e.ok&&e.json().then(t)})):u(a)?a(t):t(a)})(e,(e=>{a(t(e).map((e=>D([[{text:"None",value:""}],e]))))}))})),i=Me(P(e)),o=O(e),s=M(e),n=(e=>N(e.options.get("images_upload_url")))(e),l=(e=>g(e.options.get("images_upload_handler")))(e),c=(e=>{const t=we(e);return t?pe((t=>fe(e,t)),t):{src:"",alt:"",title:"",width:"",height:"",class:"",style:"",caption:!1,hspace:"",vspace:"",border:"",borderStyle:"",isDecorative:!1}})(e),m=R(e),d=k(e),p=L(e),h=z(e),v=H(e),y=F(e),f=b.some(j(e)).filter((e=>r(e)&&e.length>0));return a.then((e=>({image:c,imageList:e,classList:i,hasAdvTab:o,hasUploadTab:s,hasUploadUrl:n,hasUploadHandler:l,hasDescription:m,hasImageTitle:d,hasDimensions:p,hasImageCaption:h,prependURL:f,hasAccessibilityOptions:v,automaticUploads:y})))},ke=e=>{const t=e.imageList.map((e=>({name:"images",type:"listbox",label:"Image list",items:e}))),a={name:"alt",type:"input",label:"Alternative description",enabled:!(e.hasAccessibilityOptions&&e.image.isDecorative)},i=e.classList.map((e=>({name:"classes",type:"listbox",label:"Class",items:e})));return D([[{name:"src",type:"urlinput",filetype:"image",label:"Source",picker_text:"Browse files"}],t.toArray(),e.hasAccessibilityOptions&&e.hasDescription?[{type:"label",label:"Accessibility",items:[{name:"isDecorative",type:"checkbox",label:"Image is decorative"}]}]:[],e.hasDescription?[a]:[],e.hasImageTitle?[{name:"title",type:"input",label:"Image title"}]:[],e.hasDimensions?[{name:"dimensions",type:"sizeinput"}]:[],[{...(o=e.classList.isSome()&&e.hasImageCaption,o?{type:"grid",columns:2}:{type:"panel"}),items:D([i.toArray(),e.hasImageCaption?[{type:"label",label:"Caption",items:[{type:"checkbox",name:"caption",label:"Show caption"}]}]:[]])}]]);var o},ze=e=>({title:"General",name:"general",items:ke(e)}),Be=ke,He=e=>({title:"Upload",name:"upload",items:[{type:"dropzone",name:"fileinput"}]}),Fe=e=>({src:{value:e.src,meta:{}},images:e.src,alt:e.alt,title:e.title,dimensions:{width:e.width,height:e.height},classes:e.class,caption:e.caption,style:e.style,vspace:e.vspace,border:e.border,hspace:e.hspace,borderstyle:e.borderStyle,fileinput:[],isDecorative:e.isDecorative}),Ge=(e,t)=>({src:e.src.value,alt:null!==e.alt&&0!==e.alt.length||!t?e.alt:null,title:e.title,width:e.dimensions.width,height:e.dimensions.height,class:e.classes,style:e.style,caption:e.caption,hspace:e.hspace,vspace:e.vspace,border:e.border,borderStyle:e.borderstyle,isDecorative:e.isDecorative}),We=(e,t)=>{const a=t.getData();((e,t)=>/^(?:[a-zA-Z]+:)?\/\//.test(t)?b.none():e.prependURL.bind((e=>t.substring(0,e.length)!==e?b.some(e+t):b.none())))(e,a.src.value).each((e=>{t.setData({src:{value:e,meta:a.src.meta}})}))},$e=(e,t)=>{const a=t.getData(),i=a.src.meta;if(void 0!==i){const o=xe({},a);((e,t,a)=>{e.hasDescription&&r(a.alt)&&(t.alt=a.alt),e.hasAccessibilityOptions&&(t.isDecorative=a.isDecorative||t.isDecorative||!1),e.hasImageTitle&&r(a.title)&&(t.title=a.title),e.hasDimensions&&(r(a.width)&&(t.dimensions.width=a.width),r(a.height)&&(t.dimensions.height=a.height)),r(a.class)&&je(e.classList,a.class).each((e=>{t.classes=e.value})),e.hasImageCaption&&d(a.caption)&&(t.caption=a.caption),e.hasAdvTab&&(r(a.style)&&(t.style=a.style),r(a.vspace)&&(t.vspace=a.vspace),r(a.border)&&(t.border=a.border),r(a.hspace)&&(t.hspace=a.hspace),r(a.borderstyle)&&(t.borderstyle=a.borderstyle))})(e,o,i),t.setData(o)}},Ve=(e,t,a,i)=>{We(t,i),$e(t,i),((e,t,a,i)=>{const o=i.getData(),r=o.src.value,s=o.src.meta||{};s.width||s.height||!t.hasDimensions||(N(r)?e.imageSize(r).then((e=>{a.open&&i.setData({dimensions:e})})).catch((e=>console.error(e))):i.setData({dimensions:{width:"",height:""}}))})(e,t,a,i),((e,t,a)=>{const i=a.getData(),o=je(e.imageList,i.src.value);t.prevImage=o,a.setData({images:o.map((e=>e.value)).getOr("")})})(t,a,i)},qe=(e,t,a,i)=>{const o=i.getData();i.block("Uploading image"),_(o.fileinput).fold((()=>{i.unblock()}),(o=>{const r=URL.createObjectURL(o),s=()=>{i.unblock(),URL.revokeObjectURL(r)},n=o=>{i.setData({src:{value:o,meta:{}}}),i.showTab("general"),Ve(e,t,a,i)};var l;(l=o,new Promise(((e,t)=>{const a=new FileReader;a.onload=()=>{e(a.result)},a.onerror=()=>{var e;t(null===(e=a.error)||void 0===e?void 0:e.message)},a.readAsDataURL(l)}))).then((a=>{const l=e.createBlobCache(o,r,a);t.automaticUploads?e.uploadImage(l).then((e=>{n(e.url),s()})).catch((t=>{s(),e.alertErr(t)})):(e.addToBlobCache(l),n(l.blobUri()),i.unblock())}))}))},Ke=(e,t,a)=>(i,o)=>{"src"===o.name?Ve(e,t,a,i):"images"===o.name?((e,t,a,i)=>{const o=i.getData(),r=je(t.imageList,o.images);r.each((e=>{const t=""===o.alt||a.prevImage.map((e=>e.text===o.alt)).getOr(!1);t?""===e.value?i.setData({src:e,alt:a.prevAlt}):i.setData({src:e,alt:e.text}):i.setData({src:e})})),a.prevImage=r,Ve(e,t,a,i)})(e,t,a,i):"alt"===o.name?a.prevAlt=i.getData().alt:"fileinput"===o.name?qe(e,t,a,i):"isDecorative"===o.name&&i.setEnabled("alt",!i.getData().isDecorative)},Ze=e=>()=>{e.open=!1},Je=e=>{if(e.hasAdvTab||e.hasUploadUrl||e.hasUploadHandler){return{type:"tabpanel",tabs:D([[ze(e)],e.hasAdvTab?[Pe(e)]:[],e.hasUploadTab&&(e.hasUploadUrl||e.hasUploadHandler)?[He(e)]:[]])}}return{type:"panel",items:Be(e)}},Qe=(e,t,a)=>i=>{const o=xe(Fe(t.image),i.getData()),r={...o,style:ue(a.normalizeCss,Ge(o,!1))};e.execCommand("mceUpdateImage",!1,Ge(r,t.hasAccessibilityOptions)),e.editorUpload.uploadImagesAuto(),i.close()},Xe=e=>t=>q(e,t)?(e=>new Promise((t=>{const a=document.createElement("img"),i=e=>{a.onload=a.onerror=null,a.parentNode&&a.parentNode.removeChild(a),t(e)};a.onload=()=>{const e={width:G(a.width,a.clientWidth),height:G(a.height,a.clientHeight)};i(Promise.resolve(e))},a.onerror=()=>{i(Promise.reject(`Failed to get image dimensions for: ${e}`))};const o=a.style;o.visibility="hidden",o.position="fixed",o.bottom=o.left="0px",o.width=o.height="auto",document.body.appendChild(a),a.src=e})))(e.documentBaseURI.toAbsolute(t)).then((e=>({width:String(e.width),height:String(e.height)}))):Promise.resolve({width:"",height:""}),Ye=e=>(t,a,i)=>{var o;return e.editorUpload.blobCache.create({blob:t,blobUri:a,name:null===(o=t.name)||void 0===o?void 0:o.replace(/\.[^\.]+$/,""),filename:t.name,base64:i.split(",")[1]})},et=e=>t=>{e.editorUpload.blobCache.add(t)},tt=e=>t=>{e.windowManager.alert(t)},at=e=>t=>fe(e,t),it=e=>t=>e.dom.parseStyle(t),ot=e=>(t,a)=>e.dom.serializeStyle(t,a),rt=e=>t=>Ue(e).upload([t],!1).then((e=>{var t;return 0===e.length?Promise.reject("Failed to upload image"):!1===e[0].status?Promise.reject(null===(t=e[0].error)||void 0===t?void 0:t.message):e[0]})),st=e=>{const t={imageSize:Xe(e),addToBlobCache:et(e),createBlobCache:Ye(e),alertErr:tt(e),normalizeCss:at(e),parseStyle:it(e),serializeStyle:ot(e),uploadImage:rt(e)};return{open:()=>{Re(e).then((a=>{const i=(e=>({prevImage:je(e.imageList,e.image.src),prevAlt:e.image.alt,open:!0}))(a);return{title:"Insert/Edit Image",size:"normal",body:Je(a),buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:Fe(a.image),onSubmit:Qe(e,a,t),onChange:Ke(t,a,i),onClose:Ze(i)}})).then(e.windowManager.open)}}},nt=e=>{const t=e.attr("class");return g(t)&&/\bimage\b/.test(t)},lt=e=>t=>{let a=t.length;const i=t=>{t.attr("contenteditable",e?"true":null)};for(;a--;){const o=t[a];nt(o)&&(o.attr("contenteditable",e?"false":null),Se.each(o.getAll("figcaption"),i))}},ct=e=>t=>{const a=()=>{t.setEnabled(e.selection.isEditable())};return e.on("NodeChange",a),a(),()=>{e.off("NodeChange",a)}};e.add("image",(e=>{E(e),(e=>{e.on("PreInit",(()=>{e.parser.addNodeFilter("figure",lt(!0)),e.serializer.addNodeFilter("figure",lt(!1))}))})(e),(e=>{e.ui.registry.addToggleButton("image",{icon:"image",tooltip:"Insert/edit image",onAction:st(e).open,onSetup:t=>{t.setActive(g(we(e)));const a=e.selection.selectorChangedWithUnbind("img:not([data-mce-object]):not([data-mce-placeholder]),figure.image",t.setActive).unbind,i=ct(e)(t);return()=>{a(),i()}}}),e.ui.registry.addMenuItem("image",{icon:"image",text:"Image...",onAction:st(e).open,onSetup:ct(e)}),e.ui.registry.addContextMenu("image",{update:t=>e.selection.isEditable()&&(me(t)||"IMG"===t.nodeName&&!V(t))?["image"]:[]})})(e),(e=>{e.addCommand("mceImage",st(e).open),e.addCommand("mceUpdateImage",((t,a)=>{e.undoManager.transact((()=>Ce(e,a)))}))})(e)}))}()),e}export{a as __require};
|
2
2
|
//# sourceMappingURL=plugin.mjs.map
|