opentiny 6.9.2 → 6.9.4
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/package.json +1 -1
- package/plugins/quickbars/plugin.js +14 -1
- package/plugins/quickbars/plugin.min.js +1 -1
- package/tinymce.js +0 -14
- package/tinymce.min.js +1 -1
package/package.json
CHANGED
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
return prefix + '_' + random + unique + String(time);
|
|
89
89
|
};
|
|
90
90
|
|
|
91
|
+
const defaultMaxImageWidthPx = 300;
|
|
91
92
|
const insertTable = (editor, columns, rows) => {
|
|
92
93
|
editor.execCommand('mceInsertTable', false, {
|
|
93
94
|
rows,
|
|
@@ -98,7 +99,19 @@
|
|
|
98
99
|
const blobCache = editor.editorUpload.blobCache;
|
|
99
100
|
const blobInfo = blobCache.create(generate('mceu'), blob, base64);
|
|
100
101
|
blobCache.add(blobInfo);
|
|
101
|
-
|
|
102
|
+
const img = new Image();
|
|
103
|
+
img.src = blobInfo.blobUri();
|
|
104
|
+
img.onload = () => {
|
|
105
|
+
const contentBodyElement = editor.dom.select('.mce-content-body')[0];
|
|
106
|
+
const maxImageWidth = contentBodyElement ? parseInt(window.getComputedStyle(contentBodyElement).width) : defaultMaxImageWidthPx;
|
|
107
|
+
editor.insertContent(editor.dom.createHTML('img', {
|
|
108
|
+
src: blobInfo.blobUri(),
|
|
109
|
+
width: `${ Math.min(img.naturalWidth, maxImageWidth) }px`
|
|
110
|
+
}));
|
|
111
|
+
};
|
|
112
|
+
img.onerror = err => {
|
|
113
|
+
console.error('Failed to load the image blob:', err);
|
|
114
|
+
};
|
|
102
115
|
};
|
|
103
116
|
|
|
104
117
|
const blobToBase64 = blob => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TinyMCE version 7.0.0 (TBD)
|
|
3
3
|
*/
|
|
4
|
-
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=t=>e=>typeof e===t,o=("string",t=>"string"===(t=>{const e=typeof t;return null===t?"null":"object"===e&&Array.isArray(t)?"array":"object"===e&&(o=n=t,(r=String).prototype.isPrototypeOf(o)||(null===(i=n.constructor)||void 0===i?void 0:i.name)===r.name)?"string":e;var o,n,r,i})(t));const n=e("boolean"),r=e("function"),i=t=>e=>e.options.get(t),s=i("quickbars_selection_toolbar"),a=i("quickbars_insert_toolbar"),l=i("quickbars_image_toolbar");let c=0;var u=tinymce.util.Tools.resolve("tinymce.util.Delay");const d=t=>{t.ui.registry.addButton("quickimage",{icon:"image",tooltip:"Insert image",onAction:()=>{(t=>new Promise((e=>{let o=!1;const n=document.createElement("input");n.type="file",n.accept="image/*",n.style.position="fixed",n.style.left="0",n.style.top="0",n.style.opacity="0.001",document.body.appendChild(n);const r=t=>{var r;o||(null===(r=n.parentNode)||void 0===r||r.removeChild(n),o=!0,e(t))},i=t=>{r(Array.prototype.slice.call(t.target.files))};n.addEventListener("input",i),n.addEventListener("change",i);const s=e=>{const n=()=>{r([])};o||("focusin"===e.type?u.setEditorTimeout(t,n,1e3):n()),t.off("focusin remove",s)};t.on("focusin remove",s),n.click()})))(t).then((e=>{if(e.length>0){const o=e[0];(t=>new Promise((e=>{const o=new FileReader;o.onloadend=()=>{e(o.result.split(",")[1])},o.readAsDataURL(t)})))(o).then((e=>{((t,e,o)=>{const n=t.editorUpload.blobCache,r=n.create((t=>{const e=(new Date).getTime(),o=Math.floor(1e9*Math.random());return c++,"mceu_"+o+c+String(e)})(),o,e);n.add(r),t.insertContent(t.dom.createHTML("img",{src:r.blobUri()}))})(t,e,o)}))}}))}}),t.ui.registry.addButton("quicktable",{icon:"table",tooltip:"Insert table",onAction:()=>{((t,e,o)=>{t.execCommand("mceInsertTable",!1,{rows:2,columns:2})})(t)}})},m=(!1,()=>false);class
|
|
4
|
+
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=t=>e=>typeof e===t,o=("string",t=>"string"===(t=>{const e=typeof t;return null===t?"null":"object"===e&&Array.isArray(t)?"array":"object"===e&&(o=n=t,(r=String).prototype.isPrototypeOf(o)||(null===(i=n.constructor)||void 0===i?void 0:i.name)===r.name)?"string":e;var o,n,r,i})(t));const n=e("boolean"),r=e("function"),i=t=>e=>e.options.get(t),s=i("quickbars_selection_toolbar"),a=i("quickbars_insert_toolbar"),l=i("quickbars_image_toolbar");let c=0;var u=tinymce.util.Tools.resolve("tinymce.util.Delay");const d=t=>{t.ui.registry.addButton("quickimage",{icon:"image",tooltip:"Insert image",onAction:()=>{(t=>new Promise((e=>{let o=!1;const n=document.createElement("input");n.type="file",n.accept="image/*",n.style.position="fixed",n.style.left="0",n.style.top="0",n.style.opacity="0.001",document.body.appendChild(n);const r=t=>{var r;o||(null===(r=n.parentNode)||void 0===r||r.removeChild(n),o=!0,e(t))},i=t=>{r(Array.prototype.slice.call(t.target.files))};n.addEventListener("input",i),n.addEventListener("change",i);const s=e=>{const n=()=>{r([])};o||("focusin"===e.type?u.setEditorTimeout(t,n,1e3):n()),t.off("focusin remove",s)};t.on("focusin remove",s),n.click()})))(t).then((e=>{if(e.length>0){const o=e[0];(t=>new Promise((e=>{const o=new FileReader;o.onloadend=()=>{e(o.result.split(",")[1])},o.readAsDataURL(t)})))(o).then((e=>{((t,e,o)=>{const n=t.editorUpload.blobCache,r=n.create((t=>{const e=(new Date).getTime(),o=Math.floor(1e9*Math.random());return c++,"mceu_"+o+c+String(e)})(),o,e);n.add(r);const i=new Image;i.src=r.blobUri(),i.onload=()=>{const e=t.dom.select(".mce-content-body")[0],o=e?parseInt(window.getComputedStyle(e).width):300;t.insertContent(t.dom.createHTML("img",{src:r.blobUri(),width:`${Math.min(i.naturalWidth,o)}px`}))},i.onerror=t=>{console.error("Failed to load the image blob:",t)}})(t,e,o)}))}}))}}),t.ui.registry.addButton("quicktable",{icon:"table",tooltip:"Insert table",onAction:()=>{((t,e,o)=>{t.execCommand("mceInsertTable",!1,{rows:2,columns:2})})(t)}})},m=(!1,()=>false);class h{constructor(t,e){this.tag=t,this.value=e}static some(t){return new h(!0,t)}static none(){return h.singletonNone}fold(t,e){return this.tag?e(this.value):t()}isSome(){return this.tag}isNone(){return!this.tag}map(t){return this.tag?h.some(t(this.value)):h.none()}bind(t){return this.tag?t(this.value):h.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:h.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 null==t?h.none():h.some(t)}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()"}}h.singletonNone=new h(!1),"undefined"!=typeof window?window:Function("return this;")();var g=(t,e,o,n,i)=>t(o,n)?h.some(o):r(i)&&i(o)?h.none():e(o,n,i);const b=t=>{if(null==t)throw new Error("Node cannot be null or undefined");return{dom:t}},p=b,v=(t,e)=>{const o=t.dom;if(1!==o.nodeType)return!1;{const t=o;if(void 0!==t.matches)return t.matches(e);if(void 0!==t.msMatchesSelector)return t.msMatchesSelector(e);if(void 0!==t.webkitMatchesSelector)return t.webkitMatchesSelector(e);if(void 0!==t.mozMatchesSelector)return t.mozMatchesSelector(e);throw new Error("Browser lacks native selectors")}},f=(t,e,o)=>{let n=t.dom;const i=r(o)?o:m;for(;n.parentNode;){n=n.parentNode;const t=p(n);if(e(t))return h.some(t);if(i(t))break}return h.none()},y=(t,e,o)=>f(t,(t=>v(t,e)),o),w=t=>{const e=a(t);e.length>0&&t.ui.registry.addContextToolbar("quickblock",{predicate:e=>{const o=p(e),n=t.schema.getTextBlockElements(),r=e=>e.dom===t.getBody();return!((t,e)=>{const o=t.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute("data-mce-bogus")})(o)&&((t,e,o)=>g(((t,e)=>v(t,e)),y,t,'table,[data-mce-bogus="all"]',o))(o,0,r).fold((()=>((t,e,o)=>((t,e,o)=>g(((t,e)=>e(t)),f,t,e,o))(t,e,o).isSome())(o,(e=>e.dom.nodeName.toLowerCase()in n&&t.dom.isEmpty(e.dom)),r)),m)},items:e,position:"line",scope:"editor"})};t.add("quickbars",(t=>{(t=>{const e=t.options.register,r=t=>e=>{const r=n(e)||o(e);return r?n(e)?{value:e?t:"",valid:r}:{value:e.trim(),valid:r}:{valid:!1,message:"Must be a boolean or string."}},i="bold italic | quicklink h2 h3 blockquote";e("quickbars_selection_toolbar",{processor:r(i),default:i});const s="quickimage quicktable";e("quickbars_insert_toolbar",{processor:r(s),default:s});const a="alignleft aligncenter alignright";e("quickbars_image_toolbar",{processor:r(a),default:a})})(t),d(t),w(t),(t=>{const e=e=>t.dom.isEditable(e),o=t=>{const o="FIGURE"===t.nodeName&&/image/i.test(t.className),n="IMG"===t.nodeName||o,r=(t=>void 0!==t.dom.classList)(i=p(t))&&i.dom.classList.contains("mce-pagebreak");var i;return n&&e(t.parentElement)&&!r},n=l(t);n.length>0&&t.ui.registry.addContextToolbar("imageselection",{predicate:o,items:n,position:"node"});const r=s(t);r.length>0&&t.ui.registry.addContextToolbar("textselection",{predicate:n=>!o(n)&&!t.selection.isCollapsed()&&e(n),items:r,position:"selection",scope:"editor"})})(t)}))}();
|
package/tinymce.js
CHANGED
|
@@ -7725,8 +7725,6 @@
|
|
|
7725
7725
|
const shouldSandboxIframes = option('sandbox_iframes');
|
|
7726
7726
|
const getSandboxIframesExclusions = editor => editor.options.get('sandbox_iframes_exclusions');
|
|
7727
7727
|
const shouldConvertUnsafeEmbeds = option('convert_unsafe_embeds');
|
|
7728
|
-
const getLicenseKey = option('license_key');
|
|
7729
|
-
const getApiKey = option('api_key');
|
|
7730
7728
|
|
|
7731
7729
|
const isElement$3 = isElement$6;
|
|
7732
7730
|
const isText$5 = isText$b;
|
|
@@ -28573,17 +28571,6 @@
|
|
|
28573
28571
|
};
|
|
28574
28572
|
};
|
|
28575
28573
|
|
|
28576
|
-
const isGplKey = key => key.toLowerCase() === 'gpl';
|
|
28577
|
-
const isValidGeneratedKey = key => key.length >= 64 && key.length <= 255;
|
|
28578
|
-
const validateLicenseKey = key => isGplKey(key) || isValidGeneratedKey(key) ? 'VALID' : 'INVALID';
|
|
28579
|
-
const validateEditorLicenseKey = editor => {
|
|
28580
|
-
const licenseKey = getLicenseKey(editor);
|
|
28581
|
-
const hasApiKey = isString(getApiKey(editor));
|
|
28582
|
-
if (!hasApiKey && (isUndefined(licenseKey) || validateLicenseKey(licenseKey) === 'INVALID')) {
|
|
28583
|
-
console.warn('You are running TinyMCE in evaluation mode. Provide a valid license key or specify the license to \'GPL\' to agree to the open source license terms. https://www.tiny.cloud/');
|
|
28584
|
-
}
|
|
28585
|
-
};
|
|
28586
|
-
|
|
28587
28574
|
const DOM$6 = DOMUtils.DOM;
|
|
28588
28575
|
const appendStyle = (editor, text) => {
|
|
28589
28576
|
const body = SugarElement.fromDom(editor.getBody());
|
|
@@ -28935,7 +28922,6 @@
|
|
|
28935
28922
|
setup$7(editor);
|
|
28936
28923
|
const setupRtcThunk = setup$t(editor);
|
|
28937
28924
|
preInit(editor);
|
|
28938
|
-
validateEditorLicenseKey(editor);
|
|
28939
28925
|
setupRtcThunk.fold(() => {
|
|
28940
28926
|
const cancelProgress = startProgress(editor);
|
|
28941
28927
|
loadContentCss(editor).then(() => {
|