10 lines
18 KiB
JavaScript
10 lines
18 KiB
JavaScript
/*!
|
|
* Tiny Checklist plugin
|
|
*
|
|
* Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc.
|
|
* Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/
|
|
*
|
|
* Version: 8.3.0-112
|
|
*/
|
|
|
|
!function(){"use strict";const e=e=>t=>typeof t===e,t=e=>"string"===(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})(e),n=e("boolean"),o=e=>null==e,r=e=>!o(e),s=e("function"),a=e("number"),i=()=>{},c=()=>false;class l{tag;value;static singletonNone=new l(!1);constructor(e,t){this.tag=e,this.value=t}static some(e){return new l(!0,e)}static none(){return l.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?l.some(e(this.value)):l.none()}bind(e){return this.tag?e(this.value):l.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:l.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 r(e)?l.some(e):l.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()"}}const d=Array.prototype.indexOf,u=(e,t)=>{return n=e,o=t,d.call(n,o)>-1;var n,o},m=(e,t)=>{for(let n=0,o=e.length;n<o;n++)if(t(e[n],n))return!0;return!1},g=(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},p=(e,t)=>{for(let n=0,o=e.length;n<o;n++)t(e[n],n)},h=(e,t)=>{const n=[];for(let o=0,r=e.length;o<r;o++){const r=e[o];t(r,o)&&n.push(r)}return n},f=Object.keys,v=(e,t)=>{const n=f(e);for(let o=0,r=n.length;o<r;o++){const r=n[o];t(e[r],r)}},y=(e,t)=>S(e,((e,n)=>({k:n,v:t(e,n)}))),S=(e,t)=>{const n={};return v(e,((e,o)=>{const r=t(e,o);n[r.k]=r.v})),n},C=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},w=(e,t)=>{const{type:n,message:o}=t;e.notificationManager.open({type:n,text:o})},x=e=>{(e=>{switch(e){case"error":return console.error;case"info":return console.info;case"warn":return console.warn;default:return console.log}})(e.type)(e.message)},k=(e,t)=>{const{protect:n,allowList:o=[],blockList:s=[]}=null!=e?e:{};let a;return a=r(n)?n:o.length>0||s.length>0||t,{protect:a,allowList:o,blockList:s}},b=e=>{const{protect:t,allowList:n,blockList:o}=null!=e?e:{};return e=>{const r=e.toLowerCase();return n.length>0?!m(n,(e=>e.toLowerCase()===r)):o.length>0?m(o,(e=>e.toLowerCase()===r)):t}},L=e=>{const t=b(e);return(e,n)=>{const o=((e,t)=>`${e}:${t}`)(n,e.toLowerCase());return t(o)}},P=(e,t,n,o)=>{const r=Reflect.get(e,"on"),s={protectedEventHandlers:[],cleanupScheduled:!1},a=(e,t)=>{o&&console.log(`[EventsProxy] ${e}`,t||"")},c=t=>{"invalid"===t&&s.protectedEventHandlers.length>0&&(a("Removing event handlers",s.protectedEventHandlers),p(s.protectedEventHandlers,(t=>{e.off(t.name,t.callback)})),s.protectedEventHandlers=[])},l=t.onStatusChange(c);return e.on("remove",l),(o,l,d)=>{a(`Adding event listener: ${o}`,{shouldProtect:n(o)});const u=((e,o)=>{const r=n(e),a=t.getStatus(),c=r&&"invalid"===a?i:o;return r&&s.protectedEventHandlers.push({name:e,callback:c}),c})(o,l);return s.cleanupScheduled||(s.cleanupScheduled=!0,window.setTimeout((()=>{c(t.getStatus()),s.cleanupScheduled=!1}),0)),Reflect.apply(r,e,[o,u,d])}},R=(e,t,n)=>o=>{const s="invalid"!==t.getStatus()&&r(n)?n(o):i,a=((e,t,n)=>{const o=e=>{"invalid"===e&&n.setEnabled(!1)},r=()=>o(t.getStatus());o(t.getStatus()),e.on("NodeChange",r);const s=t.onStatusChange(o);return()=>{e.off("NodeChange",r),s()}})(e,t,o);return e=>{null==s||s(e),a()}},$=(e,t,n)=>(...o)=>{var r;return"invalid"===e.getStatus()?n:null!==(r=null==t?void 0:t(...o))&&void 0!==r?r:n},E=(e,t)=>$(e,t,Promise.resolve([])),T=(e,t)=>$(e,t,[]),N=(e,t)=>$(e,t,!1),M=(e,n,o,r)=>{const s=n=>{const{command:s,value:a}=n,i=l.from(a).filter(t).map((e=>e.toLowerCase())),c=s.toLowerCase()===r.toLowerCase(),d=i.exists((e=>o.has(e))),u=i.exists((t=>t===e.queryCommandValue(r)));c&&d&&!u&&n.preventDefault()},a=n.onStatusChange((t=>{if("invalid"===t){e.on("BeforeExecCommand",s);const t=()=>{const t=e.queryCommandValue(r);o.has(t.toLowerCase())&&e.execCommand(r,!1,t)};e.initialized?t():e.on("init",t)}}));e.on("remove",(()=>{a(),e.off("BeforeExecCommand",s)}))},O=(e,n,o,r,s,a=!1)=>{const i=new Set,c=new Set,l=(e,t)=>{a&&console.log(`[UiProxy] ${e}`,t||"")};((e,t,n)=>{M(e,t,n,"ToggleView")})(e,o,i),((e,t,n)=>{M(e,t,n,"ToggleSidebar")})(e,o,c);const d=(t,n,a,i)=>{const c=s(t,a);return l(`${i}: ${t}`,{spec:n,context:r,shouldProtect:c}),c?{...n,onSetup:R(e,o,n.onSetup)}:n};return new Proxy(n,{get:(e,n,a)=>{const u=Reflect.get(e,n,a);if(!t(n))return u;switch(n){case"addButton":case"addGroupToolbarButton":case"addToggleButton":case"addMenuButton":case"addSplitButton":return(...t)=>{const[o,r,...s]=t,a=d(o,r,"button",String(n));return Reflect.apply(u,e,[o,a,...s])};case"addMenuItem":case"addToggleMenuItem":case"addNestedMenuItem":return(...t)=>{const[o,r,...s]=t,a=d(o,r,"menuitem",String(n));return Reflect.apply(u,e,[o,a,...s])};case"addAutocompleter":return(...t)=>{const[a,i,...c]=t,d=s(a,"autocompleter");if(l(`${String(n)}: ${a}`,{spec:i,context:r,shouldProtect:d}),d){const t={...i,fetch:E(o,i.fetch)};return Reflect.apply(u,e,[a,t,...c])}return Reflect.apply(u,e,[a,i,...c])};case"addSidebar":return(...t)=>{const[o,a,...i]=t,d=s(o,"sidebar");if(l(`${String(n)}: ${o}`,{spec:a,context:r,shouldProtect:d}),d){c.add(o.toLowerCase());const t={...a};return Reflect.apply(u,e,[o,t,...i])}return Reflect.apply(u,e,[o,a,...i])};case"addView":return(...t)=>{const[o,a,...c]=t,d=s(o,"view");if(l(`${String(n)}: ${o}`,{spec:a,context:r,shouldProtect:d}),d){i.add(o.toLowerCase());const t={...a};return Reflect.apply(u,e,[o,t,...c])}return Reflect.apply(u,e,[o,a,...c])};case"addContextMenu":return(...t)=>{const[a,i,...c]=t,d=s(a,"contextmenu");if(l(`${String(n)}: ${a}`,{spec:i,context:r,shouldProtect:d}),d){const t={...i,update:T(o,i.update)};return Reflect.apply(u,e,[a,t,...c])}return Reflect.apply(u,e,[a,i,...c])};case"addContextToolbar":case"addContextForm":return(...t)=>{const[a,i,...c]=t,d=s(a,"contexttoolbar");if(l(`${String(n)}: ${a}`,{spec:i,context:r,shouldProtect:d}),d){const t={...i,predicate:N(o,i.predicate)};return Reflect.apply(u,e,[a,t,...c])}return Reflect.apply(u,e,[a,i,...c])};case"addIcon":case"getAll":case"addContext":return u}}})},A=new Set(["addCommand","addCommands","addQueryStateHandler","addQueryValueHandler"]),B=e=>(t,n)=>{e&&console.log(`[EditorProxy] ${t}`,n||"")},j=(e,t)=>{const{statusProvider:n,uiContext:o,protection:r,debug:a=!1}=t,{events:c,commands:l,ui:d}=r;B(a)("Creating enhanced editor with options:",{hasStatusProvider:!!n,uiContext:o,debug:a,protection:r});const{editorUiProxy:u,editorCommandsProxy:m,editorEventListenerProxy:g}=((e,t,n,o,r,s,a)=>{const c=s.protect?{...e.ui,registry:O(e,e.ui.registry,t,n,L(s),a)}:e.ui,l=o.protect?((e,t,n,o,r)=>{const s={protectedCommands:[],cleanupScheduled:!1},a=(e,t)=>{r&&console.log(`[CommandsProxy] ${e}`,t||"")},c=(e,t)=>{const r=o(e),a=n.getStatus();return r&&s.protectedCommands.push(e),r&&"invalid"===a?i:t},l=t=>{"invalid"===t&&s.protectedCommands.length>0&&(a("Removing commands",s.protectedCommands),p(s.protectedCommands,(t=>{e.editorCommands.removeCommand(t)})),s.protectedCommands=[])},d=()=>{s.cleanupScheduled||(s.cleanupScheduled=!0,window.setTimeout((()=>{l(n.getStatus()),s.cleanupScheduled=!1}),0))},u=n.onStatusChange(l);return e.on("remove",u),new Proxy(t,{get:(e,n,r)=>{if(a(`Accessing property: ${String(n)}`),"addCommand"===n){const s=Reflect.get(e,n,r);return(e,n,...r)=>{a(`Adding command: ${e}`,{shouldProtect:o(e)});const i=c(e,n);return d(),Reflect.apply(s,t,[e,i,...r])}}if("addCommands"===n){const o=Reflect.get(e,n,r);return(e,n="exec")=>{a(`Adding commands (${n})`,{commandCount:Object.keys(e).length,willApplyEnforcement:"exec"===n});const r="exec"!==n?e:y(e,((e,t)=>c(t,e)));return d(),Reflect.apply(o,t,[r,n])}}return Reflect.get(e,n,r)}})})(e,e.editorCommands,t,b(o),a):e.editorCommands;return{editorUiProxy:c,editorCommandsProxy:l,editorEventListenerProxy:r.protect?P(e,t,b(r),a):e.on.bind(e)}})(e,n,o||"",l,c,d,a),h=((e,t,n,o)=>(r,a,i)=>{const c=String(a);if("on"===a)return B(o)("on intercepted"),n;if(A.has(c))return B(o)(`${c} intercepted`),t[c].bind(t);if("editorCommands"===a)return B(o)("editorCommands accessed"),t;if("ui"===a)return B(o)("ui accessed"),e;const l=Reflect.get(r,a,i);return s(l)?l.bind(r):l})(u,m,g,a);return new Proxy(e,{get:h,set:(e,t,n,o)=>Reflect.set(e,t,n,o),has:(e,t)=>Reflect.has(e,t),ownKeys:e=>Reflect.ownKeys(e),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(e,t),defineProperty:(e,t,n)=>Reflect.defineProperty(e,t,n),deleteProperty:(e,t)=>Reflect.deleteProperty(e,t),isExtensible:e=>Reflect.isExtensible(e),preventExtensions:e=>Reflect.preventExtensions(e),getPrototypeOf:e=>Reflect.getPrototypeOf(e),setPrototypeOf:(e,t)=>Reflect.setPrototypeOf(e,t)})},I=e=>parseInt(e,10),D=(e,t)=>{const n=e-t;return 0===n?0:n>0?1:-1},H=(e,t,n)=>({major:e,minor:t,patch:n}),z=e=>{const t=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return t?H(I(t[1]),I(t[2]),I(t[3])):H(0,0,0)},U=(e,t)=>!!e&&-1===((e,t)=>{const n=D(e.major,t.major);if(0!==n)return n;const o=D(e.minor,t.minor);if(0!==o)return o;const r=D(e.patch,t.patch);return 0!==r?r:0})((e=>z((e=>[e.majorVersion,e.minorVersion].join(".").split(".").slice(0,3).join("."))(e)))(e),z(t)),V=z("8.3.0"),q=`${V.major}.${V.minor}.0`,K=`${V.major+1}.0.0`,_=(e,t)=>{const{setup:n,protection:a}=t;return(i,c)=>{if(!((e,t)=>U(e,q)?(console.error(`The "${t}" plugin requires at least version ${q} of TinyMCE.`),!1):!!U(e,K)||(console.error(`The "${t}" plugin requires at least version ${q} of TinyMCE but less than ${K}.`),!1))(tinymce,e)||((e,t)=>!!(e=>{var t;const n=null===(t=e.options.get("license_key"))||void 0===t?void 0:t.toLowerCase(),r=e.options.get("online_license_key");return o(r)&&"gpl"===n})(e)&&(((e,t)=>{const{console:n,editor:o}=t;r(o)&&(e._skinLoaded?w(e,o):e.on("SkinLoaded",(()=>{w(e,o)}))),r(n)&&x(n)})(e,{console:{type:"error",message:[`The "${t}" plugin requires a valid TinyMCE license key.`,"Read more: https://www.tiny.cloud/docs/tinymce/latest/license-key/"].join(" ")}}),!0))(i,e))return{};const l=(e=>{const{protect:t=!0,events:n,commands:o,ui:r,api:s}=null!=e?e:{};return{protect:t,events:k(n,false),commands:k(o,true),ui:k(r,true),api:k(s,true)}})(a),d=((e="pre-validation")=>{const t=C(e),n=new Set;let o=!1;const{enableLogging:r=!1}={},s=(e,...t)=>{r&&console.log(`[StatusProvider] ${e}`,...t)};return{setStatus:e=>{const o=t.get();if(o===e)return s("Status unchanged:",e),!1;t.set(e),s("Status changed:",o,"->",e);const r={currentStatus:e,previousStatus:o},a=Array.from(n);return p(a,(e=>{e(r.currentStatus,r.previousStatus)})),!0},onStatusChange:e=>(n.add(e),s("Callback registered, total listeners:",n.size),()=>{n.delete(e)&&s("Callback unregistered, remaining listeners:",n.size)}),getStatus:t.get,hasListeners:()=>n.size>0,destroy:()=>{o||(s("Destroying StatusProvider, clearing",n.size,"listeners"),n.clear(),o=!0)}}})(),u=((e,t,n)=>{const o=`commercial-license-${t}`;return e.ui.registry.addContext(o,(()=>"invalid"!==n.getStatus()&&!e.mode.isReadOnly())),e.licenseKeyManager.validate({plugin:t}).then((e=>{n.setStatus(e?"valid":"invalid")}),(e=>{console.error(e),console.error(`An unknown error occurred when trying to validate "${t}" plugin.`),n.setStatus("invalid")})),{ui:{context:o}}})(i,e,d),m=l.protect?j(i,{statusProvider:d,uiContext:u.ui.context,debug:t.debug||!1,protection:l}):i,g=((e,t)=>({pluginCode:e,enforcer:{isInvalid:()=>"invalid"===t.getStatus(),onInvalid:e=>t.onStatusChange(((t,n)=>{"invalid"===t&&e(t,n)}))}}))(e,d);return((e,t,n,o)=>{if(t.protect&&t.api.protect&&r(e)){const i=b(t.api);return(a=e=>"invalid"===n.getStatus()&&i(e),(e,t)=>y(e,((e,n)=>s(e)?(...o)=>{if(a(n.toLowerCase())){const e=`Method "${r(t)?`${t}.`:""}${n}" is not available due to license key restrictions.`,o=new Error(e);throw console.error(e),o}return e(...o)}:e)))(e,o)}var a;return e})(n(m,c,g),l,d,e)}},F=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},G=(e,t)=>{const n=(t||document).createElement(e);return F(n)},Q=F,W=(e,t)=>{const n=e.dom;if(1!==n.nodeType)return!1;{const e=n;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},X=e=>e.dom.nodeName.toLowerCase(),J=e=>1===(e=>e.dom.nodeType)(e);const Y=e=>t=>J(t)&&X(t)===e,Z=e=>l.from(e.dom.parentNode).map(Q),ee=e=>g(e.dom.childNodes,Q),te=e=>(e=>{const t=e.dom.childNodes;return l.from(t[0]).map(Q)})(e),ne=(e,t)=>{e.dom.appendChild(t.dom)},oe=(e,o,r)=>{if(!(t(r)||n(r)||a(r)))throw console.error("Invalid call to Attribute.set. Key ",o,":: Value ",r,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(o,r+"")},re=(e,t,n)=>{oe(e.dom,t,n)},se=(e,t)=>{e.dom.removeAttribute(t)},ae=(e,t)=>{const n=G(t);return((e,t)=>{const n=e.dom;v(t,((e,t)=>{oe(n,t,e)}))})(n,(o=e.dom.attributes,r=(e,t)=>(e[t.name]=t.value,e),s={},p(o,((e,t)=>{s=r(s,e)})),s)),n;var o,r,s},ie=(e,t)=>{const n=ae(e,t);var o,r;return r=n,(e=>l.from(e.dom.nextSibling).map(Q))(o=e).fold((()=>{Z(o).each((e=>{ne(e,r)}))}),(e=>{((e,t)=>{Z(e).each((n=>{n.dom.insertBefore(t.dom,e.dom)}))})(e,r)})),((e,t)=>{p(t,(t=>{ne(e,t)}))})(n,ee(e)),(e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)})(e),n},ce=(e,t)=>{const n=((e,t)=>{const n=e.dom.getAttribute(t);return null===n?void 0:n})(e,t);return void 0===n||""===n?[]:n.split(" ")};var le=(e,t,n,o,r)=>e(n,o)?l.some(n):s(r)&&r(n)?l.none():t(n,o,r);const de=(e,t,n)=>{let o=e.dom;const r=s(n)?n:c;for(;o.parentNode;){o=o.parentNode;const e=Q(o);if(t(e))return l.some(e);if(r(e))break}return l.none()},ue=(e,t,n)=>de(e,(e=>W(e,t)),n),me=e=>void 0!==e.dom.classList,ge=e=>ce(e,"class"),pe=(e,t)=>((e,t,n)=>{const o=ce(e,t).concat([n]);return re(e,t,o.join(" ")),!0})(e,"class",t),he=(e,t)=>((e,t,n)=>{const o=h(ce(e,t),(e=>e!==n));return o.length>0?re(e,t,o.join(" ")):se(e,t),!1})(e,"class",t),fe=(e,t)=>{me(e)?e.dom.classList.add(t):pe(e,t)},ve=e=>{0===(me(e)?e.dom.classList:ge(e)).length&&se(e,"class")},ye=(e,t)=>{me(e)?e.dom.classList.remove(t):he(e,t),ve(e)},Se=(e,t)=>me(e)&&e.dom.classList.contains(t),Ce=e=>Y("li")(e)&&Z(e).filter((e=>"ul"===X(e)&&Se(e,"tox-checklist"))).isSome(),we=e=>((e,t)=>{const n=me(e)?e.dom.classList.toggle(t):((e,t)=>u(ge(e),t)?he(e,t):pe(e,t))(e,t);return ve(e),n})(e,"tox-checklist--checked"),xe=e=>u(["ul","ol","dl"],X(e)),ke=e=>(l.from(e).filter((e=>Se(e,"tox-checklist"))).bind(te).map((e=>{Y("li")(e)&&te(e).exists(Y("ul"))&&fe(e,"tox-checklist--hidden")})),e),be=e=>t=>r(t)&&e.test(t.nodeName),Le=be(/^(OL|UL|DL)$/),Pe=be(/^(LI|DT|DD)$/),Re=["OL","UL","DL"],$e=Re.join(","),Ee=(e,t)=>{const n=e.dom.getParents(t,e.dom.isBlock);return(o=n,r=t=>{return n=e.schema,!Le(o=t)&&!Pe(o)&&m(Re,(e=>n.isValidChild(o.nodeName,e)));var n,o},((e,t,n)=>{for(let o=0,r=e.length;o<r;o++){const r=e[o];if(t(r,o))return l.some(r);if(n(r,o))break}return l.none()})(o,r,c)).getOr(e.getBody());var o,r},Te=e=>{const t=e=>"ol"===X(e)||"ul"===X(e),n=()=>{const n=Q(e.selection.getNode());var o,s;e.selection.isEditable()&&(o=n,s=t,le(((e,t)=>t(e)),de,o,s,undefined)).fold((()=>{e.undoManager.transact((()=>{e.execCommand("InsertUnorderedList",!1,{"list-attributes":{class:"tox-checklist"}}),p(h(g(e.selection.getSelectedBlocks(),Q),t),(e=>fe(e,"tox-checklist")))}))}),(t=>{e.undoManager.transact((()=>{if(Se(t,"tox-checklist"))e.execCommand("RemoveList");else{const n=e.selection.getBookmark(),o=(e=>{const t=(e=>{const t=e.selection.getStart(!0);return e.dom.getParent(t,$e,Ee(e,t))})(e),n=e.selection.getSelectedBlocks();return((e,t)=>r(e)&&1===t.length&&t[0]===e)(t,n)?(e=>h(e.querySelectorAll($e),Le))(t):h(n,(e=>Le(e)&&t!==e))})(e).map(Q);p([t,...o],(e=>{const t=ie(e,"ul");fe(t,"tox-checklist")})),e.selection.moveToBookmark(n)}}))}))};e.ui.registry.addToggleButton("checklist",{icon:"checklist",tooltip:"Insert Checklist",onAction:n,onSetup:n=>{const o=Q(e.getBody()),r=e=>{return n=o,e.dom===n.dom||t(e);var n},s=t=>n.setActive(!e.readonly&&((e,t,n)=>le(((e,t)=>W(e,t)),ue,e,".tox-checklist",n))(Q(t),0,r).isSome()),a=()=>{const t=e.selection.isEditable();n.setEnabled(!e.readonly&&t)},i=e=>{s(e.element),a()};return e.on("NodeChange",i),s(e.selection.getNode()),a(),()=>e.off("NodeChange",i)}}),e.ui.registry.addMenuItem("checklist",{icon:"checklist",text:"Checklist",onAction:n,onSetup:t=>{const n=()=>{const n=e.selection.isEditable();t.setEnabled(!e.readonly&&n)};return e.on("NodeChange",n),n(),()=>e.off("NodeChange",n)}})};((e,t)=>{const{i18n:n=!0}=t;n&&tinymce.PluginManager.requireLangPack(e,"ar,bg-BG,ca,cs,da,de,el,es,eu,fa,fi,fr-FR,he-IL,hi,hr,hu-HU,id,it,ja,kk,ko-KR,ms,nb-NO,nl,pl,pt-BR,pt-PT,ro,ru,sk,sl-SI,sv-SE,th-TH,tr,uk,vi,zh-CN,zh-TW"),tinymce.PluginManager.add(e,_(e,t))})("checklist",{setup:(e,t,n)=>{e.on("init",(()=>{e.hasPlugin("lists",!0)||e.windowManager.alert("Please use the Checklist Plugin together with the Lists plugin.")})),(e=>{e.on("ListMutation",(e=>{const t=l.from(e.element).map(Q);"IndentList"===e.action||"OutdentList"===e.action?t.map(ke).map((e=>p(((e,t)=>{const n=void 0===t?document:t.dom;return 1!==(o=n).nodeType&&9!==o.nodeType&&11!==o.nodeType||0===o.childElementCount?[]:g(n.querySelectorAll(e),Q);var o})("ul",e),(e=>ke(e))))):"ToggleUlList"!==e.action&&"ToggleOlList"!==e.action&&"ToggleDLList"!==e.action||t.filter(xe).map((e=>{ye(e,"tox-checklist"),p(ee(e),(e=>ye(e,"tox-checklist--checked")))}))}))})(e),Te(e),((e,t)=>{e.shortcuts.add("meta+13","Check checklist item",(()=>{const n=e.selection.getSelectedBlocks();p(n,(n=>{const o=Q(n);!Ce(o)||e.mode.isReadOnly()||t.isInvalid()||we(o)}))}))})(e,n.enforcer),((e,t)=>{const n=C(l.none());e.on("mousedown touchstart",(o=>{const r=Q(o.target);((e,t)=>t.exists((t=>"touchstart"===t.type&&"mousedown"===e.type&&e.timeStamp-t.timeStamp<250)))(o,n.get())||!Ce(r)||!((e,t,n)=>{const o=e.document.createRange();return o.selectNodeContents(t.dom),n<o.getBoundingClientRect().left})(e.contentWindow,r,(e=>(e=>"touchstart"===e.type)(e)?e.touches[0].clientX:e.clientX)(o))||e.mode.isReadOnly()||t.isInvalid()||(n.set(l.some(o)),e.undoManager.transact((()=>{o.preventDefault(),we(r)})))}))})(e,n.enforcer)},i18n:!1})}(); |