Update TinyMCE to 4.7.9
This commit is contained in:
parent
1f320e1f5d
commit
e8403b9679
|
@ -168,6 +168,10 @@ html, body {
|
||||||
height: 29px !important;
|
height: 29px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mce-top-part::before {
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* Fix 100% width of link toolbar */
|
/* Fix 100% width of link toolbar */
|
||||||
div.mce-tinymce-inline {
|
div.mce-tinymce-inline {
|
||||||
width: initial !important;
|
width: initial !important;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<link type="text/css" rel="stylesheet" href="css/note-ui.css"/>
|
<link type="text/css" rel="stylesheet" href="css/note-ui.css"/>
|
||||||
<script type="text/javascript" src="tinymce.js"></script>
|
<script type="text/javascript" src="tinymce.min.js"></script>
|
||||||
<script type="text/javascript" src="locale.js"></script>
|
<script type="text/javascript" src="locale.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
tinymce.init({
|
tinymce.init({
|
||||||
|
|
|
@ -1,209 +0,0 @@
|
||||||
/**
|
|
||||||
* plugin.js
|
|
||||||
*
|
|
||||||
* Released under LGPL License.
|
|
||||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
|
||||||
*
|
|
||||||
* License: http://www.tinymce.com/license
|
|
||||||
* Contributing: http://www.tinymce.com/contributing
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*global tinymce:true */
|
|
||||||
|
|
||||||
tinymce.PluginManager.add('autolink', function(editor) {
|
|
||||||
var AutoUrlDetectState;
|
|
||||||
var AutoLinkPattern = /^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i;
|
|
||||||
|
|
||||||
if (editor.settings.autolink_pattern) {
|
|
||||||
AutoLinkPattern = editor.settings.autolink_pattern;
|
|
||||||
}
|
|
||||||
|
|
||||||
editor.on("keydown", function(e) {
|
|
||||||
if (e.keyCode == 13) {
|
|
||||||
return handleEnter(editor);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Internet Explorer has built-in automatic linking for most cases
|
|
||||||
if (tinymce.Env.ie) {
|
|
||||||
editor.on("focus", function() {
|
|
||||||
if (!AutoUrlDetectState) {
|
|
||||||
AutoUrlDetectState = true;
|
|
||||||
|
|
||||||
try {
|
|
||||||
editor.execCommand('AutoUrlDetect', false, true);
|
|
||||||
} catch (ex) {
|
|
||||||
// Ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
editor.on("keypress", function(e) {
|
|
||||||
if (e.keyCode == 41) {
|
|
||||||
return handleEclipse(editor);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.on("keyup", function(e) {
|
|
||||||
if (e.keyCode == 32) {
|
|
||||||
return handleSpacebar(editor);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function handleEclipse(editor) {
|
|
||||||
parseCurrentLine(editor, -1, '(', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleSpacebar(editor) {
|
|
||||||
parseCurrentLine(editor, 0, '', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleEnter(editor) {
|
|
||||||
parseCurrentLine(editor, -1, '', false);
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseCurrentLine(editor, end_offset, delimiter) {
|
|
||||||
var rng, end, start, endContainer, bookmark, text, matches, prev, len, rngText;
|
|
||||||
|
|
||||||
function scopeIndex(container, index) {
|
|
||||||
if (index < 0) {
|
|
||||||
index = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (container.nodeType == 3) {
|
|
||||||
var len = container.data.length;
|
|
||||||
|
|
||||||
if (index > len) {
|
|
||||||
index = len;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setStart(container, offset) {
|
|
||||||
if (container.nodeType != 1 || container.hasChildNodes()) {
|
|
||||||
rng.setStart(container, scopeIndex(container, offset));
|
|
||||||
} else {
|
|
||||||
rng.setStartBefore(container);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setEnd(container, offset) {
|
|
||||||
if (container.nodeType != 1 || container.hasChildNodes()) {
|
|
||||||
rng.setEnd(container, scopeIndex(container, offset));
|
|
||||||
} else {
|
|
||||||
rng.setEndAfter(container);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Never create a link when we are inside a link
|
|
||||||
if (editor.selection.getNode().tagName == 'A') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We need at least five characters to form a URL,
|
|
||||||
// hence, at minimum, five characters from the beginning of the line.
|
|
||||||
rng = editor.selection.getRng(true).cloneRange();
|
|
||||||
if (rng.startOffset < 5) {
|
|
||||||
// During testing, the caret is placed between two text nodes.
|
|
||||||
// The previous text node contains the URL.
|
|
||||||
prev = rng.endContainer.previousSibling;
|
|
||||||
if (!prev) {
|
|
||||||
if (!rng.endContainer.firstChild || !rng.endContainer.firstChild.nextSibling) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
prev = rng.endContainer.firstChild.nextSibling;
|
|
||||||
}
|
|
||||||
|
|
||||||
len = prev.length;
|
|
||||||
setStart(prev, len);
|
|
||||||
setEnd(prev, len);
|
|
||||||
|
|
||||||
if (rng.endOffset < 5) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
end = rng.endOffset;
|
|
||||||
endContainer = prev;
|
|
||||||
} else {
|
|
||||||
endContainer = rng.endContainer;
|
|
||||||
|
|
||||||
// Get a text node
|
|
||||||
if (endContainer.nodeType != 3 && endContainer.firstChild) {
|
|
||||||
while (endContainer.nodeType != 3 && endContainer.firstChild) {
|
|
||||||
endContainer = endContainer.firstChild;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Move range to text node
|
|
||||||
if (endContainer.nodeType == 3) {
|
|
||||||
setStart(endContainer, 0);
|
|
||||||
setEnd(endContainer, endContainer.nodeValue.length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rng.endOffset == 1) {
|
|
||||||
end = 2;
|
|
||||||
} else {
|
|
||||||
end = rng.endOffset - 1 - end_offset;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
start = end;
|
|
||||||
|
|
||||||
do {
|
|
||||||
// Move the selection one character backwards.
|
|
||||||
setStart(endContainer, end >= 2 ? end - 2 : 0);
|
|
||||||
setEnd(endContainer, end >= 1 ? end - 1 : 0);
|
|
||||||
end -= 1;
|
|
||||||
rngText = rng.toString();
|
|
||||||
|
|
||||||
// Loop until one of the following is found: a blank space, , delimiter, (end-2) >= 0
|
|
||||||
} while (rngText != ' ' && rngText !== '' && rngText.charCodeAt(0) != 160 && (end - 2) >= 0 && rngText != delimiter);
|
|
||||||
|
|
||||||
if (rng.toString() == delimiter || rng.toString().charCodeAt(0) == 160) {
|
|
||||||
setStart(endContainer, end);
|
|
||||||
setEnd(endContainer, start);
|
|
||||||
end += 1;
|
|
||||||
} else if (rng.startOffset === 0) {
|
|
||||||
setStart(endContainer, 0);
|
|
||||||
setEnd(endContainer, start);
|
|
||||||
} else {
|
|
||||||
setStart(endContainer, end);
|
|
||||||
setEnd(endContainer, start);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Exclude last . from word like "www.site.com."
|
|
||||||
text = rng.toString();
|
|
||||||
if (text.charAt(text.length - 1) == '.') {
|
|
||||||
setEnd(endContainer, start - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
text = rng.toString();
|
|
||||||
matches = text.match(AutoLinkPattern);
|
|
||||||
|
|
||||||
if (matches) {
|
|
||||||
if (matches[1] == 'www.') {
|
|
||||||
matches[1] = 'http://www.';
|
|
||||||
} else if (/@$/.test(matches[1]) && !/^mailto:/.test(matches[1])) {
|
|
||||||
matches[1] = 'mailto:' + matches[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
bookmark = editor.selection.getBookmark();
|
|
||||||
|
|
||||||
editor.selection.setRng(rng);
|
|
||||||
editor.execCommand('createlink', false, matches[1] + matches[2]);
|
|
||||||
|
|
||||||
if (editor.settings.default_link_target) {
|
|
||||||
editor.dom.setAttrib(editor.selection.getNode(), 'target', editor.settings.default_link_target);
|
|
||||||
}
|
|
||||||
|
|
||||||
editor.selection.moveToBookmark(bookmark);
|
|
||||||
editor.nodeChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
1
resource/tinymce/plugins/autolink/plugin.min.js
vendored
Normal file
1
resource/tinymce/plugins/autolink/plugin.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.Env"),n=function(e){return e.getParam("autolink_pattern",/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i)},i=function(e){return e.getParam("default_link_target","")},o=function(e,t){if(t<0&&(t=0),3===e.nodeType){var n=e.data.length;t>n&&(t=n)}return t},r=function(e,t,n){1!==t.nodeType||t.hasChildNodes()?e.setStart(t,o(t,n)):e.setStartBefore(t)},a=function(e,t,n){1!==t.nodeType||t.hasChildNodes()?e.setEnd(t,o(t,n)):e.setEndAfter(t)},f=function(e,t,o){var f,s,d,l,c,u,g,h,C,m,y=n(e),k=i(e);if("A"!==e.selection.getNode().tagName){if((f=e.selection.getRng(!0).cloneRange()).startOffset<5){if(!(h=f.endContainer.previousSibling)){if(!f.endContainer.firstChild||!f.endContainer.firstChild.nextSibling)return;h=f.endContainer.firstChild.nextSibling}if(C=h.length,r(f,h,C),a(f,h,C),f.endOffset<5)return;s=f.endOffset,l=h}else{if(3!==(l=f.endContainer).nodeType&&l.firstChild){for(;3!==l.nodeType&&l.firstChild;)l=l.firstChild;3===l.nodeType&&(r(f,l,0),a(f,l,l.nodeValue.length))}s=1===f.endOffset?2:f.endOffset-1-t}for(d=s;r(f,l,s>=2?s-2:0),a(f,l,s>=1?s-1:0),s-=1," "!==(m=f.toString())&&""!==m&&160!==m.charCodeAt(0)&&s-2>=0&&m!==o;);var p;(p=f.toString())===o||" "===p||160===p.charCodeAt(0)?(r(f,l,s),a(f,l,d),s+=1):0===f.startOffset?(r(f,l,0),a(f,l,d)):(r(f,l,s),a(f,l,d)),"."===(u=f.toString()).charAt(u.length-1)&&a(f,l,d-1),(g=(u=f.toString().trim()).match(y))&&("www."===g[1]?g[1]="http://www.":/@$/.test(g[1])&&!/^mailto:/.test(g[1])&&(g[1]="mailto:"+g[1]),c=e.selection.getBookmark(),e.selection.setRng(f),e.execCommand("createlink",!1,g[1]+g[2]),k&&e.dom.setAttrib(e.selection.getNode(),"target",k),e.selection.moveToBookmark(c),e.nodeChanged())}},s=function(e){var n;e.on("keydown",function(t){13!==t.keyCode||f(e,-1,"")}),t.ie?e.on("focus",function(){if(!n){n=!0;try{e.execCommand("AutoUrlDetect",!1,!0)}catch(t){}}}):(e.on("keypress",function(t){41!==t.keyCode||f(e,-1,"(")}),e.on("keyup",function(t){32!==t.keyCode||f(e,0,"")}))};e.add("autolink",function(e){s(e)})}();
|
|
@ -1,60 +0,0 @@
|
||||||
/**
|
|
||||||
* plugin.js
|
|
||||||
*
|
|
||||||
* Released under LGPL License.
|
|
||||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
|
||||||
*
|
|
||||||
* License: http://www.tinymce.com/license
|
|
||||||
* Contributing: http://www.tinymce.com/contributing
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*global tinymce:true */
|
|
||||||
|
|
||||||
tinymce.PluginManager.add('code', function(editor) {
|
|
||||||
function showDialog() {
|
|
||||||
var win = editor.windowManager.open({
|
|
||||||
title: "Source code",
|
|
||||||
body: {
|
|
||||||
type: 'textbox',
|
|
||||||
name: 'code',
|
|
||||||
multiline: true,
|
|
||||||
minWidth: editor.getParam("code_dialog_width", 600),
|
|
||||||
minHeight: editor.getParam("code_dialog_height", Math.min(tinymce.DOM.getViewPort().h - 200, 500)),
|
|
||||||
spellcheck: false,
|
|
||||||
style: 'direction: ltr; text-align: left'
|
|
||||||
},
|
|
||||||
onSubmit: function(e) {
|
|
||||||
// We get a lovely "Wrong document" error in IE 11 if we
|
|
||||||
// don't move the focus to the editor before creating an undo
|
|
||||||
// transation since it tries to make a bookmark for the current selection
|
|
||||||
editor.focus();
|
|
||||||
|
|
||||||
editor.undoManager.transact(function() {
|
|
||||||
editor.setContent(e.data.code);
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.selection.setCursorLocation();
|
|
||||||
editor.nodeChanged();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Gecko has a major performance issue with textarea
|
|
||||||
// contents so we need to set it when all reflows are done
|
|
||||||
win.find('#code').value(editor.getContent({source_view: true}));
|
|
||||||
}
|
|
||||||
|
|
||||||
editor.addCommand("mceCodeEditor", showDialog);
|
|
||||||
|
|
||||||
editor.addButton('code', {
|
|
||||||
icon: 'code',
|
|
||||||
tooltip: 'Source code',
|
|
||||||
onclick: showDialog
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.addMenuItem('code', {
|
|
||||||
icon: 'code',
|
|
||||||
text: 'Source code',
|
|
||||||
context: 'tools',
|
|
||||||
onclick: showDialog
|
|
||||||
});
|
|
||||||
});
|
|
1
resource/tinymce/plugins/code/plugin.min.js
vendored
Normal file
1
resource/tinymce/plugins/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"),e=function(t){return t.getParam("code_dialog_width",600)},o=function(t){return t.getParam("code_dialog_height",Math.min(n.DOM.getViewPort().h-200,500))},i=function(t,n){t.focus(),t.undoManager.transact(function(){t.setContent(n)}),t.selection.setCursorLocation(),t.nodeChanged()},c=function(t){return t.getContent({source_view:!0})},d=function(t){var n=e(t),d=o(t);t.windowManager.open({title:"Source code",body:{type:"textbox",name:"code",multiline:!0,minWidth:n,minHeight:d,spellcheck:!1,style:"direction: ltr; text-align: left"},onSubmit:function(n){i(t,n.data.code)}}).find("#code").value(c(t))},u=function(t){t.addCommand("mceCodeEditor",function(){d(t)})},a=function(t){t.addButton("code",{icon:"code",tooltip:"Source code",onclick:function(){d(t)}}),t.addMenuItem("code",{icon:"code",text:"Source code",onclick:function(){d(t)}})};t.add("code",function(t){return u(t),a(t),{}})}();
|
|
@ -1,116 +0,0 @@
|
||||||
/**
|
|
||||||
* plugin.js
|
|
||||||
*
|
|
||||||
* Released under LGPL License.
|
|
||||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
|
||||||
*
|
|
||||||
* License: http://www.tinymce.com/license
|
|
||||||
* Contributing: http://www.tinymce.com/contributing
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*global tinymce:true */
|
|
||||||
|
|
||||||
tinymce.PluginManager.add('contextmenu', function(editor) {
|
|
||||||
var menu, visibleState, contextmenuNeverUseNative = editor.settings.contextmenu_never_use_native;
|
|
||||||
|
|
||||||
var isNativeOverrideKeyEvent = function (e) {
|
|
||||||
return e.ctrlKey && !contextmenuNeverUseNative;
|
|
||||||
};
|
|
||||||
|
|
||||||
var isMacWebKit = function () {
|
|
||||||
return tinymce.Env.mac && tinymce.Env.webkit;
|
|
||||||
};
|
|
||||||
|
|
||||||
var isContextMenuVisible = function () {
|
|
||||||
return visibleState === true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This takes care of a os x native issue where it expands the selection
|
|
||||||
* to the word at the caret position to do "lookups". Since we are overriding
|
|
||||||
* the context menu we also need to override this expanding so the behavior becomes
|
|
||||||
* normalized. Firefox on os x doesn't expand to the word when using the context menu.
|
|
||||||
*/
|
|
||||||
editor.on('mousedown', function (e) {
|
|
||||||
if (isMacWebKit() && e.button === 2 && !isNativeOverrideKeyEvent(e)) {
|
|
||||||
if (editor.selection.isCollapsed()) {
|
|
||||||
editor.once('contextmenu', function (e) {
|
|
||||||
editor.selection.placeCaretAt(e.clientX, e.clientY);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.on('contextmenu', function(e) {
|
|
||||||
var contextmenu;
|
|
||||||
|
|
||||||
if (isNativeOverrideKeyEvent(e)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
contextmenu = editor.settings.contextmenu || 'link openlink image inserttable | cell row column deletetable';
|
|
||||||
|
|
||||||
// Render menu
|
|
||||||
if (!menu) {
|
|
||||||
var items = [];
|
|
||||||
|
|
||||||
tinymce.each(contextmenu.split(/[ ,]/), function(name) {
|
|
||||||
var item = editor.menuItems[name];
|
|
||||||
|
|
||||||
if (name == '|') {
|
|
||||||
item = {text: name};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item) {
|
|
||||||
item.shortcut = ''; // Hide shortcuts
|
|
||||||
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 = new tinymce.ui.Menu({
|
|
||||||
items: items,
|
|
||||||
context: 'contextmenu',
|
|
||||||
classes: 'contextmenu'
|
|
||||||
}).renderTo();
|
|
||||||
|
|
||||||
menu.on('hide', function (e) {
|
|
||||||
if (e.control === this) {
|
|
||||||
visibleState = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.on('remove', function() {
|
|
||||||
menu.remove();
|
|
||||||
menu = null;
|
|
||||||
});
|
|
||||||
|
|
||||||
} else {
|
|
||||||
menu.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Position menu
|
|
||||||
var pos = {x: e.pageX, y: e.pageY};
|
|
||||||
|
|
||||||
if (!editor.inline) {
|
|
||||||
pos = tinymce.DOM.getPos(editor.getContentAreaContainer());
|
|
||||||
pos.x += e.clientX;
|
|
||||||
pos.y += e.clientY;
|
|
||||||
}
|
|
||||||
|
|
||||||
menu.moveTo(pos.x, pos.y);
|
|
||||||
visibleState = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
|
||||||
isContextMenuVisible: isContextMenuVisible
|
|
||||||
};
|
|
||||||
});
|
|
1
resource/tinymce/plugins/contextmenu/plugin.min.js
vendored
Normal file
1
resource/tinymce/plugins/contextmenu/plugin.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
!function(){"use strict";var t=function(n){var e=n,o=function(){return e};return{get:o,set:function(t){e=t},clone:function(){return t(o())}}},n=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=function(t){return{isContextMenuVisible:function(){return t.get()}}},o=function(t){return t.settings.contextmenu_never_use_native},i=function(t){return t.getParam("contextmenu","link openlink image inserttable | cell row column deletetable")},r=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),u=function(t){return r.DOM.select(t.settings.ui_container)[0]},c=function(t,n){return{x:t,y:n}},l=function(t,n,e){return c(t.x+n,t.y+e)},s=function(t,n){if(t&&"static"!==r.DOM.getStyle(t,"position",!0)){var e=r.DOM.getPos(t),o=e.x-t.scrollLeft,i=e.y-t.scrollTop;return l(n,-o,-i)}return l(n,0,0)},a=function(t,n){if(t.inline)return s(u(t),c((f=n).pageX,f.pageY));var e,o,i,a,f,m=(e=t.getContentAreaContainer(),o=c((a=n).clientX,a.clientY),i=r.DOM.getPos(e),l(o,i.x,i.y));return s(u(t),m)},f=tinymce.util.Tools.resolve("tinymce.ui.Factory"),m=tinymce.util.Tools.resolve("tinymce.util.Tools"),g=function(t,n,e,o){null===o.get()?o.set(function(t,n){var e,o,r=[];o=i(t),m.each(o.split(/[ ,]/),function(n){var e=t.menuItems[n];"|"===n&&(e={text:n}),e&&(e.shortcut="",r.push(e))});for(var c=0;c<r.length;c++)"|"===r[c].text&&(0!==c&&c!==r.length-1||r.splice(c,1));return(e=f.create("menu",{items:r,context:"contextmenu",classes:"contextmenu"})).uiContainer=u(t),e.renderTo(u(t)),e.on("hide",function(t){t.control===this&&n.set(!1)}),t.on("remove",function(){e.remove(),e=null}),e}(t,e)):o.get().show(),o.get().moveTo(n.x,n.y),e.set(!0)},v=function(t,n,e){t.on("contextmenu",function(i){var r;r=t,(!i.ctrlKey||o(r))&&(i.preventDefault(),g(t,a(t,i),n,e))})};n.add("contextmenu",function(n){var o=t(null),i=t(!1);return v(n,i,o),e(i)})}();
|
|
@ -1,64 +0,0 @@
|
||||||
/**
|
|
||||||
* plugin.js
|
|
||||||
*
|
|
||||||
* Released under LGPL License.
|
|
||||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
|
||||||
*
|
|
||||||
* License: http://www.tinymce.com/license
|
|
||||||
* Contributing: http://www.tinymce.com/contributing
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*global tinymce:true */
|
|
||||||
|
|
||||||
tinymce.PluginManager.add('directionality', function(editor) {
|
|
||||||
function setDir(dir) {
|
|
||||||
var dom = editor.dom, curDir, blocks = editor.selection.getSelectedBlocks();
|
|
||||||
|
|
||||||
if (blocks.length) {
|
|
||||||
curDir = dom.getAttrib(blocks[0], "dir");
|
|
||||||
|
|
||||||
tinymce.each(blocks, function(block) {
|
|
||||||
// Add dir to block if the parent block doesn't already have that dir
|
|
||||||
if (!dom.getParent(block.parentNode, "*[dir='" + dir + "']", dom.getRoot())) {
|
|
||||||
if (curDir != dir) {
|
|
||||||
dom.setAttrib(block, "dir", dir);
|
|
||||||
} else {
|
|
||||||
dom.setAttrib(block, "dir", null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.nodeChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function generateSelector(dir) {
|
|
||||||
var selector = [];
|
|
||||||
|
|
||||||
tinymce.each('h1 h2 h3 h4 h5 h6 div p'.split(' '), function(name) {
|
|
||||||
selector.push(name + '[dir=' + dir + ']');
|
|
||||||
});
|
|
||||||
|
|
||||||
return selector.join(',');
|
|
||||||
}
|
|
||||||
|
|
||||||
editor.addCommand('mceDirectionLTR', function() {
|
|
||||||
setDir("ltr");
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.addCommand('mceDirectionRTL', function() {
|
|
||||||
setDir("rtl");
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.addButton('ltr', {
|
|
||||||
title: 'Left to right',
|
|
||||||
cmd: 'mceDirectionLTR',
|
|
||||||
stateSelector: generateSelector('ltr')
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.addButton('rtl', {
|
|
||||||
title: 'Right to left',
|
|
||||||
cmd: 'mceDirectionRTL',
|
|
||||||
stateSelector: generateSelector('rtl')
|
|
||||||
});
|
|
||||||
});
|
|
1
resource/tinymce/plugins/directionality/plugin.min.js
vendored
Normal file
1
resource/tinymce/plugins/directionality/plugin.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=tinymce.util.Tools.resolve("tinymce.util.Tools"),i=function(t,i){var n,o=t.dom,c=t.selection.getSelectedBlocks();c.length&&(n=o.getAttrib(c[0],"dir"),e.each(c,function(t){o.getParent(t.parentNode,'*[dir="'+i+'"]',o.getRoot())||o.setAttrib(t,"dir",n!==i?i:null)}),t.nodeChanged())},n=function(t){t.addCommand("mceDirectionLTR",function(){i(t,"ltr")}),t.addCommand("mceDirectionRTL",function(){i(t,"rtl")})},o=function(t){var i=[];return e.each("h1 h2 h3 h4 h5 h6 div p".split(" "),function(e){i.push(e+"[dir="+t+"]")}),i.join(",")},c=function(t){t.addButton("ltr",{title:"Left to right",cmd:"mceDirectionLTR",stateSelector:o("ltr")}),t.addButton("rtl",{title:"Right to left",cmd:"mceDirectionRTL",stateSelector:o("rtl")})};t.add("directionality",function(t){n(t),c(t)})}();
|
|
@ -1,615 +0,0 @@
|
||||||
/**
|
|
||||||
* plugin.js
|
|
||||||
*
|
|
||||||
* Released under LGPL License.
|
|
||||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
|
||||||
*
|
|
||||||
* License: http://www.tinymce.com/license
|
|
||||||
* Contributing: http://www.tinymce.com/contributing
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*global tinymce:true */
|
|
||||||
|
|
||||||
tinymce.PluginManager.add('link', function(editor) {
|
|
||||||
var attachState = {};
|
|
||||||
|
|
||||||
function isLink(elm) {
|
|
||||||
return elm && elm.nodeName === 'A' && elm.href;
|
|
||||||
}
|
|
||||||
|
|
||||||
function hasLinks(elements) {
|
|
||||||
return tinymce.util.Tools.grep(elements, isLink).length > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getLink(elm) {
|
|
||||||
return editor.dom.getParent(elm, 'a[href]');
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSelectedLink() {
|
|
||||||
return getLink(editor.selection.getStart());
|
|
||||||
}
|
|
||||||
|
|
||||||
function getHref(elm) {
|
|
||||||
// Returns the real href value not the resolved a.href value
|
|
||||||
var href = elm.getAttribute('data-mce-href');
|
|
||||||
return href ? href : elm.getAttribute('href');
|
|
||||||
}
|
|
||||||
|
|
||||||
function isContextMenuVisible() {
|
|
||||||
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;
|
|
||||||
};
|
|
||||||
|
|
||||||
function leftClickedOnAHref(elm) {
|
|
||||||
var sel, rng, node;
|
|
||||||
if (editor.settings.link_context_toolbar && !isContextMenuVisible() && isLink(elm)) {
|
|
||||||
sel = editor.selection;
|
|
||||||
rng = sel.getRng();
|
|
||||||
node = rng.startContainer;
|
|
||||||
// ignore cursor positions at the beginning/end (to make context toolbar less noisy)
|
|
||||||
if (node.nodeType == 3 && sel.isCollapsed() && rng.startOffset > 0 && rng.startOffset < node.data.length) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function appendClickRemove(link, evt) {
|
|
||||||
document.body.appendChild(link);
|
|
||||||
link.dispatchEvent(evt);
|
|
||||||
document.body.removeChild(link);
|
|
||||||
}
|
|
||||||
|
|
||||||
function openDetachedWindow(url) { /* Added by Zotero */ editor.execCommand("ZoteroLinkClick", false, url); } /*
|
|
||||||
// Chrome and Webkit has implemented noopener and works correctly with/without popup blocker
|
|
||||||
// Firefox has it implemented noopener but when the popup blocker is activated it doesn't work
|
|
||||||
// Edge has only implemented noreferrer and it seems to remove opener as well
|
|
||||||
// Older IE versions pre IE 11 falls back to a window.open approach
|
|
||||||
if (!tinymce.Env.ie || tinymce.Env.ie > 10) {
|
|
||||||
var link = document.createElement('a');
|
|
||||||
link.target = '_blank';
|
|
||||||
link.href = url;
|
|
||||||
link.rel = 'noreferrer noopener';
|
|
||||||
|
|
||||||
var evt = document.createEvent('MouseEvents');
|
|
||||||
evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
|
||||||
|
|
||||||
appendClickRemove(link, evt);
|
|
||||||
} else {
|
|
||||||
var win = window.open('', '_blank');
|
|
||||||
if (win) {
|
|
||||||
win.opener = null;
|
|
||||||
var doc = win.document;
|
|
||||||
doc.open();
|
|
||||||
doc.write('<meta http-equiv="refresh" content="0; url=' + tinymce.DOM.encode(url) + '">');
|
|
||||||
doc.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*/function gotoLink(a) {
|
|
||||||
if (a) {
|
|
||||||
var href = getHref(a);
|
|
||||||
if (/^#/.test(href)) {
|
|
||||||
var targetEl = editor.$(href);
|
|
||||||
if (targetEl.length) {
|
|
||||||
editor.selection.scrollIntoView(targetEl[0], true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
openDetachedWindow(a.href);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function gotoSelectedLink() {
|
|
||||||
gotoLink(getSelectedLink());
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleViewLinkState() {
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
var toggleVisibility = function (e) {
|
|
||||||
if (hasLinks(e.parents)) {
|
|
||||||
self.show();
|
|
||||||
} else {
|
|
||||||
self.hide();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!hasLinks(editor.dom.getParents(editor.selection.getStart()))) {
|
|
||||||
self.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
editor.on('nodechange', toggleVisibility);
|
|
||||||
|
|
||||||
self.on('remove', function () {
|
|
||||||
editor.off('nodechange', toggleVisibility);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function createLinkList(callback) {
|
|
||||||
return function() {
|
|
||||||
var linkList = editor.settings.link_list;
|
|
||||||
|
|
||||||
if (typeof linkList == "string") {
|
|
||||||
tinymce.util.XHR.send({
|
|
||||||
url: linkList,
|
|
||||||
success: function(text) {
|
|
||||||
callback(tinymce.util.JSON.parse(text));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (typeof linkList == "function") {
|
|
||||||
linkList(callback);
|
|
||||||
} else {
|
|
||||||
callback(linkList);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildListItems(inputList, itemCallback, startItems) {
|
|
||||||
function appendItems(values, output) {
|
|
||||||
output = output || [];
|
|
||||||
|
|
||||||
tinymce.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 || []);
|
|
||||||
}
|
|
||||||
|
|
||||||
function showDialog(linkList) {
|
|
||||||
var data = {}, selection = editor.selection, dom = editor.dom, selectedElm, anchorElm, initialText;
|
|
||||||
var win, onlyText, textListCtrl, linkListCtrl, relListCtrl, targetListCtrl, classListCtrl, linkTitleCtrl, value;
|
|
||||||
|
|
||||||
function linkListChangeHandler(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());
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildAnchorListControl(url) {
|
|
||||||
var anchorList = [];
|
|
||||||
|
|
||||||
tinymce.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
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateText() {
|
|
||||||
if (!initialText && data.text.length === 0 && onlyText) {
|
|
||||||
this.parent().parent().find('#text')[0].value(this.value());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function urlChange(e) {
|
|
||||||
var meta = e.meta || {};
|
|
||||||
|
|
||||||
if (linkListCtrl) {
|
|
||||||
linkListCtrl.value(editor.convertURL(this.value(), 'href'));
|
|
||||||
}
|
|
||||||
|
|
||||||
tinymce.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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function isOnlyTextSelected(anchorElm) {
|
|
||||||
var html = selection.getContent();
|
|
||||||
|
|
||||||
// Partial html and not a fully selected anchor element
|
|
||||||
if (/</.test(html) && (!/^<a [^>]+>[^<]+<\/a>$/.test(html) || html.indexOf('href=') == -1)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (anchorElm) {
|
|
||||||
var nodes = anchorElm.childNodes, i;
|
|
||||||
|
|
||||||
if (nodes.length === 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = nodes.length - 1; i >= 0; i--) {
|
|
||||||
if (nodes[i].nodeType != 3) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onBeforeCall(e) {
|
|
||||||
e.meta = win.toJSON();
|
|
||||||
}
|
|
||||||
|
|
||||||
selectedElm = selection.getNode();
|
|
||||||
anchorElm = dom.getParent(selectedElm, 'a[href]');
|
|
||||||
onlyText = isOnlyTextSelected();
|
|
||||||
|
|
||||||
data.text = initialText = anchorElm ? (anchorElm.innerText || anchorElm.textContent) : selection.getContent({format: 'text'});
|
|
||||||
data.href = anchorElm ? dom.getAttrib(anchorElm, 'href') : '';
|
|
||||||
|
|
||||||
if (anchorElm) {
|
|
||||||
data.target = dom.getAttrib(anchorElm, 'target');
|
|
||||||
} else if (editor.settings.default_link_target) {
|
|
||||||
data.target = editor.settings.default_link_target;
|
|
||||||
}
|
|
||||||
|
|
||||||
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() {
|
|
||||||
/*eslint consistent-this:0*/
|
|
||||||
linkListCtrl = this;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (editor.settings.target_list !== false) {
|
|
||||||
if (!editor.settings.target_list) {
|
|
||||||
editor.settings.target_list = [
|
|
||||||
{text: 'None', value: ''},
|
|
||||||
{text: 'New window', value: '_blank'}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
targetListCtrl = {
|
|
||||||
name: 'target',
|
|
||||||
type: 'listbox',
|
|
||||||
label: 'Target',
|
|
||||||
values: buildListItems(editor.settings.target_list)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (editor.settings.rel_list) {
|
|
||||||
relListCtrl = {
|
|
||||||
name: 'rel',
|
|
||||||
type: 'listbox',
|
|
||||||
label: 'Rel',
|
|
||||||
values: buildListItems(editor.settings.rel_list)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (editor.settings.link_class_list) {
|
|
||||||
classListCtrl = {
|
|
||||||
name: 'class',
|
|
||||||
type: 'listbox',
|
|
||||||
label: 'Class',
|
|
||||||
values: buildListItems(
|
|
||||||
editor.settings.link_class_list,
|
|
||||||
function(item) {
|
|
||||||
if (item.value) {
|
|
||||||
item.textStyle = function() {
|
|
||||||
return editor.formatter.getCssText({inline: 'a', classes: [item.value]});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (editor.settings.link_title !== false) {
|
|
||||||
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,
|
|
||||||
onbeforecall: onBeforeCall
|
|
||||||
},
|
|
||||||
textListCtrl,
|
|
||||||
linkTitleCtrl,
|
|
||||||
buildAnchorListControl(data.href),
|
|
||||||
linkListCtrl,
|
|
||||||
relListCtrl,
|
|
||||||
targetListCtrl,
|
|
||||||
classListCtrl
|
|
||||||
],
|
|
||||||
onSubmit: function(e) {
|
|
||||||
/*eslint dot-notation: 0*/
|
|
||||||
var href;
|
|
||||||
|
|
||||||
data = tinymce.extend(data, e.data);
|
|
||||||
href = data.href;
|
|
||||||
|
|
||||||
// Delay confirm since onSubmit will move focus
|
|
||||||
function delayedConfirm(message, callback) {
|
|
||||||
var rng = editor.selection.getRng();
|
|
||||||
|
|
||||||
tinymce.util.Delay.setEditorTimeout(editor, function() {
|
|
||||||
editor.windowManager.confirm(message, function(state) {
|
|
||||||
editor.selection.setRng(rng);
|
|
||||||
callback(state);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleTargetRules(rel, isUnsafe) {
|
|
||||||
var rules = 'noopener noreferrer';
|
|
||||||
|
|
||||||
function addTargetRules(rel) {
|
|
||||||
rel = removeTargetRules(rel);
|
|
||||||
return rel ? [rel, rules].join(' ') : rules;
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeTargetRules(rel) {
|
|
||||||
var regExp = new RegExp('(' + rules.replace(' ', '|') + ')', 'g');
|
|
||||||
if (rel) {
|
|
||||||
rel = tinymce.trim(rel.replace(regExp, ''));
|
|
||||||
}
|
|
||||||
return rel ? rel : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return isUnsafe ? addTargetRules(rel) : removeTargetRules(rel);
|
|
||||||
}
|
|
||||||
|
|
||||||
function createLink() {
|
|
||||||
var linkAttrs = {
|
|
||||||
href: 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 (!editor.settings.allow_unsafe_link_target) {
|
|
||||||
linkAttrs.rel = toggleTargetRules(linkAttrs.rel, linkAttrs.target == '_blank');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (href === attachState.href) {
|
|
||||||
attachState.attach();
|
|
||||||
attachState = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (anchorElm) {
|
|
||||||
editor.focus();
|
|
||||||
|
|
||||||
if (onlyText && data.text != initialText) {
|
|
||||||
if ("innerText" in anchorElm) {
|
|
||||||
anchorElm.innerText = data.text;
|
|
||||||
} else {
|
|
||||||
anchorElm.textContent = data.text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dom.setAttribs(anchorElm, linkAttrs);
|
|
||||||
|
|
||||||
selection.select(anchorElm);
|
|
||||||
editor.undoManager.add();
|
|
||||||
} else {
|
|
||||||
if (onlyText) {
|
|
||||||
editor.insertContent(dom.createHTML('a', linkAttrs, dom.encode(data.text)));
|
|
||||||
} else {
|
|
||||||
editor.execCommand('mceInsertLink', false, linkAttrs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function insertLink() {
|
|
||||||
editor.undoManager.transact(createLink);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!href) {
|
|
||||||
editor.execCommand('unlink');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Is email and not //user@domain.com
|
|
||||||
if (href.indexOf('@') > 0 && href.indexOf('//') == -1 && href.indexOf('mailto:') == -1) {
|
|
||||||
delayedConfirm(
|
|
||||||
'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?',
|
|
||||||
function(state) {
|
|
||||||
if (state) {
|
|
||||||
href = 'mailto:' + href;
|
|
||||||
}
|
|
||||||
|
|
||||||
insertLink();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Is not protocol prefixed
|
|
||||||
if ((editor.settings.link_assume_external_targets && !/^\w+:/i.test(href)) ||
|
|
||||||
(!editor.settings.link_assume_external_targets && /^\s*www[\.|\d\.]/i.test(href))) {
|
|
||||||
delayedConfirm(
|
|
||||||
'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?',
|
|
||||||
function(state) {
|
|
||||||
if (state) {
|
|
||||||
href = 'http://' + href;
|
|
||||||
}
|
|
||||||
|
|
||||||
insertLink();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
insertLink();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
editor.addButton('link', {
|
|
||||||
icon: 'link',
|
|
||||||
tooltip: 'Insert/edit link',
|
|
||||||
shortcut: 'Meta+K',
|
|
||||||
onclick: createLinkList(showDialog),
|
|
||||||
stateSelector: 'a[href]'
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.addButton('unlink', {
|
|
||||||
icon: 'unlink',
|
|
||||||
tooltip: 'Remove link',
|
|
||||||
cmd: 'unlink',
|
|
||||||
stateSelector: 'a[href]'
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
if (editor.addContextToolbar) {
|
|
||||||
editor.addButton('openlink', {
|
|
||||||
icon: 'newtab',
|
|
||||||
tooltip: 'Open link',
|
|
||||||
onclick: gotoSelectedLink
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.addContextToolbar(
|
|
||||||
leftClickedOnAHref,
|
|
||||||
'openlink | link unlink'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
editor.addShortcut('Meta+K', '', createLinkList(showDialog));
|
|
||||||
editor.addCommand('mceLink', createLinkList(showDialog));
|
|
||||||
|
|
||||||
editor.on('click', function (e) {
|
|
||||||
var link = getLink(e.target);
|
|
||||||
if (link && tinymce.util.VK.metaKeyPressed(e)) {
|
|
||||||
e.preventDefault();
|
|
||||||
gotoLink(link);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.on('keydown', function (e) {
|
|
||||||
var link = getSelectedLink();
|
|
||||||
if (link && e.keyCode === 13 && hasOnlyAltModifier(e)) {
|
|
||||||
e.preventDefault();
|
|
||||||
gotoLink(link);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.showDialog = showDialog;
|
|
||||||
|
|
||||||
editor.addMenuItem('openlink', {
|
|
||||||
text: 'Open link',
|
|
||||||
icon: 'newtab',
|
|
||||||
onclick: gotoSelectedLink,
|
|
||||||
onPostRender: toggleViewLinkState,
|
|
||||||
prependToContext: true
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.addMenuItem('link', {
|
|
||||||
icon: 'link',
|
|
||||||
text: 'Link',
|
|
||||||
shortcut: 'Meta+K',
|
|
||||||
onclick: createLinkList(showDialog),
|
|
||||||
stateSelector: 'a[href]',
|
|
||||||
context: 'insert',
|
|
||||||
prependToContext: true
|
|
||||||
});
|
|
||||||
});
|
|
1
resource/tinymce/plugins/link/plugin.min.js
vendored
Normal file
1
resource/tinymce/plugins/link/plugin.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
1
resource/tinymce/plugins/lists/plugin.min.js
vendored
Normal file
1
resource/tinymce/plugins/lists/plugin.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
1
resource/tinymce/plugins/paste/plugin.min.js
vendored
Normal file
1
resource/tinymce/plugins/paste/plugin.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,609 +0,0 @@
|
||||||
/**
|
|
||||||
* plugin.js
|
|
||||||
*
|
|
||||||
* Released under LGPL License.
|
|
||||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
|
||||||
*
|
|
||||||
* License: http://www.tinymce.com/license
|
|
||||||
* Contributing: http://www.tinymce.com/contributing
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*jshint smarttabs:true, undef:true, unused:true, latedef:true, curly:true, bitwise:true */
|
|
||||||
/*eslint no-labels:0, no-constant-condition: 0 */
|
|
||||||
/*global tinymce:true */
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
function isContentEditableFalse(node) {
|
|
||||||
return node && node.nodeType == 1 && node.contentEditable === "false";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Based on work developed by: James Padolsey http://james.padolsey.com
|
|
||||||
// released under UNLICENSE that is compatible with LGPL
|
|
||||||
// TODO: Handle contentEditable edgecase:
|
|
||||||
// <p>text<span contentEditable="false">text<span contentEditable="true">text</span>text</span>text</p>
|
|
||||||
function findAndReplaceDOMText(regex, node, replacementNode, captureGroup, schema) {
|
|
||||||
var m, matches = [], text, count = 0, doc;
|
|
||||||
var blockElementsMap, hiddenTextElementsMap, shortEndedElementsMap;
|
|
||||||
|
|
||||||
doc = node.ownerDocument;
|
|
||||||
blockElementsMap = schema.getBlockElements(); // H1-H6, P, TD etc
|
|
||||||
hiddenTextElementsMap = schema.getWhiteSpaceElements(); // TEXTAREA, PRE, STYLE, SCRIPT
|
|
||||||
shortEndedElementsMap = schema.getShortEndedElements(); // BR, IMG, INPUT
|
|
||||||
|
|
||||||
function getMatchIndexes(m, captureGroup) {
|
|
||||||
captureGroup = captureGroup || 0;
|
|
||||||
|
|
||||||
if (!m[0]) {
|
|
||||||
throw 'findAndReplaceDOMText cannot handle zero-length matches';
|
|
||||||
}
|
|
||||||
|
|
||||||
var index = m.index;
|
|
||||||
|
|
||||||
if (captureGroup > 0) {
|
|
||||||
var cg = m[captureGroup];
|
|
||||||
|
|
||||||
if (!cg) {
|
|
||||||
throw '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]) {
|
|
||||||
// We've found the ending
|
|
||||||
endNode = curNode;
|
|
||||||
endNodeIndex = matchLocation[1] - atIndex;
|
|
||||||
} else if (startNode) {
|
|
||||||
// Intersecting node
|
|
||||||
innerNodes.push(curNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!startNode && curNode.length + atIndex > matchLocation[0]) {
|
|
||||||
// We've found the match start
|
|
||||||
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
|
|
||||||
});
|
|
||||||
|
|
||||||
// replaceFn has to return the node that replaced the endNode
|
|
||||||
// and then we step back so we can continue from the end of the
|
|
||||||
// match:
|
|
||||||
atIndex -= (endNode.length - endNodeIndex);
|
|
||||||
startNode = null;
|
|
||||||
endNode = null;
|
|
||||||
innerNodes = [];
|
|
||||||
matchLocation = matches.shift();
|
|
||||||
matchIndex++;
|
|
||||||
|
|
||||||
if (!matchLocation) {
|
|
||||||
break; // no more matches
|
|
||||||
}
|
|
||||||
} else if ((!hiddenTextElementsMap[curNode.nodeName] || blockElementsMap[curNode.nodeName]) && curNode.firstChild) {
|
|
||||||
if (!isContentEditableFalse(curNode)) {
|
|
||||||
// Move down
|
|
||||||
curNode = curNode.firstChild;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} else if (curNode.nextSibling) {
|
|
||||||
// Move forward:
|
|
||||||
curNode = curNode.nextSibling;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Move forward or up:
|
|
||||||
while (true) {
|
|
||||||
if (curNode.nextSibling) {
|
|
||||||
curNode = curNode.nextSibling;
|
|
||||||
break;
|
|
||||||
} else if (curNode.parentNode !== node) {
|
|
||||||
curNode = curNode.parentNode;
|
|
||||||
} else {
|
|
||||||
break out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates the actual replaceFn which splits up text nodes
|
|
||||||
* and inserts the replacement element.
|
|
||||||
*/
|
|
||||||
function genReplacer(nodeName) {
|
|
||||||
var makeReplacementNode;
|
|
||||||
|
|
||||||
if (typeof nodeName != 'function') {
|
|
||||||
var stencilNode = nodeName.nodeType ? nodeName : doc.createElement(nodeName);
|
|
||||||
|
|
||||||
makeReplacementNode = function(fill, matchIndex) {
|
|
||||||
var clone = stencilNode.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, after, parentNode, startNode = range.startNode,
|
|
||||||
endNode = range.endNode, matchIndex = range.matchIndex;
|
|
||||||
|
|
||||||
if (startNode === endNode) {
|
|
||||||
var node = startNode;
|
|
||||||
|
|
||||||
parentNode = node.parentNode;
|
|
||||||
if (range.startNodeIndex > 0) {
|
|
||||||
// Add `before` text node (before the match)
|
|
||||||
before = doc.createTextNode(node.data.substring(0, range.startNodeIndex));
|
|
||||||
parentNode.insertBefore(before, node);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the replacement node:
|
|
||||||
var el = makeReplacementNode(range.match[0], matchIndex);
|
|
||||||
parentNode.insertBefore(el, node);
|
|
||||||
if (range.endNodeIndex < node.length) {
|
|
||||||
// Add `after` text node (after the match)
|
|
||||||
after = doc.createTextNode(node.data.substring(range.endNodeIndex));
|
|
||||||
parentNode.insertBefore(after, node);
|
|
||||||
}
|
|
||||||
|
|
||||||
node.parentNode.removeChild(node);
|
|
||||||
|
|
||||||
return el;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Replace startNode -> [innerNodes...] -> endNode (in that order)
|
|
||||||
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);
|
|
||||||
var innerEls = [];
|
|
||||||
|
|
||||||
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);
|
|
||||||
innerEls.push(innerEl);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
function Plugin(editor) {
|
|
||||||
var self = this, currentIndex = -1;
|
|
||||||
|
|
||||||
function showDialog() {
|
|
||||||
var last = {}, selectedText;
|
|
||||||
|
|
||||||
selectedText = tinymce.trim(editor.selection.getContent({format: 'text'}));
|
|
||||||
|
|
||||||
function updateButtonStates() {
|
|
||||||
win.statusbar.find('#next').disabled(!findSpansByIndex(currentIndex + 1).length);
|
|
||||||
win.statusbar.find('#prev').disabled(!findSpansByIndex(currentIndex - 1).length);
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
self.done();
|
|
||||||
},
|
|
||||||
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) {
|
|
||||||
self.done(false);
|
|
||||||
win.statusbar.items().slice(1).disabled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (last.text == text && last.caseState == caseState && last.wholeWord == wholeWord) {
|
|
||||||
if (findSpansByIndex(currentIndex + 1).length === 0) {
|
|
||||||
notFoundAlert();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.next();
|
|
||||||
updateButtonStates();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
count = self.find(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 (!self.replace(win.find('#replace').value())) {
|
|
||||||
win.statusbar.items().slice(1).disabled(true);
|
|
||||||
currentIndex = -1;
|
|
||||||
last = {};
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
{text: "Replace all", disabled: true, onclick: function() {
|
|
||||||
self.replace(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() {
|
|
||||||
self.prev();
|
|
||||||
updateButtonStates();
|
|
||||||
}},
|
|
||||||
{text: "Next", name: 'next', disabled: true, onclick: function() {
|
|
||||||
self.next();
|
|
||||||
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: ' '}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
self.init = function(ed) {
|
|
||||||
ed.addMenuItem('searchreplace', {
|
|
||||||
text: 'Find and replace',
|
|
||||||
shortcut: 'Meta+F',
|
|
||||||
onclick: showDialog,
|
|
||||||
separator: 'before',
|
|
||||||
context: 'edit'
|
|
||||||
});
|
|
||||||
|
|
||||||
ed.addButton('searchreplace', {
|
|
||||||
tooltip: 'Find and replace',
|
|
||||||
shortcut: 'Meta+F',
|
|
||||||
onclick: showDialog
|
|
||||||
});
|
|
||||||
|
|
||||||
ed.addCommand("SearchReplace", showDialog);
|
|
||||||
ed.shortcuts.add('Meta+F', '', showDialog);
|
|
||||||
};
|
|
||||||
|
|
||||||
function getElmIndex(elm) {
|
|
||||||
var value = elm.getAttribute('data-mce-index');
|
|
||||||
|
|
||||||
if (typeof value == "number") {
|
|
||||||
return "" + value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function markAllMatches(regex) {
|
|
||||||
var node, marker;
|
|
||||||
|
|
||||||
marker = editor.dom.create('span', {
|
|
||||||
"data-mce-bogus": 1
|
|
||||||
});
|
|
||||||
|
|
||||||
marker.className = 'mce-match-marker'; // IE 7 adds class="mce-match-marker" and class=mce-match-marker
|
|
||||||
node = editor.getBody();
|
|
||||||
|
|
||||||
self.done(false);
|
|
||||||
|
|
||||||
return findAndReplaceDOMText(regex, node, marker, false, editor.schema);
|
|
||||||
}
|
|
||||||
|
|
||||||
function unwrap(node) {
|
|
||||||
var parentNode = node.parentNode;
|
|
||||||
|
|
||||||
if (node.firstChild) {
|
|
||||||
parentNode.insertBefore(node.firstChild, node);
|
|
||||||
}
|
|
||||||
|
|
||||||
node.parentNode.removeChild(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
function findSpansByIndex(index) {
|
|
||||||
var nodes, spans = [];
|
|
||||||
|
|
||||||
nodes = tinymce.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;
|
|
||||||
}
|
|
||||||
|
|
||||||
function moveSelection(forward) {
|
|
||||||
var testIndex = currentIndex, dom = editor.dom;
|
|
||||||
|
|
||||||
forward = forward !== false;
|
|
||||||
|
|
||||||
if (forward) {
|
|
||||||
testIndex++;
|
|
||||||
} else {
|
|
||||||
testIndex--;
|
|
||||||
}
|
|
||||||
|
|
||||||
dom.removeClass(findSpansByIndex(currentIndex), 'mce-match-marker-selected');
|
|
||||||
|
|
||||||
var spans = findSpansByIndex(testIndex);
|
|
||||||
if (spans.length) {
|
|
||||||
dom.addClass(findSpansByIndex(testIndex), 'mce-match-marker-selected');
|
|
||||||
editor.selection.scrollIntoView(spans[0]);
|
|
||||||
return testIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeNode(node) {
|
|
||||||
var dom = editor.dom, parent = node.parentNode;
|
|
||||||
|
|
||||||
dom.remove(node);
|
|
||||||
|
|
||||||
if (dom.isEmpty(parent)) {
|
|
||||||
dom.remove(parent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self.find = function(text, matchCase, wholeWord) {
|
|
||||||
text = text.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
||||||
text = wholeWord ? '\\b' + text + '\\b' : text;
|
|
||||||
|
|
||||||
var count = markAllMatches(new RegExp(text, matchCase ? 'g' : 'gi'));
|
|
||||||
|
|
||||||
if (count) {
|
|
||||||
currentIndex = -1;
|
|
||||||
currentIndex = moveSelection(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
|
||||||
};
|
|
||||||
|
|
||||||
self.next = function() {
|
|
||||||
var index = moveSelection(true);
|
|
||||||
|
|
||||||
if (index !== -1) {
|
|
||||||
currentIndex = index;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
self.prev = function() {
|
|
||||||
var index = moveSelection(false);
|
|
||||||
|
|
||||||
if (index !== -1) {
|
|
||||||
currentIndex = index;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function isMatchSpan(node) {
|
|
||||||
var matchIndex = getElmIndex(node);
|
|
||||||
|
|
||||||
return matchIndex !== null && matchIndex.length > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.replace = function(text, forward, all) {
|
|
||||||
var i, nodes, node, matchIndex, currentMatchIndex, nextIndex = currentIndex, hasMore;
|
|
||||||
|
|
||||||
forward = forward !== false;
|
|
||||||
|
|
||||||
node = editor.getBody();
|
|
||||||
nodes = tinymce.grep(tinymce.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 === currentIndex) {
|
|
||||||
if (text.length) {
|
|
||||||
nodes[i].firstChild.nodeValue = text;
|
|
||||||
unwrap(nodes[i]);
|
|
||||||
} else {
|
|
||||||
removeNode(nodes[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (nodes[++i]) {
|
|
||||||
matchIndex = parseInt(getElmIndex(nodes[i]), 10);
|
|
||||||
|
|
||||||
if (matchIndex === currentMatchIndex) {
|
|
||||||
removeNode(nodes[i]);
|
|
||||||
} else {
|
|
||||||
i--;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (forward) {
|
|
||||||
nextIndex--;
|
|
||||||
}
|
|
||||||
} else if (currentMatchIndex > currentIndex) {
|
|
||||||
nodes[i].setAttribute('data-mce-index', currentMatchIndex - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
editor.undoManager.add();
|
|
||||||
currentIndex = nextIndex;
|
|
||||||
|
|
||||||
if (forward) {
|
|
||||||
hasMore = findSpansByIndex(nextIndex + 1).length > 0;
|
|
||||||
self.next();
|
|
||||||
} else {
|
|
||||||
hasMore = findSpansByIndex(nextIndex - 1).length > 0;
|
|
||||||
self.prev();
|
|
||||||
}
|
|
||||||
|
|
||||||
return !all && hasMore;
|
|
||||||
};
|
|
||||||
|
|
||||||
self.done = function(keepEditorSelection) {
|
|
||||||
var i, nodes, startContainer, endContainer;
|
|
||||||
|
|
||||||
nodes = tinymce.toArray(editor.getBody().getElementsByTagName('span'));
|
|
||||||
for (i = 0; i < nodes.length; i++) {
|
|
||||||
var nodeIndex = getElmIndex(nodes[i]);
|
|
||||||
|
|
||||||
if (nodeIndex !== null && nodeIndex.length) {
|
|
||||||
if (nodeIndex === currentIndex.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;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
tinymce.PluginManager.add('searchreplace', Plugin);
|
|
||||||
})();
|
|
1
resource/tinymce/plugins/searchreplace/plugin.min.js
vendored
Normal file
1
resource/tinymce/plugins/searchreplace/plugin.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,297 +0,0 @@
|
||||||
/**
|
|
||||||
* plugin.js
|
|
||||||
*
|
|
||||||
* Released under LGPL License.
|
|
||||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
|
||||||
*
|
|
||||||
* License: http://www.tinymce.com/license
|
|
||||||
* Contributing: http://www.tinymce.com/contributing
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*global tinymce:true */
|
|
||||||
/*eslint consistent-this:0 */
|
|
||||||
|
|
||||||
tinymce.PluginManager.add('textcolor', function(editor) {
|
|
||||||
var cols, rows;
|
|
||||||
|
|
||||||
rows = {
|
|
||||||
forecolor: editor.settings.forecolor_rows || editor.settings.textcolor_rows || 5,
|
|
||||||
backcolor: editor.settings.backcolor_rows || editor.settings.textcolor_rows || 5
|
|
||||||
};
|
|
||||||
cols = {
|
|
||||||
forecolor: editor.settings.forecolor_cols || editor.settings.textcolor_cols || 8,
|
|
||||||
backcolor: editor.settings.backcolor_cols || editor.settings.textcolor_cols || 8
|
|
||||||
};
|
|
||||||
|
|
||||||
function getCurrentColor(format) {
|
|
||||||
var color;
|
|
||||||
|
|
||||||
editor.dom.getParents(editor.selection.getStart(), function(elm) {
|
|
||||||
var value;
|
|
||||||
|
|
||||||
if ((value = elm.style[format == 'forecolor' ? 'color' : 'background-color'])) {
|
|
||||||
color = value;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapColors(type) {
|
|
||||||
var i, colors = [], colorMap;
|
|
||||||
|
|
||||||
colorMap = [
|
|
||||||
"000000", "Black",
|
|
||||||
"993300", "Burnt orange",
|
|
||||||
"333300", "Dark olive",
|
|
||||||
"003300", "Dark green",
|
|
||||||
"003366", "Dark azure",
|
|
||||||
"000080", "Navy Blue",
|
|
||||||
"333399", "Indigo",
|
|
||||||
"333333", "Very dark gray",
|
|
||||||
"800000", "Maroon",
|
|
||||||
"FF6600", "Orange",
|
|
||||||
"808000", "Olive",
|
|
||||||
"008000", "Green",
|
|
||||||
"008080", "Teal",
|
|
||||||
"0000FF", "Blue",
|
|
||||||
"666699", "Grayish blue",
|
|
||||||
"808080", "Gray",
|
|
||||||
"FF0000", "Red",
|
|
||||||
"FF9900", "Amber",
|
|
||||||
"99CC00", "Yellow green",
|
|
||||||
"339966", "Sea green",
|
|
||||||
"33CCCC", "Turquoise",
|
|
||||||
"3366FF", "Royal blue",
|
|
||||||
"800080", "Purple",
|
|
||||||
"999999", "Medium gray",
|
|
||||||
"FF00FF", "Magenta",
|
|
||||||
"FFCC00", "Gold",
|
|
||||||
"FFFF00", "Yellow",
|
|
||||||
"00FF00", "Lime",
|
|
||||||
"00FFFF", "Aqua",
|
|
||||||
"00CCFF", "Sky blue",
|
|
||||||
"993366", "Red violet",
|
|
||||||
"FFFFFF", "White",
|
|
||||||
"FF99CC", "Pink",
|
|
||||||
"FFCC99", "Peach",
|
|
||||||
"FFFF99", "Light yellow",
|
|
||||||
"CCFFCC", "Pale green",
|
|
||||||
"CCFFFF", "Pale cyan",
|
|
||||||
"99CCFF", "Light sky blue",
|
|
||||||
"CC99FF", "Plum"
|
|
||||||
];
|
|
||||||
|
|
||||||
colorMap = editor.settings.textcolor_map || colorMap;
|
|
||||||
colorMap = editor.settings[type + '_map'] || colorMap;
|
|
||||||
|
|
||||||
for (i = 0; i < colorMap.length; i += 2) {
|
|
||||||
colors.push({
|
|
||||||
text: colorMap[i + 1],
|
|
||||||
color: '#' + colorMap[i]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return colors;
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderColorPicker() {
|
|
||||||
var ctrl = this, colors, color, html, last, x, y, i, id = ctrl._id, count = 0, type;
|
|
||||||
|
|
||||||
type = ctrl.settings.origin;
|
|
||||||
|
|
||||||
function getColorCellHtml(color, title) {
|
|
||||||
var isNoColor = color == 'transparent';
|
|
||||||
|
|
||||||
return (
|
|
||||||
'<td class="mce-grid-cell' + (isNoColor ? ' mce-colorbtn-trans' : '') + '">' +
|
|
||||||
'<div id="' + id + '-' + (count++) + '"' +
|
|
||||||
' data-mce-color="' + (color ? color : '') + '"' +
|
|
||||||
' role="option"' +
|
|
||||||
' tabIndex="-1"' +
|
|
||||||
' style="' + (color ? 'background-color: ' + color : '') + '"' +
|
|
||||||
' title="' + tinymce.translate(title) + '">' +
|
|
||||||
(isNoColor ? '×' : '') +
|
|
||||||
'</div>' +
|
|
||||||
'</td>'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
colors = mapColors(type);
|
|
||||||
colors.push({
|
|
||||||
text: tinymce.translate("No color"),
|
|
||||||
color: "transparent"
|
|
||||||
});
|
|
||||||
|
|
||||||
html = '<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>';
|
|
||||||
last = colors.length - 1;
|
|
||||||
|
|
||||||
for (y = 0; y < rows[type]; y++) {
|
|
||||||
html += '<tr>';
|
|
||||||
|
|
||||||
for (x = 0; x < cols[type]; x++) {
|
|
||||||
i = y * cols[type] + x;
|
|
||||||
|
|
||||||
if (i > last) {
|
|
||||||
html += '<td></td>';
|
|
||||||
} else {
|
|
||||||
color = colors[i];
|
|
||||||
html += getColorCellHtml(color.color, color.text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
html += '</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (editor.settings.color_picker_callback) {
|
|
||||||
html += (
|
|
||||||
'<tr>' +
|
|
||||||
'<td colspan="' + cols[type] + '" class="mce-custom-color-btn">' +
|
|
||||||
'<div id="' + id + '-c" class="mce-widget mce-btn mce-btn-small mce-btn-flat" ' +
|
|
||||||
'role="button" tabindex="-1" aria-labelledby="' + id + '-c" style="width: 100%">' +
|
|
||||||
'<button type="button" role="presentation" tabindex="-1">' + tinymce.translate('Custom...') + '</button>' +
|
|
||||||
'</div>' +
|
|
||||||
'</td>' +
|
|
||||||
'</tr>'
|
|
||||||
);
|
|
||||||
|
|
||||||
html += '<tr>';
|
|
||||||
|
|
||||||
for (x = 0; x < cols[type]; x++) {
|
|
||||||
html += getColorCellHtml('', 'Custom color');
|
|
||||||
}
|
|
||||||
|
|
||||||
html += '</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
html += '</tbody></table>';
|
|
||||||
|
|
||||||
return html;
|
|
||||||
}
|
|
||||||
|
|
||||||
function applyFormat(format, value) {
|
|
||||||
editor.undoManager.transact(function() {
|
|
||||||
editor.focus();
|
|
||||||
editor.formatter.apply(format, {value: value});
|
|
||||||
editor.nodeChanged();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeFormat(format) {
|
|
||||||
editor.undoManager.transact(function() {
|
|
||||||
editor.focus();
|
|
||||||
editor.formatter.remove(format, {value: null}, null, true);
|
|
||||||
editor.nodeChanged();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function onPanelClick(e) {
|
|
||||||
var buttonCtrl = this.parent(), value, type;
|
|
||||||
|
|
||||||
type = buttonCtrl.settings.origin;
|
|
||||||
|
|
||||||
function selectColor(value) {
|
|
||||||
buttonCtrl.hidePanel();
|
|
||||||
buttonCtrl.color(value);
|
|
||||||
applyFormat(buttonCtrl.settings.format, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
function resetColor() {
|
|
||||||
buttonCtrl.hidePanel();
|
|
||||||
buttonCtrl.resetColor();
|
|
||||||
removeFormat(buttonCtrl.settings.format);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setDivColor(div, value) {
|
|
||||||
div.style.background = value;
|
|
||||||
div.setAttribute('data-mce-color', value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tinymce.DOM.getParent(e.target, '.mce-custom-color-btn')) {
|
|
||||||
buttonCtrl.hidePanel();
|
|
||||||
|
|
||||||
editor.settings.color_picker_callback.call(editor, function(value) {
|
|
||||||
var tableElm = buttonCtrl.panel.getEl().getElementsByTagName('table')[0];
|
|
||||||
var customColorCells, div, i;
|
|
||||||
|
|
||||||
customColorCells = tinymce.map(tableElm.rows[tableElm.rows.length - 1].childNodes, function(elm) {
|
|
||||||
return elm.firstChild;
|
|
||||||
});
|
|
||||||
|
|
||||||
for (i = 0; i < customColorCells.length; i++) {
|
|
||||||
div = customColorCells[i];
|
|
||||||
if (!div.getAttribute('data-mce-color')) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Shift colors to the right
|
|
||||||
// TODO: Might need to be the left on RTL
|
|
||||||
if (i == cols[type]) {
|
|
||||||
for (i = 0; i < cols[type] - 1; i++) {
|
|
||||||
setDivColor(customColorCells[i], customColorCells[i + 1].getAttribute('data-mce-color'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setDivColor(div, value);
|
|
||||||
selectColor(value);
|
|
||||||
}, getCurrentColor(buttonCtrl.settings.format));
|
|
||||||
}
|
|
||||||
|
|
||||||
value = e.target.getAttribute('data-mce-color');
|
|
||||||
if (value) {
|
|
||||||
if (this.lastId) {
|
|
||||||
document.getElementById(this.lastId).setAttribute('aria-selected', false);
|
|
||||||
}
|
|
||||||
|
|
||||||
e.target.setAttribute('aria-selected', true);
|
|
||||||
this.lastId = e.target.id;
|
|
||||||
|
|
||||||
if (value == 'transparent') {
|
|
||||||
resetColor();
|
|
||||||
} else {
|
|
||||||
selectColor(value);
|
|
||||||
}
|
|
||||||
} else if (value !== null) {
|
|
||||||
buttonCtrl.hidePanel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onButtonClick() {
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
if (self._color) {
|
|
||||||
applyFormat(self.settings.format, self._color);
|
|
||||||
} else {
|
|
||||||
removeFormat(self.settings.format);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
editor.addButton('forecolor', {
|
|
||||||
type: 'colorbutton',
|
|
||||||
tooltip: 'Text color',
|
|
||||||
format: 'forecolor',
|
|
||||||
panel: {
|
|
||||||
origin: 'forecolor',
|
|
||||||
role: 'application',
|
|
||||||
ariaRemember: true,
|
|
||||||
html: renderColorPicker,
|
|
||||||
onclick: onPanelClick
|
|
||||||
},
|
|
||||||
onclick: onButtonClick
|
|
||||||
});
|
|
||||||
|
|
||||||
editor.addButton('backcolor', {
|
|
||||||
type: 'colorbutton',
|
|
||||||
tooltip: 'Background color',
|
|
||||||
format: 'hilitecolor',
|
|
||||||
panel: {
|
|
||||||
origin: 'backcolor',
|
|
||||||
role: 'application',
|
|
||||||
ariaRemember: true,
|
|
||||||
html: renderColorPicker,
|
|
||||||
onclick: onPanelClick
|
|
||||||
},
|
|
||||||
onclick: onButtonClick
|
|
||||||
});
|
|
||||||
});
|
|
1
resource/tinymce/plugins/textcolor/plugin.min.js
vendored
Normal file
1
resource/tinymce/plugins/textcolor/plugin.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=function(t,e){var o;return t.dom.getParents(t.selection.getStart(),function(t){var r;(r=t.style["forecolor"===e?"color":"background-color"])&&(o=r)}),o},o=function(t){var e,o=[];for(e=0;e<t.length;e+=2)o.push({text:t[e+1],color:"#"+t[e]});return o},r=function(t,e,o){t.undoManager.transact(function(){t.focus(),t.formatter.apply(e,{value:o}),t.nodeChanged()})},n=function(t,e){t.undoManager.transact(function(){t.focus(),t.formatter.remove(e,{value:null},null,!0),t.nodeChanged()})},a=function(t){t.addCommand("mceApplyTextcolor",function(e,o){r(t,e,o)}),t.addCommand("mceRemoveTextcolor",function(e){n(t,e)})},l=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),c=tinymce.util.Tools.resolve("tinymce.util.Tools"),i=["000000","Black","993300","Burnt orange","333300","Dark olive","003300","Dark green","003366","Dark azure","000080","Navy Blue","333399","Indigo","333333","Very dark gray","800000","Maroon","FF6600","Orange","808000","Olive","008000","Green","008080","Teal","0000FF","Blue","666699","Grayish blue","808080","Gray","FF0000","Red","FF9900","Amber","99CC00","Yellow green","339966","Sea green","33CCCC","Turquoise","3366FF","Royal blue","800080","Purple","999999","Medium gray","FF00FF","Magenta","FFCC00","Gold","FFFF00","Yellow","00FF00","Lime","00FFFF","Aqua","00CCFF","Sky blue","993366","Red violet","FFFFFF","White","FF99CC","Pink","FFCC99","Peach","FFFF99","Light yellow","CCFFCC","Pale green","CCFFFF","Pale cyan","99CCFF","Light sky blue","CC99FF","Plum"],u=function(t){return t.getParam("textcolor_map",i)},m=function(t){return t.getParam("textcolor_rows",5)},s=function(t){return t.getParam("textcolor_cols",8)},d=function(t){return t.getParam("color_picker_callback",null)},f=function(t){return t.getParam("forecolor_map",u(t))},g=function(t){return t.getParam("backcolor_map",u(t))},F=function(t){return t.getParam("forecolor_rows",m(t))},b=function(t){return t.getParam("backcolor_rows",m(t))},p=function(t){return t.getParam("forecolor_cols",s(t))},C=function(t){return t.getParam("backcolor_cols",s(t))},y=d,v=function(t){return"function"==typeof d(t)},h=tinymce.util.Tools.resolve("tinymce.util.I18n"),P=function(t,e,r,n){var a,c,i,u,m,s,d,f=0,g=l.DOM.uniqueId("mcearia"),F=function(t,e){var o="transparent"===t;return'<td class="mce-grid-cell'+(o?" mce-colorbtn-trans":"")+'"><div id="'+g+"-"+f+++'" data-mce-color="'+(t||"")+'" role="option" tabIndex="-1" style="'+(t?"background-color: "+t:"")+'" title="'+h.translate(e)+'">'+(o?"×":"")+"</div></td>"};for((a=o(r)).push({text:h.translate("No color"),color:"transparent"}),i='<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>',u=a.length-1,s=0;s<e;s++){for(i+="<tr>",m=0;m<t;m++)i+=(d=s*t+m)>u?"<td></td>":F((c=a[d]).color,c.text);i+="</tr>"}if(n){for(i+='<tr><td colspan="'+t+'" class="mce-custom-color-btn"><div id="'+g+'-c" class="mce-widget mce-btn mce-btn-small mce-btn-flat" role="button" tabindex="-1" aria-labelledby="'+g+'-c" style="width: 100%"><button type="button" role="presentation" tabindex="-1">'+h.translate("Custom...")+"</button></div></td></tr>",i+="<tr>",m=0;m<t;m++)i+=F("","Custom color");i+="</tr>"}return i+="</tbody></table>"},k=function(t,e){t.style.background=e,t.setAttribute("data-mce-color",e)},x=function(t){return function(e){var o=e.control;o._color?t.execCommand("mceApplyTextcolor",o.settings.format,o._color):t.execCommand("mceRemoveTextcolor",o.settings.format)}},T=function(t,o){return function(r){var n,a=this.parent(),i=e(t,a.settings.format),u=function(e){a.hidePanel(),a.color(e),t.execCommand("mceApplyTextcolor",a.settings.format,e)};l.DOM.getParent(r.target,".mce-custom-color-btn")&&(a.hidePanel(),y(t).call(t,function(t){var e,r,n,l=a.panel.getEl().getElementsByTagName("table")[0];for(e=c.map(l.rows[l.rows.length-1].childNodes,function(t){return t.firstChild}),n=0;n<e.length&&(r=e[n]).getAttribute("data-mce-color");n++);if(n===o)for(n=0;n<o-1;n++)k(e[n],e[n+1].getAttribute("data-mce-color"));k(r,t),u(t)},i)),(n=r.target.getAttribute("data-mce-color"))?(this.lastId&&l.DOM.get(this.lastId).setAttribute("aria-selected",!1),r.target.setAttribute("aria-selected",!0),this.lastId=r.target.id,"transparent"===n?(a.hidePanel(),a.resetColor(),t.execCommand("mceRemoveTextcolor",a.settings.format)):u(n)):null!==n&&a.hidePanel()}},_=function(t,e){return function(){var o=e?p(t):C(t),r=e?F(t):b(t),n=e?f(t):g(t),a=v(t);return P(o,r,n,a)}},A=function(t){t.addButton("forecolor",{type:"colorbutton",tooltip:"Text color",format:"forecolor",panel:{role:"application",ariaRemember:!0,html:_(t,!0),onclick:T(t,p(t))},onclick:x(t)}),t.addButton("backcolor",{type:"colorbutton",tooltip:"Background color",format:"hilitecolor",panel:{role:"application",ariaRemember:!0,html:_(t,!1),onclick:T(t,C(t))},onclick:x(t)})};t.add("textcolor",function(t){a(t),A(t)})}();
|
|
@ -1 +1 @@
|
||||||
body{background-color:#FFFFFF;color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px;scrollbar-3dlight-color:#F0F0EE;scrollbar-arrow-color:#676662;scrollbar-base-color:#F0F0EE;scrollbar-darkshadow-color:#DDDDDD;scrollbar-face-color:#E0E0DD;scrollbar-highlight-color:#F0F0EE;scrollbar-shadow-color:#F0F0EE;scrollbar-track-color:#F5F5F5}td,th{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px}.mce-content-body .mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:transparent;text-decoration:none;color:black;font-family:Arial;font-size:11px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;line-height:normal;font-weight:normal;text-align:left;-webkit-tap-highlight-color:transparent;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-object{border:1px dotted #3A3A3A;background:#D5D5D5 url(img/object.gif) no-repeat center}.mce-preview-object{display:inline-block;position:relative;margin:0 2px 0 2px;line-height:0;border:1px solid gray}.mce-preview-object[data-mce-selected="2"] .mce-shim{display:none}.mce-preview-object .mce-shim{position:absolute;top:0;left:0;width:100%;height:100%;background:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}figure.align-left{float:left}figure.align-right{float:right}figure.image.align-center{display:table;margin-left:auto;margin-right:auto}figure.image{display:inline-block;border:1px solid gray;margin:0 2px 0 1px;background:#f5f2f0}figure.image img{margin:8px 8px 0 8px}figure.image figcaption{margin:6px 8px 6px 8px;text-align:center}.mce-toc{border:1px solid gray}.mce-toc h2{margin:4px}.mce-toc li{list-style-type:none}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px !important;height:9px !important;border:1px dotted #3A3A3A;background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-nbsp,.mce-shy{background:#AAA}.mce-shy::after{content:'-'}hr{cursor:default}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#3399ff;color:#fff}.mce-spellchecker-word{border-bottom:2px solid #F00;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid #008000;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td[data-mce-selected],th[data-mce-selected]{background-color:#3399ff !important}.mce-edit-focus{outline:1px dotted #333}.mce-content-body *[contentEditable=false] *[contentEditable=true]:focus{outline:2px solid #2d8ac7}.mce-content-body *[contentEditable=false] *[contentEditable=true]:hover{outline:2px solid #7ACAFF}.mce-content-body *[contentEditable=false][data-mce-selected]{outline:2px solid #2d8ac7}.mce-resize-bar-dragging{background-color:blue;opacity:.25;filter:alpha(opacity=25);zoom:1}
|
body{background-color:#FFFFFF;color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px;line-height:1.3;}td,th{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px}.word-wrap{word-wrap:break-word;-ms-word-break:break-all;word-break:break-all;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}.mce-content-body .mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:transparent;text-decoration:none;color:black;font-family:Arial;font-size:11px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;line-height:normal;font-weight:normal;text-align:left;-webkit-tap-highlight-color:transparent;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-object{border:1px dotted #3A3A3A;background:#D5D5D5 url(img/object.gif) no-repeat center}.mce-preview-object{display:inline-block;position:relative;margin:0 2px 0 2px;line-height:0;border:1px solid gray}.mce-preview-object[data-mce-selected="2"] .mce-shim{display:none}.mce-preview-object .mce-shim{position:absolute;top:0;left:0;width:100%;height:100%;background:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}figure.align-left{float:left}figure.align-right{float:right}figure.image.align-center{display:table;margin-left:auto;margin-right:auto}figure.image{display:inline-block;border:1px solid gray;margin:0 2px 0 1px;background:#f5f2f0}figure.image img{margin:8px 8px 0 8px}figure.image figcaption{margin:6px 8px 6px 8px;text-align:center}.mce-toc{border:1px solid gray}.mce-toc h2{margin:4px}.mce-toc li{list-style-type:none}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;width:9px !important;height:9px !important;border:1px dotted #3A3A3A;background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-nbsp,.mce-shy{background:#AAA}.mce-shy::after{content:'-'}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#3399ff;color:#fff}.mce-spellchecker-word{border-bottom:2px solid rgba(208,2,27,0.5);cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid #008000;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td[data-mce-selected],th[data-mce-selected]{background-color:#2276d2 !important}.mce-edit-focus{outline:1px dotted #333}.mce-content-body *[contentEditable=false] *[contentEditable=true]:focus{outline:2px solid #2276d2}.mce-content-body *[contentEditable=false] *[contentEditable=true]:hover{outline:2px solid #2276d2}.mce-content-body *[contentEditable=false][data-mce-selected]{outline:2px solid #2276d2}.mce-content-body *[data-mce-selected="inline-boundary"]{background:#bfe6ff}.mce-content-body .mce-item-anchor[data-mce-selected]{background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-content-body hr{cursor:default}.ephox-snooker-resizer-bar{background-color:#2276d2;opacity:0}.ephox-snooker-resizer-cols{cursor:col-resize}.ephox-snooker-resizer-rows{cursor:row-resize}.ephox-snooker-resizer-bar.ephox-snooker-resizer-bar-dragging{opacity:.2}
|
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
1
resource/tinymce/themes/modern/theme.min.js
vendored
Normal file
1
resource/tinymce/themes/modern/theme.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
2
resource/tinymce/tinymce.min.js
vendored
Normal file
2
resource/tinymce/tinymce.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user