Initial commit
This commit is contained in:
commit
57a2089dd9
1541 changed files with 595392 additions and 0 deletions
160
wp-content/plugins/tinymce-advanced/mce/advlist/plugin.js
Normal file
160
wp-content/plugins/tinymce-advanced/mce/advlist/plugin.js
Normal file
|
@ -0,0 +1,160 @@
|
|||
(function () {
|
||||
var advlist = (function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var applyListFormat = function (editor, listName, styleValue) {
|
||||
var cmd = listName === 'UL' ? 'InsertUnorderedList' : 'InsertOrderedList';
|
||||
editor.execCommand(cmd, false, styleValue === false ? null : { 'list-style-type': styleValue });
|
||||
};
|
||||
var Actions = { applyListFormat: applyListFormat };
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('ApplyUnorderedListStyle', function (ui, value) {
|
||||
Actions.applyListFormat(editor, 'UL', value['list-style-type']);
|
||||
});
|
||||
editor.addCommand('ApplyOrderedListStyle', function (ui, value) {
|
||||
Actions.applyListFormat(editor, 'OL', value['list-style-type']);
|
||||
});
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var getNumberStyles = function (editor) {
|
||||
var styles = editor.getParam('advlist_number_styles', 'default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman');
|
||||
return styles ? styles.split(/[ ,]/) : [];
|
||||
};
|
||||
var getBulletStyles = function (editor) {
|
||||
var styles = editor.getParam('advlist_bullet_styles', 'default,circle,disc,square');
|
||||
return styles ? styles.split(/[ ,]/) : [];
|
||||
};
|
||||
var Settings = {
|
||||
getNumberStyles: getNumberStyles,
|
||||
getBulletStyles: getBulletStyles
|
||||
};
|
||||
|
||||
var isChildOfBody = function (editor, elm) {
|
||||
return editor.$.contains(editor.getBody(), elm);
|
||||
};
|
||||
var isTableCellNode = function (node) {
|
||||
return node && /^(TH|TD)$/.test(node.nodeName);
|
||||
};
|
||||
var isListNode = function (editor) {
|
||||
return function (node) {
|
||||
return node && /^(OL|UL|DL)$/.test(node.nodeName) && isChildOfBody(editor, node);
|
||||
};
|
||||
};
|
||||
var getSelectedStyleType = function (editor) {
|
||||
var listElm = editor.dom.getParent(editor.selection.getNode(), 'ol,ul');
|
||||
return editor.dom.getStyle(listElm, 'listStyleType') || '';
|
||||
};
|
||||
var ListUtils = {
|
||||
isTableCellNode: isTableCellNode,
|
||||
isListNode: isListNode,
|
||||
getSelectedStyleType: getSelectedStyleType
|
||||
};
|
||||
|
||||
var styleValueToText = function (styleValue) {
|
||||
return styleValue.replace(/\-/g, ' ').replace(/\b\w/g, function (chr) {
|
||||
return chr.toUpperCase();
|
||||
});
|
||||
};
|
||||
var toMenuItems = function (styles) {
|
||||
return global$1.map(styles, function (styleValue) {
|
||||
var text = styleValueToText(styleValue);
|
||||
var data = styleValue === 'default' ? '' : styleValue;
|
||||
return {
|
||||
text: text,
|
||||
data: data
|
||||
};
|
||||
});
|
||||
};
|
||||
var ListStyles = { toMenuItems: toMenuItems };
|
||||
|
||||
var findIndex = function (list, predicate) {
|
||||
for (var index = 0; index < list.length; index++) {
|
||||
var element = list[index];
|
||||
if (predicate(element)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
var listState = function (editor, listName) {
|
||||
return function (e) {
|
||||
var ctrl = e.control;
|
||||
editor.on('NodeChange', function (e) {
|
||||
var tableCellIndex = findIndex(e.parents, ListUtils.isTableCellNode);
|
||||
var parents = tableCellIndex !== -1 ? e.parents.slice(0, tableCellIndex) : e.parents;
|
||||
var lists = global$1.grep(parents, ListUtils.isListNode(editor));
|
||||
ctrl.active(lists.length > 0 && lists[0].nodeName === listName);
|
||||
});
|
||||
};
|
||||
};
|
||||
var updateSelection = function (editor) {
|
||||
return function (e) {
|
||||
var listStyleType = ListUtils.getSelectedStyleType(editor);
|
||||
e.control.items().each(function (ctrl) {
|
||||
ctrl.active(ctrl.settings.data === listStyleType);
|
||||
});
|
||||
};
|
||||
};
|
||||
var addSplitButton = function (editor, id, tooltip, cmd, nodeName, styles) {
|
||||
editor.addButton(id, {
|
||||
active: false,
|
||||
type: 'splitbutton',
|
||||
tooltip: tooltip,
|
||||
menu: ListStyles.toMenuItems(styles),
|
||||
onPostRender: listState(editor, nodeName),
|
||||
onshow: updateSelection(editor),
|
||||
onselect: function (e) {
|
||||
Actions.applyListFormat(editor, nodeName, e.control.settings.data);
|
||||
},
|
||||
onclick: function () {
|
||||
editor.execCommand(cmd);
|
||||
}
|
||||
});
|
||||
};
|
||||
var addButton = function (editor, id, tooltip, cmd, nodeName, styles) {
|
||||
editor.addButton(id, {
|
||||
active: false,
|
||||
type: 'button',
|
||||
tooltip: tooltip,
|
||||
onPostRender: listState(editor, nodeName),
|
||||
onclick: function () {
|
||||
editor.execCommand(cmd);
|
||||
}
|
||||
});
|
||||
};
|
||||
var addControl = function (editor, id, tooltip, cmd, nodeName, styles) {
|
||||
if (styles.length > 0) {
|
||||
addSplitButton(editor, id, tooltip, cmd, nodeName, styles);
|
||||
} else {
|
||||
addButton(editor, id, tooltip, cmd, nodeName);
|
||||
}
|
||||
};
|
||||
var register$1 = function (editor) {
|
||||
addControl(editor, 'numlist', 'Numbered list', 'InsertOrderedList', 'OL', Settings.getNumberStyles(editor));
|
||||
addControl(editor, 'bullist', 'Bullet list', 'InsertUnorderedList', 'UL', Settings.getBulletStyles(editor));
|
||||
};
|
||||
var Buttons = { register: register$1 };
|
||||
|
||||
global.add('advlist', function (editor) {
|
||||
var hasPlugin = function (editor, plugin) {
|
||||
var plugins = editor.settings.plugins ? editor.settings.plugins : '';
|
||||
return global$1.inArray(plugins.split(/[ ,]/), plugin) !== -1;
|
||||
};
|
||||
if (hasPlugin(editor, 'lists')) {
|
||||
Buttons.register(editor);
|
||||
Commands.register(editor);
|
||||
}
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
1
wp-content/plugins/tinymce-advanced/mce/advlist/plugin.min.js
vendored
Normal file
1
wp-content/plugins/tinymce-advanced/mce/advlist/plugin.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=tinymce.util.Tools.resolve("tinymce.util.Tools"),s=function(t,e,n){var r="UL"===e?"InsertUnorderedList":"InsertOrderedList";t.execCommand(r,!1,!1===n?null:{"list-style-type":n})},o=function(n){n.addCommand("ApplyUnorderedListStyle",function(t,e){s(n,"UL",e["list-style-type"])}),n.addCommand("ApplyOrderedListStyle",function(t,e){s(n,"OL",e["list-style-type"])})},e=function(t){var e=t.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");return e?e.split(/[ ,]/):[]},n=function(t){var e=t.getParam("advlist_bullet_styles","default,circle,disc,square");return e?e.split(/[ ,]/):[]},u=function(t){return t&&/^(TH|TD)$/.test(t.nodeName)},c=function(r){return function(t){return t&&/^(OL|UL|DL)$/.test(t.nodeName)&&(n=t,(e=r).$.contains(e.getBody(),n));var e,n}},d=function(t){var e=t.dom.getParent(t.selection.getNode(),"ol,ul");return t.dom.getStyle(e,"listStyleType")||""},p=function(t){return a.map(t,function(t){return{text:t.replace(/\-/g," ").replace(/\b\w/g,function(t){return t.toUpperCase()}),data:"default"===t?"":t}})},f=function(i,l){return function(t){var o=t.control;i.on("NodeChange",function(t){var e=function(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return n;return-1}(t.parents,u),n=-1!==e?t.parents.slice(0,e):t.parents,r=a.grep(n,c(i));o.active(0<r.length&&r[0].nodeName===l)})}},m=function(e,t,n,r,o,i){var l;e.addButton(t,{active:!1,type:"splitbutton",tooltip:n,menu:p(i),onPostRender:f(e,o),onshow:(l=e,function(t){var e=d(l);t.control.items().each(function(t){t.active(t.settings.data===e)})}),onselect:function(t){s(e,o,t.control.settings.data)},onclick:function(){e.execCommand(r)}})},r=function(t,e,n,r,o,i){var l,a,s,u,c;0<i.length?m(t,e,n,r,o,i):(a=e,s=n,u=r,c=o,(l=t).addButton(a,{active:!1,type:"button",tooltip:s,onPostRender:f(l,c),onclick:function(){l.execCommand(u)}}))},i=function(t){r(t,"numlist","Numbered list","InsertOrderedList","OL",e(t)),r(t,"bullist","Bullet list","InsertUnorderedList","UL",n(t))};t.add("advlist",function(t){var e,n,r;n="lists",r=(e=t).settings.plugins?e.settings.plugins:"",-1!==a.inArray(r.split(/[ ,]/),n)&&(i(t),o(t))})}();
|
118
wp-content/plugins/tinymce-advanced/mce/anchor/plugin.js
Normal file
118
wp-content/plugins/tinymce-advanced/mce/anchor/plugin.js
Normal file
|
@ -0,0 +1,118 @@
|
|||
(function () {
|
||||
var anchor = (function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var isValidId = function (id) {
|
||||
return /^[A-Za-z][A-Za-z0-9\-:._]*$/.test(id);
|
||||
};
|
||||
var getId = function (editor) {
|
||||
var selectedNode = editor.selection.getNode();
|
||||
var isAnchor = selectedNode.tagName === 'A' && editor.dom.getAttrib(selectedNode, 'href') === '';
|
||||
return isAnchor ? selectedNode.id || selectedNode.name : '';
|
||||
};
|
||||
var insert = function (editor, id) {
|
||||
var selectedNode = editor.selection.getNode();
|
||||
var isAnchor = selectedNode.tagName === 'A' && editor.dom.getAttrib(selectedNode, 'href') === '';
|
||||
if (isAnchor) {
|
||||
selectedNode.removeAttribute('name');
|
||||
selectedNode.id = id;
|
||||
editor.undoManager.add();
|
||||
} else {
|
||||
editor.focus();
|
||||
editor.selection.collapse(true);
|
||||
editor.execCommand('mceInsertContent', false, editor.dom.createHTML('a', { id: id }));
|
||||
}
|
||||
};
|
||||
var Anchor = {
|
||||
isValidId: isValidId,
|
||||
getId: getId,
|
||||
insert: insert
|
||||
};
|
||||
|
||||
var insertAnchor = function (editor, newId) {
|
||||
if (!Anchor.isValidId(newId)) {
|
||||
editor.windowManager.alert('Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.');
|
||||
return true;
|
||||
} else {
|
||||
Anchor.insert(editor, newId);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
var open = function (editor) {
|
||||
var currentId = Anchor.getId(editor);
|
||||
editor.windowManager.open({
|
||||
title: 'Anchor',
|
||||
body: {
|
||||
type: 'textbox',
|
||||
name: 'id',
|
||||
size: 40,
|
||||
label: 'Id',
|
||||
value: currentId
|
||||
},
|
||||
onsubmit: function (e) {
|
||||
var newId = e.data.id;
|
||||
if (insertAnchor(editor, newId)) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
var Dialog = { open: open };
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mceAnchor', function () {
|
||||
Dialog.open(editor);
|
||||
});
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var isAnchorNode = function (node) {
|
||||
return !node.attr('href') && (node.attr('id') || node.attr('name')) && !node.firstChild;
|
||||
};
|
||||
var setContentEditable = function (state) {
|
||||
return function (nodes) {
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
if (isAnchorNode(nodes[i])) {
|
||||
nodes[i].attr('contenteditable', state);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
var setup = function (editor) {
|
||||
editor.on('PreInit', function () {
|
||||
editor.parser.addNodeFilter('a', setContentEditable('false'));
|
||||
editor.serializer.addNodeFilter('a', setContentEditable(null));
|
||||
});
|
||||
};
|
||||
var FilterContent = { setup: setup };
|
||||
|
||||
var register$1 = function (editor) {
|
||||
editor.addButton('anchor', {
|
||||
icon: 'anchor',
|
||||
tooltip: 'Anchor',
|
||||
cmd: 'mceAnchor',
|
||||
stateSelector: 'a:not([href])'
|
||||
});
|
||||
editor.addMenuItem('anchor', {
|
||||
icon: 'anchor',
|
||||
text: 'Anchor',
|
||||
context: 'insert',
|
||||
cmd: 'mceAnchor'
|
||||
});
|
||||
};
|
||||
var Buttons = { register: register$1 };
|
||||
|
||||
global.add('anchor', function (editor) {
|
||||
FilterContent.setup(editor);
|
||||
Commands.register(editor);
|
||||
Buttons.register(editor);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
1
wp-content/plugins/tinymce-advanced/mce/anchor/plugin.min.js
vendored
Normal file
1
wp-content/plugins/tinymce-advanced/mce/anchor/plugin.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=function(t){return/^[A-Za-z][A-Za-z0-9\-:._]*$/.test(t)},e=function(t){var e=t.selection.getNode();return"A"===e.tagName&&""===t.dom.getAttrib(e,"href")?e.id||e.name:""},i=function(t,e){var n=t.selection.getNode();"A"===n.tagName&&""===t.dom.getAttrib(n,"href")?(n.removeAttribute("name"),n.id=e,t.undoManager.add()):(t.focus(),t.selection.collapse(!0),t.execCommand("mceInsertContent",!1,t.dom.createHTML("a",{id:e})))},n=function(r){var t=e(r);r.windowManager.open({title:"Anchor",body:{type:"textbox",name:"id",size:40,label:"Id",value:t},onsubmit:function(t){var e,n,o=t.data.id;e=r,(a(n=o)?(i(e,n),0):(e.windowManager.alert("Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores."),1))&&t.preventDefault()}})},o=function(t){t.addCommand("mceAnchor",function(){n(t)})},r=function(o){return function(t){for(var e=0;e<t.length;e++)(n=t[e]).attr("href")||!n.attr("id")&&!n.attr("name")||n.firstChild||t[e].attr("contenteditable",o);var n}},c=function(t){t.on("PreInit",function(){t.parser.addNodeFilter("a",r("false")),t.serializer.addNodeFilter("a",r(null))})},d=function(t){t.addButton("anchor",{icon:"anchor",tooltip:"Anchor",cmd:"mceAnchor",stateSelector:"a:not([href])"}),t.addMenuItem("anchor",{icon:"anchor",text:"Anchor",context:"insert",cmd:"mceAnchor"})};t.add("anchor",function(t){c(t),o(t),d(t)})}();
|
94
wp-content/plugins/tinymce-advanced/mce/code/plugin.js
Normal file
94
wp-content/plugins/tinymce-advanced/mce/code/plugin.js
Normal file
|
@ -0,0 +1,94 @@
|
|||
(function () {
|
||||
var code = (function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
||||
|
||||
var getMinWidth = function (editor) {
|
||||
return editor.getParam('code_dialog_width', 600);
|
||||
};
|
||||
var getMinHeight = function (editor) {
|
||||
return editor.getParam('code_dialog_height', Math.min(global$1.DOM.getViewPort().h - 200, 500));
|
||||
};
|
||||
var Settings = {
|
||||
getMinWidth: getMinWidth,
|
||||
getMinHeight: getMinHeight
|
||||
};
|
||||
|
||||
var setContent = function (editor, html) {
|
||||
editor.focus();
|
||||
editor.undoManager.transact(function () {
|
||||
editor.setContent(html);
|
||||
});
|
||||
editor.selection.setCursorLocation();
|
||||
editor.nodeChanged();
|
||||
};
|
||||
var getContent = function (editor) {
|
||||
return editor.getContent({ source_view: true });
|
||||
};
|
||||
var Content = {
|
||||
setContent: setContent,
|
||||
getContent: getContent
|
||||
};
|
||||
|
||||
var open = function (editor) {
|
||||
var minWidth = Settings.getMinWidth(editor);
|
||||
var minHeight = Settings.getMinHeight(editor);
|
||||
var win = editor.windowManager.open({
|
||||
title: 'Source code',
|
||||
body: {
|
||||
type: 'textbox',
|
||||
name: 'code',
|
||||
multiline: true,
|
||||
minWidth: minWidth,
|
||||
minHeight: minHeight,
|
||||
spellcheck: false,
|
||||
style: 'direction: ltr; text-align: left'
|
||||
},
|
||||
onSubmit: function (e) {
|
||||
Content.setContent(editor, e.data.code);
|
||||
}
|
||||
});
|
||||
win.find('#code').value(Content.getContent(editor));
|
||||
};
|
||||
var Dialog = { open: open };
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mceCodeEditor', function () {
|
||||
Dialog.open(editor);
|
||||
});
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var register$1 = function (editor) {
|
||||
editor.addButton('code', {
|
||||
icon: 'code',
|
||||
tooltip: 'Source code',
|
||||
onclick: function () {
|
||||
Dialog.open(editor);
|
||||
}
|
||||
});
|
||||
editor.addMenuItem('code', {
|
||||
icon: 'code',
|
||||
text: 'Source code',
|
||||
onclick: function () {
|
||||
Dialog.open(editor);
|
||||
}
|
||||
});
|
||||
};
|
||||
var Buttons = { register: register$1 };
|
||||
|
||||
global.add('code', function (editor) {
|
||||
Commands.register(editor);
|
||||
Buttons.register(editor);
|
||||
return {};
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
1
wp-content/plugins/tinymce-advanced/mce/code/plugin.min.js
vendored
Normal file
1
wp-content/plugins/tinymce-advanced/mce/code/plugin.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),o=function(t){return t.getParam("code_dialog_width",600)},i=function(t){return t.getParam("code_dialog_height",Math.min(n.DOM.getViewPort().h-200,500))},c=function(t,n){t.focus(),t.undoManager.transact(function(){t.setContent(n)}),t.selection.setCursorLocation(),t.nodeChanged()},d=function(t){return t.getContent({source_view:!0})},e=function(n){var t=o(n),e=i(n);n.windowManager.open({title:"Source code",body:{type:"textbox",name:"code",multiline:!0,minWidth:t,minHeight:e,spellcheck:!1,style:"direction: ltr; text-align: left"},onSubmit:function(t){c(n,t.data.code)}}).find("#code").value(d(n))},u=function(t){t.addCommand("mceCodeEditor",function(){e(t)})},a=function(t){t.addButton("code",{icon:"code",tooltip:"Source code",onclick:function(){e(t)}}),t.addMenuItem("code",{icon:"code",text:"Source code",onclick:function(){e(t)}})};t.add("code",function(t){return u(t),a(t),{}})}();
|
168
wp-content/plugins/tinymce-advanced/mce/contextmenu/plugin.js
Normal file
168
wp-content/plugins/tinymce-advanced/mce/contextmenu/plugin.js
Normal file
|
@ -0,0 +1,168 @@
|
|||
(function () {
|
||||
var contextmenu = (function () {
|
||||
'use strict';
|
||||
|
||||
var Cell = function (initial) {
|
||||
var value = initial;
|
||||
var get = function () {
|
||||
return value;
|
||||
};
|
||||
var set = function (v) {
|
||||
value = v;
|
||||
};
|
||||
var clone = function () {
|
||||
return Cell(get());
|
||||
};
|
||||
return {
|
||||
get: get,
|
||||
set: set,
|
||||
clone: clone
|
||||
};
|
||||
};
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var get = function (visibleState) {
|
||||
var isContextMenuVisible = function () {
|
||||
return visibleState.get();
|
||||
};
|
||||
return { isContextMenuVisible: isContextMenuVisible };
|
||||
};
|
||||
var Api = { get: get };
|
||||
|
||||
var shouldNeverUseNative = function (editor) {
|
||||
return editor.settings.contextmenu_never_use_native;
|
||||
};
|
||||
var getContextMenu = function (editor) {
|
||||
return editor.getParam('contextmenu', 'link openlink image inserttable | cell row column deletetable');
|
||||
};
|
||||
var Settings = {
|
||||
shouldNeverUseNative: shouldNeverUseNative,
|
||||
getContextMenu: getContextMenu
|
||||
};
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
||||
|
||||
var getUiContainer = function (editor) {
|
||||
return global$1.DOM.select(editor.settings.ui_container)[0];
|
||||
};
|
||||
|
||||
var nu = function (x, y) {
|
||||
return {
|
||||
x: x,
|
||||
y: y
|
||||
};
|
||||
};
|
||||
var transpose = function (pos, dx, dy) {
|
||||
return nu(pos.x + dx, pos.y + dy);
|
||||
};
|
||||
var fromPageXY = function (e) {
|
||||
return nu(e.pageX, e.pageY);
|
||||
};
|
||||
var fromClientXY = function (e) {
|
||||
return nu(e.clientX, e.clientY);
|
||||
};
|
||||
var transposeUiContainer = function (element, pos) {
|
||||
if (element && global$1.DOM.getStyle(element, 'position', true) !== 'static') {
|
||||
var containerPos = global$1.DOM.getPos(element);
|
||||
var dx = containerPos.x - element.scrollLeft;
|
||||
var dy = containerPos.y - element.scrollTop;
|
||||
return transpose(pos, -dx, -dy);
|
||||
} else {
|
||||
return transpose(pos, 0, 0);
|
||||
}
|
||||
};
|
||||
var transposeContentAreaContainer = function (element, pos) {
|
||||
var containerPos = global$1.DOM.getPos(element);
|
||||
return transpose(pos, containerPos.x, containerPos.y);
|
||||
};
|
||||
var getPos = function (editor, e) {
|
||||
if (editor.inline) {
|
||||
return transposeUiContainer(getUiContainer(editor), fromPageXY(e));
|
||||
} else {
|
||||
var iframePos = transposeContentAreaContainer(editor.getContentAreaContainer(), fromClientXY(e));
|
||||
return transposeUiContainer(getUiContainer(editor), iframePos);
|
||||
}
|
||||
};
|
||||
var Coords = { getPos: getPos };
|
||||
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.ui.Factory');
|
||||
|
||||
var global$3 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var renderMenu = function (editor, visibleState) {
|
||||
var menu, contextmenu;
|
||||
var items = [];
|
||||
contextmenu = Settings.getContextMenu(editor);
|
||||
global$3.each(contextmenu.split(/[ ,]/), function (name) {
|
||||
var item = editor.menuItems[name];
|
||||
if (name === '|') {
|
||||
item = { text: name };
|
||||
}
|
||||
if (item) {
|
||||
item.shortcut = '';
|
||||
items.push(item);
|
||||
}
|
||||
});
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
if (items[i].text === '|') {
|
||||
if (i === 0 || i === items.length - 1) {
|
||||
items.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
menu = global$2.create('menu', {
|
||||
items: items,
|
||||
context: 'contextmenu',
|
||||
classes: 'contextmenu'
|
||||
});
|
||||
menu.uiContainer = getUiContainer(editor);
|
||||
menu.renderTo(getUiContainer(editor));
|
||||
menu.on('hide', function (e) {
|
||||
if (e.control === this) {
|
||||
visibleState.set(false);
|
||||
}
|
||||
});
|
||||
editor.on('remove', function () {
|
||||
menu.remove();
|
||||
menu = null;
|
||||
});
|
||||
return menu;
|
||||
};
|
||||
var show = function (editor, pos, visibleState, menu) {
|
||||
if (menu.get() === null) {
|
||||
menu.set(renderMenu(editor, visibleState));
|
||||
} else {
|
||||
menu.get().show();
|
||||
}
|
||||
menu.get().moveTo(pos.x, pos.y);
|
||||
visibleState.set(true);
|
||||
};
|
||||
var ContextMenu = { show: show };
|
||||
|
||||
var isNativeOverrideKeyEvent = function (editor, e) {
|
||||
return e.ctrlKey && !Settings.shouldNeverUseNative(editor);
|
||||
};
|
||||
var setup = function (editor, visibleState, menu) {
|
||||
editor.on('contextmenu', function (e) {
|
||||
if (isNativeOverrideKeyEvent(editor, e)) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
ContextMenu.show(editor, Coords.getPos(editor, e), visibleState, menu);
|
||||
});
|
||||
};
|
||||
var Bind = { setup: setup };
|
||||
|
||||
global.add('contextmenu', function (editor) {
|
||||
var menu = Cell(null), visibleState = Cell(false);
|
||||
Bind.setup(editor, visibleState, menu);
|
||||
return Api.get(visibleState);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
1
wp-content/plugins/tinymce-advanced/mce/contextmenu/plugin.min.js
vendored
Normal file
1
wp-content/plugins/tinymce-advanced/mce/contextmenu/plugin.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
!function(){"use strict";var o=function(t){var n=t,e=function(){return n};return{get:e,set:function(t){n=t},clone:function(){return o(e())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=function(t){return{isContextMenuVisible:function(){return t.get()}}},r=function(t){return t.settings.contextmenu_never_use_native},u=function(t){return t.getParam("contextmenu","link openlink image inserttable | cell row column deletetable")},l=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),s=function(t){return l.DOM.select(t.settings.ui_container)[0]},a=function(t,n){return{x:t,y:n}},f=function(t,n,e){return a(t.x+n,t.y+e)},m=function(t,n){if(t&&"static"!==l.DOM.getStyle(t,"position",!0)){var e=l.DOM.getPos(t),o=e.x-t.scrollLeft,i=e.y-t.scrollTop;return f(n,-o,-i)}return f(n,0,0)},c=function(t,n){if(t.inline)return m(s(t),a((u=n).pageX,u.pageY));var e,o,i,r,u,c=(e=t.getContentAreaContainer(),o=a((r=n).clientX,r.clientY),i=l.DOM.getPos(e),f(o,i.x,i.y));return m(s(t),c)},g=tinymce.util.Tools.resolve("tinymce.ui.Factory"),v=tinymce.util.Tools.resolve("tinymce.util.Tools"),y=function(t,n,e,o){null===o.get()?o.set(function(e,n){var t,o,i=[];o=u(e),v.each(o.split(/[ ,]/),function(t){var n=e.menuItems[t];"|"===t&&(n={text:t}),n&&(n.shortcut="",i.push(n))});for(var r=0;r<i.length;r++)"|"===i[r].text&&(0!==r&&r!==i.length-1||i.splice(r,1));return(t=g.create("menu",{items:i,context:"contextmenu",classes:"contextmenu"})).uiContainer=s(e),t.renderTo(s(e)),t.on("hide",function(t){t.control===this&&n.set(!1)}),e.on("remove",function(){t.remove(),t=null}),t}(t,e)):o.get().show(),o.get().moveTo(n.x,n.y),e.set(!0)},x=function(e,o,i){e.on("contextmenu",function(t){var n;n=e,(!t.ctrlKey||r(n))&&(t.preventDefault(),y(e,c(e,t),o,i))})};t.add("contextmenu",function(t){var n=o(null),e=o(!1);return x(t,e,n),i(e)})}();
|
87
wp-content/plugins/tinymce-advanced/mce/emoticons/plugin.js
Normal file
87
wp-content/plugins/tinymce-advanced/mce/emoticons/plugin.js
Normal file
|
@ -0,0 +1,87 @@
|
|||
/**
|
||||
* plugin.js (edited for WP)
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('emoticons', function(editor, url) {
|
||||
var emoticons = [{
|
||||
smile: ':-)',
|
||||
razz: ':-P',
|
||||
cool: '8-)',
|
||||
wink: ';-)',
|
||||
biggrin: ':-D'
|
||||
},
|
||||
{
|
||||
twisted: ':twisted:',
|
||||
mrgreen: ':mrgreen:',
|
||||
lol: ':lol:',
|
||||
rolleyes: ':roll:',
|
||||
confused: ':-?'
|
||||
},
|
||||
{
|
||||
cry: ':cry:',
|
||||
surprised: ':-o',
|
||||
evil: ':evil:',
|
||||
neutral: ':-|',
|
||||
redface: ':oops:'
|
||||
},
|
||||
{
|
||||
mad: ':-x',
|
||||
eek: '8-O',
|
||||
sad: ':-(',
|
||||
arrow: ':arrow:',
|
||||
idea: ':idea:'
|
||||
}];
|
||||
|
||||
function getHtml() {
|
||||
var emoticonsHtml;
|
||||
|
||||
emoticonsHtml = '<table role="list" class="mce-grid">';
|
||||
|
||||
tinymce.each(emoticons, function( row ) {
|
||||
emoticonsHtml += '<tr>';
|
||||
|
||||
tinymce.each( row, function( icon, name ) {
|
||||
var emoticonUrl = url + '/img/icon_' + name + '.gif';
|
||||
|
||||
emoticonsHtml += '<td><a href="#" data-mce-alt="' + icon + '" tabindex="-1" ' +
|
||||
'role="option" aria-label="' + icon + '"><img src="' +
|
||||
emoticonUrl + '" style="width: 15px; height: 15px; padding: 3px;" role="presentation" alt="' + icon + '" /></a></td>';
|
||||
});
|
||||
|
||||
emoticonsHtml += '</tr>';
|
||||
});
|
||||
|
||||
emoticonsHtml += '</table>';
|
||||
|
||||
return emoticonsHtml;
|
||||
}
|
||||
|
||||
editor.addButton('emoticons', {
|
||||
type: 'panelbutton',
|
||||
panel: {
|
||||
role: 'application',
|
||||
autohide: true,
|
||||
html: getHtml,
|
||||
onclick: function(e) {
|
||||
var linkElm = editor.dom.getParent( e.target, 'a' );
|
||||
|
||||
if ( linkElm ) {
|
||||
editor.insertContent(
|
||||
' ' + linkElm.getAttribute('data-mce-alt') + ' '
|
||||
);
|
||||
|
||||
this.hide();
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: 'Emoticons'
|
||||
});
|
||||
});
|
1
wp-content/plugins/tinymce-advanced/mce/emoticons/plugin.min.js
vendored
Normal file
1
wp-content/plugins/tinymce-advanced/mce/emoticons/plugin.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
tinymce.PluginManager.add("emoticons",function(a,b){function c(){var a;return a='<table role="list" class="mce-grid">',tinymce.each(d,function(c){a+="<tr>",tinymce.each(c,function(c,d){var e=b+"/img/icon_"+d+".gif";a+='<td><a href="#" data-mce-alt="'+c+'" tabindex="-1" role="option" aria-label="'+c+'"><img src="'+e+'" style="width: 15px; height: 15px; padding: 3px;" role="presentation" alt="'+c+'" /></a></td>'}),a+="</tr>"}),a+="</table>"}var d=[{smile:":-)",razz:":-P",cool:"8-)",wink:";-)",biggrin:":-D"},{twisted:":twisted:",mrgreen:":mrgreen:",lol:":lol:",rolleyes:":roll:",confused:":-?"},{cry:":cry:",surprised:":-o",evil:":evil:",neutral:":-|",redface:":oops:"},{mad:":-x",eek:"8-O",sad:":-(",arrow:":arrow:",idea:":idea:"}];a.addButton("emoticons",{type:"panelbutton",panel:{role:"application",autohide:!0,html:c,onclick:function(b){var c=a.dom.getParent(b.target,"a");c&&(a.insertContent(" "+c.getAttribute("data-mce-alt")+" "),this.hide())}},tooltip:"Emoticons"})});
|
264
wp-content/plugins/tinymce-advanced/mce/importcss/plugin.js
Normal file
264
wp-content/plugins/tinymce-advanced/mce/importcss/plugin.js
Normal file
|
@ -0,0 +1,264 @@
|
|||
(function () {
|
||||
var importcss = (function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
||||
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.EditorManager');
|
||||
|
||||
var global$3 = tinymce.util.Tools.resolve('tinymce.Env');
|
||||
|
||||
var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var shouldMergeClasses = function (editor) {
|
||||
return editor.getParam('importcss_merge_classes');
|
||||
};
|
||||
var shouldImportExclusive = function (editor) {
|
||||
return editor.getParam('importcss_exclusive');
|
||||
};
|
||||
var getSelectorConverter = function (editor) {
|
||||
return editor.getParam('importcss_selector_converter');
|
||||
};
|
||||
var getSelectorFilter = function (editor) {
|
||||
return editor.getParam('importcss_selector_filter');
|
||||
};
|
||||
var getCssGroups = function (editor) {
|
||||
return editor.getParam('importcss_groups');
|
||||
};
|
||||
var shouldAppend = function (editor) {
|
||||
return editor.getParam('importcss_append');
|
||||
};
|
||||
var getFileFilter = function (editor) {
|
||||
return editor.getParam('importcss_file_filter');
|
||||
};
|
||||
var Settings = {
|
||||
shouldMergeClasses: shouldMergeClasses,
|
||||
shouldImportExclusive: shouldImportExclusive,
|
||||
getSelectorConverter: getSelectorConverter,
|
||||
getSelectorFilter: getSelectorFilter,
|
||||
getCssGroups: getCssGroups,
|
||||
shouldAppend: shouldAppend,
|
||||
getFileFilter: getFileFilter
|
||||
};
|
||||
|
||||
var removeCacheSuffix = function (url) {
|
||||
var cacheSuffix = global$3.cacheSuffix;
|
||||
if (typeof url === 'string') {
|
||||
url = url.replace('?' + cacheSuffix, '').replace('&' + cacheSuffix, '');
|
||||
}
|
||||
return url;
|
||||
};
|
||||
var isSkinContentCss = function (editor, href) {
|
||||
var settings = editor.settings, skin = settings.skin !== false ? settings.skin || 'lightgray' : false;
|
||||
if (skin) {
|
||||
var skinUrl = settings.skin_url ? editor.documentBaseURI.toAbsolute(settings.skin_url) : global$2.baseURL + '/skins/' + skin;
|
||||
return href === skinUrl + '/content' + (editor.inline ? '.inline' : '') + '.min.css';
|
||||
}
|
||||
return false;
|
||||
};
|
||||
var compileFilter = function (filter) {
|
||||
if (typeof filter === 'string') {
|
||||
return function (value) {
|
||||
return value.indexOf(filter) !== -1;
|
||||
};
|
||||
} else if (filter instanceof RegExp) {
|
||||
return function (value) {
|
||||
return filter.test(value);
|
||||
};
|
||||
}
|
||||
return filter;
|
||||
};
|
||||
var getSelectors = function (editor, doc, fileFilter) {
|
||||
var selectors = [], contentCSSUrls = {};
|
||||
function append(styleSheet, imported) {
|
||||
var href = styleSheet.href, rules;
|
||||
href = removeCacheSuffix(href);
|
||||
if (!href || !fileFilter(href, imported) || isSkinContentCss(editor, href)) {
|
||||
return;
|
||||
}
|
||||
global$4.each(styleSheet.imports, function (styleSheet) {
|
||||
append(styleSheet, true);
|
||||
});
|
||||
try {
|
||||
rules = styleSheet.cssRules || styleSheet.rules;
|
||||
} catch (e) {
|
||||
}
|
||||
global$4.each(rules, function (cssRule) {
|
||||
if (cssRule.styleSheet) {
|
||||
append(cssRule.styleSheet, true);
|
||||
} else if (cssRule.selectorText) {
|
||||
global$4.each(cssRule.selectorText.split(','), function (selector) {
|
||||
selectors.push(global$4.trim(selector));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
global$4.each(editor.contentCSS, function (url) {
|
||||
contentCSSUrls[url] = true;
|
||||
});
|
||||
if (!fileFilter) {
|
||||
fileFilter = function (href, imported) {
|
||||
return imported || contentCSSUrls[href];
|
||||
};
|
||||
}
|
||||
try {
|
||||
global$4.each(doc.styleSheets, function (styleSheet) {
|
||||
append(styleSheet);
|
||||
});
|
||||
} catch (e) {
|
||||
}
|
||||
return selectors;
|
||||
};
|
||||
var defaultConvertSelectorToFormat = function (editor, selectorText) {
|
||||
var format;
|
||||
var selector = /^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(selectorText);
|
||||
if (!selector) {
|
||||
return;
|
||||
}
|
||||
var elementName = selector[1];
|
||||
var classes = selector[2].substr(1).split('.').join(' ');
|
||||
var inlineSelectorElements = global$4.makeMap('a,img');
|
||||
if (selector[1]) {
|
||||
format = { title: selectorText };
|
||||
if (editor.schema.getTextBlockElements()[elementName]) {
|
||||
format.block = elementName;
|
||||
} else if (editor.schema.getBlockElements()[elementName] || inlineSelectorElements[elementName.toLowerCase()]) {
|
||||
format.selector = elementName;
|
||||
} else {
|
||||
format.inline = elementName;
|
||||
}
|
||||
} else if (selector[2]) {
|
||||
format = {
|
||||
inline: 'span',
|
||||
title: selectorText.substr(1),
|
||||
classes: classes
|
||||
};
|
||||
}
|
||||
if (Settings.shouldMergeClasses(editor) !== false) {
|
||||
format.classes = classes;
|
||||
} else {
|
||||
format.attributes = { class: classes };
|
||||
}
|
||||
return format;
|
||||
};
|
||||
var getGroupsBySelector = function (groups, selector) {
|
||||
return global$4.grep(groups, function (group) {
|
||||
return !group.filter || group.filter(selector);
|
||||
});
|
||||
};
|
||||
var compileUserDefinedGroups = function (groups) {
|
||||
return global$4.map(groups, function (group) {
|
||||
return global$4.extend({}, group, {
|
||||
original: group,
|
||||
selectors: {},
|
||||
filter: compileFilter(group.filter),
|
||||
item: {
|
||||
text: group.title,
|
||||
menu: []
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
var isExclusiveMode = function (editor, group) {
|
||||
return group === null || Settings.shouldImportExclusive(editor) !== false;
|
||||
};
|
||||
var isUniqueSelector = function (editor, selector, group, globallyUniqueSelectors) {
|
||||
return !(isExclusiveMode(editor, group) ? selector in globallyUniqueSelectors : selector in group.selectors);
|
||||
};
|
||||
var markUniqueSelector = function (editor, selector, group, globallyUniqueSelectors) {
|
||||
if (isExclusiveMode(editor, group)) {
|
||||
globallyUniqueSelectors[selector] = true;
|
||||
} else {
|
||||
group.selectors[selector] = true;
|
||||
}
|
||||
};
|
||||
var convertSelectorToFormat = function (editor, plugin, selector, group) {
|
||||
var selectorConverter;
|
||||
if (group && group.selector_converter) {
|
||||
selectorConverter = group.selector_converter;
|
||||
} else if (Settings.getSelectorConverter(editor)) {
|
||||
selectorConverter = Settings.getSelectorConverter(editor);
|
||||
} else {
|
||||
selectorConverter = function () {
|
||||
return defaultConvertSelectorToFormat(editor, selector);
|
||||
};
|
||||
}
|
||||
return selectorConverter.call(plugin, selector, group);
|
||||
};
|
||||
var setup = function (editor) {
|
||||
editor.on('renderFormatsMenu', function (e) {
|
||||
var globallyUniqueSelectors = {};
|
||||
var selectorFilter = compileFilter(Settings.getSelectorFilter(editor)), ctrl = e.control;
|
||||
var groups = compileUserDefinedGroups(Settings.getCssGroups(editor));
|
||||
var processSelector = function (selector, group) {
|
||||
if (isUniqueSelector(editor, selector, group, globallyUniqueSelectors)) {
|
||||
markUniqueSelector(editor, selector, group, globallyUniqueSelectors);
|
||||
var format = convertSelectorToFormat(editor, editor.plugins.importcss, selector, group);
|
||||
if (format) {
|
||||
var formatName = format.name || global$1.DOM.uniqueId();
|
||||
editor.formatter.register(formatName, format);
|
||||
return global$4.extend({}, ctrl.settings.itemDefaults, {
|
||||
text: format.title,
|
||||
format: formatName
|
||||
});
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
if (!Settings.shouldAppend(editor)) {
|
||||
ctrl.items().remove();
|
||||
}
|
||||
global$4.each(getSelectors(editor, e.doc || editor.getDoc(), compileFilter(Settings.getFileFilter(editor))), function (selector) {
|
||||
if (selector.indexOf('.mce-') === -1) {
|
||||
if (!selectorFilter || selectorFilter(selector)) {
|
||||
var selectorGroups = getGroupsBySelector(groups, selector);
|
||||
if (selectorGroups.length > 0) {
|
||||
global$4.each(selectorGroups, function (group) {
|
||||
var menuItem = processSelector(selector, group);
|
||||
if (menuItem) {
|
||||
group.item.menu.push(menuItem);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var menuItem = processSelector(selector, null);
|
||||
if (menuItem) {
|
||||
ctrl.add(menuItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
global$4.each(groups, function (group) {
|
||||
if (group.item.menu.length > 0) {
|
||||
ctrl.add(group.item);
|
||||
}
|
||||
});
|
||||
e.control.renderNew();
|
||||
});
|
||||
};
|
||||
var ImportCss = {
|
||||
defaultConvertSelectorToFormat: defaultConvertSelectorToFormat,
|
||||
setup: setup
|
||||
};
|
||||
|
||||
var get = function (editor) {
|
||||
var convertSelectorToFormat = function (selectorText) {
|
||||
return ImportCss.defaultConvertSelectorToFormat(editor, selectorText);
|
||||
};
|
||||
return { convertSelectorToFormat: convertSelectorToFormat };
|
||||
};
|
||||
var Api = { get: get };
|
||||
|
||||
global.add('importcss', function (editor) {
|
||||
ImportCss.setup(editor);
|
||||
return Api.get(editor);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
1
wp-content/plugins/tinymce-advanced/mce/importcss/plugin.min.js
vendored
Normal file
1
wp-content/plugins/tinymce-advanced/mce/importcss/plugin.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),d=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),v=tinymce.util.Tools.resolve("tinymce.EditorManager"),h=tinymce.util.Tools.resolve("tinymce.Env"),y=tinymce.util.Tools.resolve("tinymce.util.Tools"),o=function(e){return e.getParam("importcss_merge_classes")},n=function(e){return e.getParam("importcss_exclusive")},_=function(e){return e.getParam("importcss_selector_converter")},r=function(e){return e.getParam("importcss_selector_filter")},i=function(e){return e.getParam("importcss_groups")},u=function(e){return e.getParam("importcss_append")},l=function(e){return e.getParam("importcss_file_filter")},a=function(t){return"string"==typeof t?function(e){return-1!==e.indexOf(t)}:t instanceof RegExp?function(e){return t.test(e)}:t},f=function(f,e,m){var g=[],n={};function p(e,t){var n,r,i,c=e.href;if(r=c,i=h.cacheSuffix,"string"==typeof r&&(r=r.replace("?"+i,"").replace("&"+i,"")),(c=r)&&m(c,t)&&(o=c,u=(s=f).settings,!(l=!1!==u.skin&&(u.skin||"lightgray"))||o!==(u.skin_url?s.documentBaseURI.toAbsolute(u.skin_url):v.baseURL+"/skins/"+l)+"/content"+(s.inline?".inline":"")+".min.css")){var s,o,u,l;y.each(e.imports,function(e){p(e,!0)});try{n=e.cssRules||e.rules}catch(a){}y.each(n,function(e){e.styleSheet?p(e.styleSheet,!0):e.selectorText&&y.each(e.selectorText.split(","),function(e){g.push(y.trim(e))})})}}y.each(f.contentCSS,function(e){n[e]=!0}),m||(m=function(e,t){return t||n[e]});try{y.each(e.styleSheets,function(e){p(e)})}catch(t){}return g},x=function(e,t){var n,r=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(t);if(r){var i=r[1],c=r[2].substr(1).split(".").join(" "),s=y.makeMap("a,img");return r[1]?(n={title:t},e.schema.getTextBlockElements()[i]?n.block=i:e.schema.getBlockElements()[i]||s[i.toLowerCase()]?n.selector=i:n.inline=i):r[2]&&(n={inline:"span",title:t.substr(1),classes:c}),!1!==o(e)?n.classes=c:n.attributes={"class":c},n}},T=function(e,t){return null===t||!1!==n(e)},c=x,t=function(h){h.on("renderFormatsMenu",function(e){var t,p={},c=a(r(h)),v=e.control,s=(t=i(h),y.map(t,function(e){return y.extend({},e,{original:e,selectors:{},filter:a(e.filter),item:{text:e.title,menu:[]}})})),o=function(e,t){if(f=e,g=p,!(T(h,m=t)?f in g:f in m.selectors)){u=e,a=p,T(h,l=t)?a[u]=!0:l.selectors[u]=!0;var n=(c=(i=h).plugins.importcss,s=e,((o=t)&&o.selector_converter?o.selector_converter:_(i)?_(i):function(){return x(i,s)}).call(c,s,o));if(n){var r=n.name||d.DOM.uniqueId();return h.formatter.register(r,n),y.extend({},v.settings.itemDefaults,{text:n.title,format:r})}}var i,c,s,o,u,l,a,f,m,g;return null};u(h)||v.items().remove(),y.each(f(h,e.doc||h.getDoc(),a(l(h))),function(n){if(-1===n.indexOf(".mce-")&&(!c||c(n))){var e=(r=s,i=n,y.grep(r,function(e){return!e.filter||e.filter(i)}));if(0<e.length)y.each(e,function(e){var t=o(n,e);t&&e.item.menu.push(t)});else{var t=o(n,null);t&&v.add(t)}}var r,i}),y.each(s,function(e){0<e.item.menu.length&&v.add(e.item)}),e.control.renderNew()})},s=function(t){return{convertSelectorToFormat:function(e){return c(t,e)}}};e.add("importcss",function(e){return t(e),s(e)})}();
|
173
wp-content/plugins/tinymce-advanced/mce/insertdatetime/plugin.js
Normal file
173
wp-content/plugins/tinymce-advanced/mce/insertdatetime/plugin.js
Normal file
|
@ -0,0 +1,173 @@
|
|||
(function () {
|
||||
var insertdatetime = (function () {
|
||||
'use strict';
|
||||
|
||||
var Cell = function (initial) {
|
||||
var value = initial;
|
||||
var get = function () {
|
||||
return value;
|
||||
};
|
||||
var set = function (v) {
|
||||
value = v;
|
||||
};
|
||||
var clone = function () {
|
||||
return Cell(get());
|
||||
};
|
||||
return {
|
||||
get: get,
|
||||
set: set,
|
||||
clone: clone
|
||||
};
|
||||
};
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var getDateFormat = function (editor) {
|
||||
return editor.getParam('insertdatetime_dateformat', editor.translate('%Y-%m-%d'));
|
||||
};
|
||||
var getTimeFormat = function (editor) {
|
||||
return editor.getParam('insertdatetime_timeformat', editor.translate('%H:%M:%S'));
|
||||
};
|
||||
var getFormats = function (editor) {
|
||||
return editor.getParam('insertdatetime_formats', [
|
||||
'%H:%M:%S',
|
||||
'%Y-%m-%d',
|
||||
'%I:%M:%S %p',
|
||||
'%D'
|
||||
]);
|
||||
};
|
||||
var getDefaultDateTime = function (editor) {
|
||||
var formats = getFormats(editor);
|
||||
return formats.length > 0 ? formats[0] : getTimeFormat(editor);
|
||||
};
|
||||
var shouldInsertTimeElement = function (editor) {
|
||||
return editor.getParam('insertdatetime_element', false);
|
||||
};
|
||||
var Settings = {
|
||||
getDateFormat: getDateFormat,
|
||||
getTimeFormat: getTimeFormat,
|
||||
getFormats: getFormats,
|
||||
getDefaultDateTime: getDefaultDateTime,
|
||||
shouldInsertTimeElement: shouldInsertTimeElement
|
||||
};
|
||||
|
||||
var daysShort = 'Sun Mon Tue Wed Thu Fri Sat Sun'.split(' ');
|
||||
var daysLong = 'Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday'.split(' ');
|
||||
var monthsShort = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ');
|
||||
var monthsLong = 'January February March April May June July August September October November December'.split(' ');
|
||||
var addZeros = function (value, len) {
|
||||
value = '' + value;
|
||||
if (value.length < len) {
|
||||
for (var i = 0; i < len - value.length; i++) {
|
||||
value = '0' + value;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
};
|
||||
var getDateTime = function (editor, fmt, date) {
|
||||
date = date || new Date();
|
||||
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;
|
||||
};
|
||||
var updateElement = function (editor, timeElm, computerTime, userTime) {
|
||||
var newTimeElm = editor.dom.create('time', { datetime: computerTime }, userTime);
|
||||
timeElm.parentNode.insertBefore(newTimeElm, timeElm);
|
||||
editor.dom.remove(timeElm);
|
||||
editor.selection.select(newTimeElm, true);
|
||||
editor.selection.collapse(false);
|
||||
};
|
||||
var insertDateTime = function (editor, format) {
|
||||
if (Settings.shouldInsertTimeElement(editor)) {
|
||||
var userTime = getDateTime(editor, format);
|
||||
var computerTime = void 0;
|
||||
if (/%[HMSIp]/.test(format)) {
|
||||
computerTime = getDateTime(editor, '%Y-%m-%dT%H:%M');
|
||||
} else {
|
||||
computerTime = getDateTime(editor, '%Y-%m-%d');
|
||||
}
|
||||
var timeElm = editor.dom.getParent(editor.selection.getStart(), 'time');
|
||||
if (timeElm) {
|
||||
updateElement(editor, timeElm, computerTime, userTime);
|
||||
} else {
|
||||
editor.insertContent('<time datetime="' + computerTime + '">' + userTime + '</time>');
|
||||
}
|
||||
} else {
|
||||
editor.insertContent(getDateTime(editor, format));
|
||||
}
|
||||
};
|
||||
var Actions = {
|
||||
insertDateTime: insertDateTime,
|
||||
getDateTime: getDateTime
|
||||
};
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mceInsertDate', function () {
|
||||
Actions.insertDateTime(editor, Settings.getDateFormat(editor));
|
||||
});
|
||||
editor.addCommand('mceInsertTime', function () {
|
||||
Actions.insertDateTime(editor, Settings.getTimeFormat(editor));
|
||||
});
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var createMenuItems = function (editor, lastFormatState) {
|
||||
var formats = Settings.getFormats(editor);
|
||||
return global$1.map(formats, function (fmt) {
|
||||
return {
|
||||
text: Actions.getDateTime(editor, fmt),
|
||||
onclick: function () {
|
||||
lastFormatState.set(fmt);
|
||||
Actions.insertDateTime(editor, fmt);
|
||||
}
|
||||
};
|
||||
});
|
||||
};
|
||||
var register$1 = function (editor, lastFormatState) {
|
||||
var menuItems = createMenuItems(editor, lastFormatState);
|
||||
editor.addButton('insertdatetime', {
|
||||
type: 'splitbutton',
|
||||
title: 'Insert date/time',
|
||||
menu: menuItems,
|
||||
onclick: function () {
|
||||
var lastFormat = lastFormatState.get();
|
||||
Actions.insertDateTime(editor, lastFormat ? lastFormat : Settings.getDefaultDateTime(editor));
|
||||
}
|
||||
});
|
||||
editor.addMenuItem('insertdatetime', {
|
||||
icon: 'date',
|
||||
text: 'Date/time',
|
||||
menu: menuItems,
|
||||
context: 'insert'
|
||||
});
|
||||
};
|
||||
var Buttons = { register: register$1 };
|
||||
|
||||
global.add('insertdatetime', function (editor) {
|
||||
var lastFormatState = Cell(null);
|
||||
Commands.register(editor);
|
||||
Buttons.register(editor, lastFormatState);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
1
wp-content/plugins/tinymce-advanced/mce/insertdatetime/plugin.min.js
vendored
Normal file
1
wp-content/plugins/tinymce-advanced/mce/insertdatetime/plugin.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
!function(){"use strict";var r=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return r(n())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=function(e){return e.getParam("insertdatetime_timeformat",e.translate("%H:%M:%S"))},a=function(e){return e.getParam("insertdatetime_formats",["%H:%M:%S","%Y-%m-%d","%I:%M:%S %p","%D"])},t=function(e){return e.getParam("insertdatetime_dateformat",e.translate("%Y-%m-%d"))},i=n,o=a,u=function(e){var t=a(e);return 0<t.length?t[0]:n(e)},m=function(e){return e.getParam("insertdatetime_element",!1)},c="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),l="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),s="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),d="January February March April May June July August September October November December".split(" "),p=function(e,t){if((e=""+e).length<t)for(var n=0;n<t-e.length;n++)e="0"+e;return e},f=function(e,t,n){return n=n||new Date,t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace("%D","%m/%d/%Y")).replace("%r","%I:%M:%S %p")).replace("%Y",""+n.getFullYear())).replace("%y",""+n.getYear())).replace("%m",p(n.getMonth()+1,2))).replace("%d",p(n.getDate(),2))).replace("%H",""+p(n.getHours(),2))).replace("%M",""+p(n.getMinutes(),2))).replace("%S",""+p(n.getSeconds(),2))).replace("%I",""+((n.getHours()+11)%12+1))).replace("%p",n.getHours()<12?"AM":"PM")).replace("%B",""+e.translate(d[n.getMonth()]))).replace("%b",""+e.translate(s[n.getMonth()]))).replace("%A",""+e.translate(l[n.getDay()]))).replace("%a",""+e.translate(c[n.getDay()]))).replace("%%","%")},g=function(e,t){if(m(e)){var n=f(e,t),r=void 0;r=/%[HMSIp]/.test(t)?f(e,"%Y-%m-%dT%H:%M"):f(e,"%Y-%m-%d");var a=e.dom.getParent(e.selection.getStart(),"time");a?(o=a,u=r,c=n,l=(i=e).dom.create("time",{datetime:u},c),o.parentNode.insertBefore(l,o),i.dom.remove(o),i.selection.select(l,!0),i.selection.collapse(!1)):e.insertContent('<time datetime="'+r+'">'+n+"</time>")}else e.insertContent(f(e,t));var i,o,u,c,l},y=f,M=function(e){e.addCommand("mceInsertDate",function(){g(e,t(e))}),e.addCommand("mceInsertTime",function(){g(e,i(e))})},v=tinymce.util.Tools.resolve("tinymce.util.Tools"),S=function(t,n){var r,a,e,i=(a=n,e=o(r=t),v.map(e,function(e){return{text:y(r,e),onclick:function(){a.set(e),g(r,e)}}}));t.addButton("insertdatetime",{type:"splitbutton",title:"Insert date/time",menu:i,onclick:function(){var e=n.get();g(t,e||u(t))}}),t.addMenuItem("insertdatetime",{icon:"date",text:"Date/time",menu:i,context:"insert"})};e.add("insertdatetime",function(e){var t=r(null);M(e),S(e,t)})}();
|
713
wp-content/plugins/tinymce-advanced/mce/link/plugin.js
Normal file
713
wp-content/plugins/tinymce-advanced/mce/link/plugin.js
Normal file
|
@ -0,0 +1,713 @@
|
|||
(function () {
|
||||
var link = (function (domGlobals) {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.VK');
|
||||
|
||||
var assumeExternalTargets = function (editorSettings) {
|
||||
return typeof editorSettings.link_assume_external_targets === 'boolean' ? editorSettings.link_assume_external_targets : false;
|
||||
};
|
||||
var hasContextToolbar = function (editorSettings) {
|
||||
return typeof editorSettings.link_context_toolbar === 'boolean' ? editorSettings.link_context_toolbar : false;
|
||||
};
|
||||
var getLinkList = function (editorSettings) {
|
||||
return editorSettings.link_list;
|
||||
};
|
||||
var hasDefaultLinkTarget = function (editorSettings) {
|
||||
return typeof editorSettings.default_link_target === 'string';
|
||||
};
|
||||
var getDefaultLinkTarget = function (editorSettings) {
|
||||
return editorSettings.default_link_target;
|
||||
};
|
||||
var getTargetList = function (editorSettings) {
|
||||
return editorSettings.target_list;
|
||||
};
|
||||
var setTargetList = function (editor, list) {
|
||||
editor.settings.target_list = list;
|
||||
};
|
||||
var shouldShowTargetList = function (editorSettings) {
|
||||
return getTargetList(editorSettings) !== false;
|
||||
};
|
||||
var getRelList = function (editorSettings) {
|
||||
return editorSettings.rel_list;
|
||||
};
|
||||
var hasRelList = function (editorSettings) {
|
||||
return getRelList(editorSettings) !== undefined;
|
||||
};
|
||||
var getLinkClassList = function (editorSettings) {
|
||||
return editorSettings.link_class_list;
|
||||
};
|
||||
var hasLinkClassList = function (editorSettings) {
|
||||
return getLinkClassList(editorSettings) !== undefined;
|
||||
};
|
||||
var shouldShowLinkTitle = function (editorSettings) {
|
||||
return editorSettings.link_title !== false;
|
||||
};
|
||||
var allowUnsafeLinkTarget = function (editorSettings) {
|
||||
return typeof editorSettings.allow_unsafe_link_target === 'boolean' ? editorSettings.allow_unsafe_link_target : false;
|
||||
};
|
||||
var Settings = {
|
||||
assumeExternalTargets: assumeExternalTargets,
|
||||
hasContextToolbar: hasContextToolbar,
|
||||
getLinkList: getLinkList,
|
||||
hasDefaultLinkTarget: hasDefaultLinkTarget,
|
||||
getDefaultLinkTarget: getDefaultLinkTarget,
|
||||
getTargetList: getTargetList,
|
||||
setTargetList: setTargetList,
|
||||
shouldShowTargetList: shouldShowTargetList,
|
||||
getRelList: getRelList,
|
||||
hasRelList: hasRelList,
|
||||
getLinkClassList: getLinkClassList,
|
||||
hasLinkClassList: hasLinkClassList,
|
||||
shouldShowLinkTitle: shouldShowLinkTitle,
|
||||
allowUnsafeLinkTarget: allowUnsafeLinkTarget
|
||||
};
|
||||
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
||||
|
||||
var global$3 = tinymce.util.Tools.resolve('tinymce.Env');
|
||||
|
||||
var appendClickRemove = function (link, evt) {
|
||||
domGlobals.document.body.appendChild(link);
|
||||
link.dispatchEvent(evt);
|
||||
domGlobals.document.body.removeChild(link);
|
||||
};
|
||||
var open = function (url) {
|
||||
if (!global$3.ie || global$3.ie > 10) {
|
||||
var link = domGlobals.document.createElement('a');
|
||||
link.target = '_blank';
|
||||
link.href = url;
|
||||
link.rel = 'noreferrer noopener';
|
||||
var evt = domGlobals.document.createEvent('MouseEvents');
|
||||
evt.initMouseEvent('click', true, true, domGlobals.window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
||||
appendClickRemove(link, evt);
|
||||
} else {
|
||||
var win = domGlobals.window.open('', '_blank');
|
||||
if (win) {
|
||||
win.opener = null;
|
||||
var doc = win.document;
|
||||
doc.open();
|
||||
doc.write('<meta http-equiv="refresh" content="0; url=' + global$2.DOM.encode(url) + '">');
|
||||
doc.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
var OpenUrl = { open: open };
|
||||
|
||||
var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var toggleTargetRules = function (rel, isUnsafe) {
|
||||
var rules = ['noopener'];
|
||||
var newRel = rel ? rel.split(/\s+/) : [];
|
||||
var toString = function (rel) {
|
||||
return global$4.trim(rel.sort().join(' '));
|
||||
};
|
||||
var addTargetRules = function (rel) {
|
||||
rel = removeTargetRules(rel);
|
||||
return rel.length ? rel.concat(rules) : rules;
|
||||
};
|
||||
var removeTargetRules = function (rel) {
|
||||
return rel.filter(function (val) {
|
||||
return global$4.inArray(rules, val) === -1;
|
||||
});
|
||||
};
|
||||
newRel = isUnsafe ? addTargetRules(newRel) : removeTargetRules(newRel);
|
||||
return newRel.length ? toString(newRel) : null;
|
||||
};
|
||||
var trimCaretContainers = function (text) {
|
||||
return text.replace(/\uFEFF/g, '');
|
||||
};
|
||||
var getAnchorElement = function (editor, selectedElm) {
|
||||
selectedElm = selectedElm || editor.selection.getNode();
|
||||
if (isImageFigure(selectedElm)) {
|
||||
return editor.dom.select('a[href]', selectedElm)[0];
|
||||
} else {
|
||||
return editor.dom.getParent(selectedElm, 'a[href]');
|
||||
}
|
||||
};
|
||||
var getAnchorText = function (selection, anchorElm) {
|
||||
var text = anchorElm ? anchorElm.innerText || anchorElm.textContent : selection.getContent({ format: 'text' });
|
||||
return trimCaretContainers(text);
|
||||
};
|
||||
var isLink = function (elm) {
|
||||
return elm && elm.nodeName === 'A' && elm.href;
|
||||
};
|
||||
var hasLinks = function (elements) {
|
||||
return global$4.grep(elements, isLink).length > 0;
|
||||
};
|
||||
var isOnlyTextSelected = function (html) {
|
||||
if (/</.test(html) && (!/^<a [^>]+>[^<]+<\/a>$/.test(html) || html.indexOf('href=') === -1)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
var isImageFigure = function (node) {
|
||||
return node && node.nodeName === 'FIGURE' && /\bimage\b/i.test(node.className);
|
||||
};
|
||||
var link = function (editor, attachState) {
|
||||
return function (data) {
|
||||
editor.undoManager.transact(function () {
|
||||
var selectedElm = editor.selection.getNode();
|
||||
var anchorElm = getAnchorElement(editor, selectedElm);
|
||||
var linkAttrs = {
|
||||
href: data.href,
|
||||
target: data.target ? data.target : null,
|
||||
rel: data.rel ? data.rel : null,
|
||||
class: data.class ? data.class : null,
|
||||
title: data.title ? data.title : null
|
||||
};
|
||||
if (!Settings.hasRelList(editor.settings) && Settings.allowUnsafeLinkTarget(editor.settings) === false) {
|
||||
linkAttrs.rel = toggleTargetRules(linkAttrs.rel, linkAttrs.target === '_blank');
|
||||
}
|
||||
if (data.href === attachState.href) {
|
||||
attachState.attach();
|
||||
attachState = {};
|
||||
}
|
||||
if (anchorElm) {
|
||||
editor.focus();
|
||||
if (data.hasOwnProperty('text')) {
|
||||
if ('innerText' in anchorElm) {
|
||||
anchorElm.innerText = data.text;
|
||||
} else {
|
||||
anchorElm.textContent = data.text;
|
||||
}
|
||||
}
|
||||
editor.dom.setAttribs(anchorElm, linkAttrs);
|
||||
editor.selection.select(anchorElm);
|
||||
editor.undoManager.add();
|
||||
} else {
|
||||
if (isImageFigure(selectedElm)) {
|
||||
linkImageFigure(editor, selectedElm, linkAttrs);
|
||||
} else if (data.hasOwnProperty('text')) {
|
||||
editor.insertContent(editor.dom.createHTML('a', linkAttrs, editor.dom.encode(data.text)));
|
||||
} else {
|
||||
editor.execCommand('mceInsertLink', false, linkAttrs);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
var unlink = function (editor) {
|
||||
return function () {
|
||||
editor.undoManager.transact(function () {
|
||||
var node = editor.selection.getNode();
|
||||
if (isImageFigure(node)) {
|
||||
unlinkImageFigure(editor, node);
|
||||
} else {
|
||||
editor.execCommand('unlink');
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
var unlinkImageFigure = function (editor, fig) {
|
||||
var a, img;
|
||||
img = editor.dom.select('img', fig)[0];
|
||||
if (img) {
|
||||
a = editor.dom.getParents(img, 'a[href]', fig)[0];
|
||||
if (a) {
|
||||
a.parentNode.insertBefore(img, a);
|
||||
editor.dom.remove(a);
|
||||
}
|
||||
}
|
||||
};
|
||||
var linkImageFigure = function (editor, fig, attrs) {
|
||||
var a, img;
|
||||
img = editor.dom.select('img', fig)[0];
|
||||
if (img) {
|
||||
a = editor.dom.create('a', attrs);
|
||||
img.parentNode.insertBefore(a, img);
|
||||
a.appendChild(img);
|
||||
}
|
||||
};
|
||||
var Utils = {
|
||||
link: link,
|
||||
unlink: unlink,
|
||||
isLink: isLink,
|
||||
hasLinks: hasLinks,
|
||||
isOnlyTextSelected: isOnlyTextSelected,
|
||||
getAnchorElement: getAnchorElement,
|
||||
getAnchorText: getAnchorText,
|
||||
toggleTargetRules: toggleTargetRules
|
||||
};
|
||||
|
||||
var global$5 = tinymce.util.Tools.resolve('tinymce.util.Delay');
|
||||
|
||||
var global$6 = tinymce.util.Tools.resolve('tinymce.util.XHR');
|
||||
|
||||
var attachState = {};
|
||||
var createLinkList = function (editor, callback) {
|
||||
var linkList = Settings.getLinkList(editor.settings);
|
||||
if (typeof linkList === 'string') {
|
||||
global$6.send({
|
||||
url: linkList,
|
||||
success: function (text) {
|
||||
callback(editor, JSON.parse(text));
|
||||
}
|
||||
});
|
||||
} else if (typeof linkList === 'function') {
|
||||
linkList(function (list) {
|
||||
callback(editor, list);
|
||||
});
|
||||
} else {
|
||||
callback(editor, linkList);
|
||||
}
|
||||
};
|
||||
var buildListItems = function (inputList, itemCallback, startItems) {
|
||||
var appendItems = function (values, output) {
|
||||
output = output || [];
|
||||
global$4.each(values, function (item) {
|
||||
var menuItem = { text: item.text || item.title };
|
||||
if (item.menu) {
|
||||
menuItem.menu = appendItems(item.menu);
|
||||
} else {
|
||||
menuItem.value = item.value;
|
||||
if (itemCallback) {
|
||||
itemCallback(menuItem);
|
||||
}
|
||||
}
|
||||
output.push(menuItem);
|
||||
});
|
||||
return output;
|
||||
};
|
||||
return appendItems(inputList, startItems || []);
|
||||
};
|
||||
var delayedConfirm = function (editor, message, callback) {
|
||||
var rng = editor.selection.getRng();
|
||||
global$5.setEditorTimeout(editor, function () {
|
||||
editor.windowManager.confirm(message, function (state) {
|
||||
editor.selection.setRng(rng);
|
||||
callback(state);
|
||||
});
|
||||
});
|
||||
};
|
||||
var showDialog = function (editor, linkList) {
|
||||
var data = {};
|
||||
var selection = editor.selection;
|
||||
var dom = editor.dom;
|
||||
var anchorElm, initialText;
|
||||
var win, onlyText, textListCtrl, linkListCtrl, relListCtrl, targetListCtrl, classListCtrl, linkTitleCtrl, value;
|
||||
var linkListChangeHandler = function (e) {
|
||||
var textCtrl = win.find('#text');
|
||||
if (!textCtrl.value() || e.lastControl && textCtrl.value() === e.lastControl.text()) {
|
||||
textCtrl.value(e.control.text());
|
||||
}
|
||||
win.find('#href').value(e.control.value());
|
||||
};
|
||||
var buildAnchorListControl = function (url) {
|
||||
var anchorList = [];
|
||||
global$4.each(editor.dom.select('a:not([href])'), function (anchor) {
|
||||
var id = anchor.name || anchor.id;
|
||||
if (id) {
|
||||
anchorList.push({
|
||||
text: id,
|
||||
value: '#' + id,
|
||||
selected: url.indexOf('#' + id) !== -1
|
||||
});
|
||||
}
|
||||
});
|
||||
if (anchorList.length) {
|
||||
anchorList.unshift({
|
||||
text: 'None',
|
||||
value: ''
|
||||
});
|
||||
return {
|
||||
name: 'anchor',
|
||||
type: 'listbox',
|
||||
label: 'Anchors',
|
||||
values: anchorList,
|
||||
onselect: linkListChangeHandler
|
||||
};
|
||||
}
|
||||
};
|
||||
var updateText = function () {
|
||||
if (!initialText && onlyText && !data.text) {
|
||||
this.parent().parent().find('#text')[0].value(this.value());
|
||||
}
|
||||
};
|
||||
var urlChange = function (e) {
|
||||
var meta = e.meta || {};
|
||||
if (linkListCtrl) {
|
||||
linkListCtrl.value(editor.convertURL(this.value(), 'href'));
|
||||
}
|
||||
global$4.each(e.meta, function (value, key) {
|
||||
var inp = win.find('#' + key);
|
||||
if (key === 'text') {
|
||||
if (initialText.length === 0) {
|
||||
inp.value(value);
|
||||
data.text = value;
|
||||
}
|
||||
} else {
|
||||
inp.value(value);
|
||||
}
|
||||
});
|
||||
if (meta.attach) {
|
||||
attachState = {
|
||||
href: this.value(),
|
||||
attach: meta.attach
|
||||
};
|
||||
}
|
||||
if (!meta.text) {
|
||||
updateText.call(this);
|
||||
}
|
||||
};
|
||||
var onBeforeCall = function (e) {
|
||||
e.meta = win.toJSON();
|
||||
};
|
||||
onlyText = Utils.isOnlyTextSelected(selection.getContent());
|
||||
anchorElm = Utils.getAnchorElement(editor);
|
||||
data.text = initialText = Utils.getAnchorText(editor.selection, anchorElm);
|
||||
data.href = anchorElm ? dom.getAttrib(anchorElm, 'href') : '';
|
||||
if (anchorElm) {
|
||||
data.target = dom.getAttrib(anchorElm, 'target');
|
||||
} else if (Settings.hasDefaultLinkTarget(editor.settings)) {
|
||||
data.target = Settings.getDefaultLinkTarget(editor.settings);
|
||||
}
|
||||
if (value = dom.getAttrib(anchorElm, 'rel')) {
|
||||
data.rel = value;
|
||||
}
|
||||
if (value = dom.getAttrib(anchorElm, 'class')) {
|
||||
data.class = value;
|
||||
}
|
||||
if (value = dom.getAttrib(anchorElm, 'title')) {
|
||||
data.title = value;
|
||||
}
|
||||
if (onlyText) {
|
||||
textListCtrl = {
|
||||
name: 'text',
|
||||
type: 'textbox',
|
||||
size: 40,
|
||||
label: 'Text to display',
|
||||
onchange: function () {
|
||||
data.text = this.value();
|
||||
}
|
||||
};
|
||||
}
|
||||
if (linkList) {
|
||||
linkListCtrl = {
|
||||
type: 'listbox',
|
||||
label: 'Link list',
|
||||
values: buildListItems(linkList, function (item) {
|
||||
item.value = editor.convertURL(item.value || item.url, 'href');
|
||||
}, [{
|
||||
text: 'None',
|
||||
value: ''
|
||||
}]),
|
||||
onselect: linkListChangeHandler,
|
||||
value: editor.convertURL(data.href, 'href'),
|
||||
onPostRender: function () {
|
||||
linkListCtrl = this;
|
||||
}
|
||||
};
|
||||
}
|
||||
if (Settings.shouldShowTargetList(editor.settings)) {
|
||||
if (Settings.getTargetList(editor.settings) === undefined) {
|
||||
Settings.setTargetList(editor, [
|
||||
{
|
||||
text: 'None',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
text: 'New window',
|
||||
value: '_blank'
|
||||
}
|
||||
]);
|
||||
}
|
||||
targetListCtrl = {
|
||||
name: 'target',
|
||||
type: 'listbox',
|
||||
label: 'Target',
|
||||
values: buildListItems(Settings.getTargetList(editor.settings))
|
||||
};
|
||||
}
|
||||
if (Settings.hasRelList(editor.settings)) {
|
||||
relListCtrl = {
|
||||
name: 'rel',
|
||||
type: 'listbox',
|
||||
label: 'Rel',
|
||||
values: buildListItems(Settings.getRelList(editor.settings), function (item) {
|
||||
if (Settings.allowUnsafeLinkTarget(editor.settings) === false) {
|
||||
item.value = Utils.toggleTargetRules(item.value, data.target === '_blank');
|
||||
}
|
||||
})
|
||||
};
|
||||
}
|
||||
if (Settings.hasLinkClassList(editor.settings)) {
|
||||
classListCtrl = {
|
||||
name: 'class',
|
||||
type: 'listbox',
|
||||
label: 'Class',
|
||||
values: buildListItems(Settings.getLinkClassList(editor.settings), function (item) {
|
||||
if (item.value) {
|
||||
item.textStyle = function () {
|
||||
return editor.formatter.getCssText({
|
||||
inline: 'a',
|
||||
classes: [item.value]
|
||||
});
|
||||
};
|
||||
}
|
||||
})
|
||||
};
|
||||
}
|
||||
if (Settings.shouldShowLinkTitle(editor.settings)) {
|
||||
linkTitleCtrl = {
|
||||
name: 'title',
|
||||
type: 'textbox',
|
||||
label: 'Title',
|
||||
value: data.title
|
||||
};
|
||||
}
|
||||
win = editor.windowManager.open({
|
||||
title: 'Insert link',
|
||||
data: data,
|
||||
body: [
|
||||
{
|
||||
name: 'href',
|
||||
type: 'filepicker',
|
||||
filetype: 'file',
|
||||
size: 40,
|
||||
autofocus: true,
|
||||
label: 'Url',
|
||||
onchange: urlChange,
|
||||
onkeyup: updateText,
|
||||
onpaste: updateText,
|
||||
onbeforecall: onBeforeCall
|
||||
},
|
||||
textListCtrl,
|
||||
linkTitleCtrl,
|
||||
buildAnchorListControl(data.href),
|
||||
linkListCtrl,
|
||||
relListCtrl,
|
||||
targetListCtrl,
|
||||
classListCtrl
|
||||
],
|
||||
onSubmit: function (e) {
|
||||
var assumeExternalTargets = Settings.assumeExternalTargets(editor.settings);
|
||||
var insertLink = Utils.link(editor, attachState);
|
||||
var removeLink = Utils.unlink(editor);
|
||||
var resultData = global$4.extend({}, data, e.data);
|
||||
var href = resultData.href;
|
||||
if (!href) {
|
||||
removeLink();
|
||||
return;
|
||||
}
|
||||
if (!onlyText || resultData.text === initialText) {
|
||||
delete resultData.text;
|
||||
}
|
||||
if (href.indexOf('@') > 0 && href.indexOf('//') === -1 && href.indexOf('mailto:') === -1) {
|
||||
delayedConfirm(editor, 'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?', function (state) {
|
||||
if (state) {
|
||||
resultData.href = 'mailto:' + href;
|
||||
}
|
||||
insertLink(resultData);
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (assumeExternalTargets === true && !/^\w+:/i.test(href) || assumeExternalTargets === false && /^\s*www[\.|\d\.]/i.test(href)) {
|
||||
delayedConfirm(editor, 'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?', function (state) {
|
||||
if (state) {
|
||||
resultData.href = 'http://' + href;
|
||||
}
|
||||
insertLink(resultData);
|
||||
});
|
||||
return;
|
||||
}
|
||||
insertLink(resultData);
|
||||
}
|
||||
});
|
||||
};
|
||||
var open$1 = function (editor) {
|
||||
createLinkList(editor, showDialog);
|
||||
};
|
||||
var Dialog = { open: open$1 };
|
||||
|
||||
var getLink = function (editor, elm) {
|
||||
return editor.dom.getParent(elm, 'a[href]');
|
||||
};
|
||||
var getSelectedLink = function (editor) {
|
||||
return getLink(editor, editor.selection.getStart());
|
||||
};
|
||||
var getHref = function (elm) {
|
||||
var href = elm.getAttribute('data-mce-href');
|
||||
return href ? href : elm.getAttribute('href');
|
||||
};
|
||||
var isContextMenuVisible = function (editor) {
|
||||
var contextmenu = editor.plugins.contextmenu;
|
||||
return contextmenu ? contextmenu.isContextMenuVisible() : false;
|
||||
};
|
||||
var hasOnlyAltModifier = function (e) {
|
||||
return e.altKey === true && e.shiftKey === false && e.ctrlKey === false && e.metaKey === false;
|
||||
};
|
||||
var gotoLink = function (editor, a) {
|
||||
if (a) {
|
||||
var href = getHref(a);
|
||||
if (/^#/.test(href)) {
|
||||
var targetEl = editor.$(href);
|
||||
if (targetEl.length) {
|
||||
editor.selection.scrollIntoView(targetEl[0], true);
|
||||
}
|
||||
} else {
|
||||
OpenUrl.open(a.href);
|
||||
}
|
||||
}
|
||||
};
|
||||
var openDialog = function (editor) {
|
||||
return function () {
|
||||
Dialog.open(editor);
|
||||
};
|
||||
};
|
||||
var gotoSelectedLink = function (editor) {
|
||||
return function () {
|
||||
gotoLink(editor, getSelectedLink(editor));
|
||||
};
|
||||
};
|
||||
var leftClickedOnAHref = function (editor) {
|
||||
return function (elm) {
|
||||
var sel, rng, node;
|
||||
if (Settings.hasContextToolbar(editor.settings) && !isContextMenuVisible(editor) && Utils.isLink(elm)) {
|
||||
sel = editor.selection;
|
||||
rng = sel.getRng();
|
||||
node = rng.startContainer;
|
||||
if (node.nodeType === 3 && sel.isCollapsed() && rng.startOffset > 0 && rng.startOffset < node.data.length) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
};
|
||||
var setupGotoLinks = function (editor) {
|
||||
editor.on('click', function (e) {
|
||||
var link = getLink(editor, e.target);
|
||||
if (link && global$1.metaKeyPressed(e)) {
|
||||
e.preventDefault();
|
||||
gotoLink(editor, link);
|
||||
}
|
||||
});
|
||||
editor.on('keydown', function (e) {
|
||||
var link = getSelectedLink(editor);
|
||||
if (link && e.keyCode === 13 && hasOnlyAltModifier(e)) {
|
||||
e.preventDefault();
|
||||
gotoLink(editor, link);
|
||||
}
|
||||
});
|
||||
};
|
||||
var toggleActiveState = function (editor) {
|
||||
return function () {
|
||||
var self = this;
|
||||
editor.on('nodechange', function (e) {
|
||||
self.active(!editor.readonly && !!Utils.getAnchorElement(editor, e.element));
|
||||
});
|
||||
};
|
||||
};
|
||||
var toggleViewLinkState = function (editor) {
|
||||
return function () {
|
||||
var self = this;
|
||||
var toggleVisibility = function (e) {
|
||||
if (Utils.hasLinks(e.parents)) {
|
||||
self.show();
|
||||
} else {
|
||||
self.hide();
|
||||
}
|
||||
};
|
||||
if (!Utils.hasLinks(editor.dom.getParents(editor.selection.getStart()))) {
|
||||
self.hide();
|
||||
}
|
||||
editor.on('nodechange', toggleVisibility);
|
||||
self.on('remove', function () {
|
||||
editor.off('nodechange', toggleVisibility);
|
||||
});
|
||||
};
|
||||
};
|
||||
var Actions = {
|
||||
openDialog: openDialog,
|
||||
gotoSelectedLink: gotoSelectedLink,
|
||||
leftClickedOnAHref: leftClickedOnAHref,
|
||||
setupGotoLinks: setupGotoLinks,
|
||||
toggleActiveState: toggleActiveState,
|
||||
toggleViewLinkState: toggleViewLinkState
|
||||
};
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mceLink', Actions.openDialog(editor));
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var setup = function (editor) {
|
||||
editor.addShortcut('Meta+K', '', Actions.openDialog(editor));
|
||||
};
|
||||
var Keyboard = { setup: setup };
|
||||
|
||||
var setupButtons = function (editor) {
|
||||
editor.addButton('link', {
|
||||
active: false,
|
||||
icon: 'link',
|
||||
tooltip: 'Insert/edit link',
|
||||
onclick: Actions.openDialog(editor),
|
||||
onpostrender: Actions.toggleActiveState(editor)
|
||||
});
|
||||
editor.addButton('unlink', {
|
||||
active: false,
|
||||
icon: 'unlink',
|
||||
tooltip: 'Remove link',
|
||||
onclick: Utils.unlink(editor),
|
||||
onpostrender: Actions.toggleActiveState(editor)
|
||||
});
|
||||
if (editor.addContextToolbar) {
|
||||
editor.addButton('openlink', {
|
||||
icon: 'newtab',
|
||||
tooltip: 'Open link',
|
||||
onclick: Actions.gotoSelectedLink(editor)
|
||||
});
|
||||
}
|
||||
};
|
||||
var setupMenuItems = function (editor) {
|
||||
editor.addMenuItem('openlink', {
|
||||
text: 'Open link',
|
||||
icon: 'newtab',
|
||||
onclick: Actions.gotoSelectedLink(editor),
|
||||
onPostRender: Actions.toggleViewLinkState(editor),
|
||||
prependToContext: true
|
||||
});
|
||||
editor.addMenuItem('link', {
|
||||
icon: 'link',
|
||||
text: 'Link',
|
||||
shortcut: 'Meta+K',
|
||||
onclick: Actions.openDialog(editor),
|
||||
stateSelector: 'a[href]',
|
||||
context: 'insert',
|
||||
prependToContext: true
|
||||
});
|
||||
editor.addMenuItem('unlink', {
|
||||
icon: 'unlink',
|
||||
text: 'Remove link',
|
||||
onclick: Utils.unlink(editor),
|
||||
stateSelector: 'a[href]'
|
||||
});
|
||||
};
|
||||
var setupContextToolbars = function (editor) {
|
||||
if (editor.addContextToolbar) {
|
||||
editor.addContextToolbar(Actions.leftClickedOnAHref(editor), 'openlink | link unlink');
|
||||
}
|
||||
};
|
||||
var Controls = {
|
||||
setupButtons: setupButtons,
|
||||
setupMenuItems: setupMenuItems,
|
||||
setupContextToolbars: setupContextToolbars
|
||||
};
|
||||
|
||||
global.add('link', function (editor) {
|
||||
Controls.setupButtons(editor);
|
||||
Controls.setupMenuItems(editor);
|
||||
Controls.setupContextToolbars(editor);
|
||||
Actions.setupGotoLinks(editor);
|
||||
Commands.register(editor);
|
||||
Keyboard.setup(editor);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}(window));
|
||||
})();
|
1
wp-content/plugins/tinymce-advanced/mce/link/plugin.min.js
vendored
Normal file
1
wp-content/plugins/tinymce-advanced/mce/link/plugin.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,85 @@
|
|||
(function () {
|
||||
var nonbreaking = (function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var stringRepeat = function (string, repeats) {
|
||||
var str = '';
|
||||
for (var index = 0; index < repeats; index++) {
|
||||
str += string;
|
||||
}
|
||||
return str;
|
||||
};
|
||||
var isVisualCharsEnabled = function (editor) {
|
||||
return editor.plugins.visualchars ? editor.plugins.visualchars.isEnabled() : false;
|
||||
};
|
||||
var insertNbsp = function (editor, times) {
|
||||
var nbsp = isVisualCharsEnabled(editor) ? '<span class="mce-nbsp"> </span>' : ' ';
|
||||
editor.insertContent(stringRepeat(nbsp, times));
|
||||
editor.dom.setAttrib(editor.dom.select('span.mce-nbsp'), 'data-mce-bogus', '1');
|
||||
};
|
||||
var Actions = { insertNbsp: insertNbsp };
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mceNonBreaking', function () {
|
||||
Actions.insertNbsp(editor, 1);
|
||||
});
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.VK');
|
||||
|
||||
var getKeyboardSpaces = function (editor) {
|
||||
var spaces = editor.getParam('nonbreaking_force_tab', 0);
|
||||
if (typeof spaces === 'boolean') {
|
||||
return spaces === true ? 3 : 0;
|
||||
} else {
|
||||
return spaces;
|
||||
}
|
||||
};
|
||||
var Settings = { getKeyboardSpaces: getKeyboardSpaces };
|
||||
|
||||
var setup = function (editor) {
|
||||
var spaces = Settings.getKeyboardSpaces(editor);
|
||||
if (spaces > 0) {
|
||||
editor.on('keydown', function (e) {
|
||||
if (e.keyCode === global$1.TAB && !e.isDefaultPrevented()) {
|
||||
if (e.shiftKey) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
Actions.insertNbsp(editor, spaces);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
var Keyboard = { setup: setup };
|
||||
|
||||
var register$1 = function (editor) {
|
||||
editor.addButton('nonbreaking', {
|
||||
title: 'Nonbreaking space',
|
||||
cmd: 'mceNonBreaking'
|
||||
});
|
||||
editor.addMenuItem('nonbreaking', {
|
||||
icon: 'nonbreaking',
|
||||
text: 'Nonbreaking space',
|
||||
cmd: 'mceNonBreaking',
|
||||
context: 'insert'
|
||||
});
|
||||
};
|
||||
var Buttons = { register: register$1 };
|
||||
|
||||
global.add('nonbreaking', function (editor) {
|
||||
Commands.register(editor);
|
||||
Buttons.register(editor);
|
||||
Keyboard.setup(editor);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
1
wp-content/plugins/tinymce-advanced/mce/nonbreaking/plugin.min.js
vendored
Normal file
1
wp-content/plugins/tinymce-advanced/mce/nonbreaking/plugin.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
!function(){"use strict";var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=function(n,e){var t,i=(t=n).plugins.visualchars&&t.plugins.visualchars.isEnabled()?'<span class="mce-nbsp"> </span>':" ";n.insertContent(function(n,e){for(var t="",i=0;i<e;i++)t+=n;return t}(i,e)),n.dom.setAttrib(n.dom.select("span.mce-nbsp"),"data-mce-bogus","1")},e=function(n){n.addCommand("mceNonBreaking",function(){i(n,1)})},o=tinymce.util.Tools.resolve("tinymce.util.VK"),a=function(n){var e=n.getParam("nonbreaking_force_tab",0);return"boolean"==typeof e?!0===e?3:0:e},t=function(e){var t=a(e);0<t&&e.on("keydown",function(n){if(n.keyCode===o.TAB&&!n.isDefaultPrevented()){if(n.shiftKey)return;n.preventDefault(),n.stopImmediatePropagation(),i(e,t)}})},r=function(n){n.addButton("nonbreaking",{title:"Nonbreaking space",cmd:"mceNonBreaking"}),n.addMenuItem("nonbreaking",{icon:"nonbreaking",text:"Nonbreaking space",cmd:"mceNonBreaking",context:"insert"})};n.add("nonbreaking",function(n){e(n),r(n),t(n)})}();
|
44
wp-content/plugins/tinymce-advanced/mce/print/plugin.js
Normal file
44
wp-content/plugins/tinymce-advanced/mce/print/plugin.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
(function () {
|
||||
var print = (function () {
|
||||
'use strict';
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
|
||||
|
||||
var register = function (editor) {
|
||||
editor.addCommand('mcePrint', function () {
|
||||
if (global$1.ie && global$1.ie <= 11) {
|
||||
editor.getDoc().execCommand('print', false, null);
|
||||
} else {
|
||||
editor.getWin().print();
|
||||
}
|
||||
});
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var register$1 = function (editor) {
|
||||
editor.addButton('print', {
|
||||
title: 'Print',
|
||||
cmd: 'mcePrint'
|
||||
});
|
||||
editor.addMenuItem('print', {
|
||||
text: 'Print',
|
||||
cmd: 'mcePrint',
|
||||
icon: 'print'
|
||||
});
|
||||
};
|
||||
var Buttons = { register: register$1 };
|
||||
|
||||
global.add('print', function (editor) {
|
||||
Commands.register(editor);
|
||||
Buttons.register(editor);
|
||||
editor.addShortcut('Meta+P', '', 'mcePrint');
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
1
wp-content/plugins/tinymce-advanced/mce/print/plugin.min.js
vendored
Normal file
1
wp-content/plugins/tinymce-advanced/mce/print/plugin.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.Env"),i=function(t){t.addCommand("mcePrint",function(){n.ie&&n.ie<=11?t.getDoc().execCommand("print",!1,null):t.getWin().print()})},e=function(t){t.addButton("print",{title:"Print",cmd:"mcePrint"}),t.addMenuItem("print",{text:"Print",cmd:"mcePrint",icon:"print"})};t.add("print",function(t){i(t),e(t),t.addShortcut("Meta+P","","mcePrint")})}();
|
601
wp-content/plugins/tinymce-advanced/mce/searchreplace/plugin.js
Normal file
601
wp-content/plugins/tinymce-advanced/mce/searchreplace/plugin.js
Normal file
|
@ -0,0 +1,601 @@
|
|||
(function () {
|
||||
var searchreplace = (function () {
|
||||
'use strict';
|
||||
|
||||
var Cell = function (initial) {
|
||||
var value = initial;
|
||||
var get = function () {
|
||||
return value;
|
||||
};
|
||||
var set = function (v) {
|
||||
value = v;
|
||||
};
|
||||
var clone = function () {
|
||||
return Cell(get());
|
||||
};
|
||||
return {
|
||||
get: get,
|
||||
set: set,
|
||||
clone: clone
|
||||
};
|
||||
};
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
function isContentEditableFalse(node) {
|
||||
return node && node.nodeType === 1 && node.contentEditable === 'false';
|
||||
}
|
||||
function findAndReplaceDOMText(regex, node, replacementNode, captureGroup, schema) {
|
||||
var m;
|
||||
var matches = [];
|
||||
var text, count = 0, doc;
|
||||
var blockElementsMap, hiddenTextElementsMap, shortEndedElementsMap;
|
||||
doc = node.ownerDocument;
|
||||
blockElementsMap = schema.getBlockElements();
|
||||
hiddenTextElementsMap = schema.getWhiteSpaceElements();
|
||||
shortEndedElementsMap = schema.getShortEndedElements();
|
||||
function getMatchIndexes(m, captureGroup) {
|
||||
captureGroup = captureGroup || 0;
|
||||
if (!m[0]) {
|
||||
throw new Error('findAndReplaceDOMText cannot handle zero-length matches');
|
||||
}
|
||||
var index = m.index;
|
||||
if (captureGroup > 0) {
|
||||
var cg = m[captureGroup];
|
||||
if (!cg) {
|
||||
throw new Error('Invalid capture group');
|
||||
}
|
||||
index += m[0].indexOf(cg);
|
||||
m[0] = cg;
|
||||
}
|
||||
return [
|
||||
index,
|
||||
index + m[0].length,
|
||||
[m[0]]
|
||||
];
|
||||
}
|
||||
function getText(node) {
|
||||
var txt;
|
||||
if (node.nodeType === 3) {
|
||||
return node.data;
|
||||
}
|
||||
if (hiddenTextElementsMap[node.nodeName] && !blockElementsMap[node.nodeName]) {
|
||||
return '';
|
||||
}
|
||||
txt = '';
|
||||
if (isContentEditableFalse(node)) {
|
||||
return '\n';
|
||||
}
|
||||
if (blockElementsMap[node.nodeName] || shortEndedElementsMap[node.nodeName]) {
|
||||
txt += '\n';
|
||||
}
|
||||
if (node = node.firstChild) {
|
||||
do {
|
||||
txt += getText(node);
|
||||
} while (node = node.nextSibling);
|
||||
}
|
||||
return txt;
|
||||
}
|
||||
function stepThroughMatches(node, matches, replaceFn) {
|
||||
var startNode, endNode, startNodeIndex, endNodeIndex, innerNodes = [], atIndex = 0, curNode = node, matchLocation = matches.shift(), matchIndex = 0;
|
||||
out:
|
||||
while (true) {
|
||||
if (blockElementsMap[curNode.nodeName] || shortEndedElementsMap[curNode.nodeName] || isContentEditableFalse(curNode)) {
|
||||
atIndex++;
|
||||
}
|
||||
if (curNode.nodeType === 3) {
|
||||
if (!endNode && curNode.length + atIndex >= matchLocation[1]) {
|
||||
endNode = curNode;
|
||||
endNodeIndex = matchLocation[1] - atIndex;
|
||||
} else if (startNode) {
|
||||
innerNodes.push(curNode);
|
||||
}
|
||||
if (!startNode && curNode.length + atIndex > matchLocation[0]) {
|
||||
startNode = curNode;
|
||||
startNodeIndex = matchLocation[0] - atIndex;
|
||||
}
|
||||
atIndex += curNode.length;
|
||||
}
|
||||
if (startNode && endNode) {
|
||||
curNode = replaceFn({
|
||||
startNode: startNode,
|
||||
startNodeIndex: startNodeIndex,
|
||||
endNode: endNode,
|
||||
endNodeIndex: endNodeIndex,
|
||||
innerNodes: innerNodes,
|
||||
match: matchLocation[2],
|
||||
matchIndex: matchIndex
|
||||
});
|
||||
atIndex -= endNode.length - endNodeIndex;
|
||||
startNode = null;
|
||||
endNode = null;
|
||||
innerNodes = [];
|
||||
matchLocation = matches.shift();
|
||||
matchIndex++;
|
||||
if (!matchLocation) {
|
||||
break;
|
||||
}
|
||||
} else if ((!hiddenTextElementsMap[curNode.nodeName] || blockElementsMap[curNode.nodeName]) && curNode.firstChild) {
|
||||
if (!isContentEditableFalse(curNode)) {
|
||||
curNode = curNode.firstChild;
|
||||
continue;
|
||||
}
|
||||
} else if (curNode.nextSibling) {
|
||||
curNode = curNode.nextSibling;
|
||||
continue;
|
||||
}
|
||||
while (true) {
|
||||
if (curNode.nextSibling) {
|
||||
curNode = curNode.nextSibling;
|
||||
break;
|
||||
} else if (curNode.parentNode !== node) {
|
||||
curNode = curNode.parentNode;
|
||||
} else {
|
||||
break out;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function genReplacer(nodeName) {
|
||||
var makeReplacementNode;
|
||||
if (typeof nodeName !== 'function') {
|
||||
var stencilNode_1 = nodeName.nodeType ? nodeName : doc.createElement(nodeName);
|
||||
makeReplacementNode = function (fill, matchIndex) {
|
||||
var clone = stencilNode_1.cloneNode(false);
|
||||
clone.setAttribute('data-mce-index', matchIndex);
|
||||
if (fill) {
|
||||
clone.appendChild(doc.createTextNode(fill));
|
||||
}
|
||||
return clone;
|
||||
};
|
||||
} else {
|
||||
makeReplacementNode = nodeName;
|
||||
}
|
||||
return function (range) {
|
||||
var before;
|
||||
var after;
|
||||
var parentNode;
|
||||
var startNode = range.startNode;
|
||||
var endNode = range.endNode;
|
||||
var matchIndex = range.matchIndex;
|
||||
if (startNode === endNode) {
|
||||
var node_1 = startNode;
|
||||
parentNode = node_1.parentNode;
|
||||
if (range.startNodeIndex > 0) {
|
||||
before = doc.createTextNode(node_1.data.substring(0, range.startNodeIndex));
|
||||
parentNode.insertBefore(before, node_1);
|
||||
}
|
||||
var el = makeReplacementNode(range.match[0], matchIndex);
|
||||
parentNode.insertBefore(el, node_1);
|
||||
if (range.endNodeIndex < node_1.length) {
|
||||
after = doc.createTextNode(node_1.data.substring(range.endNodeIndex));
|
||||
parentNode.insertBefore(after, node_1);
|
||||
}
|
||||
node_1.parentNode.removeChild(node_1);
|
||||
return el;
|
||||
}
|
||||
before = doc.createTextNode(startNode.data.substring(0, range.startNodeIndex));
|
||||
after = doc.createTextNode(endNode.data.substring(range.endNodeIndex));
|
||||
var elA = makeReplacementNode(startNode.data.substring(range.startNodeIndex), matchIndex);
|
||||
for (var i = 0, l = range.innerNodes.length; i < l; ++i) {
|
||||
var innerNode = range.innerNodes[i];
|
||||
var innerEl = makeReplacementNode(innerNode.data, matchIndex);
|
||||
innerNode.parentNode.replaceChild(innerEl, innerNode);
|
||||
}
|
||||
var elB = makeReplacementNode(endNode.data.substring(0, range.endNodeIndex), matchIndex);
|
||||
parentNode = startNode.parentNode;
|
||||
parentNode.insertBefore(before, startNode);
|
||||
parentNode.insertBefore(elA, startNode);
|
||||
parentNode.removeChild(startNode);
|
||||
parentNode = endNode.parentNode;
|
||||
parentNode.insertBefore(elB, endNode);
|
||||
parentNode.insertBefore(after, endNode);
|
||||
parentNode.removeChild(endNode);
|
||||
return elB;
|
||||
};
|
||||
}
|
||||
text = getText(node);
|
||||
if (!text) {
|
||||
return;
|
||||
}
|
||||
if (regex.global) {
|
||||
while (m = regex.exec(text)) {
|
||||
matches.push(getMatchIndexes(m, captureGroup));
|
||||
}
|
||||
} else {
|
||||
m = text.match(regex);
|
||||
matches.push(getMatchIndexes(m, captureGroup));
|
||||
}
|
||||
if (matches.length) {
|
||||
count = matches.length;
|
||||
stepThroughMatches(node, matches, genReplacer(replacementNode));
|
||||
}
|
||||
return count;
|
||||
}
|
||||
var FindReplaceText = { findAndReplaceDOMText: findAndReplaceDOMText };
|
||||
|
||||
var getElmIndex = function (elm) {
|
||||
var value = elm.getAttribute('data-mce-index');
|
||||
if (typeof value === 'number') {
|
||||
return '' + value;
|
||||
}
|
||||
return value;
|
||||
};
|
||||
var markAllMatches = function (editor, currentIndexState, regex) {
|
||||
var node, marker;
|
||||
marker = editor.dom.create('span', { 'data-mce-bogus': 1 });
|
||||
marker.className = 'mce-match-marker';
|
||||
node = editor.getBody();
|
||||
done(editor, currentIndexState, false);
|
||||
return FindReplaceText.findAndReplaceDOMText(regex, node, marker, false, editor.schema);
|
||||
};
|
||||
var unwrap = function (node) {
|
||||
var parentNode = node.parentNode;
|
||||
if (node.firstChild) {
|
||||
parentNode.insertBefore(node.firstChild, node);
|
||||
}
|
||||
node.parentNode.removeChild(node);
|
||||
};
|
||||
var findSpansByIndex = function (editor, index) {
|
||||
var nodes;
|
||||
var spans = [];
|
||||
nodes = global$1.toArray(editor.getBody().getElementsByTagName('span'));
|
||||
if (nodes.length) {
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
var nodeIndex = getElmIndex(nodes[i]);
|
||||
if (nodeIndex === null || !nodeIndex.length) {
|
||||
continue;
|
||||
}
|
||||
if (nodeIndex === index.toString()) {
|
||||
spans.push(nodes[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return spans;
|
||||
};
|
||||
var moveSelection = function (editor, currentIndexState, forward) {
|
||||
var testIndex = currentIndexState.get();
|
||||
var dom = editor.dom;
|
||||
forward = forward !== false;
|
||||
if (forward) {
|
||||
testIndex++;
|
||||
} else {
|
||||
testIndex--;
|
||||
}
|
||||
dom.removeClass(findSpansByIndex(editor, currentIndexState.get()), 'mce-match-marker-selected');
|
||||
var spans = findSpansByIndex(editor, testIndex);
|
||||
if (spans.length) {
|
||||
dom.addClass(findSpansByIndex(editor, testIndex), 'mce-match-marker-selected');
|
||||
editor.selection.scrollIntoView(spans[0]);
|
||||
return testIndex;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
var removeNode = function (dom, node) {
|
||||
var parent = node.parentNode;
|
||||
dom.remove(node);
|
||||
if (dom.isEmpty(parent)) {
|
||||
dom.remove(parent);
|
||||
}
|
||||
};
|
||||
var find = function (editor, currentIndexState, text, matchCase, wholeWord) {
|
||||
text = text.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
||||
text = text.replace(/\s/g, '[^\\S\\r\\n]');
|
||||
text = wholeWord ? '\\b' + text + '\\b' : text;
|
||||
var count = markAllMatches(editor, currentIndexState, new RegExp(text, matchCase ? 'g' : 'gi'));
|
||||
if (count) {
|
||||
currentIndexState.set(-1);
|
||||
currentIndexState.set(moveSelection(editor, currentIndexState, true));
|
||||
}
|
||||
return count;
|
||||
};
|
||||
var next = function (editor, currentIndexState) {
|
||||
var index = moveSelection(editor, currentIndexState, true);
|
||||
if (index !== -1) {
|
||||
currentIndexState.set(index);
|
||||
}
|
||||
};
|
||||
var prev = function (editor, currentIndexState) {
|
||||
var index = moveSelection(editor, currentIndexState, false);
|
||||
if (index !== -1) {
|
||||
currentIndexState.set(index);
|
||||
}
|
||||
};
|
||||
var isMatchSpan = function (node) {
|
||||
var matchIndex = getElmIndex(node);
|
||||
return matchIndex !== null && matchIndex.length > 0;
|
||||
};
|
||||
var replace = function (editor, currentIndexState, text, forward, all) {
|
||||
var i, nodes, node, matchIndex, currentMatchIndex, nextIndex = currentIndexState.get(), hasMore;
|
||||
forward = forward !== false;
|
||||
node = editor.getBody();
|
||||
nodes = global$1.grep(global$1.toArray(node.getElementsByTagName('span')), isMatchSpan);
|
||||
for (i = 0; i < nodes.length; i++) {
|
||||
var nodeIndex = getElmIndex(nodes[i]);
|
||||
matchIndex = currentMatchIndex = parseInt(nodeIndex, 10);
|
||||
if (all || matchIndex === currentIndexState.get()) {
|
||||
if (text.length) {
|
||||
nodes[i].firstChild.nodeValue = text;
|
||||
unwrap(nodes[i]);
|
||||
} else {
|
||||
removeNode(editor.dom, nodes[i]);
|
||||
}
|
||||
while (nodes[++i]) {
|
||||
matchIndex = parseInt(getElmIndex(nodes[i]), 10);
|
||||
if (matchIndex === currentMatchIndex) {
|
||||
removeNode(editor.dom, nodes[i]);
|
||||
} else {
|
||||
i--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (forward) {
|
||||
nextIndex--;
|
||||
}
|
||||
} else if (currentMatchIndex > currentIndexState.get()) {
|
||||
nodes[i].setAttribute('data-mce-index', currentMatchIndex - 1);
|
||||
}
|
||||
}
|
||||
currentIndexState.set(nextIndex);
|
||||
if (forward) {
|
||||
hasMore = hasNext(editor, currentIndexState);
|
||||
next(editor, currentIndexState);
|
||||
} else {
|
||||
hasMore = hasPrev(editor, currentIndexState);
|
||||
prev(editor, currentIndexState);
|
||||
}
|
||||
return !all && hasMore;
|
||||
};
|
||||
var done = function (editor, currentIndexState, keepEditorSelection) {
|
||||
var i, nodes, startContainer, endContainer;
|
||||
nodes = global$1.toArray(editor.getBody().getElementsByTagName('span'));
|
||||
for (i = 0; i < nodes.length; i++) {
|
||||
var nodeIndex = getElmIndex(nodes[i]);
|
||||
if (nodeIndex !== null && nodeIndex.length) {
|
||||
if (nodeIndex === currentIndexState.get().toString()) {
|
||||
if (!startContainer) {
|
||||
startContainer = nodes[i].firstChild;
|
||||
}
|
||||
endContainer = nodes[i].firstChild;
|
||||
}
|
||||
unwrap(nodes[i]);
|
||||
}
|
||||
}
|
||||
if (startContainer && endContainer) {
|
||||
var rng = editor.dom.createRng();
|
||||
rng.setStart(startContainer, 0);
|
||||
rng.setEnd(endContainer, endContainer.data.length);
|
||||
if (keepEditorSelection !== false) {
|
||||
editor.selection.setRng(rng);
|
||||
}
|
||||
return rng;
|
||||
}
|
||||
};
|
||||
var hasNext = function (editor, currentIndexState) {
|
||||
return findSpansByIndex(editor, currentIndexState.get() + 1).length > 0;
|
||||
};
|
||||
var hasPrev = function (editor, currentIndexState) {
|
||||
return findSpansByIndex(editor, currentIndexState.get() - 1).length > 0;
|
||||
};
|
||||
var Actions = {
|
||||
done: done,
|
||||
find: find,
|
||||
next: next,
|
||||
prev: prev,
|
||||
replace: replace,
|
||||
hasNext: hasNext,
|
||||
hasPrev: hasPrev
|
||||
};
|
||||
|
||||
var get = function (editor, currentIndexState) {
|
||||
var done = function (keepEditorSelection) {
|
||||
return Actions.done(editor, currentIndexState, keepEditorSelection);
|
||||
};
|
||||
var find = function (text, matchCase, wholeWord) {
|
||||
return Actions.find(editor, currentIndexState, text, matchCase, wholeWord);
|
||||
};
|
||||
var next = function () {
|
||||
return Actions.next(editor, currentIndexState);
|
||||
};
|
||||
var prev = function () {
|
||||
return Actions.prev(editor, currentIndexState);
|
||||
};
|
||||
var replace = function (text, forward, all) {
|
||||
return Actions.replace(editor, currentIndexState, text, forward, all);
|
||||
};
|
||||
return {
|
||||
done: done,
|
||||
find: find,
|
||||
next: next,
|
||||
prev: prev,
|
||||
replace: replace
|
||||
};
|
||||
};
|
||||
var Api = { get: get };
|
||||
|
||||
var open = function (editor, currentIndexState) {
|
||||
var last = {}, selectedText;
|
||||
editor.undoManager.add();
|
||||
selectedText = global$1.trim(editor.selection.getContent({ format: 'text' }));
|
||||
function updateButtonStates() {
|
||||
win.statusbar.find('#next').disabled(Actions.hasNext(editor, currentIndexState) === false);
|
||||
win.statusbar.find('#prev').disabled(Actions.hasPrev(editor, currentIndexState) === false);
|
||||
}
|
||||
function notFoundAlert() {
|
||||
editor.windowManager.alert('Could not find the specified string.', function () {
|
||||
win.find('#find')[0].focus();
|
||||
});
|
||||
}
|
||||
var win = editor.windowManager.open({
|
||||
layout: 'flex',
|
||||
pack: 'center',
|
||||
align: 'center',
|
||||
onClose: function () {
|
||||
editor.focus();
|
||||
Actions.done(editor, currentIndexState);
|
||||
editor.undoManager.add();
|
||||
},
|
||||
onSubmit: function (e) {
|
||||
var count, caseState, text, wholeWord;
|
||||
e.preventDefault();
|
||||
caseState = win.find('#case').checked();
|
||||
wholeWord = win.find('#words').checked();
|
||||
text = win.find('#find').value();
|
||||
if (!text.length) {
|
||||
Actions.done(editor, currentIndexState, false);
|
||||
win.statusbar.items().slice(1).disabled(true);
|
||||
return;
|
||||
}
|
||||
if (last.text === text && last.caseState === caseState && last.wholeWord === wholeWord) {
|
||||
if (!Actions.hasNext(editor, currentIndexState)) {
|
||||
notFoundAlert();
|
||||
return;
|
||||
}
|
||||
Actions.next(editor, currentIndexState);
|
||||
updateButtonStates();
|
||||
return;
|
||||
}
|
||||
count = Actions.find(editor, currentIndexState, text, caseState, wholeWord);
|
||||
if (!count) {
|
||||
notFoundAlert();
|
||||
}
|
||||
win.statusbar.items().slice(1).disabled(count === 0);
|
||||
updateButtonStates();
|
||||
last = {
|
||||
text: text,
|
||||
caseState: caseState,
|
||||
wholeWord: wholeWord
|
||||
};
|
||||
},
|
||||
buttons: [
|
||||
{
|
||||
text: 'Find',
|
||||
subtype: 'primary',
|
||||
onclick: function () {
|
||||
win.submit();
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Replace',
|
||||
disabled: true,
|
||||
onclick: function () {
|
||||
if (!Actions.replace(editor, currentIndexState, win.find('#replace').value())) {
|
||||
win.statusbar.items().slice(1).disabled(true);
|
||||
currentIndexState.set(-1);
|
||||
last = {};
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Replace all',
|
||||
disabled: true,
|
||||
onclick: function () {
|
||||
Actions.replace(editor, currentIndexState, win.find('#replace').value(), true, true);
|
||||
win.statusbar.items().slice(1).disabled(true);
|
||||
last = {};
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'spacer',
|
||||
flex: 1
|
||||
},
|
||||
{
|
||||
text: 'Prev',
|
||||
name: 'prev',
|
||||
disabled: true,
|
||||
onclick: function () {
|
||||
Actions.prev(editor, currentIndexState);
|
||||
updateButtonStates();
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Next',
|
||||
name: 'next',
|
||||
disabled: true,
|
||||
onclick: function () {
|
||||
Actions.next(editor, currentIndexState);
|
||||
updateButtonStates();
|
||||
}
|
||||
}
|
||||
],
|
||||
title: 'Find and replace',
|
||||
items: {
|
||||
type: 'form',
|
||||
padding: 20,
|
||||
labelGap: 30,
|
||||
spacing: 10,
|
||||
items: [
|
||||
{
|
||||
type: 'textbox',
|
||||
name: 'find',
|
||||
size: 40,
|
||||
label: 'Find',
|
||||
value: selectedText
|
||||
},
|
||||
{
|
||||
type: 'textbox',
|
||||
name: 'replace',
|
||||
size: 40,
|
||||
label: 'Replace with'
|
||||
},
|
||||
{
|
||||
type: 'checkbox',
|
||||
name: 'case',
|
||||
text: 'Match case',
|
||||
label: ' '
|
||||
},
|
||||
{
|
||||
type: 'checkbox',
|
||||
name: 'words',
|
||||
text: 'Whole words',
|
||||
label: ' '
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
};
|
||||
var Dialog = { open: open };
|
||||
|
||||
var register = function (editor, currentIndexState) {
|
||||
editor.addCommand('SearchReplace', function () {
|
||||
Dialog.open(editor, currentIndexState);
|
||||
});
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var showDialog = function (editor, currentIndexState) {
|
||||
return function () {
|
||||
Dialog.open(editor, currentIndexState);
|
||||
};
|
||||
};
|
||||
var register$1 = function (editor, currentIndexState) {
|
||||
editor.addMenuItem('searchreplace', {
|
||||
text: 'Find and replace',
|
||||
shortcut: 'Meta+F',
|
||||
onclick: showDialog(editor, currentIndexState),
|
||||
separator: 'before',
|
||||
context: 'edit'
|
||||
});
|
||||
editor.addButton('searchreplace', {
|
||||
tooltip: 'Find and replace',
|
||||
onclick: showDialog(editor, currentIndexState)
|
||||
});
|
||||
editor.shortcuts.add('Meta+F', '', showDialog(editor, currentIndexState));
|
||||
};
|
||||
var Buttons = { register: register$1 };
|
||||
|
||||
global.add('searchreplace', function (editor) {
|
||||
var currentIndexState = Cell(-1);
|
||||
Commands.register(editor, currentIndexState);
|
||||
Buttons.register(editor, currentIndexState);
|
||||
return Api.get(editor, currentIndexState);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
1
wp-content/plugins/tinymce-advanced/mce/searchreplace/plugin.min.js
vendored
Normal file
1
wp-content/plugins/tinymce-advanced/mce/searchreplace/plugin.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
9270
wp-content/plugins/tinymce-advanced/mce/table/plugin.js
Normal file
9270
wp-content/plugins/tinymce-advanced/mce/table/plugin.js
Normal file
File diff suppressed because it is too large
Load diff
1
wp-content/plugins/tinymce-advanced/mce/table/plugin.min.js
vendored
Normal file
1
wp-content/plugins/tinymce-advanced/mce/table/plugin.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,154 @@
|
|||
.mce-visualblocks p {
|
||||
padding-top: 10px;
|
||||
border: 1px dashed #BBB;
|
||||
margin-left: 3px;
|
||||
background-image: url(data:image/gif;base64,R0lGODlhCQAJAJEAAAAAAP///7u7u////yH5BAEAAAMALAAAAAAJAAkAAAIQnG+CqCN/mlyvsRUpThG6AgA7);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.mce-visualblocks h1 {
|
||||
padding-top: 10px;
|
||||
border: 1px dashed #BBB;
|
||||
margin-left: 3px;
|
||||
background-image: url(data:image/gif;base64,R0lGODlhDQAKAIABALu7u////yH5BAEAAAEALAAAAAANAAoAAAIXjI8GybGu1JuxHoAfRNRW3TWXyF2YiRUAOw==);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.mce-visualblocks h2 {
|
||||
padding-top: 10px;
|
||||
border: 1px dashed #BBB;
|
||||
margin-left: 3px;
|
||||
background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8Hybbx4oOuqgTynJd6bGlWg3DkJzoaUAAAOw==);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.mce-visualblocks h3 {
|
||||
padding-top: 10px;
|
||||
border: 1px dashed #BBB;
|
||||
margin-left: 3px;
|
||||
background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIZjI8Hybbx4oOuqgTynJf2Ln2NOHpQpmhAAQA7);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.mce-visualblocks h4 {
|
||||
padding-top: 10px;
|
||||
border: 1px dashed #BBB;
|
||||
margin-left: 3px;
|
||||
background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxInR0zqeAdhtJlXwV1oCll2HaWgAAOw==);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.mce-visualblocks h5 {
|
||||
padding-top: 10px;
|
||||
border: 1px dashed #BBB;
|
||||
margin-left: 3px;
|
||||
background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxIoiuwjane4iq5GlW05GgIkIZUAAAOw==);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.mce-visualblocks h6 {
|
||||
padding-top: 10px;
|
||||
border: 1px dashed #BBB;
|
||||
margin-left: 3px;
|
||||
background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxIoiuwjan04jep1iZ1XRlAo5bVgAAOw==);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.mce-visualblocks div:not([data-mce-bogus]) {
|
||||
padding-top: 10px;
|
||||
border: 1px dashed #BBB;
|
||||
margin-left: 3px;
|
||||
background-image: url(data:image/gif;base64,R0lGODlhEgAKAIABALu7u////yH5BAEAAAEALAAAAAASAAoAAAIfjI9poI0cgDywrhuxfbrzDEbQM2Ei5aRjmoySW4pAAQA7);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.mce-visualblocks section {
|
||||
padding-top: 10px;
|
||||
border: 1px dashed #BBB;
|
||||
margin: 0 0 1em 3px;
|
||||
background-image: url(data:image/gif;base64,R0lGODlhKAAKAIABALu7u////yH5BAEAAAEALAAAAAAoAAoAAAI5jI+pywcNY3sBWHdNrplytD2ellDeSVbp+GmWqaDqDMepc8t17Y4vBsK5hDyJMcI6KkuYU+jpjLoKADs=);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.mce-visualblocks article {
|
||||
padding-top: 10px;
|
||||
border: 1px dashed #BBB;
|
||||
margin: 0 0 1em 3px;
|
||||
background-image: url(data:image/gif;base64,R0lGODlhKgAKAIABALu7u////yH5BAEAAAEALAAAAAAqAAoAAAI6jI+pywkNY3wG0GBvrsd2tXGYSGnfiF7ikpXemTpOiJScasYoDJJrjsG9gkCJ0ag6KhmaIe3pjDYBBQA7);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.mce-visualblocks blockquote {
|
||||
padding-top: 10px;
|
||||
border: 1px dashed #BBB;
|
||||
background-image: url(data:image/gif;base64,R0lGODlhPgAKAIABALu7u////yH5BAEAAAEALAAAAAA+AAoAAAJPjI+py+0Knpz0xQDyuUhvfoGgIX5iSKZYgq5uNL5q69asZ8s5rrf0yZmpNkJZzFesBTu8TOlDVAabUyatguVhWduud3EyiUk45xhTTgMBBQA7);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.mce-visualblocks address {
|
||||
padding-top: 10px;
|
||||
border: 1px dashed #BBB;
|
||||
margin: 0 0 1em 3px;
|
||||
background-image: url(data:image/gif;base64,R0lGODlhLQAKAIABALu7u////yH5BAEAAAEALAAAAAAtAAoAAAI/jI+pywwNozSP1gDyyZcjb3UaRpXkWaXmZW4OqKLhBmLs+K263DkJK7OJeifh7FicKD9A1/IpGdKkyFpNmCkAADs=);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.mce-visualblocks pre {
|
||||
padding-top: 10px;
|
||||
border: 1px dashed #BBB;
|
||||
margin-left: 3px;
|
||||
background-image: url(data:image/gif;base64,R0lGODlhFQAKAIABALu7uwAAACH5BAEAAAEALAAAAAAVAAoAAAIjjI+ZoN0cgDwSmnpz1NCueYERhnibZVKLNnbOq8IvKpJtVQAAOw==);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.mce-visualblocks figure {
|
||||
padding-top: 10px;
|
||||
border: 1px dashed #BBB;
|
||||
margin: 0 0 1em 3px;
|
||||
background-image: url(data:image/gif;base64,R0lGODlhJAAKAIAAALu7u////yH5BAEAAAEALAAAAAAkAAoAAAI0jI+py+2fwAHUSFvD3RlvG4HIp4nX5JFSpnZUJ6LlrM52OE7uSWosBHScgkSZj7dDKnWAAgA7);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.mce-visualblocks hgroup {
|
||||
padding-top: 10px;
|
||||
border: 1px dashed #BBB;
|
||||
margin: 0 0 1em 3px;
|
||||
background-image: url(data:image/gif;base64,R0lGODlhJwAKAIABALu7uwAAACH5BAEAAAEALAAAAAAnAAoAAAI3jI+pywYNI3uB0gpsRtt5fFnfNZaVSYJil4Wo03Hv6Z62uOCgiXH1kZIIJ8NiIxRrAZNMZAtQAAA7);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.mce-visualblocks aside {
|
||||
padding-top: 10px;
|
||||
border: 1px dashed #BBB;
|
||||
margin: 0 0 1em 3px;
|
||||
background-image: url(data:image/gif;base64,R0lGODlhHgAKAIABAKqqqv///yH5BAEAAAEALAAAAAAeAAoAAAItjI+pG8APjZOTzgtqy7I3f1yehmQcFY4WKZbqByutmW4aHUd6vfcVbgudgpYCADs=);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.mce-visualblocks figcaption {
|
||||
border: 1px dashed #BBB;
|
||||
}
|
||||
|
||||
.mce-visualblocks ul {
|
||||
padding-top: 10px;
|
||||
border: 1px dashed #BBB;
|
||||
margin: 0 0 1em 3px;
|
||||
background-image: url(data:image/gif;base64,R0lGODlhDQAKAIAAALu7u////yH5BAEAAAEALAAAAAANAAoAAAIXjI8GybGuYnqUVSjvw26DzzXiqIDlVwAAOw==);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.mce-visualblocks ol {
|
||||
padding-top: 10px;
|
||||
border: 1px dashed #BBB;
|
||||
margin: 0 0 1em 3px;
|
||||
background-image: url(data:image/gif;base64,R0lGODlhDQAKAIABALu7u////yH5BAEAAAEALAAAAAANAAoAAAIXjI8GybH6HHt0qourxC6CvzXieHyeWQAAOw==);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.mce-visualblocks dl {
|
||||
padding-top: 10px;
|
||||
border: 1px dashed #BBB;
|
||||
margin: 0 0 1em 3px;
|
||||
background-image: url(data:image/gif;base64,R0lGODlhDQAKAIABALu7u////yH5BAEAAAEALAAAAAANAAoAAAIXjI8GybEOnmOvUoWznTqeuEjNSCqeGRUAOw==);
|
||||
background-repeat: no-repeat;
|
||||
}
|
135
wp-content/plugins/tinymce-advanced/mce/visualblocks/plugin.js
Normal file
135
wp-content/plugins/tinymce-advanced/mce/visualblocks/plugin.js
Normal file
|
@ -0,0 +1,135 @@
|
|||
(function () {
|
||||
var visualblocks = (function () {
|
||||
'use strict';
|
||||
|
||||
var Cell = function (initial) {
|
||||
var value = initial;
|
||||
var get = function () {
|
||||
return value;
|
||||
};
|
||||
var set = function (v) {
|
||||
value = v;
|
||||
};
|
||||
var clone = function () {
|
||||
return Cell(get());
|
||||
};
|
||||
return {
|
||||
get: get,
|
||||
set: set,
|
||||
clone: clone
|
||||
};
|
||||
};
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var fireVisualBlocks = function (editor, state) {
|
||||
editor.fire('VisualBlocks', { state: state });
|
||||
};
|
||||
var Events = { fireVisualBlocks: fireVisualBlocks };
|
||||
|
||||
var isEnabledByDefault = function (editor) {
|
||||
return editor.getParam('visualblocks_default_state', false);
|
||||
};
|
||||
var getContentCss = function (editor) {
|
||||
return editor.settings.visualblocks_content_css;
|
||||
};
|
||||
var Settings = {
|
||||
isEnabledByDefault: isEnabledByDefault,
|
||||
getContentCss: getContentCss
|
||||
};
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
||||
|
||||
var global$2 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
||||
|
||||
var cssId = global$1.DOM.uniqueId();
|
||||
var load = function (doc, url) {
|
||||
var linkElements = global$2.toArray(doc.getElementsByTagName('link'));
|
||||
var matchingLinkElms = global$2.grep(linkElements, function (head) {
|
||||
return head.id === cssId;
|
||||
});
|
||||
if (matchingLinkElms.length === 0) {
|
||||
var linkElm = global$1.DOM.create('link', {
|
||||
id: cssId,
|
||||
rel: 'stylesheet',
|
||||
href: url
|
||||
});
|
||||
doc.getElementsByTagName('head')[0].appendChild(linkElm);
|
||||
}
|
||||
};
|
||||
var LoadCss = { load: load };
|
||||
|
||||
var toggleVisualBlocks = function (editor, pluginUrl, enabledState) {
|
||||
var dom = editor.dom;
|
||||
var contentCss = Settings.getContentCss(editor);
|
||||
LoadCss.load(editor.getDoc(), contentCss ? contentCss : pluginUrl + '/css/visualblocks.css');
|
||||
dom.toggleClass(editor.getBody(), 'mce-visualblocks');
|
||||
enabledState.set(!enabledState.get());
|
||||
Events.fireVisualBlocks(editor, enabledState.get());
|
||||
};
|
||||
var VisualBlocks = { toggleVisualBlocks: toggleVisualBlocks };
|
||||
|
||||
var register = function (editor, pluginUrl, enabledState) {
|
||||
editor.addCommand('mceVisualBlocks', function () {
|
||||
VisualBlocks.toggleVisualBlocks(editor, pluginUrl, enabledState);
|
||||
});
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var setup = function (editor, pluginUrl, enabledState) {
|
||||
editor.on('PreviewFormats AfterPreviewFormats', function (e) {
|
||||
if (enabledState.get()) {
|
||||
editor.dom.toggleClass(editor.getBody(), 'mce-visualblocks', e.type === 'afterpreviewformats');
|
||||
}
|
||||
});
|
||||
editor.on('init', function () {
|
||||
if (Settings.isEnabledByDefault(editor)) {
|
||||
VisualBlocks.toggleVisualBlocks(editor, pluginUrl, enabledState);
|
||||
}
|
||||
});
|
||||
editor.on('remove', function () {
|
||||
editor.dom.removeClass(editor.getBody(), 'mce-visualblocks');
|
||||
});
|
||||
};
|
||||
var Bindings = { setup: setup };
|
||||
|
||||
var toggleActiveState = function (editor, enabledState) {
|
||||
return function (e) {
|
||||
var ctrl = e.control;
|
||||
ctrl.active(enabledState.get());
|
||||
editor.on('VisualBlocks', function (e) {
|
||||
ctrl.active(e.state);
|
||||
});
|
||||
};
|
||||
};
|
||||
var register$1 = function (editor, enabledState) {
|
||||
editor.addButton('visualblocks', {
|
||||
active: false,
|
||||
title: 'Show blocks',
|
||||
cmd: 'mceVisualBlocks',
|
||||
onPostRender: toggleActiveState(editor, enabledState)
|
||||
});
|
||||
editor.addMenuItem('visualblocks', {
|
||||
text: 'Show blocks',
|
||||
cmd: 'mceVisualBlocks',
|
||||
onPostRender: toggleActiveState(editor, enabledState),
|
||||
selectable: true,
|
||||
context: 'view',
|
||||
prependToContext: true
|
||||
});
|
||||
};
|
||||
var Buttons = { register: register$1 };
|
||||
|
||||
global.add('visualblocks', function (editor, pluginUrl) {
|
||||
var enabledState = Cell(false);
|
||||
Commands.register(editor, pluginUrl, enabledState);
|
||||
Buttons.register(editor, enabledState);
|
||||
Bindings.setup(editor, pluginUrl, enabledState);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}());
|
||||
})();
|
1
wp-content/plugins/tinymce-advanced/mce/visualblocks/plugin.min.js
vendored
Normal file
1
wp-content/plugins/tinymce-advanced/mce/visualblocks/plugin.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
!function(){"use strict";var o=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return o(n())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=function(e,t){e.fire("VisualBlocks",{state:t})},s=function(e){return e.getParam("visualblocks_default_state",!1)},c=function(e){return e.settings.visualblocks_content_css},l=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),u=tinymce.util.Tools.resolve("tinymce.util.Tools"),a=l.DOM.uniqueId(),r=function(e,t){var n=u.toArray(e.getElementsByTagName("link"));if(0===u.grep(n,function(e){return e.id===a}).length){var o=l.DOM.create("link",{id:a,rel:"stylesheet",href:t});e.getElementsByTagName("head")[0].appendChild(o)}},m=function(e,t,n){var o=e.dom,s=c(e);r(e.getDoc(),s||t+"/css/visualblocks.css"),o.toggleClass(e.getBody(),"mce-visualblocks"),n.set(!n.get()),i(e,n.get())},f=function(e,t,n){e.addCommand("mceVisualBlocks",function(){m(e,t,n)})},d=function(t,e,n){t.on("PreviewFormats AfterPreviewFormats",function(e){n.get()&&t.dom.toggleClass(t.getBody(),"mce-visualblocks","afterpreviewformats"===e.type)}),t.on("init",function(){s(t)&&m(t,e,n)}),t.on("remove",function(){t.dom.removeClass(t.getBody(),"mce-visualblocks")})},n=function(n,o){return function(e){var t=e.control;t.active(o.get()),n.on("VisualBlocks",function(e){t.active(e.state)})}},v=function(e,t){e.addButton("visualblocks",{active:!1,title:"Show blocks",cmd:"mceVisualBlocks",onPostRender:n(e,t)}),e.addMenuItem("visualblocks",{text:"Show blocks",cmd:"mceVisualBlocks",onPostRender:n(e,t),selectable:!0,context:"view",prependToContext:!0})};e.add("visualblocks",function(e,t){var n=o(!1);f(e,t,n),v(e,n),d(e,t,n)})}();
|
457
wp-content/plugins/tinymce-advanced/mce/visualchars/plugin.js
Normal file
457
wp-content/plugins/tinymce-advanced/mce/visualchars/plugin.js
Normal file
|
@ -0,0 +1,457 @@
|
|||
(function () {
|
||||
var visualchars = (function (domGlobals) {
|
||||
'use strict';
|
||||
|
||||
var Cell = function (initial) {
|
||||
var value = initial;
|
||||
var get = function () {
|
||||
return value;
|
||||
};
|
||||
var set = function (v) {
|
||||
value = v;
|
||||
};
|
||||
var clone = function () {
|
||||
return Cell(get());
|
||||
};
|
||||
return {
|
||||
get: get,
|
||||
set: set,
|
||||
clone: clone
|
||||
};
|
||||
};
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
var get = function (toggleState) {
|
||||
var isEnabled = function () {
|
||||
return toggleState.get();
|
||||
};
|
||||
return { isEnabled: isEnabled };
|
||||
};
|
||||
var Api = { get: get };
|
||||
|
||||
var fireVisualChars = function (editor, state) {
|
||||
return editor.fire('VisualChars', { state: state });
|
||||
};
|
||||
var Events = { fireVisualChars: fireVisualChars };
|
||||
|
||||
var noop = function () {
|
||||
};
|
||||
var constant = function (value) {
|
||||
return function () {
|
||||
return value;
|
||||
};
|
||||
};
|
||||
var never = constant(false);
|
||||
var always = constant(true);
|
||||
|
||||
var none = function () {
|
||||
return NONE;
|
||||
};
|
||||
var NONE = function () {
|
||||
var eq = function (o) {
|
||||
return o.isNone();
|
||||
};
|
||||
var call = function (thunk) {
|
||||
return thunk();
|
||||
};
|
||||
var id = function (n) {
|
||||
return n;
|
||||
};
|
||||
var me = {
|
||||
fold: function (n, s) {
|
||||
return n();
|
||||
},
|
||||
is: never,
|
||||
isSome: never,
|
||||
isNone: always,
|
||||
getOr: id,
|
||||
getOrThunk: call,
|
||||
getOrDie: function (msg) {
|
||||
throw new Error(msg || 'error: getOrDie called on none.');
|
||||
},
|
||||
getOrNull: constant(null),
|
||||
getOrUndefined: constant(undefined),
|
||||
or: id,
|
||||
orThunk: call,
|
||||
map: none,
|
||||
each: noop,
|
||||
bind: none,
|
||||
exists: never,
|
||||
forall: always,
|
||||
filter: none,
|
||||
equals: eq,
|
||||
equals_: eq,
|
||||
toArray: function () {
|
||||
return [];
|
||||
},
|
||||
toString: constant('none()')
|
||||
};
|
||||
if (Object.freeze) {
|
||||
Object.freeze(me);
|
||||
}
|
||||
return me;
|
||||
}();
|
||||
var some = function (a) {
|
||||
var constant_a = constant(a);
|
||||
var self = function () {
|
||||
return me;
|
||||
};
|
||||
var bind = function (f) {
|
||||
return f(a);
|
||||
};
|
||||
var me = {
|
||||
fold: function (n, s) {
|
||||
return s(a);
|
||||
},
|
||||
is: function (v) {
|
||||
return a === v;
|
||||
},
|
||||
isSome: always,
|
||||
isNone: never,
|
||||
getOr: constant_a,
|
||||
getOrThunk: constant_a,
|
||||
getOrDie: constant_a,
|
||||
getOrNull: constant_a,
|
||||
getOrUndefined: constant_a,
|
||||
or: self,
|
||||
orThunk: self,
|
||||
map: function (f) {
|
||||
return some(f(a));
|
||||
},
|
||||
each: function (f) {
|
||||
f(a);
|
||||
},
|
||||
bind: bind,
|
||||
exists: bind,
|
||||
forall: bind,
|
||||
filter: function (f) {
|
||||
return f(a) ? me : NONE;
|
||||
},
|
||||
toArray: function () {
|
||||
return [a];
|
||||
},
|
||||
toString: function () {
|
||||
return 'some(' + a + ')';
|
||||
},
|
||||
equals: function (o) {
|
||||
return o.is(a);
|
||||
},
|
||||
equals_: function (o, elementEq) {
|
||||
return o.fold(never, function (b) {
|
||||
return elementEq(a, b);
|
||||
});
|
||||
}
|
||||
};
|
||||
return me;
|
||||
};
|
||||
var from = function (value) {
|
||||
return value === null || value === undefined ? NONE : some(value);
|
||||
};
|
||||
var Option = {
|
||||
some: some,
|
||||
none: none,
|
||||
from: from
|
||||
};
|
||||
|
||||
var typeOf = function (x) {
|
||||
if (x === null) {
|
||||
return 'null';
|
||||
}
|
||||
var t = typeof x;
|
||||
if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {
|
||||
return 'array';
|
||||
}
|
||||
if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {
|
||||
return 'string';
|
||||
}
|
||||
return t;
|
||||
};
|
||||
var isType = function (type) {
|
||||
return function (value) {
|
||||
return typeOf(value) === type;
|
||||
};
|
||||
};
|
||||
var isFunction = isType('function');
|
||||
|
||||
var nativeSlice = Array.prototype.slice;
|
||||
var map = function (xs, f) {
|
||||
var len = xs.length;
|
||||
var r = new Array(len);
|
||||
for (var i = 0; i < len; i++) {
|
||||
var x = xs[i];
|
||||
r[i] = f(x, i);
|
||||
}
|
||||
return r;
|
||||
};
|
||||
var each = function (xs, f) {
|
||||
for (var i = 0, len = xs.length; i < len; i++) {
|
||||
var x = xs[i];
|
||||
f(x, i);
|
||||
}
|
||||
};
|
||||
var from$1 = isFunction(Array.from) ? Array.from : function (x) {
|
||||
return nativeSlice.call(x);
|
||||
};
|
||||
|
||||
var fromHtml = function (html, scope) {
|
||||
var doc = scope || domGlobals.document;
|
||||
var div = doc.createElement('div');
|
||||
div.innerHTML = html;
|
||||
if (!div.hasChildNodes() || div.childNodes.length > 1) {
|
||||
domGlobals.console.error('HTML does not have a single root node', html);
|
||||
throw new Error('HTML must have a single root node');
|
||||
}
|
||||
return fromDom(div.childNodes[0]);
|
||||
};
|
||||
var fromTag = function (tag, scope) {
|
||||
var doc = scope || domGlobals.document;
|
||||
var node = doc.createElement(tag);
|
||||
return fromDom(node);
|
||||
};
|
||||
var fromText = function (text, scope) {
|
||||
var doc = scope || domGlobals.document;
|
||||
var node = doc.createTextNode(text);
|
||||
return fromDom(node);
|
||||
};
|
||||
var fromDom = function (node) {
|
||||
if (node === null || node === undefined) {
|
||||
throw new Error('Node cannot be null or undefined');
|
||||
}
|
||||
return { dom: constant(node) };
|
||||
};
|
||||
var fromPoint = function (docElm, x, y) {
|
||||
var doc = docElm.dom();
|
||||
return Option.from(doc.elementFromPoint(x, y)).map(fromDom);
|
||||
};
|
||||
var Element = {
|
||||
fromHtml: fromHtml,
|
||||
fromTag: fromTag,
|
||||
fromText: fromText,
|
||||
fromDom: fromDom,
|
||||
fromPoint: fromPoint
|
||||
};
|
||||
|
||||
var ATTRIBUTE = domGlobals.Node.ATTRIBUTE_NODE;
|
||||
var CDATA_SECTION = domGlobals.Node.CDATA_SECTION_NODE;
|
||||
var COMMENT = domGlobals.Node.COMMENT_NODE;
|
||||
var DOCUMENT = domGlobals.Node.DOCUMENT_NODE;
|
||||
var DOCUMENT_TYPE = domGlobals.Node.DOCUMENT_TYPE_NODE;
|
||||
var DOCUMENT_FRAGMENT = domGlobals.Node.DOCUMENT_FRAGMENT_NODE;
|
||||
var ELEMENT = domGlobals.Node.ELEMENT_NODE;
|
||||
var TEXT = domGlobals.Node.TEXT_NODE;
|
||||
var PROCESSING_INSTRUCTION = domGlobals.Node.PROCESSING_INSTRUCTION_NODE;
|
||||
var ENTITY_REFERENCE = domGlobals.Node.ENTITY_REFERENCE_NODE;
|
||||
var ENTITY = domGlobals.Node.ENTITY_NODE;
|
||||
var NOTATION = domGlobals.Node.NOTATION_NODE;
|
||||
|
||||
var Global = typeof domGlobals.window !== 'undefined' ? domGlobals.window : Function('return this;')();
|
||||
|
||||
var type = function (element) {
|
||||
return element.dom().nodeType;
|
||||
};
|
||||
var value = function (element) {
|
||||
return element.dom().nodeValue;
|
||||
};
|
||||
var isType$1 = function (t) {
|
||||
return function (element) {
|
||||
return type(element) === t;
|
||||
};
|
||||
};
|
||||
var isText = isType$1(TEXT);
|
||||
|
||||
var charMap = {
|
||||
'\xA0': 'nbsp',
|
||||
'\xAD': 'shy'
|
||||
};
|
||||
var charMapToRegExp = function (charMap, global) {
|
||||
var key, regExp = '';
|
||||
for (key in charMap) {
|
||||
regExp += key;
|
||||
}
|
||||
return new RegExp('[' + regExp + ']', global ? 'g' : '');
|
||||
};
|
||||
var charMapToSelector = function (charMap) {
|
||||
var key, selector = '';
|
||||
for (key in charMap) {
|
||||
if (selector) {
|
||||
selector += ',';
|
||||
}
|
||||
selector += 'span.mce-' + charMap[key];
|
||||
}
|
||||
return selector;
|
||||
};
|
||||
var Data = {
|
||||
charMap: charMap,
|
||||
regExp: charMapToRegExp(charMap),
|
||||
regExpGlobal: charMapToRegExp(charMap, true),
|
||||
selector: charMapToSelector(charMap),
|
||||
charMapToRegExp: charMapToRegExp,
|
||||
charMapToSelector: charMapToSelector
|
||||
};
|
||||
|
||||
var wrapCharWithSpan = function (value) {
|
||||
return '<span data-mce-bogus="1" class="mce-' + Data.charMap[value] + '">' + value + '</span>';
|
||||
};
|
||||
var Html = { wrapCharWithSpan: wrapCharWithSpan };
|
||||
|
||||
var isMatch = function (n) {
|
||||
var value$1 = value(n);
|
||||
return isText(n) && value$1 !== undefined && Data.regExp.test(value$1);
|
||||
};
|
||||
var filterDescendants = function (scope, predicate) {
|
||||
var result = [];
|
||||
var dom = scope.dom();
|
||||
var children = map(dom.childNodes, Element.fromDom);
|
||||
each(children, function (x) {
|
||||
if (predicate(x)) {
|
||||
result = result.concat([x]);
|
||||
}
|
||||
result = result.concat(filterDescendants(x, predicate));
|
||||
});
|
||||
return result;
|
||||
};
|
||||
var findParentElm = function (elm, rootElm) {
|
||||
while (elm.parentNode) {
|
||||
if (elm.parentNode === rootElm) {
|
||||
return elm;
|
||||
}
|
||||
elm = elm.parentNode;
|
||||
}
|
||||
};
|
||||
var replaceWithSpans = function (text) {
|
||||
return text.replace(Data.regExpGlobal, Html.wrapCharWithSpan);
|
||||
};
|
||||
var Nodes = {
|
||||
isMatch: isMatch,
|
||||
filterDescendants: filterDescendants,
|
||||
findParentElm: findParentElm,
|
||||
replaceWithSpans: replaceWithSpans
|
||||
};
|
||||
|
||||
var show = function (editor, rootElm) {
|
||||
var node, div;
|
||||
var nodeList = Nodes.filterDescendants(Element.fromDom(rootElm), Nodes.isMatch);
|
||||
each(nodeList, function (n) {
|
||||
var withSpans = Nodes.replaceWithSpans(editor.dom.encode(value(n)));
|
||||
div = editor.dom.create('div', null, withSpans);
|
||||
while (node = div.lastChild) {
|
||||
editor.dom.insertAfter(node, n.dom());
|
||||
}
|
||||
editor.dom.remove(n.dom());
|
||||
});
|
||||
};
|
||||
var hide = function (editor, body) {
|
||||
var nodeList = editor.dom.select(Data.selector, body);
|
||||
each(nodeList, function (node) {
|
||||
editor.dom.remove(node, 1);
|
||||
});
|
||||
};
|
||||
var toggle = function (editor) {
|
||||
var body = editor.getBody();
|
||||
var bookmark = editor.selection.getBookmark();
|
||||
var parentNode = Nodes.findParentElm(editor.selection.getNode(), body);
|
||||
parentNode = parentNode !== undefined ? parentNode : body;
|
||||
hide(editor, parentNode);
|
||||
show(editor, parentNode);
|
||||
editor.selection.moveToBookmark(bookmark);
|
||||
};
|
||||
var VisualChars = {
|
||||
show: show,
|
||||
hide: hide,
|
||||
toggle: toggle
|
||||
};
|
||||
|
||||
var toggleVisualChars = function (editor, toggleState) {
|
||||
var body = editor.getBody();
|
||||
var selection = editor.selection;
|
||||
var bookmark;
|
||||
toggleState.set(!toggleState.get());
|
||||
Events.fireVisualChars(editor, toggleState.get());
|
||||
bookmark = selection.getBookmark();
|
||||
if (toggleState.get() === true) {
|
||||
VisualChars.show(editor, body);
|
||||
} else {
|
||||
VisualChars.hide(editor, body);
|
||||
}
|
||||
selection.moveToBookmark(bookmark);
|
||||
};
|
||||
var Actions = { toggleVisualChars: toggleVisualChars };
|
||||
|
||||
var register = function (editor, toggleState) {
|
||||
editor.addCommand('mceVisualChars', function () {
|
||||
Actions.toggleVisualChars(editor, toggleState);
|
||||
});
|
||||
};
|
||||
var Commands = { register: register };
|
||||
|
||||
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Delay');
|
||||
|
||||
var setup = function (editor, toggleState) {
|
||||
var debouncedToggle = global$1.debounce(function () {
|
||||
VisualChars.toggle(editor);
|
||||
}, 300);
|
||||
if (editor.settings.forced_root_block !== false) {
|
||||
editor.on('keydown', function (e) {
|
||||
if (toggleState.get() === true) {
|
||||
e.keyCode === 13 ? VisualChars.toggle(editor) : debouncedToggle();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
var Keyboard = { setup: setup };
|
||||
|
||||
var isEnabledByDefault = function (editor) {
|
||||
return editor.getParam('visualchars_default_state', false);
|
||||
};
|
||||
var Settings = { isEnabledByDefault: isEnabledByDefault };
|
||||
|
||||
var setup$1 = function (editor, toggleState) {
|
||||
editor.on('init', function () {
|
||||
var valueForToggling = !Settings.isEnabledByDefault(editor);
|
||||
toggleState.set(valueForToggling);
|
||||
Actions.toggleVisualChars(editor, toggleState);
|
||||
});
|
||||
};
|
||||
var Bindings = { setup: setup$1 };
|
||||
|
||||
var toggleActiveState = function (editor) {
|
||||
return function (e) {
|
||||
var ctrl = e.control;
|
||||
editor.on('VisualChars', function (e) {
|
||||
ctrl.active(e.state);
|
||||
});
|
||||
};
|
||||
};
|
||||
var register$1 = function (editor) {
|
||||
editor.addButton('visualchars', {
|
||||
active: false,
|
||||
title: 'Show invisible characters',
|
||||
cmd: 'mceVisualChars',
|
||||
onPostRender: toggleActiveState(editor)
|
||||
});
|
||||
editor.addMenuItem('visualchars', {
|
||||
text: 'Show invisible characters',
|
||||
cmd: 'mceVisualChars',
|
||||
onPostRender: toggleActiveState(editor),
|
||||
selectable: true,
|
||||
context: 'view',
|
||||
prependToContext: true
|
||||
});
|
||||
};
|
||||
|
||||
global.add('visualchars', function (editor) {
|
||||
var toggleState = Cell(false);
|
||||
Commands.register(editor, toggleState);
|
||||
register$1(editor);
|
||||
Keyboard.setup(editor, toggleState);
|
||||
Bindings.setup(editor, toggleState);
|
||||
return Api.get(toggleState);
|
||||
});
|
||||
function Plugin () {
|
||||
}
|
||||
|
||||
return Plugin;
|
||||
|
||||
}(window));
|
||||
})();
|
1
wp-content/plugins/tinymce-advanced/mce/visualchars/plugin.min.js
vendored
Normal file
1
wp-content/plugins/tinymce-advanced/mce/visualchars/plugin.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
233
wp-content/plugins/tinymce-advanced/mce/wptadv/plugin.js
Normal file
233
wp-content/plugins/tinymce-advanced/mce/wptadv/plugin.js
Normal file
|
@ -0,0 +1,233 @@
|
|||
/**
|
||||
* Additional functionality for TinyMCE.
|
||||
* @package advanced-editor-tools
|
||||
*/
|
||||
|
||||
( function( tinymce ) {
|
||||
tinymce.PluginManager.add( 'wptadv', function( editor ) {
|
||||
var noAutop = ( ! editor.settings.wpautop && editor.settings.tadv_noautop );
|
||||
|
||||
function addLineBreaks( html ) {
|
||||
var blocklist = 'table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre' +
|
||||
'|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section' +
|
||||
'|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary';
|
||||
|
||||
html = html.replace( new RegExp( '<(?:' + blocklist + ')(?: [^>]*)?>', 'gi' ), '\n$&' );
|
||||
html = html.replace( new RegExp( '</(?:' + blocklist + ')>', 'gi' ), '$&\n' );
|
||||
html = html.replace( /(<br(?: [^>]*)?>)[\r\n\t]*/gi, '$1\n' );
|
||||
html = html.replace( />\n[\r\n\t]+</g, '>\n<' );
|
||||
html = html.replace( /^<li/gm, '\t<li' );
|
||||
html = html.replace( /<td>\u00a0<\/td>/g, '<td> </td>' );
|
||||
|
||||
return tinymce.trim( html );
|
||||
}
|
||||
|
||||
editor.addCommand( 'Tadv_Mark', function() {
|
||||
editor.formatter.toggle('mark');
|
||||
});
|
||||
|
||||
editor.addButton( 'tadv_mark', {
|
||||
icon: 'backcolor',
|
||||
tooltip: 'Mark',
|
||||
cmd: 'Tadv_Mark',
|
||||
stateSelector: 'mark'
|
||||
});
|
||||
|
||||
editor.on( 'init', function() {
|
||||
if ( noAutop ) {
|
||||
editor.on( 'SaveContent', function( event ) {
|
||||
event.content = event.content.replace( /caption\](\s|<br[^>]*>|<p> <\/p>)*\[caption/g, 'caption] [caption' );
|
||||
|
||||
event.content = event.content.replace( /<(object|audio|video)[\s\S]+?<\/\1>/g, function( match ) {
|
||||
return match.replace( /[\r\n\t ]+/g, ' ' );
|
||||
});
|
||||
|
||||
event.content = event.content.replace( /<pre( [^>]*)?>[\s\S]+?<\/pre>/g, function( match ) {
|
||||
match = match.replace( /<br ?\/?>(\r\n|\n)?/g, '\n' );
|
||||
return match.replace( /<\/?p( [^>]*)?>(\r\n|\n)?/g, '\n' );
|
||||
});
|
||||
|
||||
event.content = addLineBreaks( event.content );
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
if ( editor.plugins.searchreplace && ! editor.controlManager.buttons.searchreplace ) {
|
||||
editor.shortcuts.remove( 'meta+f' );
|
||||
}
|
||||
} catch ( er ) {}
|
||||
|
||||
editor.formatter.register({
|
||||
mark: { inline: 'mark' }
|
||||
});
|
||||
});
|
||||
|
||||
editor.on( 'ObjectResizeStart', function( event ) {
|
||||
var element = event.target;
|
||||
var table = editor.$( element );
|
||||
var parentWidth;
|
||||
var tableWidth;
|
||||
var width;
|
||||
|
||||
if ( table.is( 'table' ) ) {
|
||||
if ( element.style.width && element.style.width.indexOf( '%' ) !== -1 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
parentWidth = parseInt( table.parent().css( 'width' ), 10 );
|
||||
tableWidth = parseInt( event.width, 10 );
|
||||
|
||||
if ( parentWidth && tableWidth ) {
|
||||
if ( Math.abs( parentWidth - tableWidth ) < 3 ) {
|
||||
table.css({ width: '100%' });
|
||||
} else {
|
||||
width = Math.round( ( tableWidth / parentWidth ) * 100 );
|
||||
|
||||
if ( width > 10 && width < 200 ) {
|
||||
table.css({ width: width + '%' });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, true );
|
||||
|
||||
editor.addMenuItem( 'tmaresettablesize', {
|
||||
text: 'Reset table size',
|
||||
cmd: 'tmaResetTableSize',
|
||||
icon: 'dashicon dashicons-image-flip-horizontal',
|
||||
context: 'format',
|
||||
});
|
||||
|
||||
editor.addMenuItem( 'tmaremovetablestyles', {
|
||||
text: 'Remove table styling',
|
||||
cmd: 'tmaRemoveTableStyles',
|
||||
icon: 'dashicon dashicons-editor-table',
|
||||
context: 'format',
|
||||
});
|
||||
|
||||
editor.addButton( 'tmaresettablesize', {
|
||||
title: 'Reset table size',
|
||||
cmd: 'tmaResetTableSize',
|
||||
icon: 'dashicon dashicons-image-flip-horizontal',
|
||||
} );
|
||||
|
||||
editor.addButton( 'tmaremovetablestyles', {
|
||||
title: 'Remove table styling',
|
||||
cmd: 'tmaRemoveTableStyles',
|
||||
icon: 'dashicon dashicons-editor-table',
|
||||
} );
|
||||
|
||||
editor.addCommand( 'tmaRemoveTableStyles', function() {
|
||||
var node = editor.selection.getStart();
|
||||
var table = editor.dom.getParents( node, 'table' );
|
||||
var attr = {
|
||||
style: null,
|
||||
'data-mce-style': null,
|
||||
width: null,
|
||||
height: null,
|
||||
minWidth: null,
|
||||
maxWidth: null,
|
||||
minHeight: null,
|
||||
maxHeight: null,
|
||||
align: null,
|
||||
valign: null,
|
||||
axis: null,
|
||||
'char': null,
|
||||
charoff: null,
|
||||
bgcolor: null,
|
||||
border: null,
|
||||
cellspacing: null,
|
||||
cellpadding: null
|
||||
};
|
||||
|
||||
if ( table ) {
|
||||
editor.$( table ).attr( attr ).find( 'tr, th, td, thead, tbody, tfoot' ).each( function( i, element ) {
|
||||
editor.$( element ).attr( attr );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
editor.addCommand( 'tmaResetTableSize', function() {
|
||||
var node = editor.selection.getStart();
|
||||
var table = editor.dom.getParents( node, 'table' );
|
||||
|
||||
if ( table ) {
|
||||
removeInlineSizes( null, table );
|
||||
|
||||
editor.$( table ).find( 'tr, th, td, thead, tbody, tfoot' ).each( removeInlineSizes );
|
||||
}
|
||||
} );
|
||||
|
||||
function removeInlineSizes( i, node ) {
|
||||
var element = editor.$( node );
|
||||
|
||||
element.attr( {
|
||||
width: null,
|
||||
height: null,
|
||||
minWidth: null,
|
||||
maxWidth: null,
|
||||
minHeight: null,
|
||||
maxHeight: null
|
||||
} );
|
||||
|
||||
element.css({ width: null, height: null });
|
||||
|
||||
if ( element.is( 'table' ) ) {
|
||||
element.css({ 'border-collapse': 'collapse', width: '100%;' });
|
||||
}
|
||||
|
||||
if ( ! element.attr( 'style' ) ) {
|
||||
element.attr({ style: null, 'data-mce-style': null });
|
||||
} else {
|
||||
element.attr( 'data-mce-style', element.attr( 'style' ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( noAutop ) {
|
||||
editor.on( 'beforeSetContent', function( event ) {
|
||||
var autop;
|
||||
var wp = window.wp;
|
||||
|
||||
if ( ! wp ) {
|
||||
return;
|
||||
}
|
||||
|
||||
autop = wp.editor && wp.editor.autop;
|
||||
|
||||
if ( ! autop ) {
|
||||
autop = wp.oldEditor && wp.oldEditor.autop;
|
||||
}
|
||||
|
||||
if ( event.load && autop && event.content && event.content.indexOf( '\n' ) > -1 && ! /<p>/i.test( event.content ) ) {
|
||||
event.content = autop( event.content );
|
||||
}
|
||||
}, true );
|
||||
|
||||
if ( editor.settings.classic_block_editor ) {
|
||||
editor.on( 'beforeGetContent', function( event ) {
|
||||
if ( event.format === 'raw' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var blocks = tinymce.$( '.block-editor-block-list__block' );
|
||||
|
||||
if ( blocks.length === 1 && blocks.attr( 'data-type' ) === 'core/freeform' ) {
|
||||
// Mark all paragraph tags inside a single freeform block so they are not stripped by the block editor...
|
||||
editor.$( 'p' ).each( function ( i, node ) {
|
||||
if ( ! node.hasAttributes() ) {
|
||||
editor.$( node ).attr( 'data-tadv-p', 'keep' );
|
||||
}
|
||||
} );
|
||||
} else {
|
||||
// Remove the above ugliness...
|
||||
editor.$( 'p[data-tadv-p]' ).removeAttr( 'data-tadv-p' );
|
||||
}
|
||||
}, true );
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
addLineBreaks: addLineBreaks
|
||||
};
|
||||
});
|
||||
}( window.tinymce ));
|
233
wp-content/plugins/tinymce-advanced/mce/wptadv/plugin.min.js
vendored
Normal file
233
wp-content/plugins/tinymce-advanced/mce/wptadv/plugin.min.js
vendored
Normal file
|
@ -0,0 +1,233 @@
|
|||
/**
|
||||
* Additional functionality for TinyMCE.
|
||||
* @package advanced-editor-tools
|
||||
*/
|
||||
|
||||
( function( tinymce ) {
|
||||
tinymce.PluginManager.add( 'wptadv', function( editor ) {
|
||||
var noAutop = ( ! editor.settings.wpautop && editor.settings.tadv_noautop );
|
||||
|
||||
function addLineBreaks( html ) {
|
||||
var blocklist = 'table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre' +
|
||||
'|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section' +
|
||||
'|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary';
|
||||
|
||||
html = html.replace( new RegExp( '<(?:' + blocklist + ')(?: [^>]*)?>', 'gi' ), '\n$&' );
|
||||
html = html.replace( new RegExp( '</(?:' + blocklist + ')>', 'gi' ), '$&\n' );
|
||||
html = html.replace( /(<br(?: [^>]*)?>)[\r\n\t]*/gi, '$1\n' );
|
||||
html = html.replace( />\n[\r\n\t]+</g, '>\n<' );
|
||||
html = html.replace( /^<li/gm, '\t<li' );
|
||||
html = html.replace( /<td>\u00a0<\/td>/g, '<td> </td>' );
|
||||
|
||||
return tinymce.trim( html );
|
||||
}
|
||||
|
||||
editor.addCommand( 'Tadv_Mark', function() {
|
||||
editor.formatter.toggle('mark');
|
||||
});
|
||||
|
||||
editor.addButton( 'tadv_mark', {
|
||||
icon: 'backcolor',
|
||||
tooltip: 'Mark',
|
||||
cmd: 'Tadv_Mark',
|
||||
stateSelector: 'mark'
|
||||
});
|
||||
|
||||
editor.on( 'init', function() {
|
||||
if ( noAutop ) {
|
||||
editor.on( 'SaveContent', function( event ) {
|
||||
event.content = event.content.replace( /caption\](\s|<br[^>]*>|<p> <\/p>)*\[caption/g, 'caption] [caption' );
|
||||
|
||||
event.content = event.content.replace( /<(object|audio|video)[\s\S]+?<\/\1>/g, function( match ) {
|
||||
return match.replace( /[\r\n\t ]+/g, ' ' );
|
||||
});
|
||||
|
||||
event.content = event.content.replace( /<pre( [^>]*)?>[\s\S]+?<\/pre>/g, function( match ) {
|
||||
match = match.replace( /<br ?\/?>(\r\n|\n)?/g, '\n' );
|
||||
return match.replace( /<\/?p( [^>]*)?>(\r\n|\n)?/g, '\n' );
|
||||
});
|
||||
|
||||
event.content = addLineBreaks( event.content );
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
if ( editor.plugins.searchreplace && ! editor.controlManager.buttons.searchreplace ) {
|
||||
editor.shortcuts.remove( 'meta+f' );
|
||||
}
|
||||
} catch ( er ) {}
|
||||
|
||||
editor.formatter.register({
|
||||
mark: { inline: 'mark' }
|
||||
});
|
||||
});
|
||||
|
||||
editor.on( 'ObjectResizeStart', function( event ) {
|
||||
var element = event.target;
|
||||
var table = editor.$( element );
|
||||
var parentWidth;
|
||||
var tableWidth;
|
||||
var width;
|
||||
|
||||
if ( table.is( 'table' ) ) {
|
||||
if ( element.style.width && element.style.width.indexOf( '%' ) !== -1 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
parentWidth = parseInt( table.parent().css( 'width' ), 10 );
|
||||
tableWidth = parseInt( event.width, 10 );
|
||||
|
||||
if ( parentWidth && tableWidth ) {
|
||||
if ( Math.abs( parentWidth - tableWidth ) < 3 ) {
|
||||
table.css({ width: '100%' });
|
||||
} else {
|
||||
width = Math.round( ( tableWidth / parentWidth ) * 100 );
|
||||
|
||||
if ( width > 10 && width < 200 ) {
|
||||
table.css({ width: width + '%' });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, true );
|
||||
|
||||
editor.addMenuItem( 'tmaresettablesize', {
|
||||
text: 'Reset table size',
|
||||
cmd: 'tmaResetTableSize',
|
||||
icon: 'dashicon dashicons-image-flip-horizontal',
|
||||
context: 'format',
|
||||
});
|
||||
|
||||
editor.addMenuItem( 'tmaremovetablestyles', {
|
||||
text: 'Remove table styling',
|
||||
cmd: 'tmaRemoveTableStyles',
|
||||
icon: 'dashicon dashicons-editor-table',
|
||||
context: 'format',
|
||||
});
|
||||
|
||||
editor.addButton( 'tmaresettablesize', {
|
||||
title: 'Reset table size',
|
||||
cmd: 'tmaResetTableSize',
|
||||
icon: 'dashicon dashicons-image-flip-horizontal',
|
||||
} );
|
||||
|
||||
editor.addButton( 'tmaremovetablestyles', {
|
||||
title: 'Remove table styling',
|
||||
cmd: 'tmaRemoveTableStyles',
|
||||
icon: 'dashicon dashicons-editor-table',
|
||||
} );
|
||||
|
||||
editor.addCommand( 'tmaRemoveTableStyles', function() {
|
||||
var node = editor.selection.getStart();
|
||||
var table = editor.dom.getParents( node, 'table' );
|
||||
var attr = {
|
||||
style: null,
|
||||
'data-mce-style': null,
|
||||
width: null,
|
||||
height: null,
|
||||
minWidth: null,
|
||||
maxWidth: null,
|
||||
minHeight: null,
|
||||
maxHeight: null,
|
||||
align: null,
|
||||
valign: null,
|
||||
axis: null,
|
||||
'char': null,
|
||||
charoff: null,
|
||||
bgcolor: null,
|
||||
border: null,
|
||||
cellspacing: null,
|
||||
cellpadding: null
|
||||
};
|
||||
|
||||
if ( table ) {
|
||||
editor.$( table ).attr( attr ).find( 'tr, th, td, thead, tbody, tfoot' ).each( function( i, element ) {
|
||||
editor.$( element ).attr( attr );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
editor.addCommand( 'tmaResetTableSize', function() {
|
||||
var node = editor.selection.getStart();
|
||||
var table = editor.dom.getParents( node, 'table' );
|
||||
|
||||
if ( table ) {
|
||||
removeInlineSizes( null, table );
|
||||
|
||||
editor.$( table ).find( 'tr, th, td, thead, tbody, tfoot' ).each( removeInlineSizes );
|
||||
}
|
||||
} );
|
||||
|
||||
function removeInlineSizes( i, node ) {
|
||||
var element = editor.$( node );
|
||||
|
||||
element.attr( {
|
||||
width: null,
|
||||
height: null,
|
||||
minWidth: null,
|
||||
maxWidth: null,
|
||||
minHeight: null,
|
||||
maxHeight: null
|
||||
} );
|
||||
|
||||
element.css({ width: null, height: null });
|
||||
|
||||
if ( element.is( 'table' ) ) {
|
||||
element.css({ 'border-collapse': 'collapse', width: '100%;' });
|
||||
}
|
||||
|
||||
if ( ! element.attr( 'style' ) ) {
|
||||
element.attr({ style: null, 'data-mce-style': null });
|
||||
} else {
|
||||
element.attr( 'data-mce-style', element.attr( 'style' ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( noAutop ) {
|
||||
editor.on( 'beforeSetContent', function( event ) {
|
||||
var autop;
|
||||
var wp = window.wp;
|
||||
|
||||
if ( ! wp ) {
|
||||
return;
|
||||
}
|
||||
|
||||
autop = wp.editor && wp.editor.autop;
|
||||
|
||||
if ( ! autop ) {
|
||||
autop = wp.oldEditor && wp.oldEditor.autop;
|
||||
}
|
||||
|
||||
if ( event.load && autop && event.content && event.content.indexOf( '\n' ) > -1 && ! /<p>/i.test( event.content ) ) {
|
||||
event.content = autop( event.content );
|
||||
}
|
||||
}, true );
|
||||
|
||||
if ( editor.settings.classic_block_editor ) {
|
||||
editor.on( 'beforeGetContent', function( event ) {
|
||||
if ( event.format === 'raw' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var blocks = tinymce.$( '.block-editor-block-list__block' );
|
||||
|
||||
if ( blocks.length === 1 && blocks.attr( 'data-type' ) === 'core/freeform' ) {
|
||||
// Mark all paragraph tags inside a single freeform block so they are not stripped by the block editor...
|
||||
editor.$( 'p' ).each( function ( i, node ) {
|
||||
if ( ! node.hasAttributes() ) {
|
||||
editor.$( node ).attr( 'data-tadv-p', 'keep' );
|
||||
}
|
||||
} );
|
||||
} else {
|
||||
// Remove the above ugliness...
|
||||
editor.$( 'p[data-tadv-p]' ).removeAttr( 'data-tadv-p' );
|
||||
}
|
||||
}, true );
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
addLineBreaks: addLineBreaks
|
||||
};
|
||||
});
|
||||
}( window.tinymce ));
|
Loading…
Add table
Add a link
Reference in a new issue