first commit
This commit is contained in:
178
media/plg_editors_tinymce/js/plugins/dragdrop/plugin.js
Normal file
178
media/plg_editors_tinymce/js/plugins/dragdrop/plugin.js
Normal file
@ -0,0 +1,178 @@
|
||||
/**
|
||||
* File reader helper
|
||||
*
|
||||
* @param {*} file the file
|
||||
* @param {*} callback function to callback
|
||||
*
|
||||
* @TODO replace it with await new Response(file)
|
||||
*/
|
||||
function readFile(file, callback) {
|
||||
// Create a new file reader instance
|
||||
const reader = new FileReader();
|
||||
|
||||
// Add the on load callback
|
||||
reader.onload = event => {
|
||||
const {
|
||||
result
|
||||
} = event.target;
|
||||
const splitIndex = result.indexOf('base64') + 7;
|
||||
const content = result.slice(splitIndex, result.length);
|
||||
|
||||
// Upload the file
|
||||
callback(file.name, content);
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
window.tinymce.PluginManager.add('jdragndrop', editor => {
|
||||
const registerOption = editor.options.register;
|
||||
registerOption('uploadUri', {
|
||||
processor: 'string'
|
||||
});
|
||||
registerOption('comMediaAdapter', {
|
||||
processor: 'string'
|
||||
});
|
||||
registerOption('parentUploadFolder', {
|
||||
processor: 'string'
|
||||
});
|
||||
registerOption('csrfToken', {
|
||||
processor: 'string'
|
||||
});
|
||||
|
||||
// Reset the drop area border
|
||||
const dragleaveCallback = e => {
|
||||
if (!e.dataTransfer.types.includes('Files')) return;
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
editor.contentAreaContainer.style.borderWidth = '0';
|
||||
};
|
||||
window.tinyMCE.DOM.bind(document, 'dragleave', dragleaveCallback);
|
||||
|
||||
// Remove listener when editor are removed
|
||||
editor.on('remove', () => window.tinyMCE.DOM.unbind(document, 'dragleave', dragleaveCallback));
|
||||
|
||||
// Fix for Chrome
|
||||
editor.on('dragenter', e => {
|
||||
if (!e.dataTransfer.types.includes('Files')) return;
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
// Notify user when file is over the drop area
|
||||
editor.on('dragover', e => {
|
||||
if (!e.dataTransfer.types.includes('Files')) return;
|
||||
e.preventDefault();
|
||||
editor.contentAreaContainer.style.borderStyle = 'dashed';
|
||||
editor.contentAreaContainer.style.borderWidth = '5px';
|
||||
});
|
||||
async function uploadFile(name, content) {
|
||||
const settings = editor.options.get;
|
||||
Joomla.request({
|
||||
url: `${settings('uploadUri')}&path=${settings('comMediaAdapter')}${settings('parentUploadFolder')}`,
|
||||
method: 'POST',
|
||||
data: JSON.stringify({
|
||||
[settings('csrfToken')]: 1,
|
||||
name,
|
||||
content,
|
||||
parent: settings('parentUploadFolder')
|
||||
}),
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
onSuccess: resp => {
|
||||
let response;
|
||||
try {
|
||||
response = JSON.parse(resp);
|
||||
} catch (e) {
|
||||
editor.windowManager.alert(`${Joomla.Text._('ERROR')}: {${e}}`);
|
||||
}
|
||||
if (response.data && response.data.path) {
|
||||
const responseData = response.data;
|
||||
let urlPath;
|
||||
const paths = Joomla.getOptions('system.paths');
|
||||
const {
|
||||
rootFull
|
||||
} = paths;
|
||||
const parts = response.data.url.split(rootFull);
|
||||
if (parts.length > 1) {
|
||||
// For local adapters use relative paths
|
||||
urlPath = `${parts[1]}`;
|
||||
} else if (responseData.url) {
|
||||
// Absolute path for different domain
|
||||
urlPath = responseData.url;
|
||||
}
|
||||
const dialogClose = function dialogClose(api) {
|
||||
const dialogData = api.getData();
|
||||
const altEmpty = dialogData.altEmpty ? ' alt=""' : '';
|
||||
const altValue = dialogData.altText ? ` alt="${dialogData.altText}"` : altEmpty;
|
||||
const lazyValue = dialogData.isLazy ? ' loading="lazy"' : '';
|
||||
const width = dialogData.isLazy ? ` width="${responseData.width}"` : '';
|
||||
const height = dialogData.isLazy ? ` height="${responseData.height}"` : '';
|
||||
editor.execCommand('mceInsertContent', false, `<img src="${urlPath}"${altValue}${lazyValue}${width}${height}/>`);
|
||||
};
|
||||
editor.windowManager.open({
|
||||
title: Joomla.Text._('PLG_TINY_DND_ADDITIONALDATA'),
|
||||
body: {
|
||||
type: 'panel',
|
||||
items: [{
|
||||
type: 'input',
|
||||
name: 'altText',
|
||||
label: Joomla.Text._('PLG_TINY_DND_ALTTEXT')
|
||||
}, {
|
||||
type: 'checkbox',
|
||||
name: 'altEmpty',
|
||||
label: Joomla.Text._('PLG_TINY_DND_EMPTY_ALT')
|
||||
}, {
|
||||
type: 'checkbox',
|
||||
name: 'isLazy',
|
||||
label: Joomla.Text._('PLG_TINY_DND_LAZYLOADED')
|
||||
}]
|
||||
},
|
||||
buttons: [{
|
||||
type: 'cancel',
|
||||
text: 'Cancel'
|
||||
}, {
|
||||
type: 'submit',
|
||||
name: 'submitButton',
|
||||
text: 'Save',
|
||||
primary: true
|
||||
}],
|
||||
initialData: {
|
||||
altText: '',
|
||||
isLazy: true,
|
||||
altEmpty: false
|
||||
},
|
||||
onSubmit: api => {
|
||||
dialogClose(api);
|
||||
api.close();
|
||||
},
|
||||
onCancel: api => dialogClose(api)
|
||||
});
|
||||
}
|
||||
},
|
||||
onError: xhr => editor.windowManager.alert(`Error: ${xhr.statusText}`)
|
||||
});
|
||||
}
|
||||
|
||||
// Logic for the dropped file
|
||||
editor.on('drop', e => {
|
||||
if (!e.dataTransfer.types.includes('Files')) return;
|
||||
e.preventDefault();
|
||||
|
||||
// Read and upload files
|
||||
if (e.dataTransfer.files.length > 0) {
|
||||
Array.from(e.dataTransfer.files).forEach(file => {
|
||||
// Only images allowed
|
||||
if (file.name.toLowerCase().match(/\.(jpg|jpeg|png|gif|webp)$/)) {
|
||||
// Upload the file(s)
|
||||
readFile(file, uploadFile);
|
||||
}
|
||||
});
|
||||
}
|
||||
editor.contentAreaContainer.style.borderWidth = '0';
|
||||
});
|
||||
return {
|
||||
getMetadata: () => ({
|
||||
name: 'Drag and Drop (Joomla)',
|
||||
url: 'https://www.joomla.org/'
|
||||
})
|
||||
};
|
||||
});
|
||||
1
media/plg_editors_tinymce/js/plugins/dragdrop/plugin.min.js
vendored
Normal file
1
media/plg_editors_tinymce/js/plugins/dragdrop/plugin.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
function readFile(e,t){const a=new FileReader;a.onload=a=>{const{result:n}=a.target,o=n.indexOf("base64")+7,r=n.slice(o,n.length);t(e.name,r)},a.readAsDataURL(e)}window.tinymce.PluginManager.add("jdragndrop",(e=>{const t=e.options.register;t("uploadUri",{processor:"string"}),t("comMediaAdapter",{processor:"string"}),t("parentUploadFolder",{processor:"string"}),t("csrfToken",{processor:"string"});const a=t=>{t.dataTransfer.types.includes("Files")&&(t.stopPropagation(),t.preventDefault(),e.contentAreaContainer.style.borderWidth="0")};async function n(t,a){const n=e.options.get;Joomla.request({url:`${n("uploadUri")}&path=${n("comMediaAdapter")}${n("parentUploadFolder")}`,method:"POST",data:JSON.stringify({[n("csrfToken")]:1,name:t,content:a,parent:n("parentUploadFolder")}),headers:{"Content-Type":"application/json"},onSuccess:t=>{let a;try{a=JSON.parse(t)}catch(t){e.windowManager.alert(`${Joomla.Text._("ERROR")}: {${t}}`)}if(a.data&&a.data.path){const t=a.data;let n;const o=Joomla.getOptions("system.paths"),{rootFull:r}=o,s=a.data.url.split(r);s.length>1?n=`${s[1]}`:t.url&&(n=t.url);const l=function(a){const o=a.getData(),r=o.altEmpty?' alt=""':"",s=o.altText?` alt="${o.altText}"`:r,l=o.isLazy?' loading="lazy"':"",i=o.isLazy?` width="${t.width}"`:"",d=o.isLazy?` height="${t.height}"`:"";e.execCommand("mceInsertContent",!1,`<img src="${n}"${s}${l}${i}${d}/>`)};e.windowManager.open({title:Joomla.Text._("PLG_TINY_DND_ADDITIONALDATA"),body:{type:"panel",items:[{type:"input",name:"altText",label:Joomla.Text._("PLG_TINY_DND_ALTTEXT")},{type:"checkbox",name:"altEmpty",label:Joomla.Text._("PLG_TINY_DND_EMPTY_ALT")},{type:"checkbox",name:"isLazy",label:Joomla.Text._("PLG_TINY_DND_LAZYLOADED")}]},buttons:[{type:"cancel",text:"Cancel"},{type:"submit",name:"submitButton",text:"Save",primary:!0}],initialData:{altText:"",isLazy:!0,altEmpty:!1},onSubmit:e=>{l(e),e.close()},onCancel:e=>l(e)})}},onError:t=>e.windowManager.alert(`Error: ${t.statusText}`)})}return window.tinyMCE.DOM.bind(document,"dragleave",a),e.on("remove",(()=>window.tinyMCE.DOM.unbind(document,"dragleave",a))),e.on("dragenter",(e=>{e.dataTransfer.types.includes("Files")&&e.stopPropagation()})),e.on("dragover",(t=>{t.dataTransfer.types.includes("Files")&&(t.preventDefault(),e.contentAreaContainer.style.borderStyle="dashed",e.contentAreaContainer.style.borderWidth="5px")})),e.on("drop",(t=>{t.dataTransfer.types.includes("Files")&&(t.preventDefault(),t.dataTransfer.files.length>0&&Array.from(t.dataTransfer.files).forEach((e=>{e.name.toLowerCase().match(/\.(jpg|jpeg|png|gif|webp)$/)&&readFile(e,n)})),e.contentAreaContainer.style.borderWidth="0")})),{getMetadata:()=>({name:"Drag and Drop (Joomla)",url:"https://www.joomla.org/"})}}));
|
||||
BIN
media/plg_editors_tinymce/js/plugins/dragdrop/plugin.min.js.gz
Normal file
BIN
media/plg_editors_tinymce/js/plugins/dragdrop/plugin.min.js.gz
Normal file
Binary file not shown.
@ -0,0 +1,137 @@
|
||||
/**
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
window.tinymce.PluginManager.add('joomlaHighlighter', editor => {
|
||||
const setContent = html => {
|
||||
editor.focus();
|
||||
editor.undoManager.transact(() => {
|
||||
editor.setContent(html);
|
||||
});
|
||||
editor.selection.setCursorLocation();
|
||||
editor.nodeChanged();
|
||||
};
|
||||
const getContent = () => editor.getContent({
|
||||
source_view: true
|
||||
});
|
||||
let running = false;
|
||||
const showSourceEditor = () => {
|
||||
if (running) {
|
||||
return;
|
||||
}
|
||||
running = true;
|
||||
|
||||
// Create the dialog
|
||||
let cmEditor;
|
||||
const dialogConfig = {
|
||||
title: 'Source code',
|
||||
body: {
|
||||
type: 'panel',
|
||||
classes: ['joomla-highlighter-dialog'],
|
||||
items: [{
|
||||
type: 'textarea',
|
||||
name: 'textarea',
|
||||
inputMode: 'text',
|
||||
maximized: true
|
||||
}]
|
||||
},
|
||||
size: 'large',
|
||||
buttons: [{
|
||||
type: 'cancel',
|
||||
name: 'cancel',
|
||||
text: 'Cancel'
|
||||
}, {
|
||||
type: 'submit',
|
||||
name: 'save',
|
||||
text: 'Save',
|
||||
buttonType: 'primary'
|
||||
}],
|
||||
onSubmit: dialogApi => {
|
||||
setContent(cmEditor.state.doc.toString());
|
||||
dialogApi.close();
|
||||
},
|
||||
onClose: () => {
|
||||
cmEditor.destroy();
|
||||
cmEditor = null;
|
||||
running = false;
|
||||
}
|
||||
};
|
||||
|
||||
// Import codemirror and open the dialog
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
Promise.all([import('codemirror'), import('@codemirror/view'), import('@codemirror/commands')]).then(([{
|
||||
createFromTextarea
|
||||
}, {
|
||||
keymap
|
||||
}, {
|
||||
indentMore
|
||||
}]) => {
|
||||
editor.windowManager.open(dialogConfig);
|
||||
|
||||
// Find textarea and move it to shadow DOM to isolate from TinyMCE styling
|
||||
const textarea = document.querySelector('.joomla-highlighter-dialog textarea');
|
||||
const wrapper = textarea.parentElement;
|
||||
const shadow = wrapper.attachShadow({
|
||||
mode: 'open'
|
||||
});
|
||||
textarea.value = getContent();
|
||||
shadow.appendChild(textarea);
|
||||
|
||||
// Move focus out of the codemirror
|
||||
const escapeTabTrap = (view, event) => {
|
||||
event.preventDefault();
|
||||
// Find a Save button
|
||||
const dialogEl = wrapper.closest('[role="dialog"]');
|
||||
const btnEl = dialogEl.querySelector('.tox-dialog__footer [type="button"]:not(.tox-button--secondary)');
|
||||
if (btnEl) {
|
||||
btnEl.focus();
|
||||
} else {
|
||||
dialogEl.focus();
|
||||
}
|
||||
};
|
||||
const cmOptions = {
|
||||
mode: 'html',
|
||||
lineNumbers: true,
|
||||
lineWrapping: true,
|
||||
activeLine: true,
|
||||
highlightSelection: true,
|
||||
foldGutter: true,
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
root: shadow,
|
||||
customExtensions: [
|
||||
// Enable Tab trapping
|
||||
() => keymap.of([{
|
||||
key: 'Tab',
|
||||
run: indentMore,
|
||||
shift: escapeTabTrap
|
||||
}])]
|
||||
};
|
||||
const wrapperheight = wrapper.scrollHeight;
|
||||
createFromTextarea(textarea, cmOptions).then(cmView => {
|
||||
cmEditor = cmView;
|
||||
cmEditor.focus();
|
||||
cmEditor.dom.style.maxHeight = `${wrapperheight}px`;
|
||||
});
|
||||
});
|
||||
};
|
||||
editor.ui.registry.addButton('code', {
|
||||
icon: 'sourcecode',
|
||||
title: 'Source code+',
|
||||
tooltip: 'Source code+',
|
||||
onAction: showSourceEditor
|
||||
});
|
||||
editor.ui.registry.addMenuItem('code', {
|
||||
icon: 'sourcecode',
|
||||
text: 'Source code+',
|
||||
onAction: showSourceEditor,
|
||||
context: 'tools'
|
||||
});
|
||||
editor.addShortcut('Alt+U', 'Opens the code editor', showSourceEditor);
|
||||
return {
|
||||
getMetadata: () => ({
|
||||
name: 'Source Code Editor (Joomla)',
|
||||
url: 'https://www.joomla.org/'
|
||||
})
|
||||
};
|
||||
});
|
||||
1
media/plg_editors_tinymce/js/plugins/joomla-highlighter/plugin.min.js
vendored
Normal file
1
media/plg_editors_tinymce/js/plugins/joomla-highlighter/plugin.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
window.tinymce.PluginManager.add("joomlaHighlighter",(e=>{let t=!1;const o=()=>{if(t)return;let o;t=!0;const n={title:"Source code",body:{type:"panel",classes:["joomla-highlighter-dialog"],items:[{type:"textarea",name:"textarea",inputMode:"text",maximized:!0}]},size:"large",buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",buttonType:"primary"}],onSubmit:t=>{var n;n=o.state.doc.toString(),e.focus(),e.undoManager.transact((()=>{e.setContent(n)})),e.selection.setCursorLocation(),e.nodeChanged(),t.close()},onClose:()=>{o.destroy(),o=null,t=!1}};Promise.all([import("codemirror"),import("@codemirror/view"),import("@codemirror/commands")]).then((([{createFromTextarea:t},{keymap:r},{indentMore:a}])=>{e.windowManager.open(n);const i=document.querySelector(".joomla-highlighter-dialog textarea"),c=i.parentElement,l=c.attachShadow({mode:"open"});i.value=e.getContent({source_view:!0}),l.appendChild(i);const d=(e,t)=>{t.preventDefault();const o=c.closest('[role="dialog"]'),n=o.querySelector('.tox-dialog__footer [type="button"]:not(.tox-button--secondary)');n?n.focus():o.focus()},s={mode:"html",lineNumbers:!0,lineWrapping:!0,activeLine:!0,highlightSelection:!0,foldGutter:!0,width:"100%",height:"100%",root:l,customExtensions:[()=>r.of([{key:"Tab",run:a,shift:d}])]},u=c.scrollHeight;t(i,s).then((e=>{o=e,o.focus(),o.dom.style.maxHeight=`${u}px`}))}))};return e.ui.registry.addButton("code",{icon:"sourcecode",title:"Source code+",tooltip:"Source code+",onAction:o}),e.ui.registry.addMenuItem("code",{icon:"sourcecode",text:"Source code+",onAction:o,context:"tools"}),e.addShortcut("Alt+U","Opens the code editor",o),{getMetadata:()=>({name:"Source Code Editor (Joomla)",url:"https://www.joomla.org/"})}}));
|
||||
Binary file not shown.
560
media/plg_editors_tinymce/js/plugins/jtemplate/plugin.js
Normal file
560
media/plg_editors_tinymce/js/plugins/jtemplate/plugin.js
Normal file
@ -0,0 +1,560 @@
|
||||
/**
|
||||
* TinyMCE version 6.4.0 (2023-03-15)
|
||||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var global$3 = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
const hasProto = (v, constructor, predicate) => {
|
||||
var _a;
|
||||
if (predicate(v, constructor.prototype)) {
|
||||
return true;
|
||||
} else {
|
||||
return ((_a = v.constructor) === null || _a === void 0 ? void 0 : _a.name) === constructor.name;
|
||||
}
|
||||
};
|
||||
const typeOf = x => {
|
||||
const t = typeof x;
|
||||
if (x === null) {
|
||||
return 'null';
|
||||
} else if (t === 'object' && Array.isArray(x)) {
|
||||
return 'array';
|
||||
} else if (t === 'object' && hasProto(x, String, (o, proto) => proto.isPrototypeOf(o))) {
|
||||
return 'string';
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
};
|
||||
const isType = type => value => typeOf(value) === type;
|
||||
const isSimpleType = type => value => typeof value === type;
|
||||
const isString = isType('string');
|
||||
const isObject = isType('object');
|
||||
const isArray = isType('array');
|
||||
const isNullable = a => a === null || a === undefined;
|
||||
const isNonNullable = a => !isNullable(a);
|
||||
const isFunction = isSimpleType('function');
|
||||
const isArrayOf = (value, pred) => {
|
||||
if (isArray(value)) {
|
||||
for (let i = 0, len = value.length; i < len; ++i) {
|
||||
if (!pred(value[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const constant = value => {
|
||||
return () => {
|
||||
return value;
|
||||
};
|
||||
};
|
||||
function curry(fn, ...initialArgs) {
|
||||
return (...restArgs) => {
|
||||
const all = initialArgs.concat(restArgs);
|
||||
return fn.apply(null, all);
|
||||
};
|
||||
}
|
||||
const never = constant(false);
|
||||
|
||||
const escape = text => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
const option = name => editor => editor.options.get(name);
|
||||
const register$2 = editor => {
|
||||
const registerOption = editor.options.register;
|
||||
registerOption('template_cdate_classes', {
|
||||
processor: 'string',
|
||||
default: 'cdate'
|
||||
});
|
||||
registerOption('template_mdate_classes', {
|
||||
processor: 'string',
|
||||
default: 'mdate'
|
||||
});
|
||||
registerOption('template_selected_content_classes', {
|
||||
processor: 'string',
|
||||
default: 'selcontent'
|
||||
});
|
||||
registerOption('template_preview_replace_values', { processor: 'object' });
|
||||
registerOption('template_replace_values', { processor: 'object' });
|
||||
registerOption('jtemplates', {
|
||||
processor: value => isString(value) || isArrayOf(value, isObject) || isFunction(value),
|
||||
default: []
|
||||
});
|
||||
registerOption('template_cdate_format', {
|
||||
processor: 'string',
|
||||
default: editor.translate('%Y-%m-%d')
|
||||
});
|
||||
registerOption('template_mdate_format', {
|
||||
processor: 'string',
|
||||
default: editor.translate('%Y-%m-%d')
|
||||
});
|
||||
};
|
||||
const getCreationDateClasses = option('template_cdate_classes');
|
||||
const getModificationDateClasses = option('template_mdate_classes');
|
||||
const getSelectedContentClasses = option('template_selected_content_classes');
|
||||
const getPreviewReplaceValues = option('template_preview_replace_values');
|
||||
const getTemplateReplaceValues = option('template_replace_values');
|
||||
const getTemplates = option('jtemplates');
|
||||
const getCdateFormat = option('template_cdate_format');
|
||||
const getMdateFormat = option('template_mdate_format');
|
||||
const getContentStyle = option('content_style');
|
||||
const shouldUseContentCssCors = option('content_css_cors');
|
||||
const getBodyClass = option('body_class');
|
||||
|
||||
const addZeros = (value, len) => {
|
||||
value = '' + value;
|
||||
if (value.length < len) {
|
||||
for (let i = 0; i < len - value.length; i++) {
|
||||
value = '0' + value;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
};
|
||||
const getDateTime = (editor, fmt, date = new Date()) => {
|
||||
const daysShort = 'Sun Mon Tue Wed Thu Fri Sat Sun'.split(' ');
|
||||
const daysLong = 'Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday'.split(' ');
|
||||
const monthsShort = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ');
|
||||
const monthsLong = 'January February March April May June July August September October November December'.split(' ');
|
||||
fmt = fmt.replace('%D', '%m/%d/%Y');
|
||||
fmt = fmt.replace('%r', '%I:%M:%S %p');
|
||||
fmt = fmt.replace('%Y', '' + date.getFullYear());
|
||||
fmt = fmt.replace('%y', '' + date.getYear());
|
||||
fmt = fmt.replace('%m', addZeros(date.getMonth() + 1, 2));
|
||||
fmt = fmt.replace('%d', addZeros(date.getDate(), 2));
|
||||
fmt = fmt.replace('%H', '' + addZeros(date.getHours(), 2));
|
||||
fmt = fmt.replace('%M', '' + addZeros(date.getMinutes(), 2));
|
||||
fmt = fmt.replace('%S', '' + addZeros(date.getSeconds(), 2));
|
||||
fmt = fmt.replace('%I', '' + ((date.getHours() + 11) % 12 + 1));
|
||||
fmt = fmt.replace('%p', '' + (date.getHours() < 12 ? 'AM' : 'PM'));
|
||||
fmt = fmt.replace('%B', '' + editor.translate(monthsLong[date.getMonth()]));
|
||||
fmt = fmt.replace('%b', '' + editor.translate(monthsShort[date.getMonth()]));
|
||||
fmt = fmt.replace('%A', '' + editor.translate(daysLong[date.getDay()]));
|
||||
fmt = fmt.replace('%a', '' + editor.translate(daysShort[date.getDay()]));
|
||||
fmt = fmt.replace('%%', '%');
|
||||
return fmt;
|
||||
};
|
||||
|
||||
class Optional {
|
||||
constructor(tag, value) {
|
||||
this.tag = tag;
|
||||
this.value = value;
|
||||
}
|
||||
static some(value) {
|
||||
return new Optional(true, value);
|
||||
}
|
||||
static none() {
|
||||
return Optional.singletonNone;
|
||||
}
|
||||
fold(onNone, onSome) {
|
||||
if (this.tag) {
|
||||
return onSome(this.value);
|
||||
} else {
|
||||
return onNone();
|
||||
}
|
||||
}
|
||||
isSome() {
|
||||
return this.tag;
|
||||
}
|
||||
isNone() {
|
||||
return !this.tag;
|
||||
}
|
||||
map(mapper) {
|
||||
if (this.tag) {
|
||||
return Optional.some(mapper(this.value));
|
||||
} else {
|
||||
return Optional.none();
|
||||
}
|
||||
}
|
||||
bind(binder) {
|
||||
if (this.tag) {
|
||||
return binder(this.value);
|
||||
} else {
|
||||
return Optional.none();
|
||||
}
|
||||
}
|
||||
exists(predicate) {
|
||||
return this.tag && predicate(this.value);
|
||||
}
|
||||
forall(predicate) {
|
||||
return !this.tag || predicate(this.value);
|
||||
}
|
||||
filter(predicate) {
|
||||
if (!this.tag || predicate(this.value)) {
|
||||
return this;
|
||||
} else {
|
||||
return Optional.none();
|
||||
}
|
||||
}
|
||||
getOr(replacement) {
|
||||
return this.tag ? this.value : replacement;
|
||||
}
|
||||
or(replacement) {
|
||||
return this.tag ? this : replacement;
|
||||
}
|
||||
getOrThunk(thunk) {
|
||||
return this.tag ? this.value : thunk();
|
||||
}
|
||||
orThunk(thunk) {
|
||||
return this.tag ? this : thunk();
|
||||
}
|
||||
getOrDie(message) {
|
||||
if (!this.tag) {
|
||||
throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
|
||||
} else {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
static from(value) {
|
||||
return isNonNullable(value) ? Optional.some(value) : Optional.none();
|
||||
}
|
||||
getOrNull() {
|
||||
return this.tag ? this.value : null;
|
||||
}
|
||||
getOrUndefined() {
|
||||
return this.value;
|
||||
}
|
||||
each(worker) {
|
||||
if (this.tag) {
|
||||
worker(this.value);
|
||||
}
|
||||
}
|
||||
toArray() {
|
||||
return this.tag ? [this.value] : [];
|
||||
}
|
||||
toString() {
|
||||
return this.tag ? `some(${ this.value })` : 'none()';
|
||||
}
|
||||
}
|
||||
Optional.singletonNone = new Optional(false);
|
||||
|
||||
const exists = (xs, pred) => {
|
||||
for (let i = 0, len = xs.length; i < len; i++) {
|
||||
const x = xs[i];
|
||||
if (pred(x, i)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const map = (xs, f) => {
|
||||
const len = xs.length;
|
||||
const r = new Array(len);
|
||||
for (let i = 0; i < len; i++) {
|
||||
const x = xs[i];
|
||||
r[i] = f(x, i);
|
||||
}
|
||||
return r;
|
||||
};
|
||||
const findUntil = (xs, pred, until) => {
|
||||
for (let i = 0, len = xs.length; i < len; i++) {
|
||||
const x = xs[i];
|
||||
if (pred(x, i)) {
|
||||
return Optional.some(x);
|
||||
} else if (until(x, i)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Optional.none();
|
||||
};
|
||||
const find = (xs, pred) => {
|
||||
return findUntil(xs, pred, never);
|
||||
};
|
||||
|
||||
const hasOwnProperty = Object.hasOwnProperty;
|
||||
const get = (obj, key) => {
|
||||
return has(obj, key) ? Optional.from(obj[key]) : Optional.none();
|
||||
};
|
||||
const has = (obj, key) => hasOwnProperty.call(obj, key);
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.html.Serializer');
|
||||
|
||||
const entitiesAttr = {
|
||||
'"': '"',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'&': '&',
|
||||
'\'': '''
|
||||
};
|
||||
const htmlEscape = html => html.replace(/["'<>&]/g, match => get(entitiesAttr, match).getOr(match));
|
||||
const hasAnyClasses = (dom, n, classes) => exists(classes.split(/\s+/), c => dom.hasClass(n, c));
|
||||
const parseAndSerialize = (editor, html) => global$1({ validate: true }, editor.schema).serialize(editor.parser.parse(html, { insert: true }));
|
||||
|
||||
const createTemplateList = (editor, callback) => {
|
||||
return () => {
|
||||
const templateList = getTemplates(editor);
|
||||
if (isFunction(templateList)) {
|
||||
templateList(callback);
|
||||
} else if (isString(templateList)) {
|
||||
fetch(templateList).then(res => {
|
||||
if (res.ok) {
|
||||
res.json().then(callback);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
callback(templateList);
|
||||
}
|
||||
};
|
||||
};
|
||||
const replaceTemplateValues = (html, templateValues) => {
|
||||
global$2.each(templateValues, (v, k) => {
|
||||
if (isFunction(v)) {
|
||||
v = v(k);
|
||||
}
|
||||
html = html.replace(new RegExp('\\{\\$' + escape(k) + '\\}', 'g'), v);
|
||||
});
|
||||
return html;
|
||||
};
|
||||
const replaceVals = (editor, scope) => {
|
||||
const dom = editor.dom, vl = getTemplateReplaceValues(editor);
|
||||
global$2.each(dom.select('*', scope), e => {
|
||||
global$2.each(vl, (v, k) => {
|
||||
if (dom.hasClass(e, k)) {
|
||||
if (isFunction(v)) {
|
||||
v(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
const insertTemplate = (editor, _ui, html) => {
|
||||
const dom = editor.dom;
|
||||
const sel = editor.selection.getContent();
|
||||
html = replaceTemplateValues(html, getTemplateReplaceValues(editor));
|
||||
let el = dom.create('div', {}, parseAndSerialize(editor, html));
|
||||
const n = dom.select('.mceTmpl', el);
|
||||
if (n && n.length > 0) {
|
||||
el = dom.create('div');
|
||||
el.appendChild(n[0].cloneNode(true));
|
||||
}
|
||||
global$2.each(dom.select('*', el), n => {
|
||||
if (hasAnyClasses(dom, n, getCreationDateClasses(editor))) {
|
||||
n.innerHTML = getDateTime(editor, getCdateFormat(editor));
|
||||
}
|
||||
if (hasAnyClasses(dom, n, getModificationDateClasses(editor))) {
|
||||
n.innerHTML = getDateTime(editor, getMdateFormat(editor));
|
||||
}
|
||||
if (hasAnyClasses(dom, n, getSelectedContentClasses(editor))) {
|
||||
n.innerHTML = sel;
|
||||
}
|
||||
});
|
||||
replaceVals(editor, el);
|
||||
editor.execCommand('mceInsertContent', false, el.innerHTML);
|
||||
editor.addVisual();
|
||||
};
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.Env');
|
||||
|
||||
const getPreviewContent = (editor, html) => {
|
||||
var _a;
|
||||
if (html.indexOf('<html>') === -1) {
|
||||
let contentCssEntries = '';
|
||||
const contentStyle = (_a = getContentStyle(editor)) !== null && _a !== void 0 ? _a : '';
|
||||
const cors = shouldUseContentCssCors(editor) ? ' crossorigin="anonymous"' : '';
|
||||
global$2.each(editor.contentCSS, url => {
|
||||
contentCssEntries += '<link type="text/css" rel="stylesheet" href="' + editor.documentBaseURI.toAbsolute(url) + '"' + cors + '>';
|
||||
});
|
||||
if (contentStyle) {
|
||||
contentCssEntries += '<style type="text/css">' + contentStyle + '</style>';
|
||||
}
|
||||
const bodyClass = getBodyClass(editor);
|
||||
const encode = editor.dom.encode;
|
||||
const isMetaKeyPressed = global.os.isMacOS() || global.os.isiOS() ? 'e.metaKey' : 'e.ctrlKey && !e.altKey';
|
||||
const preventClicksOnLinksScript = '<script>' + 'document.addEventListener && document.addEventListener("click", function(e) {' + 'for (var elm = e.target; elm; elm = elm.parentNode) {' + 'if (elm.nodeName === "A" && !(' + isMetaKeyPressed + ')) {' + 'e.preventDefault();' + '}' + '}' + '}, false);' + '</script> ';
|
||||
const directionality = editor.getBody().dir;
|
||||
const dirAttr = directionality ? ' dir="' + encode(directionality) + '"' : '';
|
||||
html = '<!DOCTYPE html>' + '<html>' + '<head>' + '<base href="' + encode(editor.documentBaseURI.getURI()) + '">' + contentCssEntries + preventClicksOnLinksScript + '</head>' + '<body class="' + encode(bodyClass) + '"' + dirAttr + '>' + parseAndSerialize(editor, html) + '</body>' + '</html>';
|
||||
}
|
||||
return replaceTemplateValues(html, getPreviewReplaceValues(editor));
|
||||
};
|
||||
const open = (editor, templateList) => {
|
||||
const createTemplates = () => {
|
||||
if (!templateList || templateList.length === 0) {
|
||||
const message = editor.translate('No templates defined.');
|
||||
editor.notificationManager.open({
|
||||
text: message,
|
||||
type: 'info'
|
||||
});
|
||||
return Optional.none();
|
||||
}
|
||||
return Optional.from(global$2.map(templateList, (template, index) => {
|
||||
const isUrlTemplate = t => t.url !== undefined;
|
||||
return {
|
||||
selected: index === 0,
|
||||
text: template.title,
|
||||
value: {
|
||||
url: isUrlTemplate(template) ? Optional.from(template.url) : Optional.none(),
|
||||
content: !isUrlTemplate(template) ? Optional.from(template.content) : Optional.none(),
|
||||
description: template.description
|
||||
}
|
||||
};
|
||||
}));
|
||||
};
|
||||
const createSelectBoxItems = templates => map(templates, t => ({
|
||||
text: t.text,
|
||||
value: t.text
|
||||
}));
|
||||
const findTemplate = (templates, templateTitle) => find(templates, t => t.text === templateTitle);
|
||||
const loadFailedAlert = api => {
|
||||
editor.windowManager.alert('Could not load the specified template.', () => api.focus('template'));
|
||||
};
|
||||
const getTemplateContent = t => t.value.url.fold(() => Promise.resolve(t.value.content.getOr('')), url => fetch(url).then(res => res.ok ? res.text() : Promise.reject()));
|
||||
const onChange = (templates, updateDialog) => (api, change) => {
|
||||
if (change.name === 'template') {
|
||||
const newTemplateTitle = api.getData().template;
|
||||
findTemplate(templates, newTemplateTitle).each(t => {
|
||||
api.block('Loading...');
|
||||
getTemplateContent(t).then(previewHtml => {
|
||||
updateDialog(api, t, previewHtml);
|
||||
}).catch(() => {
|
||||
updateDialog(api, t, '');
|
||||
api.setEnabled('save', false);
|
||||
loadFailedAlert(api);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
const onSubmit = templates => api => {
|
||||
const data = api.getData();
|
||||
findTemplate(templates, data.template).each(t => {
|
||||
getTemplateContent(t).then(previewHtml => {
|
||||
editor.execCommand('mceInsertTemplate', false, previewHtml);
|
||||
api.close();
|
||||
}).catch(() => {
|
||||
api.setEnabled('save', false);
|
||||
loadFailedAlert(api);
|
||||
});
|
||||
});
|
||||
};
|
||||
const openDialog = templates => {
|
||||
const selectBoxItems = createSelectBoxItems(templates);
|
||||
const buildDialogSpec = (bodyItems, initialData) => ({
|
||||
title: 'Insert Template',
|
||||
size: 'large',
|
||||
body: {
|
||||
type: 'panel',
|
||||
items: bodyItems
|
||||
},
|
||||
initialData,
|
||||
buttons: [
|
||||
{
|
||||
type: 'cancel',
|
||||
name: 'cancel',
|
||||
text: 'Cancel'
|
||||
},
|
||||
{
|
||||
type: 'submit',
|
||||
name: 'save',
|
||||
text: 'Save',
|
||||
primary: true
|
||||
}
|
||||
],
|
||||
onSubmit: onSubmit(templates),
|
||||
onChange: onChange(templates, updateDialog)
|
||||
});
|
||||
const updateDialog = (dialogApi, template, previewHtml) => {
|
||||
const content = getPreviewContent(editor, previewHtml);
|
||||
const bodyItems = [
|
||||
{
|
||||
type: 'selectbox',
|
||||
name: 'template',
|
||||
label: 'Templates',
|
||||
items: selectBoxItems
|
||||
},
|
||||
{
|
||||
type: 'htmlpanel',
|
||||
html: `<p aria-live="polite">${ htmlEscape(template.value.description) }</p>`
|
||||
},
|
||||
{
|
||||
label: 'Preview',
|
||||
type: 'iframe',
|
||||
name: 'preview',
|
||||
sandboxed: false,
|
||||
transparent: false
|
||||
}
|
||||
];
|
||||
const initialData = {
|
||||
template: template.text,
|
||||
preview: content
|
||||
};
|
||||
dialogApi.unblock();
|
||||
dialogApi.redial(buildDialogSpec(bodyItems, initialData));
|
||||
dialogApi.focus('template');
|
||||
};
|
||||
const dialogApi = editor.windowManager.open(buildDialogSpec([], {
|
||||
template: '',
|
||||
preview: ''
|
||||
}));
|
||||
dialogApi.block('Loading...');
|
||||
getTemplateContent(templates[0]).then(previewHtml => {
|
||||
updateDialog(dialogApi, templates[0], previewHtml);
|
||||
}).catch(() => {
|
||||
updateDialog(dialogApi, templates[0], '');
|
||||
dialogApi.setEnabled('save', false);
|
||||
loadFailedAlert(dialogApi);
|
||||
});
|
||||
};
|
||||
const optTemplates = createTemplates();
|
||||
optTemplates.each(openDialog);
|
||||
};
|
||||
|
||||
const showDialog = editor => templates => {
|
||||
open(editor, templates);
|
||||
};
|
||||
const register$1 = editor => {
|
||||
editor.addCommand('mceInsertTemplate', curry(insertTemplate, editor));
|
||||
editor.addCommand('mceTemplate', createTemplateList(editor, showDialog(editor)));
|
||||
};
|
||||
|
||||
const setup = editor => {
|
||||
editor.on('PreProcess', o => {
|
||||
const dom = editor.dom, dateFormat = getMdateFormat(editor);
|
||||
global$2.each(dom.select('div', o.node), e => {
|
||||
if (dom.hasClass(e, 'mceTmpl')) {
|
||||
global$2.each(dom.select('*', e), e => {
|
||||
if (hasAnyClasses(dom, e, getModificationDateClasses(editor))) {
|
||||
e.innerHTML = getDateTime(editor, dateFormat);
|
||||
}
|
||||
});
|
||||
replaceVals(editor, e);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const register = editor => {
|
||||
const onAction = () => editor.execCommand('mceTemplate');
|
||||
editor.ui.registry.addButton('jtemplate', {
|
||||
icon: 'template',
|
||||
tooltip: 'Insert template',
|
||||
onAction
|
||||
});
|
||||
editor.ui.registry.addMenuItem('jtemplate', {
|
||||
icon: 'template',
|
||||
text: 'Insert template...',
|
||||
onAction
|
||||
});
|
||||
};
|
||||
|
||||
var Plugin = () => {
|
||||
global$3.add('jtemplate', editor => {
|
||||
register$2(editor);
|
||||
register(editor);
|
||||
register$1(editor);
|
||||
setup(editor);
|
||||
return {
|
||||
getMetadata: () => ({
|
||||
name: 'Template (Joomla)',
|
||||
url: 'https://www.joomla.org/'
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Plugin();
|
||||
|
||||
})();
|
||||
1
media/plg_editors_tinymce/js/plugins/jtemplate/plugin.min.js
vendored
Normal file
1
media/plg_editors_tinymce/js/plugins/jtemplate/plugin.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
media/plg_editors_tinymce/js/plugins/jtemplate/plugin.min.js.gz
Normal file
BIN
media/plg_editors_tinymce/js/plugins/jtemplate/plugin.min.js.gz
Normal file
Binary file not shown.
72
media/plg_editors_tinymce/js/plugins/jxtdbuttons/plugin.js
Normal file
72
media/plg_editors_tinymce/js/plugins/jxtdbuttons/plugin.js
Normal file
@ -0,0 +1,72 @@
|
||||
import { JoomlaEditor, JoomlaEditorButton } from 'editor-api';
|
||||
|
||||
/**
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {Editor} editor
|
||||
*/
|
||||
const pluginSetUp = editor => {
|
||||
editor.options.register('joomlaExtButtons', {
|
||||
processor: 'object',
|
||||
default: {
|
||||
names: []
|
||||
}
|
||||
});
|
||||
|
||||
// Get buttons list
|
||||
const buttons = editor.options.get('joomlaExtButtons').names || [];
|
||||
if (!buttons.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Build menu
|
||||
const subMenu = [];
|
||||
const icons = {
|
||||
joomla: '<svg viewBox="0 0 32 32" width="24" height="24"><path d="M8.313 8.646c1.026-1.026 2.688-1.026 3.713-0.001l0.245 0.246 3.159-3.161-0.246-0.246c-1.801-1.803-4.329-2.434-6.638-1.891-0.331-2.037-2.096-3.591-4.224-3.592-2.364 0-4.28 1.92-4.28 4.286 0 2.042 1.425 3.75 3.333 4.182-0.723 2.42-0.133 5.151 1.776 7.062l7.12 7.122 3.156-3.163-7.119-7.121c-1.021-1.023-1.023-2.691 0.006-3.722zM31.96 4.286c0-2.368-1.916-4.286-4.281-4.286-2.164 0-3.952 1.608-4.24 3.695-2.409-0.708-5.118-0.109-7.020 1.794l-7.12 7.122 3.159 3.162 7.118-7.12c1.029-1.030 2.687-1.028 3.709-0.006 1.025 1.026 1.025 2.691-0.001 3.717l-0.244 0.245 3.157 3.164 0.246-0.248c1.889-1.893 2.49-4.586 1.8-6.989 2.098-0.276 3.717-2.074 3.717-4.25zM28.321 23.471c0.566-2.327-0.062-4.885-1.878-6.703l-7.109-7.125-3.159 3.16 7.11 7.125c1.029 1.031 1.027 2.691 0.006 3.714-1.025 1.025-2.688 1.025-3.714-0.001l-0.243-0.243-3.156 3.164 0.242 0.241c1.922 1.925 4.676 2.514 7.105 1.765 0.395 1.959 2.123 3.431 4.196 3.431 2.363 0 4.28-1.917 4.28-4.285 0-2.163-1.599-3.952-3.679-4.244zM19.136 16.521l-7.111 7.125c-1.022 1.024-2.689 1.026-3.717-0.004-1.026-1.028-1.026-2.691-0.001-3.718l0.244-0.243-3.159-3.16-0.242 0.241c-1.836 1.838-2.455 4.432-1.858 6.781-1.887 0.446-3.292 2.145-3.292 4.172-0.001 2.367 1.917 4.285 4.281 4.285 2.034-0.001 3.737-1.419 4.173-3.324 2.334 0.58 4.906-0.041 6.729-1.867l7.109-7.124-3.157-3.163z"></path></svg>'
|
||||
};
|
||||
buttons.forEach(xtdButton => {
|
||||
const button = {};
|
||||
button.text = xtdButton.name;
|
||||
button.icon = xtdButton.icon;
|
||||
button.type = 'menuitem';
|
||||
if (xtdButton.iconSVG) {
|
||||
icons[button.icon] = xtdButton.iconSVG;
|
||||
}
|
||||
button.onAction = () => {
|
||||
JoomlaEditor.setActive(editor.id);
|
||||
if (xtdButton.action) {
|
||||
JoomlaEditorButton.runAction(xtdButton.action, xtdButton.options || {});
|
||||
} else if (xtdButton.bsModal) {
|
||||
document.getElementById(`${xtdButton.id}_modal`).open();
|
||||
} else if (xtdButton.click) {
|
||||
// eslint-disable-next-line no-new-func
|
||||
new Function(xtdButton.click)();
|
||||
}
|
||||
};
|
||||
subMenu.push(button);
|
||||
});
|
||||
|
||||
// Register icons
|
||||
Object.keys(icons).forEach(icon => {
|
||||
editor.ui.registry.addIcon(icon, icons[icon]);
|
||||
});
|
||||
|
||||
// Register main button
|
||||
editor.ui.registry.addMenuButton('jxtdbuttons', {
|
||||
text: Joomla.Text._('PLG_TINY_CORE_BUTTONS'),
|
||||
icon: 'joomla',
|
||||
fetch: callback => callback(subMenu)
|
||||
});
|
||||
};
|
||||
window.tinymce.PluginManager.add('jxtdbuttons', editor => {
|
||||
pluginSetUp(editor);
|
||||
return {
|
||||
getMetadata: () => ({
|
||||
name: 'Editor XTD buttons (Joomla)',
|
||||
url: 'https://www.joomla.org/'
|
||||
})
|
||||
};
|
||||
});
|
||||
1
media/plg_editors_tinymce/js/plugins/jxtdbuttons/plugin.min.js
vendored
Normal file
1
media/plg_editors_tinymce/js/plugins/jxtdbuttons/plugin.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
import{JoomlaEditor,JoomlaEditorButton}from"editor-api";const pluginSetUp=o=>{o.options.register("joomlaExtButtons",{processor:"object",default:{names:[]}});const t=o.options.get("joomlaExtButtons").names||[];if(!t.length)return;const n=[],i={joomla:'<svg viewBox="0 0 32 32" width="24" height="24"><path d="M8.313 8.646c1.026-1.026 2.688-1.026 3.713-0.001l0.245 0.246 3.159-3.161-0.246-0.246c-1.801-1.803-4.329-2.434-6.638-1.891-0.331-2.037-2.096-3.591-4.224-3.592-2.364 0-4.28 1.92-4.28 4.286 0 2.042 1.425 3.75 3.333 4.182-0.723 2.42-0.133 5.151 1.776 7.062l7.12 7.122 3.156-3.163-7.119-7.121c-1.021-1.023-1.023-2.691 0.006-3.722zM31.96 4.286c0-2.368-1.916-4.286-4.281-4.286-2.164 0-3.952 1.608-4.24 3.695-2.409-0.708-5.118-0.109-7.020 1.794l-7.12 7.122 3.159 3.162 7.118-7.12c1.029-1.030 2.687-1.028 3.709-0.006 1.025 1.026 1.025 2.691-0.001 3.717l-0.244 0.245 3.157 3.164 0.246-0.248c1.889-1.893 2.49-4.586 1.8-6.989 2.098-0.276 3.717-2.074 3.717-4.25zM28.321 23.471c0.566-2.327-0.062-4.885-1.878-6.703l-7.109-7.125-3.159 3.16 7.11 7.125c1.029 1.031 1.027 2.691 0.006 3.714-1.025 1.025-2.688 1.025-3.714-0.001l-0.243-0.243-3.156 3.164 0.242 0.241c1.922 1.925 4.676 2.514 7.105 1.765 0.395 1.959 2.123 3.431 4.196 3.431 2.363 0 4.28-1.917 4.28-4.285 0-2.163-1.599-3.952-3.679-4.244zM19.136 16.521l-7.111 7.125c-1.022 1.024-2.689 1.026-3.717-0.004-1.026-1.028-1.026-2.691-0.001-3.718l0.244-0.243-3.159-3.16-0.242 0.241c-1.836 1.838-2.455 4.432-1.858 6.781-1.887 0.446-3.292 2.145-3.292 4.172-0.001 2.367 1.917 4.285 4.281 4.285 2.034-0.001 3.737-1.419 4.173-3.324 2.334 0.58 4.906-0.041 6.729-1.867l7.109-7.124-3.157-3.163z"></path></svg>'};t.forEach((t=>{const e={};e.text=t.name,e.icon=t.icon,e.type="menuitem",t.iconSVG&&(i[e.icon]=t.iconSVG),e.onAction=()=>{JoomlaEditor.setActive(o.id),t.action?JoomlaEditorButton.runAction(t.action,t.options||{}):t.bsModal?document.getElementById(`${t.id}_modal`).open():t.click&&new Function(t.click)()},n.push(e)})),Object.keys(i).forEach((t=>{o.ui.registry.addIcon(t,i[t])})),o.ui.registry.addMenuButton("jxtdbuttons",{text:Joomla.Text._("PLG_TINY_CORE_BUTTONS"),icon:"joomla",fetch:o=>o(n)})};window.tinymce.PluginManager.add("jxtdbuttons",(o=>(pluginSetUp(o),{getMetadata:()=>({name:"Editor XTD buttons (Joomla)",url:"https://www.joomla.org/"})})));
|
||||
Binary file not shown.
Reference in New Issue
Block a user