Upgrade to TinyMCE 4.5.1
- New flat theme (with padding tightened a bit from the default to fit in right-hand pane) - Adds search/replace within notes - Adds URL autolinking - Image pasting/dragging is now properly disallowed (though TinyMCE 4 has hooks that may allow us to actually support this by automatically creating attachments) - New blockquote style with color bar - Replaces custom context menu on link click with built-in version To-do: - Fix display of pop-ups, which are now modal dialogs within the note frame instead of pop-up windows, to stay fully within the frame - Localize (more important now that there are tooltips) - Support image dragging - Update elements list for HTML5, for better drag-and-drop? - Move directionality control to context menu instead of taking up toolbar space? - Evaluate other plugins for potential inclusion - Show additional controls in separate note window? - Fix opacity of text in tooltips Closes #451, closes #421
|
@ -48,6 +48,7 @@
|
|||
<constructor><![CDATA[
|
||||
this.mode = this.getAttribute('mode');
|
||||
|
||||
this._onInitCallbacks = [];
|
||||
this._iframe = document.getAnonymousElementByAttribute(this, "anonid", "rt-view");
|
||||
|
||||
this._htmlRTFmap = [
|
||||
|
@ -68,8 +69,10 @@
|
|||
[/(?:\\par{}|\\\r?\n)/g, "</p><p>"]
|
||||
];
|
||||
|
||||
this.init = function() {
|
||||
if (this.initialized) return;
|
||||
this.prepare = function() {
|
||||
// DEBUG: Does this actually happen?
|
||||
if (this.prepared) return;
|
||||
|
||||
// Tag data
|
||||
var _rexData = [
|
||||
[
|
||||
|
@ -282,9 +285,9 @@
|
|||
this.rtfHTMLtagRegistry = tagRegistryMaker(1);
|
||||
this.htmlRTFtagRegistry = tagRegistryMaker(0);
|
||||
|
||||
this.initialized = true;
|
||||
this.prepared = true;
|
||||
}
|
||||
this.init();
|
||||
this.prepare();
|
||||
|
||||
this.getSplit = function(mode, txt) {
|
||||
if (!txt) return [];
|
||||
|
@ -375,14 +378,14 @@
|
|||
Zotero.debug("Setting mode to " + val);
|
||||
switch (val) {
|
||||
case 'note':
|
||||
var self = this;
|
||||
|
||||
this._eventHandler = function (event) {
|
||||
// Necessary in Fx32+
|
||||
if (event.wrappedJSObject) {
|
||||
event = event.wrappedJSObject;
|
||||
}
|
||||
|
||||
var commandEvent = false;
|
||||
|
||||
//Zotero.debug(event.type);
|
||||
switch (event.type) {
|
||||
case 'keydown':
|
||||
|
@ -392,7 +395,7 @@
|
|||
&& !event.altKey && event.keyCode == 90) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
self.redo();
|
||||
this.redo();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
@ -407,38 +410,36 @@
|
|||
//Zotero.debug("Not a char");
|
||||
return;
|
||||
}
|
||||
commandEvent = true;
|
||||
break;
|
||||
|
||||
// 'change' includes text added via drag-and-drop
|
||||
case 'change':
|
||||
break;
|
||||
|
||||
case 'openlink':
|
||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
win = wm.getMostRecentWindow('navigator:browser');
|
||||
win.ZoteroPane.loadURI(event.target.href, event.modifierKeys);
|
||||
case 'undo':
|
||||
case 'redo':
|
||||
commandEvent = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (self._timer) {
|
||||
clearTimeout(self._timer);
|
||||
// Trigger command on change
|
||||
if (commandEvent && this.timeout) {
|
||||
if (this._timer) {
|
||||
clearTimeout(this._timer);
|
||||
}
|
||||
|
||||
// Trigger command event on change
|
||||
if (event.type == 'keypress' || event.type == 'change') {
|
||||
self._timer = self.timeout && setTimeout(function () {
|
||||
var attr = self.getAttribute('oncommand');
|
||||
this._timer = setTimeout(function () {
|
||||
var attr = this.getAttribute('oncommand');
|
||||
attr = attr.replace('this', 'thisObj');
|
||||
var func = new Function('thisObj', 'event', attr);
|
||||
func(self, event);
|
||||
}, self.timeout);
|
||||
func(this, event);
|
||||
}.bind(this), this.timeout);
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
}.bind(this);
|
||||
break;
|
||||
|
||||
case 'integration':
|
||||
|
@ -583,6 +584,18 @@
|
|||
</body>
|
||||
</method>
|
||||
|
||||
<method name="onInit">
|
||||
<parameter name="callback"/>
|
||||
<body><![CDATA[
|
||||
if (this.initialized) {
|
||||
this._editor.once(event, callback);
|
||||
}
|
||||
else {
|
||||
this._onInitCallbacks.push(callback);
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<field name="_loaded"/>
|
||||
<method name="_load">
|
||||
<body>
|
||||
|
@ -660,15 +673,15 @@
|
|||
if (fontSize < 6) {
|
||||
fontSize = 11;
|
||||
}
|
||||
var css = "body#zotero-tinymce-note.mceContentBody, "
|
||||
+ "body#zotero-tinymce-note.mceContentBody p, "
|
||||
+ "body#zotero-tinymce-note.mceContentBody th, "
|
||||
+ "body#zotero-tinymce-note.mceContentBody td, "
|
||||
+ "body#zotero-tinymce-note.mceContentBody pre { "
|
||||
var css = "body#zotero-tinymce-note, "
|
||||
+ "body#zotero-tinymce-note p, "
|
||||
+ "body#zotero-tinymce-note th, "
|
||||
+ "body#zotero-tinymce-note td, "
|
||||
+ "body#zotero-tinymce-note pre { "
|
||||
+ "font-size: " + fontSize + "px; "
|
||||
+ "} "
|
||||
+ "body#zotero-tinymce-note.mceContentBody, "
|
||||
+ "body#zotero-tinymce-note.mceContentBody p { "
|
||||
+ "body#zotero-tinymce-note, "
|
||||
+ "body#zotero-tinymce-note p { "
|
||||
+ "font-family: "
|
||||
+ Zotero.Prefs.get('note.fontFamily') + "; "
|
||||
+ "}"
|
||||
|
@ -681,11 +694,11 @@
|
|||
head.appendChild(style);
|
||||
}
|
||||
|
||||
// Dispatch a tinymceInitialized event
|
||||
var ev = document.createEvent('HTMLEvents');
|
||||
ev.initEvent('tinymceInitialized', true, true);
|
||||
self.dispatchEvent(ev);
|
||||
};
|
||||
let cb;
|
||||
while (cb = this._onInitCallbacks.shift()) {
|
||||
cb(this._editor);
|
||||
}
|
||||
}.bind(this);
|
||||
}
|
||||
|
||||
var editor = SJOW.tinyMCE.get("tinymce");
|
||||
|
@ -701,11 +714,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
if(window.ZoteroTab) {
|
||||
ZoteroTab.containerWindow.gBrowser.removeEventListener("DOMContentLoaded", listener, true);
|
||||
} else {
|
||||
self._iframe.removeEventListener("DOMContentLoaded", listener, false);
|
||||
}
|
||||
|
||||
if (self._eventHandler) {
|
||||
win.wrappedJSObject.zoteroHandleEvent = self._eventHandler;
|
||||
|
@ -715,20 +724,9 @@
|
|||
win.wrappedJSObject.zoteroExecCommand = function (doc, command, ui, value) {
|
||||
return doc.execCommand(command, ui, value);
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
win.wrappedJSObject.zoteroFixWindow = function (win) {
|
||||
win.locationbar.visible = false;
|
||||
win.statusbar.visible = false;
|
||||
}
|
||||
};
|
||||
|
||||
if(window.ZoteroTab) {
|
||||
// I'm not sure why it's necessary to attach the event listener to the
|
||||
// container window to get it to fire on the tab, but apparently it is...
|
||||
ZoteroTab.containerBrowser.addEventListener("DOMContentLoaded", listener, true);
|
||||
} else {
|
||||
this._iframe.addEventListener("DOMContentLoaded", listener, false);
|
||||
}
|
||||
|
||||
this._iframe.webNavigation.loadURI(uri.spec,
|
||||
Components.interfaces.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY, null, null, null);
|
||||
|
|
|
@ -625,12 +625,9 @@ var Zotero_Citation_Dialog = new function () {
|
|||
|
||||
if (editor.initialized) {
|
||||
_originalHTML = editor.value;
|
||||
} else {
|
||||
var eventListener = function() {
|
||||
_originalHTML = editor.value;
|
||||
editor.removeEventListener("tinymceInitialized", eventListener, false);
|
||||
};
|
||||
editor.addEventListener("tinymceInitialized", eventListener, false);
|
||||
}
|
||||
else {
|
||||
editor.onInit(() => _originalHTML = editor.value);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
|
|
@ -247,7 +247,7 @@
|
|||
#zotero-item-pane
|
||||
{
|
||||
width: 338px;
|
||||
min-width: 250px;
|
||||
min-width: 320px;
|
||||
}
|
||||
|
||||
#zotero-layout-switcher
|
||||
|
|
0
resource/tinymce/css/integration-content.css
Executable file → Normal file
|
@ -1,16 +1,7 @@
|
|||
pre {
|
||||
font-family: -moz-fixed;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin-left: 2em;
|
||||
}
|
||||
|
||||
/* Add quotation marks around blockquote */
|
||||
blockquote p:not(:empty):before {
|
||||
content: '“';
|
||||
}
|
||||
|
||||
blockquote p:not(:empty):last-child:after {
|
||||
content: '”';
|
||||
margin-top: 1.5em;
|
||||
margin-bottom: 1.5em;
|
||||
margin-left: 1em;
|
||||
padding-left: .75em;
|
||||
border-left: 3px solid lightblue;
|
||||
}
|
||||
|
|
|
@ -2,40 +2,55 @@ html, body {
|
|||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
#tinymce_parent {
|
||||
display: block;
|
||||
height: 100%;
|
||||
}
|
||||
#tinymce_tbl {
|
||||
|
||||
/* Stretch editor to fit frame */
|
||||
#tinymce_ifr, .mce-tinymce:not(.mce-floatpanel) {
|
||||
height: 100% !important;
|
||||
width: 100% !important;
|
||||
border: 0 !important;
|
||||
}
|
||||
|
||||
table.mceLayout > tbody > tr.mceLast {
|
||||
.mce-container-body {
|
||||
position: absolute;
|
||||
display: block;
|
||||
top: 54px;
|
||||
bottom: 2px;
|
||||
left: 1px;
|
||||
right: 1px;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
td.mceIframeContainer {
|
||||
display: block;
|
||||
height: 100% !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
#tinymce_ifr {
|
||||
height: 100% !important;
|
||||
width: 100% !important;
|
||||
.mce-container-body .mce-edit-area {
|
||||
position: absolute;
|
||||
top: 57px;
|
||||
bottom: 1px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
#tinymce_formatselect_text {
|
||||
width: 65px;
|
||||
/* Shrink the buttons a bit */
|
||||
.mce-listbox button {
|
||||
padding-right: 8px !important;
|
||||
}
|
||||
|
||||
.mce-btn-small button {
|
||||
padding-left: 4px !important;
|
||||
padding-right: 4px !important;
|
||||
}
|
||||
|
||||
/* Tighten some padding */
|
||||
.mce-toolbar:first-child > div > :nth-child(3) {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.mce-toolbar:last-child > div > :nth-child(2) {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
/* Keep popup windows within frame */
|
||||
.mce-window {
|
||||
max-width: calc(100% - 15px) !important;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
#noScriptWarning {
|
||||
padding: 4px;
|
||||
font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
|
||||
font-family: sans-serif;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
|
29
resource/tinymce/integration.html
Executable file → Normal file
|
@ -13,41 +13,30 @@ html, body {
|
|||
height: 100%;
|
||||
min-height: 130px;
|
||||
}
|
||||
#tinymce_tbl {
|
||||
height: 100% !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
#noScriptWarning {
|
||||
padding: 10px 8px 4px;
|
||||
font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
|
||||
font-family: sans-serif;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript" src="tiny_mce.js"></script>
|
||||
<script type="text/javascript" src="tinymce.js"></script>
|
||||
<script type="text/javascript">
|
||||
tinyMCE.init({
|
||||
// General options
|
||||
mode : "none",
|
||||
theme : "advanced",
|
||||
content_css: "css/integration-content.css",
|
||||
|
||||
// Theme options
|
||||
theme_advanced_buttons1 : "bold,italic,underline,|,sub,sup,|,removeformat",
|
||||
theme_advanced_buttons2 : "",
|
||||
theme_advanced_buttons3 : "",
|
||||
theme_advanced_toolbar_location : "top",
|
||||
theme_advanced_toolbar_align : "left",
|
||||
theme_advanced_resizing : true,
|
||||
toolbar: "bold italic underline | sub sup | removeformat",
|
||||
toolbar_items_size: 'small',
|
||||
menubar: false,
|
||||
resize: false,
|
||||
statusbar: false,
|
||||
|
||||
setup : function (ed) {
|
||||
ed.onInit.add(function (ed) {
|
||||
init_instance_callback: function (ed) {
|
||||
zoteroInit(ed);
|
||||
});
|
||||
}
|
||||
});
|
||||
tinyMCE.execCommand("mceAddControl", true, "tinymce");
|
||||
tinyMCE.execCommand("mceAddEditor", true, "tinymce");
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -3,41 +3,48 @@
|
|||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link type="text/css" rel="stylesheet" href="css/note-ui.css"/>
|
||||
<script type="text/javascript;version=1.8" src="tiny_mce.js"></script>
|
||||
<script type="text/javascript;version=1.8">
|
||||
tinyMCE.init({
|
||||
// General options
|
||||
<script type="text/javascript" src="tinymce.js"></script>
|
||||
<script type="text/javascript">
|
||||
tinymce.init({
|
||||
body_id: "zotero-tinymce-note",
|
||||
mode : "none",
|
||||
theme : "advanced",
|
||||
content_css: "css/note-content.css",
|
||||
button_tile_map : true,
|
||||
language: "en", // TODO: localize
|
||||
entities: "160,nbsp",
|
||||
gecko_spellcheck : true,
|
||||
browser_spellcheck: true,
|
||||
convert_urls: false,
|
||||
fix_list_elements: true,
|
||||
|
||||
handle_event_callback : function (event) {
|
||||
zoteroHandleEvent(event);
|
||||
},
|
||||
plugins: "autolink,code,contextmenu,directionality,link,lists,paste,searchreplace",
|
||||
|
||||
onchange_callback : function () {
|
||||
zoteroHandleEvent({ type: 'change' });
|
||||
},
|
||||
toolbar1: "bold italic underline strikethrough | subscript superscript | forecolor backcolor | blockquote link | %DIR% | removeformat",
|
||||
toolbar2: "formatselect | alignleft aligncenter alignright | bullist numlist outdent indent | searchreplace",
|
||||
toolbar_items_size: 'small',
|
||||
menubar: false,
|
||||
resize: false,
|
||||
statusbar: false,
|
||||
|
||||
contextmenu: "link | code",
|
||||
|
||||
link_context_toolbar: true,
|
||||
link_assume_external_targets: true,
|
||||
|
||||
setup: function (ed) {
|
||||
// Set text direction
|
||||
var dir = window.location.href.match(/dir=(ltr|rtl)/)[1];
|
||||
ed.settings.directionality = dir;
|
||||
// Include button for opposite direction, to function as a toggle
|
||||
ed.settings.theme_advanced_buttons1 = ed.settings.theme_advanced_buttons1.replace(
|
||||
ed.settings.toolbar1 = ed.settings.toolbar1.replace(
|
||||
"%DIR%",
|
||||
"," + dir.split("").reverse().join("")
|
||||
dir.split("").reverse().join("")
|
||||
);
|
||||
},
|
||||
|
||||
ed.onInit.add(function (ed) {
|
||||
init_instance_callback: function (ed) {
|
||||
zoteroInit(ed);
|
||||
});
|
||||
|
||||
['Change', 'KeyDown', 'KeyPress', 'Undo', 'Redo'].forEach(eventName =>
|
||||
ed.on(eventName, event => zoteroHandleEvent(event))
|
||||
);
|
||||
|
||||
["Cut", "Copy", "Paste"].forEach(function (command) {
|
||||
let cmd = command;
|
||||
|
@ -47,18 +54,6 @@
|
|||
});
|
||||
},
|
||||
|
||||
fix_list_elements : true,
|
||||
fix_table_elements : true,
|
||||
plugins : "paste,contextmenu,linksmenu,directionality,autolink",
|
||||
|
||||
// Theme options
|
||||
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,sub,sup,|,forecolor,backcolor,|,blockquote,|,link,|,%DIR%",
|
||||
theme_advanced_buttons2 : "formatselect,|,justifyleft,justifycenter,justifyright,|,bullist,numlist,outdent,indent,|,removeformat,code",
|
||||
theme_advanced_buttons3 : "",
|
||||
theme_advanced_toolbar_location : "top",
|
||||
theme_advanced_toolbar_align : "left",
|
||||
theme_advanced_statusbar_location : "none",
|
||||
|
||||
// More restrictive version of default set, with JS/etc. removed
|
||||
valid_elements: "@[id|class|style|title|dir<ltr?rtl|lang|xml::lang],"
|
||||
+ "a[rel|rev|charset|hreflang|tabindex|accesskey|type|"
|
||||
|
@ -80,15 +75,8 @@
|
|||
+ "q[cite],samp,select[disabled|multiple|name|size],small,"
|
||||
+ "textarea[cols|rows|disabled|name|readonly],tt,var,big"
|
||||
});
|
||||
tinyMCE.execCommand("mceAddControl", true, "tinymce");
|
||||
tinymce.execCommand("mceAddEditor", true, "tinymce");
|
||||
</script>
|
||||
<style>
|
||||
table.mceLayout {
|
||||
border-left: 0 !important;
|
||||
border-right: 0 !important;
|
||||
border-top: 0 !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="tinymce"></div>
|
||||
|
|
|
@ -3,46 +3,24 @@
|
|||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link type="text/css" rel="stylesheet" href="css/note-ui.css"/>
|
||||
<style>
|
||||
table.mceLayout {
|
||||
border-left: 0 !important;
|
||||
border-right: 0 !important;
|
||||
border-top: 0 !important;
|
||||
}
|
||||
table.mceLayout > tbody > tr.mceLast {
|
||||
top: 0;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript" src="tiny_mce.js"></script>
|
||||
<script type="text/javascript" src="tinymce.js"></script>
|
||||
<script type="text/javascript">
|
||||
tinyMCE.init({
|
||||
// General options
|
||||
body_id: "zotero-tinymce-note",
|
||||
mode : "none",
|
||||
theme : "advanced",
|
||||
content_css: "css/note-content.css",
|
||||
button_tile_map : true,
|
||||
language: "en", // TODO: localize
|
||||
entity_encoding: "raw",
|
||||
fix_list_elements: true,
|
||||
readonly: true,
|
||||
|
||||
fix_list_elements : true,
|
||||
fix_table_elements : true,
|
||||
menubar: false,
|
||||
resize: false,
|
||||
statusbar: false,
|
||||
|
||||
setup : function (ed) {
|
||||
ed.onInit.add(function (ed) {
|
||||
init_instance_callback: function (ed) {
|
||||
zoteroInit(ed);
|
||||
});
|
||||
},
|
||||
|
||||
// Theme options
|
||||
theme_advanced_buttons1 : "",
|
||||
theme_advanced_buttons2 : "",
|
||||
theme_advanced_buttons3 : "",
|
||||
theme_advanced_toolbar_location : "top",
|
||||
theme_advanced_toolbar_align : "left",
|
||||
theme_advanced_statusbar_location : "none",
|
||||
|
||||
// More restrictive version of default set, with JS/etc. removed
|
||||
valid_elements: "@[id|class|style|title|dir<ltr?rtl|lang|xml::lang],"
|
||||
+ "a[rel|rev|charset|hreflang|tabindex|accesskey|type|"
|
||||
|
@ -64,7 +42,7 @@ table.mceLayout > tbody > tr.mceLast {
|
|||
+ "q[cite],samp,select[disabled|multiple|name|size],small,"
|
||||
+ "textarea[cols|rows|disabled|name|readonly],tt,var,big"
|
||||
});
|
||||
tinyMCE.execCommand("mceAddControl", true, "tinymce");
|
||||
tinyMCE.execCommand("mceAddEditor", true, "tinymce");
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -1,184 +0,0 @@
|
|||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2011, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.AutolinkPlugin', {
|
||||
/**
|
||||
* Initializes the plugin, this will be executed after the plugin has been created.
|
||||
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
||||
* of the editor instance to intercept that event.
|
||||
*
|
||||
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
||||
* @param {string} url Absolute URL to where the plugin is located.
|
||||
*/
|
||||
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
// Add a key down handler
|
||||
ed.onKeyDown.addToTop(function(ed, e) {
|
||||
if (e.keyCode == 13)
|
||||
return t.handleEnter(ed);
|
||||
});
|
||||
|
||||
// Internet Explorer has built-in automatic linking for most cases
|
||||
if (tinyMCE.isIE)
|
||||
return;
|
||||
|
||||
ed.onKeyPress.add(function(ed, e) {
|
||||
if (e.which == 41)
|
||||
return t.handleEclipse(ed);
|
||||
});
|
||||
|
||||
// Add a key up handler
|
||||
ed.onKeyUp.add(function(ed, e) {
|
||||
if (e.keyCode == 32)
|
||||
return t.handleSpacebar(ed);
|
||||
});
|
||||
},
|
||||
|
||||
handleEclipse : function(ed) {
|
||||
this.parseCurrentLine(ed, -1, '(', true);
|
||||
},
|
||||
|
||||
handleSpacebar : function(ed) {
|
||||
this.parseCurrentLine(ed, 0, '', true);
|
||||
},
|
||||
|
||||
handleEnter : function(ed) {
|
||||
this.parseCurrentLine(ed, -1, '', false);
|
||||
},
|
||||
|
||||
parseCurrentLine : function(ed, end_offset, delimiter, goback) {
|
||||
var r, end, start, endContainer, bookmark, text, matches, prev, len;
|
||||
|
||||
// We need at least five characters to form a URL,
|
||||
// hence, at minimum, five characters from the beginning of the line.
|
||||
r = ed.selection.getRng(true).cloneRange();
|
||||
if (r.startOffset < 5) {
|
||||
// During testing, the caret is placed inbetween two text nodes.
|
||||
// The previous text node contains the URL.
|
||||
prev = r.endContainer.previousSibling;
|
||||
if (prev == null) {
|
||||
if (r.endContainer.firstChild == null || r.endContainer.firstChild.nextSibling == null)
|
||||
return;
|
||||
|
||||
prev = r.endContainer.firstChild.nextSibling;
|
||||
}
|
||||
len = prev.length;
|
||||
r.setStart(prev, len);
|
||||
r.setEnd(prev, len);
|
||||
|
||||
if (r.endOffset < 5)
|
||||
return;
|
||||
|
||||
end = r.endOffset;
|
||||
endContainer = prev;
|
||||
} else {
|
||||
endContainer = r.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) {
|
||||
r.setStart(endContainer, 0);
|
||||
r.setEnd(endContainer, endContainer.nodeValue.length);
|
||||
}
|
||||
}
|
||||
|
||||
if (r.endOffset == 1)
|
||||
end = 2;
|
||||
else
|
||||
end = r.endOffset - 1 - end_offset;
|
||||
}
|
||||
|
||||
start = end;
|
||||
|
||||
do
|
||||
{
|
||||
// Move the selection one character backwards.
|
||||
r.setStart(endContainer, end - 2);
|
||||
r.setEnd(endContainer, end - 1);
|
||||
end -= 1;
|
||||
|
||||
// Loop until one of the following is found: a blank space, , delimeter, (end-2) >= 0
|
||||
} while (r.toString() != ' ' && r.toString() != '' && r.toString().charCodeAt(0) != 160 && (end -2) >= 0 && r.toString() != delimiter);
|
||||
|
||||
if (r.toString() == delimiter || r.toString().charCodeAt(0) == 160) {
|
||||
r.setStart(endContainer, end);
|
||||
r.setEnd(endContainer, start);
|
||||
end += 1;
|
||||
} else if (r.startOffset == 0) {
|
||||
r.setStart(endContainer, 0);
|
||||
r.setEnd(endContainer, start);
|
||||
}
|
||||
else {
|
||||
r.setStart(endContainer, end);
|
||||
r.setEnd(endContainer, start);
|
||||
}
|
||||
|
||||
// Exclude last . from word like "www.site.com."
|
||||
var text = r.toString();
|
||||
if (text.charAt(text.length - 1) == '.') {
|
||||
r.setEnd(endContainer, start - 1);
|
||||
}
|
||||
|
||||
text = r.toString();
|
||||
matches = text.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+-]+@)(.+)$/i);
|
||||
|
||||
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 = ed.selection.getBookmark();
|
||||
|
||||
ed.selection.setRng(r);
|
||||
tinyMCE.execCommand('createlink',false, matches[1] + matches[2]);
|
||||
ed.selection.moveToBookmark(bookmark);
|
||||
ed.nodeChanged();
|
||||
|
||||
// TODO: Determine if this is still needed.
|
||||
if (tinyMCE.isWebKit) {
|
||||
// move the caret to its original position
|
||||
ed.selection.collapse(false);
|
||||
var max = Math.min(endContainer.length, start + 1);
|
||||
r.setStart(endContainer, max);
|
||||
r.setEnd(endContainer, max);
|
||||
ed.selection.setRng(r);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns information about the plugin as a name/value array.
|
||||
* The current keys are longname, author, authorurl, infourl and version.
|
||||
*
|
||||
* @return {Object} Name/value array containing information about the plugin.
|
||||
*/
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Autolink',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autolink',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('autolink', tinymce.plugins.AutolinkPlugin);
|
||||
})();
|
209
resource/tinymce/plugins/autolink/plugin.js
Normal file
|
@ -0,0 +1,209 @@
|
|||
/**
|
||||
* 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();
|
||||
}
|
||||
}
|
||||
});
|
60
resource/tinymce/plugins/code/plugin.js
Normal file
|
@ -0,0 +1,60 @@
|
|||
/**
|
||||
* 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,165 +0,0 @@
|
|||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var Event = tinymce.dom.Event, each = tinymce.each, DOM = tinymce.DOM;
|
||||
|
||||
/**
|
||||
* This plugin a context menu to TinyMCE editor instances.
|
||||
*
|
||||
* @class tinymce.plugins.ContextMenu
|
||||
*/
|
||||
tinymce.create('tinymce.plugins.ContextMenu', {
|
||||
/**
|
||||
* Initializes the plugin, this will be executed after the plugin has been created.
|
||||
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
||||
* of the editor instance to intercept that event.
|
||||
*
|
||||
* @method init
|
||||
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
||||
* @param {string} url Absolute URL to where the plugin is located.
|
||||
*/
|
||||
init : function(ed) {
|
||||
var t = this, showMenu, contextmenuNeverUseNative, realCtrlKey, hideMenu;
|
||||
|
||||
t.editor = ed;
|
||||
|
||||
contextmenuNeverUseNative = ed.settings.contextmenu_never_use_native;
|
||||
|
||||
/**
|
||||
* This event gets fired when the context menu is shown.
|
||||
*
|
||||
* @event onContextMenu
|
||||
* @param {tinymce.plugins.ContextMenu} sender Plugin instance sending the event.
|
||||
* @param {tinymce.ui.DropMenu} menu Drop down menu to fill with more items if needed.
|
||||
*/
|
||||
t.onContextMenu = new tinymce.util.Dispatcher(this);
|
||||
|
||||
hideMenu = function(e) {
|
||||
hide(ed, e);
|
||||
};
|
||||
|
||||
showMenu = ed.onContextMenu.add(function(ed, e) {
|
||||
// Block TinyMCE menu on ctrlKey and work around Safari issue
|
||||
if ((realCtrlKey !== 0 ? realCtrlKey : e.ctrlKey) && !contextmenuNeverUseNative)
|
||||
return;
|
||||
|
||||
Event.cancel(e);
|
||||
|
||||
// Select the image if it's clicked. WebKit would other wise expand the selection
|
||||
if (e.target.nodeName == 'IMG')
|
||||
ed.selection.select(e.target);
|
||||
|
||||
t._getMenu(ed).showMenu(e.clientX || e.pageX, e.clientY || e.pageY);
|
||||
Event.add(ed.getDoc(), 'click', hideMenu);
|
||||
|
||||
ed.nodeChanged();
|
||||
});
|
||||
|
||||
ed.onRemove.add(function() {
|
||||
if (t._menu)
|
||||
t._menu.removeAll();
|
||||
});
|
||||
|
||||
function hide(ed, e) {
|
||||
realCtrlKey = 0;
|
||||
|
||||
// Since the contextmenu event moves
|
||||
// the selection we need to store it away
|
||||
if (e && e.button == 2) {
|
||||
realCtrlKey = e.ctrlKey;
|
||||
return;
|
||||
}
|
||||
|
||||
if (t._menu) {
|
||||
t._menu.removeAll();
|
||||
t._menu.destroy();
|
||||
Event.remove(ed.getDoc(), 'click', hideMenu);
|
||||
t._menu = null;
|
||||
}
|
||||
};
|
||||
|
||||
ed.onMouseDown.add(hide);
|
||||
ed.onKeyDown.add(hide);
|
||||
ed.onKeyDown.add(function(ed, e) {
|
||||
if (e.shiftKey && !e.ctrlKey && !e.altKey && e.keyCode === 121) {
|
||||
Event.cancel(e);
|
||||
showMenu(ed, e);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns information about the plugin as a name/value array.
|
||||
* The current keys are longname, author, authorurl, infourl and version.
|
||||
*
|
||||
* @method getInfo
|
||||
* @return {Object} Name/value array containing information about the plugin.
|
||||
*/
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Contextmenu',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
_getMenu : function(ed) {
|
||||
var t = this, m = t._menu, se = ed.selection, col = se.isCollapsed(), el = se.getNode() || ed.getBody(), am, p;
|
||||
|
||||
if (m) {
|
||||
m.removeAll();
|
||||
m.destroy();
|
||||
}
|
||||
|
||||
p = DOM.getPos(ed.getContentAreaContainer());
|
||||
|
||||
m = ed.controlManager.createDropMenu('contextmenu', {
|
||||
offset_x : p.x + ed.getParam('contextmenu_offset_x', 0),
|
||||
offset_y : p.y + ed.getParam('contextmenu_offset_y', 0),
|
||||
constrain : 1,
|
||||
keyboard_focus: true
|
||||
});
|
||||
|
||||
t._menu = m;
|
||||
|
||||
m.add({title : 'advanced.cut_desc', icon : 'cut', cmd : 'Cut'}).setDisabled(col);
|
||||
m.add({title : 'advanced.copy_desc', icon : 'copy', cmd : 'Copy'}).setDisabled(col);
|
||||
m.add({title : 'advanced.paste_desc', icon : 'paste', cmd : 'Paste'});
|
||||
|
||||
if ((el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) || !col) {
|
||||
m.addSeparator();
|
||||
// Added by Zotero
|
||||
if(el.nodeName == 'A') m.add({title : 'Open Link', icon : 'link', cmd : 'openlink', ui : true });
|
||||
m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
|
||||
m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
|
||||
}
|
||||
|
||||
m.addSeparator();
|
||||
m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
|
||||
|
||||
m.addSeparator();
|
||||
am = m.addMenu({title : 'contextmenu.align'});
|
||||
am.add({title : 'contextmenu.left', icon : 'justifyleft', cmd : 'JustifyLeft'});
|
||||
am.add({title : 'contextmenu.center', icon : 'justifycenter', cmd : 'JustifyCenter'});
|
||||
am.add({title : 'contextmenu.right', icon : 'justifyright', cmd : 'JustifyRight'});
|
||||
am.add({title : 'contextmenu.full', icon : 'justifyfull', cmd : 'JustifyFull'});
|
||||
|
||||
t.onContextMenu.dispatch(t, m, el, col);
|
||||
|
||||
return m;
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('contextmenu', tinymce.plugins.ContextMenu);
|
||||
})();
|
116
resource/tinymce/plugins/contextmenu/plugin.js
Normal file
|
@ -0,0 +1,116 @@
|
|||
/**
|
||||
* 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,85 +0,0 @@
|
|||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.Directionality', {
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
t.editor = ed;
|
||||
|
||||
function setDir(dir) {
|
||||
var dom = ed.dom, curDir, blocks = ed.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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ed.nodeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
ed.addCommand('mceDirectionLTR', function() {
|
||||
setDir("ltr");
|
||||
});
|
||||
|
||||
ed.addCommand('mceDirectionRTL', function() {
|
||||
setDir("rtl");
|
||||
});
|
||||
|
||||
ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'});
|
||||
ed.addButton('rtl', {title : 'directionality.rtl_desc', cmd : 'mceDirectionRTL'});
|
||||
|
||||
ed.onNodeChange.add(t._nodeChange, t);
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Directionality',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
// Private methods
|
||||
|
||||
_nodeChange : function(ed, cm, n) {
|
||||
var dom = ed.dom, dir;
|
||||
|
||||
n = dom.getParent(n, dom.isBlock);
|
||||
if (!n) {
|
||||
cm.setDisabled('ltr', 1);
|
||||
cm.setDisabled('rtl', 1);
|
||||
return;
|
||||
}
|
||||
|
||||
dir = dom.getAttrib(n, 'dir');
|
||||
cm.setActive('ltr', dir == "ltr");
|
||||
cm.setDisabled('ltr', 0);
|
||||
cm.setActive('rtl', dir == "rtl");
|
||||
cm.setDisabled('rtl', 0);
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('directionality', tinymce.plugins.Directionality);
|
||||
})();
|
64
resource/tinymce/plugins/directionality/plugin.js
Normal file
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
* 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')
|
||||
});
|
||||
});
|
608
resource/tinymce/plugins/link/plugin.js
Normal file
|
@ -0,0 +1,608 @@
|
|||
/**
|
||||
* 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 openDetachedWindow(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, true, 0, 0, 0, 0, false, false, false, false, 0, null);
|
||||
link.dispatchEvent(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,176 +0,0 @@
|
|||
(function() {
|
||||
var Event = tinymce.dom.Event, each = tinymce.each, DOM = tinymce.DOM;
|
||||
|
||||
/**
|
||||
* This plugin adds a left-click context menu to links in the TinyMCE editor for Zotero.
|
||||
* Code adopted and modified from TinyMCE contextmenu plugin.
|
||||
*
|
||||
* @class tinymce.plugins.LinksMenu
|
||||
*/
|
||||
tinymce.create('tinymce.plugins.LinksMenu', {
|
||||
/**
|
||||
* Initializes the plugin, this will be executed after the plugin has been created.
|
||||
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
||||
* of the editor instance to intercept that event.
|
||||
*
|
||||
* @method init
|
||||
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
||||
* @param {string} url Absolute URL to where the plugin is located.
|
||||
*/
|
||||
init : function(ed) {
|
||||
var t = this, showMenu, contextmenuNeverUseNative, realCtrlKey, hideMenu;
|
||||
|
||||
t.editor = ed;
|
||||
|
||||
contextmenuNeverUseNative = ed.settings.contextmenu_never_use_native;
|
||||
|
||||
// add editor command to open links through zoteroHandleEvent
|
||||
ed.addCommand('openlink', function(command) {
|
||||
var ed = tinyMCE.activeEditor;
|
||||
var node = ed.selection.getNode();
|
||||
if (node.nodeName == 'A') {
|
||||
zoteroHandleEvent({
|
||||
type: 'openlink',
|
||||
target: node,
|
||||
// We don't seem to be able to access the click event that triggered this
|
||||
// command in order to check the modifier keys used, so instead we save
|
||||
// the keys on every menu click in tiny_mce.js and pass them on here
|
||||
// for use by loadURI().
|
||||
modifierKeys: ed.lastClickModifierKeys
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* This event gets fired when the context menu is shown.
|
||||
*
|
||||
* @event onClick
|
||||
* @param {tinymce.plugins.LinksMenu} sender Plugin instance sending the event.
|
||||
* @param {tinymce.ui.DropMenu} menu Drop down menu to fill with more items if needed.
|
||||
*/
|
||||
t.onClick = new tinymce.util.Dispatcher(this);
|
||||
|
||||
hideMenu = function(e) {
|
||||
hide(ed, e);
|
||||
};
|
||||
|
||||
showMenu = ed.onClick.add(function(ed, e) {
|
||||
// Only show on left-click
|
||||
if (e.button != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Only show when <a> node
|
||||
if (e.target.nodeName != 'A') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Block TinyMCE menu on ctrlKey and work around Safari issue
|
||||
if ((realCtrlKey !== 0 ? realCtrlKey : e.ctrlKey) && !contextmenuNeverUseNative) {
|
||||
return;
|
||||
}
|
||||
|
||||
Event.cancel(e);
|
||||
|
||||
t._getMenu(ed).showMenu(e.clientX || e.pageX, e.clientY || e.pageY);
|
||||
Event.add(ed.getDoc(), 'click', hideMenu);
|
||||
|
||||
ed.nodeChanged();
|
||||
});
|
||||
|
||||
ed.onRemove.add(function() {
|
||||
if (t._menu)
|
||||
t._menu.removeAll();
|
||||
});
|
||||
|
||||
function hide(ed, e) {
|
||||
realCtrlKey = 0;
|
||||
|
||||
// Since the contextmenu event moves
|
||||
// the selection we need to store it away
|
||||
if (e && e.button == 2) {
|
||||
realCtrlKey = e.ctrlKey;
|
||||
return;
|
||||
}
|
||||
|
||||
if (t._menu) {
|
||||
t._menu.removeAll();
|
||||
t._menu.destroy();
|
||||
Event.remove(ed.getDoc(), 'click', hideMenu);
|
||||
t._menu = null;
|
||||
}
|
||||
};
|
||||
|
||||
ed.onMouseDown.add(hide);
|
||||
ed.onKeyDown.add(hide);
|
||||
ed.onKeyDown.add(function(ed, e) {
|
||||
if (e.shiftKey && !e.ctrlKey && !e.altKey && e.keyCode === 121) {
|
||||
Event.cancel(e);
|
||||
showMenu(ed, e);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns information about the plugin as a name/value array.
|
||||
* The current keys are longname, author, authorurl, infourl and version.
|
||||
*
|
||||
* @method getInfo
|
||||
* @return {Object} Name/value array containing information about the plugin.
|
||||
*/
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Linksmenu',
|
||||
author : '',
|
||||
authorurl : '',
|
||||
infourl : '',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
_getMenu : function(ed) {
|
||||
var t = this, m = t._menu, se = ed.selection, col = se.isCollapsed(), el = se.getNode() || ed.getBody(), am, p;
|
||||
|
||||
if (m) {
|
||||
m.removeAll();
|
||||
m.destroy();
|
||||
}
|
||||
|
||||
p = DOM.getPos(ed.getContentAreaContainer());
|
||||
|
||||
m = ed.controlManager.createDropMenu('linksmenu', {
|
||||
offset_x : p.x + ed.getParam('contextmenu_offset_x', 0),
|
||||
offset_y : p.y + ed.getParam('contextmenu_offset_y', 0),
|
||||
constrain : 1,
|
||||
keyboard_focus: true
|
||||
});
|
||||
|
||||
t._menu = m;
|
||||
|
||||
m.add({
|
||||
title : 'Open Link',
|
||||
icon : 'link',
|
||||
cmd : 'openlink',
|
||||
ui : true
|
||||
});
|
||||
m.add({
|
||||
title : 'Edit Link',
|
||||
icon : 'link',
|
||||
cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink',
|
||||
ui : true
|
||||
});
|
||||
m.add({
|
||||
title : 'advanced.unlink_desc',
|
||||
icon : 'unlink',
|
||||
cmd : 'UnLink'
|
||||
});
|
||||
|
||||
t.onClick.dispatch(t, m, el, col);
|
||||
|
||||
return m;
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('linksmenu', tinymce.plugins.LinksMenu);
|
||||
})();
|
1006
resource/tinymce/plugins/lists/plugin.js
Normal file
|
@ -1,896 +0,0 @@
|
|||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var each = tinymce.each,
|
||||
defs = {
|
||||
paste_auto_cleanup_on_paste : true,
|
||||
paste_enable_default_filters : true,
|
||||
paste_block_drop : false,
|
||||
paste_retain_style_properties : "none",
|
||||
paste_strip_class_attributes : "mso",
|
||||
paste_remove_spans : false,
|
||||
paste_remove_styles : false,
|
||||
paste_remove_styles_if_webkit : true,
|
||||
paste_convert_middot_lists : true,
|
||||
paste_convert_headers_to_strong : false,
|
||||
paste_dialog_width : "450",
|
||||
paste_dialog_height : "400",
|
||||
paste_max_consecutive_linebreaks: 2,
|
||||
paste_text_use_dialog : false,
|
||||
paste_text_sticky : false,
|
||||
paste_text_sticky_default : false,
|
||||
paste_text_notifyalways : false,
|
||||
paste_text_linebreaktype : "combined",
|
||||
paste_text_replacements : [
|
||||
[/\u2026/g, "..."],
|
||||
[/[\x93\x94\u201c\u201d]/g, '"'],
|
||||
[/[\x60\x91\x92\u2018\u2019]/g, "'"]
|
||||
]
|
||||
};
|
||||
|
||||
function getParam(ed, name) {
|
||||
return ed.getParam(name, defs[name]);
|
||||
}
|
||||
|
||||
tinymce.create('tinymce.plugins.PastePlugin', {
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
t.editor = ed;
|
||||
t.url = url;
|
||||
|
||||
// Setup plugin events
|
||||
t.onPreProcess = new tinymce.util.Dispatcher(t);
|
||||
t.onPostProcess = new tinymce.util.Dispatcher(t);
|
||||
|
||||
// Register default handlers
|
||||
t.onPreProcess.add(t._preProcess);
|
||||
t.onPostProcess.add(t._postProcess);
|
||||
|
||||
// Register optional preprocess handler
|
||||
t.onPreProcess.add(function(pl, o) {
|
||||
ed.execCallback('paste_preprocess', pl, o);
|
||||
});
|
||||
|
||||
// Register optional postprocess
|
||||
t.onPostProcess.add(function(pl, o) {
|
||||
ed.execCallback('paste_postprocess', pl, o);
|
||||
});
|
||||
|
||||
ed.onKeyDown.addToTop(function(ed, e) {
|
||||
// Block ctrl+v from adding an undo level since the default logic in tinymce.Editor will add that
|
||||
if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))
|
||||
return false; // Stop other listeners
|
||||
});
|
||||
|
||||
// Initialize plain text flag
|
||||
ed.pasteAsPlainText = getParam(ed, 'paste_text_sticky_default');
|
||||
|
||||
// This function executes the process handlers and inserts the contents
|
||||
// force_rich overrides plain text mode set by user, important for pasting with execCommand
|
||||
function process(o, force_rich) {
|
||||
var dom = ed.dom, rng;
|
||||
|
||||
// Execute pre process handlers
|
||||
t.onPreProcess.dispatch(t, o);
|
||||
|
||||
// Create DOM structure
|
||||
o.node = dom.create('div', 0, o.content);
|
||||
|
||||
// If pasting inside the same element and the contents is only one block
|
||||
// remove the block and keep the text since Firefox will copy parts of pre and h1-h6 as a pre element
|
||||
if (tinymce.isGecko) {
|
||||
rng = ed.selection.getRng(true);
|
||||
if (rng.startContainer == rng.endContainer && rng.startContainer.nodeType == 3) {
|
||||
// Is only one block node and it doesn't contain word stuff
|
||||
if (o.node.childNodes.length === 1 && /^(p|h[1-6]|pre)$/i.test(o.node.firstChild.nodeName) && o.content.indexOf('__MCE_ITEM__') === -1)
|
||||
dom.remove(o.node.firstChild, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Execute post process handlers
|
||||
t.onPostProcess.dispatch(t, o);
|
||||
|
||||
// Serialize content
|
||||
o.content = ed.serializer.serialize(o.node, {getInner : 1, forced_root_block : ''});
|
||||
|
||||
// Plain text option active?
|
||||
if ((!force_rich) && (ed.pasteAsPlainText)) {
|
||||
t._insertPlainText(o.content);
|
||||
|
||||
if (!getParam(ed, "paste_text_sticky")) {
|
||||
ed.pasteAsPlainText = false;
|
||||
ed.controlManager.setActive("pastetext", false);
|
||||
}
|
||||
} else {
|
||||
t._insert(o.content);
|
||||
}
|
||||
}
|
||||
|
||||
// Add command for external usage
|
||||
ed.addCommand('mceInsertClipboardContent', function(u, o) {
|
||||
process(o, true);
|
||||
});
|
||||
|
||||
if (!getParam(ed, "paste_text_use_dialog")) {
|
||||
ed.addCommand('mcePasteText', function(u, v) {
|
||||
var cookie = tinymce.util.Cookie;
|
||||
|
||||
ed.pasteAsPlainText = !ed.pasteAsPlainText;
|
||||
ed.controlManager.setActive('pastetext', ed.pasteAsPlainText);
|
||||
|
||||
if ((ed.pasteAsPlainText) && (!cookie.get("tinymcePasteText"))) {
|
||||
if (getParam(ed, "paste_text_sticky")) {
|
||||
ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky'));
|
||||
} else {
|
||||
ed.windowManager.alert(ed.translate('paste.plaintext_mode'));
|
||||
}
|
||||
|
||||
if (!getParam(ed, "paste_text_notifyalways")) {
|
||||
cookie.set("tinymcePasteText", "1", new Date(new Date().getFullYear() + 1, 12, 31))
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ed.addButton('pastetext', {title: 'paste.paste_text_desc', cmd: 'mcePasteText'});
|
||||
ed.addButton('selectall', {title: 'paste.selectall_desc', cmd: 'selectall'});
|
||||
|
||||
// This function grabs the contents from the clipboard by adding a
|
||||
// hidden div and placing the caret inside it and after the browser paste
|
||||
// is done it grabs that contents and processes that
|
||||
function grabContent(e) {
|
||||
var n, or, rng, oldRng, sel = ed.selection, dom = ed.dom, body = ed.getBody(), posY, textContent;
|
||||
|
||||
// Check if browser supports direct plaintext access
|
||||
if (e.clipboardData || dom.doc.dataTransfer) {
|
||||
// Added by Zotero
|
||||
// Get HTML from the clipboard directly
|
||||
var html = e.clipboardData && e.clipboardData.getData('text/html');
|
||||
if (html) {
|
||||
e.preventDefault();
|
||||
process({content : html});
|
||||
return;
|
||||
}
|
||||
|
||||
textContent = (e.clipboardData || dom.doc.dataTransfer).getData('Text');
|
||||
|
||||
if (ed.pasteAsPlainText) {
|
||||
e.preventDefault();
|
||||
process({content : dom.encode(textContent).replace(/\r?\n/g, '<br />')});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (dom.get('_mcePaste'))
|
||||
return;
|
||||
|
||||
// Create container to paste into
|
||||
n = dom.add(body, 'div', {id : '_mcePaste', 'class' : 'mcePaste', 'data-mce-bogus' : '1'}, '\uFEFF\uFEFF');
|
||||
|
||||
// If contentEditable mode we need to find out the position of the closest element
|
||||
if (body != ed.getDoc().body)
|
||||
posY = dom.getPos(ed.selection.getStart(), body).y;
|
||||
else
|
||||
posY = body.scrollTop + dom.getViewPort(ed.getWin()).y;
|
||||
|
||||
// Styles needs to be applied after the element is added to the document since WebKit will otherwise remove all styles
|
||||
// If also needs to be in view on IE or the paste would fail
|
||||
dom.setStyles(n, {
|
||||
position : 'absolute',
|
||||
left : tinymce.isGecko ? -40 : 0, // Need to move it out of site on Gecko since it will othewise display a ghost resize rect for the div
|
||||
top : posY - 25,
|
||||
width : 1,
|
||||
height : 1,
|
||||
overflow : 'hidden'
|
||||
});
|
||||
|
||||
if (tinymce.isIE) {
|
||||
// Store away the old range
|
||||
oldRng = sel.getRng();
|
||||
|
||||
// Select the container
|
||||
rng = dom.doc.body.createTextRange();
|
||||
rng.moveToElementText(n);
|
||||
rng.execCommand('Paste');
|
||||
|
||||
// Remove container
|
||||
dom.remove(n);
|
||||
|
||||
// Check if the contents was changed, if it wasn't then clipboard extraction failed probably due
|
||||
// to IE security settings so we pass the junk though better than nothing right
|
||||
if (n.innerHTML === '\uFEFF\uFEFF') {
|
||||
ed.execCommand('mcePasteWord');
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
// Restore the old range and clear the contents before pasting
|
||||
sel.setRng(oldRng);
|
||||
sel.setContent('');
|
||||
|
||||
// For some odd reason we need to detach the the mceInsertContent call from the paste event
|
||||
// It's like IE has a reference to the parent element that you paste in and the selection gets messed up
|
||||
// when it tries to restore the selection
|
||||
setTimeout(function() {
|
||||
// Process contents
|
||||
process({content : n.innerHTML});
|
||||
}, 0);
|
||||
|
||||
// Block the real paste event
|
||||
return tinymce.dom.Event.cancel(e);
|
||||
} else {
|
||||
function block(e) {
|
||||
e.preventDefault();
|
||||
};
|
||||
|
||||
// Block mousedown and click to prevent selection change
|
||||
dom.bind(ed.getDoc(), 'mousedown', block);
|
||||
dom.bind(ed.getDoc(), 'keydown', block);
|
||||
|
||||
or = ed.selection.getRng();
|
||||
|
||||
// Move select contents inside DIV
|
||||
n = n.firstChild;
|
||||
rng = ed.getDoc().createRange();
|
||||
rng.setStart(n, 0);
|
||||
rng.setEnd(n, 2);
|
||||
sel.setRng(rng);
|
||||
|
||||
// Wait a while and grab the pasted contents
|
||||
window.setTimeout(function() {
|
||||
var h = '', nl;
|
||||
|
||||
// Paste divs duplicated in paste divs seems to happen when you paste plain text so lets first look for that broken behavior in WebKit
|
||||
if (!dom.select('div.mcePaste > div.mcePaste').length) {
|
||||
nl = dom.select('div.mcePaste');
|
||||
|
||||
// WebKit will split the div into multiple ones so this will loop through then all and join them to get the whole HTML string
|
||||
each(nl, function(n) {
|
||||
var child = n.firstChild;
|
||||
|
||||
// WebKit inserts a DIV container with lots of odd styles
|
||||
if (child && child.nodeName == 'DIV' && child.style.marginTop && child.style.backgroundColor) {
|
||||
dom.remove(child, 1);
|
||||
}
|
||||
|
||||
// Remove apply style spans
|
||||
each(dom.select('span.Apple-style-span', n), function(n) {
|
||||
dom.remove(n, 1);
|
||||
});
|
||||
|
||||
// Remove bogus br elements
|
||||
each(dom.select('br[data-mce-bogus]', n), function(n) {
|
||||
dom.remove(n);
|
||||
});
|
||||
|
||||
// WebKit will make a copy of the DIV for each line of plain text pasted and insert them into the DIV
|
||||
if (n.parentNode.className != 'mcePaste')
|
||||
h += n.innerHTML;
|
||||
});
|
||||
} else {
|
||||
// Found WebKit weirdness so force the content into paragraphs this seems to happen when you paste plain text from Nodepad etc
|
||||
// So this logic will replace double enter with paragraphs and single enter with br so it kind of looks the same
|
||||
h = '<p>' + dom.encode(textContent).replace(/\r?\n\r?\n/g, '</p><p>').replace(/\r?\n/g, '<br />') + '</p>';
|
||||
}
|
||||
|
||||
// Remove the nodes
|
||||
each(dom.select('div.mcePaste'), function(n) {
|
||||
dom.remove(n);
|
||||
});
|
||||
|
||||
// Restore the old selection
|
||||
if (or)
|
||||
sel.setRng(or);
|
||||
|
||||
process({content : h});
|
||||
|
||||
// Unblock events ones we got the contents
|
||||
dom.unbind(ed.getDoc(), 'mousedown', block);
|
||||
dom.unbind(ed.getDoc(), 'keydown', block);
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we should use the new auto process method
|
||||
if (getParam(ed, "paste_auto_cleanup_on_paste")) {
|
||||
// Is it's Opera or older FF use key handler
|
||||
if (tinymce.isOpera || /Firefox\/2/.test(navigator.userAgent)) {
|
||||
ed.onKeyDown.addToTop(function(ed, e) {
|
||||
if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))
|
||||
grabContent(e);
|
||||
});
|
||||
} else {
|
||||
// Grab contents on paste event on Gecko and WebKit
|
||||
ed.onPaste.addToTop(function(ed, e) {
|
||||
return grabContent(e);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
ed.onInit.add(function() {
|
||||
ed.controlManager.setActive("pastetext", ed.pasteAsPlainText);
|
||||
|
||||
// Block all drag/drop events
|
||||
if (getParam(ed, "paste_block_drop")) {
|
||||
ed.dom.bind(ed.getBody(), ['dragend', 'dragover', 'draggesture', 'dragdrop', 'drop', 'drag'], function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Add legacy support
|
||||
t._legacySupport();
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Paste text/word',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
_preProcess : function(pl, o) {
|
||||
var ed = this.editor,
|
||||
h = o.content,
|
||||
grep = tinymce.grep,
|
||||
explode = tinymce.explode,
|
||||
trim = tinymce.trim,
|
||||
len, stripClass;
|
||||
|
||||
//console.log('Before preprocess:' + o.content);
|
||||
|
||||
function process(items) {
|
||||
each(items, function(v) {
|
||||
// Remove or replace
|
||||
if (v.constructor == RegExp)
|
||||
h = h.replace(v, '');
|
||||
else
|
||||
h = h.replace(v[0], v[1]);
|
||||
});
|
||||
}
|
||||
|
||||
if (ed.settings.paste_enable_default_filters == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
// IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser
|
||||
if (tinymce.isIE && document.documentMode >= 9 && /<(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)/.test(o.content)) {
|
||||
// IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser
|
||||
process([[/(?:<br> [\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br> [\s\r\n]+|<br>)*/g, '$1']]);
|
||||
|
||||
// IE9 also adds an extra BR element for each soft-linefeed and it also adds a BR for each word wrap break
|
||||
process([
|
||||
[/<br><br>/g, '<BR><BR>'], // Replace multiple BR elements with uppercase BR to keep them intact
|
||||
[/<br>/g, ' '], // Replace single br elements with space since they are word wrap BR:s
|
||||
[/<BR><BR>/g, '<br>'] // Replace back the double brs but into a single BR
|
||||
]);
|
||||
}
|
||||
|
||||
// Detect Word content and process it more aggressive
|
||||
if (/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(h) || o.wordContent) {
|
||||
o.wordContent = true; // Mark the pasted contents as word specific content
|
||||
//console.log('Word contents detected.');
|
||||
|
||||
// Process away some basic content
|
||||
process([
|
||||
/^\s*( )+/gi, // entities at the start of contents
|
||||
/( |<br[^>]*>)+\s*$/gi // entities at the end of contents
|
||||
]);
|
||||
|
||||
if (getParam(ed, "paste_convert_headers_to_strong")) {
|
||||
h = h.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi, "<p><strong>$1</strong></p>");
|
||||
}
|
||||
|
||||
if (getParam(ed, "paste_convert_middot_lists")) {
|
||||
process([
|
||||
[/<!--\[if !supportLists\]-->/gi, '$&__MCE_ITEM__'], // Convert supportLists to a list item marker
|
||||
[/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi, '$1__MCE_ITEM__'], // Convert mso-list and symbol spans to item markers
|
||||
[/(<p[^>]+(?:MsoListParagraph)[^>]+>)/gi, '$1__MCE_ITEM__'] // Convert mso-list and symbol paragraphs to item markers (FF)
|
||||
]);
|
||||
}
|
||||
|
||||
process([
|
||||
// Word comments like conditional comments etc
|
||||
/<!--[\s\S]+?-->/gi,
|
||||
|
||||
// Remove comments, scripts (e.g., msoShowComment), XML tag, VML content, MS Office namespaced tags, and a few other tags
|
||||
/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,
|
||||
|
||||
// Convert <s> into <strike> for line-though
|
||||
[/<(\/?)s>/gi, "<$1strike>"],
|
||||
|
||||
// Replace nsbp entites to char since it's easier to handle
|
||||
[/ /gi, "\u00a0"]
|
||||
]);
|
||||
|
||||
// Remove bad attributes, with or without quotes, ensuring that attribute text is really inside a tag.
|
||||
// If JavaScript had a RegExp look-behind, we could have integrated this with the last process() array and got rid of the loop. But alas, it does not, so we cannot.
|
||||
do {
|
||||
len = h.length;
|
||||
// Don't remove the type attribute for lists so that non-default list types display correctly.
|
||||
h = h.replace(/(<?!(ol|ul)[^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1");
|
||||
h = h.replace(/(<(ol|ul)[^>]*\s)(?:id|name|language|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1");
|
||||
} while (len != h.length);
|
||||
|
||||
// Remove all spans if no styles is to be retained
|
||||
if (getParam(ed, "paste_retain_style_properties").replace(/^none$/i, "").length == 0) {
|
||||
h = h.replace(/<\/?span[^>]*>/gi, "");
|
||||
} else {
|
||||
// We're keeping styles, so at least clean them up.
|
||||
// CSS Reference: http://msdn.microsoft.com/en-us/library/aa155477.aspx
|
||||
|
||||
process([
|
||||
// Convert <span style="mso-spacerun:yes">___</span> to string of alternating breaking/non-breaking spaces of same length
|
||||
[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,
|
||||
function(str, spaces) {
|
||||
return (spaces.length > 0)? spaces.replace(/./, " ").slice(Math.floor(spaces.length/2)).split("").join("\u00a0") : "";
|
||||
}
|
||||
],
|
||||
|
||||
// Examine all styles: delete junk, transform some, and keep the rest
|
||||
[/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,
|
||||
function(str, tag, style) {
|
||||
var n = [],
|
||||
i = 0,
|
||||
s = explode(trim(style).replace(/"/gi, "'"), ";");
|
||||
|
||||
// Examine each style definition within the tag's style attribute
|
||||
each(s, function(v) {
|
||||
var name, value,
|
||||
parts = explode(v, ":");
|
||||
|
||||
function ensureUnits(v) {
|
||||
return v + ((v !== "0") && (/\d$/.test(v)))? "px" : "";
|
||||
}
|
||||
|
||||
if (parts.length == 2) {
|
||||
name = parts[0].toLowerCase();
|
||||
value = parts[1].toLowerCase();
|
||||
|
||||
// Translate certain MS Office styles into their CSS equivalents
|
||||
switch (name) {
|
||||
case "mso-padding-alt":
|
||||
case "mso-padding-top-alt":
|
||||
case "mso-padding-right-alt":
|
||||
case "mso-padding-bottom-alt":
|
||||
case "mso-padding-left-alt":
|
||||
case "mso-margin-alt":
|
||||
case "mso-margin-top-alt":
|
||||
case "mso-margin-right-alt":
|
||||
case "mso-margin-bottom-alt":
|
||||
case "mso-margin-left-alt":
|
||||
case "mso-table-layout-alt":
|
||||
case "mso-height":
|
||||
case "mso-width":
|
||||
case "mso-vertical-align-alt":
|
||||
n[i++] = name.replace(/^mso-|-alt$/g, "") + ":" + ensureUnits(value);
|
||||
return;
|
||||
|
||||
case "horiz-align":
|
||||
n[i++] = "text-align:" + value;
|
||||
return;
|
||||
|
||||
case "vert-align":
|
||||
n[i++] = "vertical-align:" + value;
|
||||
return;
|
||||
|
||||
case "font-color":
|
||||
case "mso-foreground":
|
||||
n[i++] = "color:" + value;
|
||||
return;
|
||||
|
||||
case "mso-background":
|
||||
case "mso-highlight":
|
||||
n[i++] = "background:" + value;
|
||||
return;
|
||||
|
||||
case "mso-default-height":
|
||||
n[i++] = "min-height:" + ensureUnits(value);
|
||||
return;
|
||||
|
||||
case "mso-default-width":
|
||||
n[i++] = "min-width:" + ensureUnits(value);
|
||||
return;
|
||||
|
||||
case "mso-padding-between-alt":
|
||||
n[i++] = "border-collapse:separate;border-spacing:" + ensureUnits(value);
|
||||
return;
|
||||
|
||||
case "text-line-through":
|
||||
if ((value == "single") || (value == "double")) {
|
||||
n[i++] = "text-decoration:line-through";
|
||||
}
|
||||
return;
|
||||
|
||||
case "mso-zero-height":
|
||||
if (value == "yes") {
|
||||
n[i++] = "display:none";
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Eliminate all MS Office style definitions that have no CSS equivalent by examining the first characters in the name
|
||||
if (/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/.test(name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If it reached this point, it must be a valid CSS style
|
||||
n[i++] = name + ":" + parts[1]; // Lower-case name, but keep value case
|
||||
}
|
||||
});
|
||||
|
||||
// If style attribute contained any valid styles the re-write it; otherwise delete style attribute.
|
||||
if (i > 0) {
|
||||
return tag + ' style="' + n.join(';') + '"';
|
||||
} else {
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// Replace headers with <strong>
|
||||
if (getParam(ed, "paste_convert_headers_to_strong")) {
|
||||
process([
|
||||
[/<h[1-6][^>]*>/gi, "<p><strong>"],
|
||||
[/<\/h[1-6][^>]*>/gi, "</strong></p>"]
|
||||
]);
|
||||
}
|
||||
|
||||
process([
|
||||
// Copy paste from Java like Open Office will produce this junk on FF
|
||||
[/Version:[\d.]+\nStartHTML:\d+\nEndHTML:\d+\nStartFragment:\d+\nEndFragment:\d+/gi, '']
|
||||
]);
|
||||
|
||||
// Class attribute options are: leave all as-is ("none"), remove all ("all"), or remove only those starting with mso ("mso").
|
||||
// Note:- paste_strip_class_attributes: "none", verify_css_classes: true is also a good variation.
|
||||
stripClass = getParam(ed, "paste_strip_class_attributes");
|
||||
|
||||
if (stripClass !== "none") {
|
||||
function removeClasses(match, g1) {
|
||||
if (stripClass === "all")
|
||||
return '';
|
||||
|
||||
var cls = grep(explode(g1.replace(/^(["'])(.*)\1$/, "$2"), " "),
|
||||
function(v) {
|
||||
return (/^(?!mso)/i.test(v));
|
||||
}
|
||||
);
|
||||
|
||||
return cls.length ? ' class="' + cls.join(" ") + '"' : '';
|
||||
};
|
||||
|
||||
h = h.replace(/ class="([^"]+)"/gi, removeClasses);
|
||||
h = h.replace(/ class=([\-\w]+)/gi, removeClasses);
|
||||
}
|
||||
|
||||
// Remove spans option
|
||||
if (getParam(ed, "paste_remove_spans")) {
|
||||
h = h.replace(/<\/?span[^>]*>/gi, "");
|
||||
}
|
||||
|
||||
//console.log('After preprocess:' + h);
|
||||
|
||||
o.content = h;
|
||||
},
|
||||
|
||||
/**
|
||||
* Various post process items.
|
||||
*/
|
||||
_postProcess : function(pl, o) {
|
||||
var t = this, ed = t.editor, dom = ed.dom, styleProps;
|
||||
|
||||
if (ed.settings.paste_enable_default_filters == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (o.wordContent) {
|
||||
// Remove named anchors or TOC links
|
||||
each(dom.select('a', o.node), function(a) {
|
||||
if (!a.href || a.href.indexOf('#_Toc') != -1)
|
||||
dom.remove(a, 1);
|
||||
});
|
||||
|
||||
if (getParam(ed, "paste_convert_middot_lists")) {
|
||||
t._convertLists(pl, o);
|
||||
}
|
||||
|
||||
// Process styles
|
||||
styleProps = getParam(ed, "paste_retain_style_properties"); // retained properties
|
||||
|
||||
// Process only if a string was specified and not equal to "all" or "*"
|
||||
if ((tinymce.is(styleProps, "string")) && (styleProps !== "all") && (styleProps !== "*")) {
|
||||
styleProps = tinymce.explode(styleProps.replace(/^none$/i, ""));
|
||||
|
||||
// Retains some style properties
|
||||
each(dom.select('*', o.node), function(el) {
|
||||
var newStyle = {}, npc = 0, i, sp, sv;
|
||||
|
||||
// Store a subset of the existing styles
|
||||
if (styleProps) {
|
||||
for (i = 0; i < styleProps.length; i++) {
|
||||
sp = styleProps[i];
|
||||
sv = dom.getStyle(el, sp);
|
||||
|
||||
if (sv) {
|
||||
newStyle[sp] = sv;
|
||||
npc++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all of the existing styles
|
||||
dom.setAttrib(el, 'style', '');
|
||||
|
||||
if (styleProps && npc > 0)
|
||||
dom.setStyles(el, newStyle); // Add back the stored subset of styles
|
||||
else // Remove empty span tags that do not have class attributes
|
||||
if (el.nodeName == 'SPAN' && !el.className)
|
||||
dom.remove(el, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all style information or only specifically on WebKit to avoid the style bug on that browser
|
||||
if (getParam(ed, "paste_remove_styles") || (getParam(ed, "paste_remove_styles_if_webkit") && tinymce.isWebKit)) {
|
||||
each(dom.select('*[style]', o.node), function(el) {
|
||||
el.removeAttribute('style');
|
||||
el.removeAttribute('data-mce-style');
|
||||
});
|
||||
} else {
|
||||
if (tinymce.isWebKit) {
|
||||
// We need to compress the styles on WebKit since if you paste <img border="0" /> it will become <img border="0" style="... lots of junk ..." />
|
||||
// Removing the mce_style that contains the real value will force the Serializer engine to compress the styles
|
||||
each(dom.select('*', o.node), function(el) {
|
||||
el.removeAttribute('data-mce-style');
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts the most common bullet and number formats in Office into a real semantic UL/LI list.
|
||||
*/
|
||||
_convertLists : function(pl, o) {
|
||||
var dom = pl.editor.dom, listElm, li, lastMargin = -1, margin, levels = [], lastType, html;
|
||||
|
||||
// Convert middot lists into real semantic lists
|
||||
each(dom.select('p', o.node), function(p) {
|
||||
var sib, val = '', type, html, idx, parents;
|
||||
|
||||
// Get text node value at beginning of paragraph
|
||||
for (sib = p.firstChild; sib && sib.nodeType == 3; sib = sib.nextSibling)
|
||||
val += sib.nodeValue;
|
||||
|
||||
val = p.innerHTML.replace(/<\/?\w+[^>]*>/gi, '').replace(/ /g, '\u00a0');
|
||||
|
||||
// Detect unordered lists look for bullets
|
||||
if (/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*\u00a0*/.test(val))
|
||||
type = 'ul';
|
||||
|
||||
// Detect ordered lists 1., a. or ixv.
|
||||
if (/^__MCE_ITEM__\s*\w+\.\s*\u00a0+/.test(val))
|
||||
type = 'ol';
|
||||
|
||||
// Check if node value matches the list pattern: o
|
||||
if (type) {
|
||||
margin = parseFloat(p.style.marginLeft || 0);
|
||||
|
||||
if (margin > lastMargin)
|
||||
levels.push(margin);
|
||||
|
||||
if (!listElm || type != lastType) {
|
||||
listElm = dom.create(type);
|
||||
dom.insertAfter(listElm, p);
|
||||
} else {
|
||||
// Nested list element
|
||||
if (margin > lastMargin) {
|
||||
listElm = li.appendChild(dom.create(type));
|
||||
} else if (margin < lastMargin) {
|
||||
// Find parent level based on margin value
|
||||
idx = tinymce.inArray(levels, margin);
|
||||
parents = dom.getParents(listElm.parentNode, type);
|
||||
listElm = parents[parents.length - 1 - idx] || listElm;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove middot or number spans if they exists
|
||||
each(dom.select('span', p), function(span) {
|
||||
var html = span.innerHTML.replace(/<\/?\w+[^>]*>/gi, '');
|
||||
|
||||
// Remove span with the middot or the number
|
||||
if (type == 'ul' && /^__MCE_ITEM__[\u2022\u00b7\u00a7\u00d8o\u25CF]/.test(html))
|
||||
dom.remove(span);
|
||||
else if (/^__MCE_ITEM__[\s\S]*\w+\.( |\u00a0)*\s*/.test(html))
|
||||
dom.remove(span);
|
||||
});
|
||||
|
||||
html = p.innerHTML;
|
||||
|
||||
// Remove middot/list items
|
||||
if (type == 'ul')
|
||||
html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*( |\u00a0)+\s*/, '');
|
||||
else
|
||||
html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^\s*\w+\.( |\u00a0)+\s*/, '');
|
||||
|
||||
// Create li and add paragraph data into the new li
|
||||
li = listElm.appendChild(dom.create('li', 0, html));
|
||||
dom.remove(p);
|
||||
|
||||
lastMargin = margin;
|
||||
lastType = type;
|
||||
} else
|
||||
listElm = lastMargin = 0; // End list element
|
||||
});
|
||||
|
||||
// Remove any left over makers
|
||||
html = o.node.innerHTML;
|
||||
if (html.indexOf('__MCE_ITEM__') != -1)
|
||||
o.node.innerHTML = html.replace(/__MCE_ITEM__/g, '');
|
||||
},
|
||||
|
||||
/**
|
||||
* Inserts the specified contents at the caret position.
|
||||
*/
|
||||
_insert : function(h, skip_undo) {
|
||||
var ed = this.editor, r = ed.selection.getRng();
|
||||
|
||||
// First delete the contents seems to work better on WebKit when the selection spans multiple list items or multiple table cells.
|
||||
if (!ed.selection.isCollapsed() && r.startContainer != r.endContainer)
|
||||
ed.getDoc().execCommand('Delete', false, null);
|
||||
|
||||
ed.execCommand('mceInsertContent', false, h, {skip_undo : skip_undo});
|
||||
},
|
||||
|
||||
/**
|
||||
* Instead of the old plain text method which tried to re-create a paste operation, the
|
||||
* new approach adds a plain text mode toggle switch that changes the behavior of paste.
|
||||
* This function is passed the same input that the regular paste plugin produces.
|
||||
* It performs additional scrubbing and produces (and inserts) the plain text.
|
||||
* This approach leverages all of the great existing functionality in the paste
|
||||
* plugin, and requires minimal changes to add the new functionality.
|
||||
* Speednet - June 2009
|
||||
*/
|
||||
_insertPlainText : function(content) {
|
||||
var ed = this.editor,
|
||||
linebr = getParam(ed, "paste_text_linebreaktype"),
|
||||
rl = getParam(ed, "paste_text_replacements"),
|
||||
is = tinymce.is;
|
||||
|
||||
function process(items) {
|
||||
each(items, function(v) {
|
||||
if (v.constructor == RegExp)
|
||||
content = content.replace(v, "");
|
||||
else
|
||||
content = content.replace(v[0], v[1]);
|
||||
});
|
||||
};
|
||||
|
||||
if ((typeof(content) === "string") && (content.length > 0)) {
|
||||
// If HTML content with line-breaking tags, then remove all cr/lf chars because only tags will break a line
|
||||
if (/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(content)) {
|
||||
process([
|
||||
/[\n\r]+/g
|
||||
]);
|
||||
} else {
|
||||
// Otherwise just get rid of carriage returns (only need linefeeds)
|
||||
process([
|
||||
/\r+/g
|
||||
]);
|
||||
}
|
||||
|
||||
process([
|
||||
[/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi, "\n\n"], // Block tags get a blank line after them
|
||||
[/<br[^>]*>|<\/tr>/gi, "\n"], // Single linebreak for <br /> tags and table rows
|
||||
[/<\/t[dh]>\s*<t[dh][^>]*>/gi, "\t"], // Table cells get tabs betweem them
|
||||
/<[a-z!\/?][^>]*>/gi, // Delete all remaining tags
|
||||
[/ /gi, " "], // Convert non-break spaces to regular spaces (remember, *plain text*)
|
||||
[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"] // Cool little RegExp deletes whitespace around linebreak chars.
|
||||
]);
|
||||
|
||||
var maxLinebreaks = Number(getParam(ed, "paste_max_consecutive_linebreaks"));
|
||||
if (maxLinebreaks > -1) {
|
||||
var maxLinebreaksRegex = new RegExp("\n{" + (maxLinebreaks + 1) + ",}", "g");
|
||||
var linebreakReplacement = "";
|
||||
|
||||
while (linebreakReplacement.length < maxLinebreaks) {
|
||||
linebreakReplacement += "\n";
|
||||
}
|
||||
|
||||
process([
|
||||
[maxLinebreaksRegex, linebreakReplacement] // Limit max consecutive linebreaks
|
||||
]);
|
||||
}
|
||||
|
||||
content = ed.dom.decode(tinymce.html.Entities.encodeRaw(content));
|
||||
|
||||
// Perform default or custom replacements
|
||||
if (is(rl, "array")) {
|
||||
process(rl);
|
||||
} else if (is(rl, "string")) {
|
||||
process(new RegExp(rl, "gi"));
|
||||
}
|
||||
|
||||
// Treat paragraphs as specified in the config
|
||||
if (linebr == "none") {
|
||||
// Convert all line breaks to space
|
||||
process([
|
||||
[/\n+/g, " "]
|
||||
]);
|
||||
} else if (linebr == "br") {
|
||||
// Convert all line breaks to <br />
|
||||
process([
|
||||
[/\n/g, "<br />"]
|
||||
]);
|
||||
} else if (linebr == "p") {
|
||||
// Convert all line breaks to <p>...</p>
|
||||
process([
|
||||
[/\n+/g, "</p><p>"],
|
||||
[/^(.*<\/p>)(<p>)$/, '<p>$1']
|
||||
]);
|
||||
} else {
|
||||
// defaults to "combined"
|
||||
// Convert single line breaks to <br /> and double line breaks to <p>...</p>
|
||||
process([
|
||||
[/\n\n/g, "</p><p>"],
|
||||
[/^(.*<\/p>)(<p>)$/, '<p>$1'],
|
||||
[/\n/g, "<br />"]
|
||||
]);
|
||||
}
|
||||
|
||||
ed.execCommand('mceInsertContent', false, content);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* This method will open the old style paste dialogs. Some users might want the old behavior but still use the new cleanup engine.
|
||||
*/
|
||||
_legacySupport : function() {
|
||||
var t = this, ed = t.editor;
|
||||
|
||||
// Register command(s) for backwards compatibility
|
||||
ed.addCommand("mcePasteWord", function() {
|
||||
ed.windowManager.open({
|
||||
file: t.url + "/pasteword.htm",
|
||||
width: parseInt(getParam(ed, "paste_dialog_width")),
|
||||
height: parseInt(getParam(ed, "paste_dialog_height")),
|
||||
inline: 1
|
||||
});
|
||||
});
|
||||
|
||||
if (getParam(ed, "paste_text_use_dialog")) {
|
||||
ed.addCommand("mcePasteText", function() {
|
||||
ed.windowManager.open({
|
||||
file : t.url + "/pastetext.htm",
|
||||
width: parseInt(getParam(ed, "paste_dialog_width")),
|
||||
height: parseInt(getParam(ed, "paste_dialog_height")),
|
||||
inline : 1
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Register button for backwards compatibility
|
||||
ed.addButton("pasteword", {title : "paste.paste_word_desc", cmd : "mcePasteWord"});
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add("paste", tinymce.plugins.PastePlugin);
|
||||
})();
|
1856
resource/tinymce/plugins/paste/plugin.js
Normal file
609
resource/tinymce/plugins/searchreplace/plugin.js
Normal file
|
@ -0,0 +1,609 @@
|
|||
/**
|
||||
* 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/skins/lightgray/content.min.css
vendored
Normal file
|
@ -0,0 +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 .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-preview-object[data-mce-selected="2"] .mce-shim{display: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}
|
BIN
resource/tinymce/skins/lightgray/fonts/tinymce-small.woff
Normal file
BIN
resource/tinymce/skins/lightgray/fonts/tinymce.woff
Normal file
BIN
resource/tinymce/skins/lightgray/img/anchor.gif
Normal file
After Width: | Height: | Size: 53 B |
BIN
resource/tinymce/skins/lightgray/img/loader.gif
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
resource/tinymce/skins/lightgray/img/object.gif
Normal file
After Width: | Height: | Size: 152 B |
BIN
resource/tinymce/skins/lightgray/img/trans.gif
Normal file
After Width: | Height: | Size: 43 B |
1
resource/tinymce/skins/lightgray/skin.min.css
vendored
Normal file
|
@ -1,52 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#advanced_dlg.about_title}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="../../utils/mctabs.js"></script>
|
||||
<script type="text/javascript" src="js/about.js"></script>
|
||||
</head>
|
||||
<body id="about" style="display: none">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.about_general}</a></span></li>
|
||||
<li id="help_tab" style="display:none" aria-hidden="true" aria-controls="help_panel"><span><a href="javascript:mcTabs.displayTab('help_tab','help_panel');" onmousedown="return false;">{#advanced_dlg.about_help}</a></span></li>
|
||||
<li id="plugins_tab" aria-controls="plugins_panel"><span><a href="javascript:mcTabs.displayTab('plugins_tab','plugins_panel');" onmousedown="return false;">{#advanced_dlg.about_plugins}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel_wrapper">
|
||||
<div id="general_panel" class="panel current">
|
||||
<h3>{#advanced_dlg.about_title}</h3>
|
||||
<p>Version: <span id="version"></span> (<span id="date"></span>)</p>
|
||||
<p>TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under <a href="../../license.txt" target="_blank">LGPL</a>
|
||||
by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.</p>
|
||||
<p>Copyright © 2003-2008, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.</p>
|
||||
<p>For more information about this software visit the <a href="http://tinymce.moxiecode.com" target="_blank">TinyMCE website</a>.</p>
|
||||
|
||||
<div id="buttoncontainer">
|
||||
<a href="http://www.moxiecode.com" target="_blank"><img src="http://tinymce.moxiecode.com/images/gotmoxie.png" alt="Got Moxie?" border="0" /></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="plugins_panel" class="panel">
|
||||
<div id="pluginscontainer">
|
||||
<h3>{#advanced_dlg.about_loaded}</h3>
|
||||
|
||||
<div id="plugintablecontainer">
|
||||
</div>
|
||||
|
||||
<p> </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="help_panel" class="panel noscroll" style="overflow: visible;">
|
||||
<div id="iframecontainer"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<input type="button" id="cancel" name="cancel" value="{#close}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,26 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#advanced_dlg.anchor_title}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="js/anchor.js"></script>
|
||||
</head>
|
||||
<body style="display: none" role="application" aria-labelledby="app_title">
|
||||
<form onsubmit="AnchorDialog.update();return false;" action="#">
|
||||
<table border="0" cellpadding="4" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
<td colspan="2" class="title" id="app_title">{#advanced_dlg.anchor_title}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><label for="anchorName">{#advanced_dlg.anchor_name}:</label></td>
|
||||
<td><input name="anchorName" type="text" class="mceFocus" id="anchorName" value="" style="width: 200px" aria-required="true" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<input type="submit" id="insert" name="insert" value="{#update}" />
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
|
@ -1,55 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#advanced_dlg.charmap_title}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="js/charmap.js"></script>
|
||||
</head>
|
||||
<body id="charmap" style="display:none" role="application">
|
||||
<table align="center" border="0" cellspacing="0" cellpadding="2" role="presentation">
|
||||
<tr>
|
||||
<td colspan="2" class="title" ><label for="charmapView" id="charmap_label">{#advanced_dlg.charmap_title}</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="charmapView" rowspan="2" align="left" valign="top">
|
||||
<!-- Chars will be rendered here -->
|
||||
</td>
|
||||
<td width="100" align="center" valign="top">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100" style="height:100px" role="presentation">
|
||||
<tr>
|
||||
<td id="codeV"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="codeN"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="bottom" style="padding-bottom: 3px;">
|
||||
<table width="100" align="center" border="0" cellpadding="2" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
<td align="center" style="border-left: 1px solid #666699; border-top: 1px solid #666699; border-right: 1px solid #666699;"><label for="codeA">HTML-Code</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="font-size: 16px; font-weight: bold; border-left: 1px solid #666699; border-bottom: 1px solid #666699; border-right: 1px solid #666699;" id="codeA" align="center"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="font-size: 1px;"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" style="border-left: 1px solid #666699; border-top: 1px solid #666699; border-right: 1px solid #666699;"><label for="codeB">NUM-Code</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="font-size: 16px; font-weight: bold; border-left: 1px solid #666699; border-bottom: 1px solid #666699; border-right: 1px solid #666699;" id="codeB" align="center"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" id="charmap_usage">{#advanced_dlg.charmap_usage}</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -1,71 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!-- Added by Dan S./Zotero -->
|
||||
<title>{#advanced_dlg.colorpicker_title}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="../../utils/mctabs.js"></script>
|
||||
<script type="text/javascript" src="js/color_picker.js"></script>
|
||||
</head>
|
||||
<body id="colorpicker" style="display: none" role="application" aria-labelledby="app_label">
|
||||
<span class="mceVoiceLabel" id="app_label" style="display:none;">{#advanced_dlg.colorpicker_title}</span>
|
||||
<form onsubmit="insertAction();return false" action="#">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li id="picker_tab" aria-controls="picker_panel" class="current"><span><a href="javascript:mcTabs.displayTab('picker_tab','picker_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_picker_tab}</a></span></li>
|
||||
<li id="rgb_tab" aria-controls="rgb_panel"><span><a href="javascript:;" onclick="mcTabs.displayTab('rgb_tab','rgb_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_palette_tab}</a></span></li>
|
||||
<li id="named_tab" aria-controls="named_panel"><span><a href="javascript:;" onclick="javascript:mcTabs.displayTab('named_tab','named_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_named_tab}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel_wrapper">
|
||||
<div id="picker_panel" class="panel current">
|
||||
<fieldset>
|
||||
<legend>{#advanced_dlg.colorpicker_picker_title}</legend>
|
||||
<div id="picker">
|
||||
<img id="colors" src="img/colorpicker.jpg" onclick="computeColor(event)" onmousedown="isMouseDown = true;return false;" onmouseup="isMouseDown = false;" onmousemove="if (isMouseDown && isMouseOver) computeColor(event); return false;" onmouseover="isMouseOver=true;" onmouseout="isMouseOver=false;" alt="" />
|
||||
|
||||
<div id="light">
|
||||
<!-- Will be filled with divs -->
|
||||
</div>
|
||||
|
||||
<br style="clear: both" />
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id="rgb_panel" class="panel">
|
||||
<fieldset>
|
||||
<legend id="webcolors_title">{#advanced_dlg.colorpicker_palette_title}</legend>
|
||||
<div id="webcolors">
|
||||
<!-- Gets filled with web safe colors-->
|
||||
</div>
|
||||
|
||||
<br style="clear: both" />
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id="named_panel" class="panel">
|
||||
<fieldset id="named_picker_label">
|
||||
<legend id="named_title">{#advanced_dlg.colorpicker_named_title}</legend>
|
||||
<div id="namedcolors" role="listbox" tabindex="0" aria-labelledby="named_picker_label">
|
||||
<!-- Gets filled with named colors-->
|
||||
</div>
|
||||
|
||||
<br style="clear: both" />
|
||||
|
||||
<div id="colornamecontainer">
|
||||
{#advanced_dlg.colorpicker_name} <span id="colorname"></span>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<input type="submit" id="insert" name="insert" value="{#apply}" />
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();"/>
|
||||
<div id="preview_wrapper"><div id="previewblock"><label for="color">{#advanced_dlg.colorpicker_color}</label> <input id="color" type="text" size="8" class="text mceFocus" aria-required="true" /></div><span id="preview"></span></div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
|
@ -1,80 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#advanced_dlg.image_title}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="../../utils/mctabs.js"></script>
|
||||
<script type="text/javascript" src="../../utils/form_utils.js"></script>
|
||||
<script type="text/javascript" src="js/image.js"></script>
|
||||
</head>
|
||||
<body id="image" style="display: none">
|
||||
<form onsubmit="ImageDialog.update();return false;" action="#">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.image_title}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel_wrapper">
|
||||
<div id="general_panel" class="panel current">
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="nowrap"><label for="src">{#advanced_dlg.image_src}</label></td>
|
||||
<td><table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input id="src" name="src" type="text" class="mceFocus" value="" style="width: 200px" onchange="ImageDialog.getImageData();" /></td>
|
||||
<td id="srcbrowsercontainer"> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="image_list">{#advanced_dlg.image_list}</label></td>
|
||||
<td><select id="image_list" name="image_list" onchange="document.getElementById('src').value=this.options[this.selectedIndex].value;document.getElementById('alt').value=this.options[this.selectedIndex].text;"></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><label for="alt">{#advanced_dlg.image_alt}</label></td>
|
||||
<td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><label for="align">{#advanced_dlg.image_align}</label></td>
|
||||
<td><select id="align" name="align" onchange="ImageDialog.updateStyle();">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="baseline">{#advanced_dlg.image_align_baseline}</option>
|
||||
<option value="top">{#advanced_dlg.image_align_top}</option>
|
||||
<option value="middle">{#advanced_dlg.image_align_middle}</option>
|
||||
<option value="bottom">{#advanced_dlg.image_align_bottom}</option>
|
||||
<option value="text-top">{#advanced_dlg.image_align_texttop}</option>
|
||||
<option value="text-bottom">{#advanced_dlg.image_align_textbottom}</option>
|
||||
<option value="left">{#advanced_dlg.image_align_left}</option>
|
||||
<option value="right">{#advanced_dlg.image_align_right}</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><label for="width">{#advanced_dlg.image_dimensions}</label></td>
|
||||
<td><input id="width" name="width" type="text" value="" size="3" maxlength="5" />
|
||||
x
|
||||
<input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><label for="border">{#advanced_dlg.image_border}</label></td>
|
||||
<td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><label for="vspace">{#advanced_dlg.image_vspace}</label></td>
|
||||
<td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><label for="hspace">{#advanced_dlg.image_hspace}</label></td>
|
||||
<td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<input type="submit" id="insert" name="insert" value="{#insert}" />
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 12 KiB |
|
@ -1,73 +0,0 @@
|
|||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
function init() {
|
||||
var ed, tcont;
|
||||
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
ed = tinyMCEPopup.editor;
|
||||
|
||||
// Give FF some time
|
||||
window.setTimeout(insertHelpIFrame, 10);
|
||||
|
||||
tcont = document.getElementById('plugintablecontainer');
|
||||
document.getElementById('plugins_tab').style.display = 'none';
|
||||
|
||||
var html = "";
|
||||
html += '<table id="plugintable">';
|
||||
html += '<thead>';
|
||||
html += '<tr>';
|
||||
html += '<td>' + ed.getLang('advanced_dlg.about_plugin') + '</td>';
|
||||
html += '<td>' + ed.getLang('advanced_dlg.about_author') + '</td>';
|
||||
html += '<td>' + ed.getLang('advanced_dlg.about_version') + '</td>';
|
||||
html += '</tr>';
|
||||
html += '</thead>';
|
||||
html += '<tbody>';
|
||||
|
||||
tinymce.each(ed.plugins, function(p, n) {
|
||||
var info;
|
||||
|
||||
if (!p.getInfo)
|
||||
return;
|
||||
|
||||
html += '<tr>';
|
||||
|
||||
info = p.getInfo();
|
||||
|
||||
if (info.infourl != null && info.infourl != '')
|
||||
html += '<td width="50%" title="' + n + '"><a href="' + info.infourl + '" target="_blank">' + info.longname + '</a></td>';
|
||||
else
|
||||
html += '<td width="50%" title="' + n + '">' + info.longname + '</td>';
|
||||
|
||||
if (info.authorurl != null && info.authorurl != '')
|
||||
html += '<td width="35%"><a href="' + info.authorurl + '" target="_blank">' + info.author + '</a></td>';
|
||||
else
|
||||
html += '<td width="35%">' + info.author + '</td>';
|
||||
|
||||
html += '<td width="15%">' + info.version + '</td>';
|
||||
html += '</tr>';
|
||||
|
||||
document.getElementById('plugins_tab').style.display = '';
|
||||
|
||||
});
|
||||
|
||||
html += '</tbody>';
|
||||
html += '</table>';
|
||||
|
||||
tcont.innerHTML = html;
|
||||
|
||||
tinyMCEPopup.dom.get('version').innerHTML = tinymce.majorVersion + "." + tinymce.minorVersion;
|
||||
tinyMCEPopup.dom.get('date').innerHTML = tinymce.releaseDate;
|
||||
}
|
||||
|
||||
function insertHelpIFrame() {
|
||||
var html;
|
||||
|
||||
if (tinyMCEPopup.getParam('docs_url')) {
|
||||
html = '<iframe width="100%" height="300" src="' + tinyMCEPopup.editor.baseURI.toAbsolute(tinyMCEPopup.getParam('docs_url')) + '"></iframe>';
|
||||
document.getElementById('iframecontainer').innerHTML = html;
|
||||
document.getElementById('help_tab').style.display = 'block';
|
||||
document.getElementById('help_tab').setAttribute("aria-hidden", "false");
|
||||
}
|
||||
}
|
||||
|
||||
tinyMCEPopup.onInit.add(init);
|
|
@ -1,56 +0,0 @@
|
|||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
var AnchorDialog = {
|
||||
init : function(ed) {
|
||||
var action, elm, f = document.forms[0];
|
||||
|
||||
this.editor = ed;
|
||||
elm = ed.dom.getParent(ed.selection.getNode(), 'A');
|
||||
v = ed.dom.getAttrib(elm, 'name') || ed.dom.getAttrib(elm, 'id');
|
||||
|
||||
if (v) {
|
||||
this.action = 'update';
|
||||
f.anchorName.value = v;
|
||||
}
|
||||
|
||||
f.insert.value = ed.getLang(elm ? 'update' : 'insert');
|
||||
},
|
||||
|
||||
update : function() {
|
||||
var ed = this.editor, elm, name = document.forms[0].anchorName.value, attribName;
|
||||
|
||||
if (!name || !/^[a-z][a-z0-9\-\_:\.]*$/i.test(name)) {
|
||||
tinyMCEPopup.alert('advanced_dlg.anchor_invalid');
|
||||
return;
|
||||
}
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
|
||||
if (this.action != 'update')
|
||||
ed.selection.collapse(1);
|
||||
|
||||
var aRule = ed.schema.getElementRule('a');
|
||||
if (!aRule || aRule.attributes.name) {
|
||||
attribName = 'name';
|
||||
} else {
|
||||
attribName = 'id';
|
||||
}
|
||||
|
||||
elm = ed.dom.getParent(ed.selection.getNode(), 'A');
|
||||
if (elm) {
|
||||
elm.setAttribute(attribName, name);
|
||||
elm[attribName] = name;
|
||||
ed.undoManager.add();
|
||||
} else {
|
||||
// create with zero-sized nbsp so that in Webkit where anchor is on last line by itself caret cannot be placed after it
|
||||
var attrs = {'class' : 'mceItemAnchor'};
|
||||
attrs[attribName] = name;
|
||||
ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', attrs, '\uFEFF'));
|
||||
ed.nodeChanged();
|
||||
}
|
||||
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
};
|
||||
|
||||
tinyMCEPopup.onInit.add(AnchorDialog.init, AnchorDialog);
|
|
@ -1,363 +0,0 @@
|
|||
/**
|
||||
* charmap.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
var charmap = [
|
||||
[' ', ' ', true, 'no-break space'],
|
||||
['&', '&', true, 'ampersand'],
|
||||
['"', '"', true, 'quotation mark'],
|
||||
// finance
|
||||
['¢', '¢', true, 'cent sign'],
|
||||
['€', '€', true, 'euro sign'],
|
||||
['£', '£', true, 'pound sign'],
|
||||
['¥', '¥', true, 'yen sign'],
|
||||
// signs
|
||||
['©', '©', true, 'copyright sign'],
|
||||
['®', '®', true, 'registered sign'],
|
||||
['™', '™', true, 'trade mark sign'],
|
||||
['‰', '‰', true, 'per mille sign'],
|
||||
['µ', 'µ', true, 'micro sign'],
|
||||
['·', '·', true, 'middle dot'],
|
||||
['•', '•', true, 'bullet'],
|
||||
['…', '…', true, 'three dot leader'],
|
||||
['′', '′', true, 'minutes / feet'],
|
||||
['″', '″', true, 'seconds / inches'],
|
||||
['§', '§', true, 'section sign'],
|
||||
['¶', '¶', true, 'paragraph sign'],
|
||||
['ß', 'ß', true, 'sharp s / ess-zed'],
|
||||
// quotations
|
||||
['‹', '‹', true, 'single left-pointing angle quotation mark'],
|
||||
['›', '›', true, 'single right-pointing angle quotation mark'],
|
||||
['«', '«', true, 'left pointing guillemet'],
|
||||
['»', '»', true, 'right pointing guillemet'],
|
||||
['‘', '‘', true, 'left single quotation mark'],
|
||||
['’', '’', true, 'right single quotation mark'],
|
||||
['“', '“', true, 'left double quotation mark'],
|
||||
['”', '”', true, 'right double quotation mark'],
|
||||
['‚', '‚', true, 'single low-9 quotation mark'],
|
||||
['„', '„', true, 'double low-9 quotation mark'],
|
||||
['<', '<', true, 'less-than sign'],
|
||||
['>', '>', true, 'greater-than sign'],
|
||||
['≤', '≤', true, 'less-than or equal to'],
|
||||
['≥', '≥', true, 'greater-than or equal to'],
|
||||
['–', '–', true, 'en dash'],
|
||||
['—', '—', true, 'em dash'],
|
||||
['¯', '¯', true, 'macron'],
|
||||
['‾', '‾', true, 'overline'],
|
||||
['¤', '¤', true, 'currency sign'],
|
||||
['¦', '¦', true, 'broken bar'],
|
||||
['¨', '¨', true, 'diaeresis'],
|
||||
['¡', '¡', true, 'inverted exclamation mark'],
|
||||
['¿', '¿', true, 'turned question mark'],
|
||||
['ˆ', 'ˆ', true, 'circumflex accent'],
|
||||
['˜', '˜', true, 'small tilde'],
|
||||
['°', '°', true, 'degree sign'],
|
||||
['−', '−', true, 'minus sign'],
|
||||
['±', '±', true, 'plus-minus sign'],
|
||||
['÷', '÷', true, 'division sign'],
|
||||
['⁄', '⁄', true, 'fraction slash'],
|
||||
['×', '×', true, 'multiplication sign'],
|
||||
['¹', '¹', true, 'superscript one'],
|
||||
['²', '²', true, 'superscript two'],
|
||||
['³', '³', true, 'superscript three'],
|
||||
['¼', '¼', true, 'fraction one quarter'],
|
||||
['½', '½', true, 'fraction one half'],
|
||||
['¾', '¾', true, 'fraction three quarters'],
|
||||
// math / logical
|
||||
['ƒ', 'ƒ', true, 'function / florin'],
|
||||
['∫', '∫', true, 'integral'],
|
||||
['∑', '∑', true, 'n-ary sumation'],
|
||||
['∞', '∞', true, 'infinity'],
|
||||
['√', '√', true, 'square root'],
|
||||
['∼', '∼', false,'similar to'],
|
||||
['≅', '≅', false,'approximately equal to'],
|
||||
['≈', '≈', true, 'almost equal to'],
|
||||
['≠', '≠', true, 'not equal to'],
|
||||
['≡', '≡', true, 'identical to'],
|
||||
['∈', '∈', false,'element of'],
|
||||
['∉', '∉', false,'not an element of'],
|
||||
['∋', '∋', false,'contains as member'],
|
||||
['∏', '∏', true, 'n-ary product'],
|
||||
['∧', '∧', false,'logical and'],
|
||||
['∨', '∨', false,'logical or'],
|
||||
['¬', '¬', true, 'not sign'],
|
||||
['∩', '∩', true, 'intersection'],
|
||||
['∪', '∪', false,'union'],
|
||||
['∂', '∂', true, 'partial differential'],
|
||||
['∀', '∀', false,'for all'],
|
||||
['∃', '∃', false,'there exists'],
|
||||
['∅', '∅', false,'diameter'],
|
||||
['∇', '∇', false,'backward difference'],
|
||||
['∗', '∗', false,'asterisk operator'],
|
||||
['∝', '∝', false,'proportional to'],
|
||||
['∠', '∠', false,'angle'],
|
||||
// undefined
|
||||
['´', '´', true, 'acute accent'],
|
||||
['¸', '¸', true, 'cedilla'],
|
||||
['ª', 'ª', true, 'feminine ordinal indicator'],
|
||||
['º', 'º', true, 'masculine ordinal indicator'],
|
||||
['†', '†', true, 'dagger'],
|
||||
['‡', '‡', true, 'double dagger'],
|
||||
// alphabetical special chars
|
||||
['À', 'À', true, 'A - grave'],
|
||||
['Á', 'Á', true, 'A - acute'],
|
||||
['Â', 'Â', true, 'A - circumflex'],
|
||||
['Ã', 'Ã', true, 'A - tilde'],
|
||||
['Ä', 'Ä', true, 'A - diaeresis'],
|
||||
['Å', 'Å', true, 'A - ring above'],
|
||||
['Æ', 'Æ', true, 'ligature AE'],
|
||||
['Ç', 'Ç', true, 'C - cedilla'],
|
||||
['È', 'È', true, 'E - grave'],
|
||||
['É', 'É', true, 'E - acute'],
|
||||
['Ê', 'Ê', true, 'E - circumflex'],
|
||||
['Ë', 'Ë', true, 'E - diaeresis'],
|
||||
['Ì', 'Ì', true, 'I - grave'],
|
||||
['Í', 'Í', true, 'I - acute'],
|
||||
['Î', 'Î', true, 'I - circumflex'],
|
||||
['Ï', 'Ï', true, 'I - diaeresis'],
|
||||
['Ð', 'Ð', true, 'ETH'],
|
||||
['Ñ', 'Ñ', true, 'N - tilde'],
|
||||
['Ò', 'Ò', true, 'O - grave'],
|
||||
['Ó', 'Ó', true, 'O - acute'],
|
||||
['Ô', 'Ô', true, 'O - circumflex'],
|
||||
['Õ', 'Õ', true, 'O - tilde'],
|
||||
['Ö', 'Ö', true, 'O - diaeresis'],
|
||||
['Ø', 'Ø', true, 'O - slash'],
|
||||
['Œ', 'Œ', true, 'ligature OE'],
|
||||
['Š', 'Š', true, 'S - caron'],
|
||||
['Ù', 'Ù', true, 'U - grave'],
|
||||
['Ú', 'Ú', true, 'U - acute'],
|
||||
['Û', 'Û', true, 'U - circumflex'],
|
||||
['Ü', 'Ü', true, 'U - diaeresis'],
|
||||
['Ý', 'Ý', true, 'Y - acute'],
|
||||
['Ÿ', 'Ÿ', true, 'Y - diaeresis'],
|
||||
['Þ', 'Þ', true, 'THORN'],
|
||||
['à', 'à', true, 'a - grave'],
|
||||
['á', 'á', true, 'a - acute'],
|
||||
['â', 'â', true, 'a - circumflex'],
|
||||
['ã', 'ã', true, 'a - tilde'],
|
||||
['ä', 'ä', true, 'a - diaeresis'],
|
||||
['å', 'å', true, 'a - ring above'],
|
||||
['æ', 'æ', true, 'ligature ae'],
|
||||
['ç', 'ç', true, 'c - cedilla'],
|
||||
['è', 'è', true, 'e - grave'],
|
||||
['é', 'é', true, 'e - acute'],
|
||||
['ê', 'ê', true, 'e - circumflex'],
|
||||
['ë', 'ë', true, 'e - diaeresis'],
|
||||
['ì', 'ì', true, 'i - grave'],
|
||||
['í', 'í', true, 'i - acute'],
|
||||
['î', 'î', true, 'i - circumflex'],
|
||||
['ï', 'ï', true, 'i - diaeresis'],
|
||||
['ð', 'ð', true, 'eth'],
|
||||
['ñ', 'ñ', true, 'n - tilde'],
|
||||
['ò', 'ò', true, 'o - grave'],
|
||||
['ó', 'ó', true, 'o - acute'],
|
||||
['ô', 'ô', true, 'o - circumflex'],
|
||||
['õ', 'õ', true, 'o - tilde'],
|
||||
['ö', 'ö', true, 'o - diaeresis'],
|
||||
['ø', 'ø', true, 'o slash'],
|
||||
['œ', 'œ', true, 'ligature oe'],
|
||||
['š', 'š', true, 's - caron'],
|
||||
['ù', 'ù', true, 'u - grave'],
|
||||
['ú', 'ú', true, 'u - acute'],
|
||||
['û', 'û', true, 'u - circumflex'],
|
||||
['ü', 'ü', true, 'u - diaeresis'],
|
||||
['ý', 'ý', true, 'y - acute'],
|
||||
['þ', 'þ', true, 'thorn'],
|
||||
['ÿ', 'ÿ', true, 'y - diaeresis'],
|
||||
['Α', 'Α', true, 'Alpha'],
|
||||
['Β', 'Β', true, 'Beta'],
|
||||
['Γ', 'Γ', true, 'Gamma'],
|
||||
['Δ', 'Δ', true, 'Delta'],
|
||||
['Ε', 'Ε', true, 'Epsilon'],
|
||||
['Ζ', 'Ζ', true, 'Zeta'],
|
||||
['Η', 'Η', true, 'Eta'],
|
||||
['Θ', 'Θ', true, 'Theta'],
|
||||
['Ι', 'Ι', true, 'Iota'],
|
||||
['Κ', 'Κ', true, 'Kappa'],
|
||||
['Λ', 'Λ', true, 'Lambda'],
|
||||
['Μ', 'Μ', true, 'Mu'],
|
||||
['Ν', 'Ν', true, 'Nu'],
|
||||
['Ξ', 'Ξ', true, 'Xi'],
|
||||
['Ο', 'Ο', true, 'Omicron'],
|
||||
['Π', 'Π', true, 'Pi'],
|
||||
['Ρ', 'Ρ', true, 'Rho'],
|
||||
['Σ', 'Σ', true, 'Sigma'],
|
||||
['Τ', 'Τ', true, 'Tau'],
|
||||
['Υ', 'Υ', true, 'Upsilon'],
|
||||
['Φ', 'Φ', true, 'Phi'],
|
||||
['Χ', 'Χ', true, 'Chi'],
|
||||
['Ψ', 'Ψ', true, 'Psi'],
|
||||
['Ω', 'Ω', true, 'Omega'],
|
||||
['α', 'α', true, 'alpha'],
|
||||
['β', 'β', true, 'beta'],
|
||||
['γ', 'γ', true, 'gamma'],
|
||||
['δ', 'δ', true, 'delta'],
|
||||
['ε', 'ε', true, 'epsilon'],
|
||||
['ζ', 'ζ', true, 'zeta'],
|
||||
['η', 'η', true, 'eta'],
|
||||
['θ', 'θ', true, 'theta'],
|
||||
['ι', 'ι', true, 'iota'],
|
||||
['κ', 'κ', true, 'kappa'],
|
||||
['λ', 'λ', true, 'lambda'],
|
||||
['μ', 'μ', true, 'mu'],
|
||||
['ν', 'ν', true, 'nu'],
|
||||
['ξ', 'ξ', true, 'xi'],
|
||||
['ο', 'ο', true, 'omicron'],
|
||||
['π', 'π', true, 'pi'],
|
||||
['ρ', 'ρ', true, 'rho'],
|
||||
['ς', 'ς', true, 'final sigma'],
|
||||
['σ', 'σ', true, 'sigma'],
|
||||
['τ', 'τ', true, 'tau'],
|
||||
['υ', 'υ', true, 'upsilon'],
|
||||
['φ', 'φ', true, 'phi'],
|
||||
['χ', 'χ', true, 'chi'],
|
||||
['ψ', 'ψ', true, 'psi'],
|
||||
['ω', 'ω', true, 'omega'],
|
||||
// symbols
|
||||
['ℵ', 'ℵ', false,'alef symbol'],
|
||||
['ϖ', 'ϖ', false,'pi symbol'],
|
||||
['ℜ', 'ℜ', false,'real part symbol'],
|
||||
['ϑ','ϑ', false,'theta symbol'],
|
||||
['ϒ', 'ϒ', false,'upsilon - hook symbol'],
|
||||
['℘', '℘', false,'Weierstrass p'],
|
||||
['ℑ', 'ℑ', false,'imaginary part'],
|
||||
// arrows
|
||||
['←', '←', true, 'leftwards arrow'],
|
||||
['↑', '↑', true, 'upwards arrow'],
|
||||
['→', '→', true, 'rightwards arrow'],
|
||||
['↓', '↓', true, 'downwards arrow'],
|
||||
['↔', '↔', true, 'left right arrow'],
|
||||
['↵', '↵', false,'carriage return'],
|
||||
['⇐', '⇐', false,'leftwards double arrow'],
|
||||
['⇑', '⇑', false,'upwards double arrow'],
|
||||
['⇒', '⇒', false,'rightwards double arrow'],
|
||||
['⇓', '⇓', false,'downwards double arrow'],
|
||||
['⇔', '⇔', false,'left right double arrow'],
|
||||
['∴', '∴', false,'therefore'],
|
||||
['⊂', '⊂', false,'subset of'],
|
||||
['⊃', '⊃', false,'superset of'],
|
||||
['⊄', '⊄', false,'not a subset of'],
|
||||
['⊆', '⊆', false,'subset of or equal to'],
|
||||
['⊇', '⊇', false,'superset of or equal to'],
|
||||
['⊕', '⊕', false,'circled plus'],
|
||||
['⊗', '⊗', false,'circled times'],
|
||||
['⊥', '⊥', false,'perpendicular'],
|
||||
['⋅', '⋅', false,'dot operator'],
|
||||
['⌈', '⌈', false,'left ceiling'],
|
||||
['⌉', '⌉', false,'right ceiling'],
|
||||
['⌊', '⌊', false,'left floor'],
|
||||
['⌋', '⌋', false,'right floor'],
|
||||
['⟨', '〈', false,'left-pointing angle bracket'],
|
||||
['⟩', '〉', false,'right-pointing angle bracket'],
|
||||
['◊', '◊', true, 'lozenge'],
|
||||
['♠', '♠', true, 'black spade suit'],
|
||||
['♣', '♣', true, 'black club suit'],
|
||||
['♥', '♥', true, 'black heart suit'],
|
||||
['♦', '♦', true, 'black diamond suit'],
|
||||
[' ', ' ', false,'en space'],
|
||||
[' ', ' ', false,'em space'],
|
||||
[' ', ' ', false,'thin space'],
|
||||
['‌', '‌', false,'zero width non-joiner'],
|
||||
['‍', '‍', false,'zero width joiner'],
|
||||
['‎', '‎', false,'left-to-right mark'],
|
||||
['‏', '‏', false,'right-to-left mark'],
|
||||
['­', '­', false,'soft hyphen']
|
||||
];
|
||||
|
||||
tinyMCEPopup.onInit.add(function() {
|
||||
tinyMCEPopup.dom.setHTML('charmapView', renderCharMapHTML());
|
||||
addKeyboardNavigation();
|
||||
});
|
||||
|
||||
function addKeyboardNavigation(){
|
||||
var tableElm, cells, settings;
|
||||
|
||||
cells = tinyMCEPopup.dom.select("a.charmaplink", "charmapgroup");
|
||||
|
||||
settings ={
|
||||
root: "charmapgroup",
|
||||
items: cells
|
||||
};
|
||||
cells[0].tabindex=0;
|
||||
tinyMCEPopup.dom.addClass(cells[0], "mceFocus");
|
||||
if (tinymce.isGecko) {
|
||||
cells[0].focus();
|
||||
} else {
|
||||
setTimeout(function(){
|
||||
cells[0].focus();
|
||||
}, 100);
|
||||
}
|
||||
tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', settings, tinyMCEPopup.dom);
|
||||
}
|
||||
|
||||
function renderCharMapHTML() {
|
||||
var charsPerRow = 20, tdWidth=20, tdHeight=20, i;
|
||||
var html = '<div id="charmapgroup" aria-labelledby="charmap_label" tabindex="0" role="listbox">'+
|
||||
'<table role="presentation" border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth*charsPerRow) +
|
||||
'"><tr height="' + tdHeight + '">';
|
||||
var cols=-1;
|
||||
|
||||
for (i=0; i<charmap.length; i++) {
|
||||
var previewCharFn;
|
||||
|
||||
if (charmap[i][2]==true) {
|
||||
cols++;
|
||||
previewCharFn = 'previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');';
|
||||
html += ''
|
||||
+ '<td class="charmap">'
|
||||
+ '<a class="charmaplink" role="button" onmouseover="'+previewCharFn+'" onfocus="'+previewCharFn+'" href="javascript:void(0)" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + ' '+ tinyMCEPopup.editor.translate("advanced_dlg.charmap_usage")+'">'
|
||||
+ charmap[i][1]
|
||||
+ '</a></td>';
|
||||
if ((cols+1) % charsPerRow == 0)
|
||||
html += '</tr><tr height="' + tdHeight + '">';
|
||||
}
|
||||
}
|
||||
|
||||
if (cols % charsPerRow > 0) {
|
||||
var padd = charsPerRow - (cols % charsPerRow);
|
||||
for (var i=0; i<padd-1; i++)
|
||||
html += '<td width="' + tdWidth + '" height="' + tdHeight + '" class="charmap"> </td>';
|
||||
}
|
||||
|
||||
html += '</tr></table></div>';
|
||||
html = html.replace(/<tr height="20"><\/tr>/g, '');
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function insertChar(chr) {
|
||||
tinyMCEPopup.execCommand('mceInsertContent', false, '&#' + chr + ';');
|
||||
|
||||
// Refocus in window
|
||||
if (tinyMCEPopup.isWindow)
|
||||
window.focus();
|
||||
|
||||
tinyMCEPopup.editor.focus();
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
function previewChar(codeA, codeB, codeN) {
|
||||
var elmA = document.getElementById('codeA');
|
||||
var elmB = document.getElementById('codeB');
|
||||
var elmV = document.getElementById('codeV');
|
||||
var elmN = document.getElementById('codeN');
|
||||
|
||||
if (codeA=='#160;') {
|
||||
elmV.innerHTML = '__';
|
||||
} else {
|
||||
elmV.innerHTML = '&' + codeA;
|
||||
}
|
||||
|
||||
elmB.innerHTML = '&' + codeA;
|
||||
elmA.innerHTML = '&' + codeB;
|
||||
elmN.innerHTML = codeN;
|
||||
}
|
|
@ -1,345 +0,0 @@
|
|||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false;
|
||||
|
||||
var colors = [
|
||||
"#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033",
|
||||
"#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099",
|
||||
"#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff",
|
||||
"#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033",
|
||||
"#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399",
|
||||
"#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff",
|
||||
"#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333",
|
||||
"#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399",
|
||||
"#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff",
|
||||
"#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633",
|
||||
"#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699",
|
||||
"#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff",
|
||||
"#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633",
|
||||
"#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999",
|
||||
"#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff",
|
||||
"#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933",
|
||||
"#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999",
|
||||
"#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff",
|
||||
"#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33",
|
||||
"#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99",
|
||||
"#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff",
|
||||
"#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33",
|
||||
"#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99",
|
||||
"#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff",
|
||||
"#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33",
|
||||
"#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99",
|
||||
"#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"
|
||||
];
|
||||
|
||||
var named = {
|
||||
'#F0F8FF':'Alice Blue','#FAEBD7':'Antique White','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige',
|
||||
'#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'Blanched Almond','#0000FF':'Blue','#8A2BE2':'Blue Violet','#A52A2A':'Brown',
|
||||
'#DEB887':'Burly Wood','#5F9EA0':'Cadet Blue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'Cornflower Blue',
|
||||
'#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'Dark Blue','#008B8B':'Dark Cyan','#B8860B':'Dark Golden Rod',
|
||||
'#A9A9A9':'Dark Gray','#A9A9A9':'Dark Grey','#006400':'Dark Green','#BDB76B':'Dark Khaki','#8B008B':'Dark Magenta','#556B2F':'Dark Olive Green',
|
||||
'#FF8C00':'Darkorange','#9932CC':'Dark Orchid','#8B0000':'Dark Red','#E9967A':'Dark Salmon','#8FBC8F':'Dark Sea Green','#483D8B':'Dark Slate Blue',
|
||||
'#2F4F4F':'Dark Slate Gray','#2F4F4F':'Dark Slate Grey','#00CED1':'Dark Turquoise','#9400D3':'Dark Violet','#FF1493':'Deep Pink','#00BFFF':'Deep Sky Blue',
|
||||
'#696969':'Dim Gray','#696969':'Dim Grey','#1E90FF':'Dodger Blue','#B22222':'Fire Brick','#FFFAF0':'Floral White','#228B22':'Forest Green',
|
||||
'#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'Ghost White','#FFD700':'Gold','#DAA520':'Golden Rod','#808080':'Gray','#808080':'Grey',
|
||||
'#008000':'Green','#ADFF2F':'Green Yellow','#F0FFF0':'Honey Dew','#FF69B4':'Hot Pink','#CD5C5C':'Indian Red','#4B0082':'Indigo','#FFFFF0':'Ivory',
|
||||
'#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'Lavender Blush','#7CFC00':'Lawn Green','#FFFACD':'Lemon Chiffon','#ADD8E6':'Light Blue',
|
||||
'#F08080':'Light Coral','#E0FFFF':'Light Cyan','#FAFAD2':'Light Golden Rod Yellow','#D3D3D3':'Light Gray','#D3D3D3':'Light Grey','#90EE90':'Light Green',
|
||||
'#FFB6C1':'Light Pink','#FFA07A':'Light Salmon','#20B2AA':'Light Sea Green','#87CEFA':'Light Sky Blue','#778899':'Light Slate Gray','#778899':'Light Slate Grey',
|
||||
'#B0C4DE':'Light Steel Blue','#FFFFE0':'Light Yellow','#00FF00':'Lime','#32CD32':'Lime Green','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon',
|
||||
'#66CDAA':'Medium Aqua Marine','#0000CD':'Medium Blue','#BA55D3':'Medium Orchid','#9370D8':'Medium Purple','#3CB371':'Medium Sea Green','#7B68EE':'Medium Slate Blue',
|
||||
'#00FA9A':'Medium Spring Green','#48D1CC':'Medium Turquoise','#C71585':'Medium Violet Red','#191970':'Midnight Blue','#F5FFFA':'Mint Cream','#FFE4E1':'Misty Rose','#FFE4B5':'Moccasin',
|
||||
'#FFDEAD':'Navajo White','#000080':'Navy','#FDF5E6':'Old Lace','#808000':'Olive','#6B8E23':'Olive Drab','#FFA500':'Orange','#FF4500':'Orange Red','#DA70D6':'Orchid',
|
||||
'#EEE8AA':'Pale Golden Rod','#98FB98':'Pale Green','#AFEEEE':'Pale Turquoise','#D87093':'Pale Violet Red','#FFEFD5':'Papaya Whip','#FFDAB9':'Peach Puff',
|
||||
'#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'Powder Blue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'Rosy Brown','#4169E1':'Royal Blue',
|
||||
'#8B4513':'Saddle Brown','#FA8072':'Salmon','#F4A460':'Sandy Brown','#2E8B57':'Sea Green','#FFF5EE':'Sea Shell','#A0522D':'Sienna','#C0C0C0':'Silver',
|
||||
'#87CEEB':'Sky Blue','#6A5ACD':'Slate Blue','#708090':'Slate Gray','#708090':'Slate Grey','#FFFAFA':'Snow','#00FF7F':'Spring Green',
|
||||
'#4682B4':'Steel Blue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet',
|
||||
'#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'White Smoke','#FFFF00':'Yellow','#9ACD32':'Yellow Green'
|
||||
};
|
||||
|
||||
var namedLookup = {};
|
||||
|
||||
function init() {
|
||||
var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color')), key, value;
|
||||
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
|
||||
generatePicker();
|
||||
generateWebColors();
|
||||
generateNamedColors();
|
||||
|
||||
if (inputColor) {
|
||||
changeFinalColor(inputColor);
|
||||
|
||||
col = convertHexToRGB(inputColor);
|
||||
|
||||
if (col)
|
||||
updateLight(col.r, col.g, col.b);
|
||||
}
|
||||
|
||||
for (key in named) {
|
||||
value = named[key];
|
||||
namedLookup[value.replace(/\s+/, '').toLowerCase()] = key.replace(/#/, '').toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
function toHexColor(color) {
|
||||
var matches, red, green, blue, toInt = parseInt;
|
||||
|
||||
function hex(value) {
|
||||
value = parseInt(value).toString(16);
|
||||
|
||||
return value.length > 1 ? value : '0' + value; // Padd with leading zero
|
||||
};
|
||||
|
||||
color = tinymce.trim(color);
|
||||
color = color.replace(/^[#]/, '').toLowerCase(); // remove leading '#'
|
||||
color = namedLookup[color] || color;
|
||||
|
||||
matches = /^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/.exec(color);
|
||||
|
||||
if (matches) {
|
||||
red = toInt(matches[1]);
|
||||
green = toInt(matches[2]);
|
||||
blue = toInt(matches[3]);
|
||||
} else {
|
||||
matches = /^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/.exec(color);
|
||||
|
||||
if (matches) {
|
||||
red = toInt(matches[1], 16);
|
||||
green = toInt(matches[2], 16);
|
||||
blue = toInt(matches[3], 16);
|
||||
} else {
|
||||
matches = /^([0-9a-f])([0-9a-f])([0-9a-f])$/.exec(color);
|
||||
|
||||
if (matches) {
|
||||
red = toInt(matches[1] + matches[1], 16);
|
||||
green = toInt(matches[2] + matches[2], 16);
|
||||
blue = toInt(matches[3] + matches[3], 16);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return '#' + hex(red) + hex(green) + hex(blue);
|
||||
}
|
||||
|
||||
function insertAction() {
|
||||
var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func');
|
||||
|
||||
var hexColor = toHexColor(color);
|
||||
|
||||
if (hexColor === '') {
|
||||
var text = tinyMCEPopup.editor.getLang('advanced_dlg.invalid_color_value');
|
||||
tinyMCEPopup.alert(text + ': ' + color);
|
||||
}
|
||||
else {
|
||||
tinyMCEPopup.restoreSelection();
|
||||
|
||||
if (f)
|
||||
f(hexColor);
|
||||
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
}
|
||||
|
||||
function showColor(color, name) {
|
||||
if (name)
|
||||
document.getElementById("colorname").innerHTML = name;
|
||||
|
||||
document.getElementById("preview").style.backgroundColor = color;
|
||||
document.getElementById("color").value = color.toUpperCase();
|
||||
}
|
||||
|
||||
function convertRGBToHex(col) {
|
||||
var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
|
||||
|
||||
if (!col)
|
||||
return col;
|
||||
|
||||
var rgb = col.replace(re, "$1,$2,$3").split(',');
|
||||
if (rgb.length == 3) {
|
||||
r = parseInt(rgb[0]).toString(16);
|
||||
g = parseInt(rgb[1]).toString(16);
|
||||
b = parseInt(rgb[2]).toString(16);
|
||||
|
||||
r = r.length == 1 ? '0' + r : r;
|
||||
g = g.length == 1 ? '0' + g : g;
|
||||
b = b.length == 1 ? '0' + b : b;
|
||||
|
||||
return "#" + r + g + b;
|
||||
}
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
function convertHexToRGB(col) {
|
||||
if (col.indexOf('#') != -1) {
|
||||
col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
|
||||
|
||||
r = parseInt(col.substring(0, 2), 16);
|
||||
g = parseInt(col.substring(2, 4), 16);
|
||||
b = parseInt(col.substring(4, 6), 16);
|
||||
|
||||
return {r : r, g : g, b : b};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function generatePicker() {
|
||||
var el = document.getElementById('light'), h = '', i;
|
||||
|
||||
for (i = 0; i < detail; i++){
|
||||
h += '<div id="gs'+i+'" style="background-color:#000000; width:15px; height:3px; border-style:none; border-width:0px;"'
|
||||
+ ' onclick="changeFinalColor(this.style.backgroundColor)"'
|
||||
+ ' onmousedown="isMouseDown = true; return false;"'
|
||||
+ ' onmouseup="isMouseDown = false;"'
|
||||
+ ' onmousemove="if (isMouseDown && isMouseOver) changeFinalColor(this.style.backgroundColor); return false;"'
|
||||
+ ' onmouseover="isMouseOver = true;"'
|
||||
+ ' onmouseout="isMouseOver = false;"'
|
||||
+ '></div>';
|
||||
}
|
||||
|
||||
el.innerHTML = h;
|
||||
}
|
||||
|
||||
function generateWebColors() {
|
||||
var el = document.getElementById('webcolors'), h = '', i;
|
||||
|
||||
if (el.className == 'generated')
|
||||
return;
|
||||
|
||||
// TODO: VoiceOver doesn't seem to support legend as a label referenced by labelledby.
|
||||
h += '<div role="listbox" aria-labelledby="webcolors_title" tabindex="0"><table role="presentation" border="0" cellspacing="1" cellpadding="0">'
|
||||
+ '<tr>';
|
||||
|
||||
for (i=0; i<colors.length; i++) {
|
||||
h += '<td bgcolor="' + colors[i] + '" width="10" height="10">'
|
||||
+ '<a href="javascript:insertAction();" role="option" tabindex="-1" aria-labelledby="web_colors_' + i + '" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');" style="display:block;width:10px;height:10px;overflow:hidden;">';
|
||||
if (tinyMCEPopup.editor.forcedHighContrastMode) {
|
||||
h += '<canvas class="mceColorSwatch" height="10" width="10" data-color="' + colors[i] + '"></canvas>';
|
||||
}
|
||||
h += '<span class="mceVoiceLabel" style="display:none;" id="web_colors_' + i + '">' + colors[i].toUpperCase() + '</span>';
|
||||
h += '</a></td>';
|
||||
if ((i+1) % 18 == 0)
|
||||
h += '</tr><tr>';
|
||||
}
|
||||
|
||||
h += '</table></div>';
|
||||
|
||||
el.innerHTML = h;
|
||||
el.className = 'generated';
|
||||
|
||||
paintCanvas(el);
|
||||
enableKeyboardNavigation(el.firstChild);
|
||||
}
|
||||
|
||||
function paintCanvas(el) {
|
||||
tinyMCEPopup.getWin().tinymce.each(tinyMCEPopup.dom.select('canvas.mceColorSwatch', el), function(canvas) {
|
||||
var context;
|
||||
if (canvas.getContext && (context = canvas.getContext("2d"))) {
|
||||
context.fillStyle = canvas.getAttribute('data-color');
|
||||
context.fillRect(0, 0, 10, 10);
|
||||
}
|
||||
});
|
||||
}
|
||||
function generateNamedColors() {
|
||||
var el = document.getElementById('namedcolors'), h = '', n, v, i = 0;
|
||||
|
||||
if (el.className == 'generated')
|
||||
return;
|
||||
|
||||
for (n in named) {
|
||||
v = named[n];
|
||||
h += '<a href="javascript:insertAction();" role="option" tabindex="-1" aria-labelledby="named_colors_' + i + '" onfocus="showColor(\'' + n + '\',\'' + v + '\');" onmouseover="showColor(\'' + n + '\',\'' + v + '\');" style="background-color: ' + n + '">';
|
||||
if (tinyMCEPopup.editor.forcedHighContrastMode) {
|
||||
h += '<canvas class="mceColorSwatch" height="10" width="10" data-color="' + colors[i] + '"></canvas>';
|
||||
}
|
||||
h += '<span class="mceVoiceLabel" style="display:none;" id="named_colors_' + i + '">' + v + '</span>';
|
||||
h += '</a>';
|
||||
i++;
|
||||
}
|
||||
|
||||
el.innerHTML = h;
|
||||
el.className = 'generated';
|
||||
|
||||
paintCanvas(el);
|
||||
enableKeyboardNavigation(el);
|
||||
}
|
||||
|
||||
function enableKeyboardNavigation(el) {
|
||||
tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', {
|
||||
root: el,
|
||||
items: tinyMCEPopup.dom.select('a', el)
|
||||
}, tinyMCEPopup.dom);
|
||||
}
|
||||
|
||||
function dechex(n) {
|
||||
return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16);
|
||||
}
|
||||
|
||||
function computeColor(e) {
|
||||
var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB, pos = tinyMCEPopup.dom.getPos(e.target);
|
||||
|
||||
x = e.offsetX ? e.offsetX : (e.target ? e.clientX - pos.x : 0);
|
||||
y = e.offsetY ? e.offsetY : (e.target ? e.clientY - pos.y : 0);
|
||||
|
||||
partWidth = document.getElementById('colors').width / 6;
|
||||
partDetail = detail / 2;
|
||||
imHeight = document.getElementById('colors').height;
|
||||
|
||||
r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255;
|
||||
g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255 + (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth);
|
||||
b = (x >= 2*partWidth)*(x < 3*partWidth)*(-2*255 + x * 255 / partWidth) + (x >= 3*partWidth)*(x < 5*partWidth)*255 + (x >= 5*partWidth)*(x < 6*partWidth)*(6*255 - x * 255 / partWidth);
|
||||
|
||||
coef = (imHeight - y) / imHeight;
|
||||
r = 128 + (r - 128) * coef;
|
||||
g = 128 + (g - 128) * coef;
|
||||
b = 128 + (b - 128) * coef;
|
||||
|
||||
changeFinalColor('#' + dechex(r) + dechex(g) + dechex(b));
|
||||
updateLight(r, g, b);
|
||||
}
|
||||
|
||||
function updateLight(r, g, b) {
|
||||
var i, partDetail = detail / 2, finalCoef, finalR, finalG, finalB, color;
|
||||
|
||||
for (i=0; i<detail; i++) {
|
||||
if ((i>=0) && (i<partDetail)) {
|
||||
finalCoef = i / partDetail;
|
||||
finalR = dechex(255 - (255 - r) * finalCoef);
|
||||
finalG = dechex(255 - (255 - g) * finalCoef);
|
||||
finalB = dechex(255 - (255 - b) * finalCoef);
|
||||
} else {
|
||||
finalCoef = 2 - i / partDetail;
|
||||
finalR = dechex(r * finalCoef);
|
||||
finalG = dechex(g * finalCoef);
|
||||
finalB = dechex(b * finalCoef);
|
||||
}
|
||||
|
||||
color = finalR + finalG + finalB;
|
||||
|
||||
setCol('gs' + i, '#'+color);
|
||||
}
|
||||
}
|
||||
|
||||
function changeFinalColor(color) {
|
||||
if (color.indexOf('#') == -1)
|
||||
color = convertRGBToHex(color);
|
||||
|
||||
setCol('preview', color);
|
||||
document.getElementById('color').value = color;
|
||||
}
|
||||
|
||||
function setCol(e, c) {
|
||||
try {
|
||||
document.getElementById(e).style.backgroundColor = c;
|
||||
} catch (ex) {
|
||||
// Ignore IE warning
|
||||
}
|
||||
}
|
||||
|
||||
tinyMCEPopup.onInit.add(init);
|
|
@ -1,253 +0,0 @@
|
|||
var ImageDialog = {
|
||||
preInit : function() {
|
||||
var url;
|
||||
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
if (url = tinyMCEPopup.getParam("external_image_list_url"))
|
||||
document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
|
||||
},
|
||||
|
||||
init : function() {
|
||||
var f = document.forms[0], ed = tinyMCEPopup.editor;
|
||||
|
||||
// Setup browse button
|
||||
document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image');
|
||||
if (isVisible('srcbrowser'))
|
||||
document.getElementById('src').style.width = '180px';
|
||||
|
||||
e = ed.selection.getNode();
|
||||
|
||||
this.fillFileList('image_list', tinyMCEPopup.getParam('external_image_list', 'tinyMCEImageList'));
|
||||
|
||||
if (e.nodeName == 'IMG') {
|
||||
f.src.value = ed.dom.getAttrib(e, 'src');
|
||||
f.alt.value = ed.dom.getAttrib(e, 'alt');
|
||||
f.border.value = this.getAttrib(e, 'border');
|
||||
f.vspace.value = this.getAttrib(e, 'vspace');
|
||||
f.hspace.value = this.getAttrib(e, 'hspace');
|
||||
f.width.value = ed.dom.getAttrib(e, 'width');
|
||||
f.height.value = ed.dom.getAttrib(e, 'height');
|
||||
f.insert.value = ed.getLang('update');
|
||||
this.styleVal = ed.dom.getAttrib(e, 'style');
|
||||
selectByValue(f, 'image_list', f.src.value);
|
||||
selectByValue(f, 'align', this.getAttrib(e, 'align'));
|
||||
this.updateStyle();
|
||||
}
|
||||
},
|
||||
|
||||
fillFileList : function(id, l) {
|
||||
var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
|
||||
|
||||
l = typeof(l) === 'function' ? l() : window[l];
|
||||
|
||||
if (l && l.length > 0) {
|
||||
lst.options[lst.options.length] = new Option('', '');
|
||||
|
||||
tinymce.each(l, function(o) {
|
||||
lst.options[lst.options.length] = new Option(o[0], o[1]);
|
||||
});
|
||||
} else
|
||||
dom.remove(dom.getParent(id, 'tr'));
|
||||
},
|
||||
|
||||
update : function() {
|
||||
var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, args = {}, el;
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
|
||||
if (f.src.value === '') {
|
||||
if (ed.selection.getNode().nodeName == 'IMG') {
|
||||
ed.dom.remove(ed.selection.getNode());
|
||||
ed.execCommand('mceRepaint');
|
||||
}
|
||||
|
||||
tinyMCEPopup.close();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ed.settings.inline_styles) {
|
||||
args = tinymce.extend(args, {
|
||||
vspace : nl.vspace.value,
|
||||
hspace : nl.hspace.value,
|
||||
border : nl.border.value,
|
||||
align : getSelectValue(f, 'align')
|
||||
});
|
||||
} else
|
||||
args.style = this.styleVal;
|
||||
|
||||
tinymce.extend(args, {
|
||||
src : f.src.value.replace(/ /g, '%20'),
|
||||
alt : f.alt.value,
|
||||
width : f.width.value,
|
||||
height : f.height.value
|
||||
});
|
||||
|
||||
el = ed.selection.getNode();
|
||||
|
||||
if (el && el.nodeName == 'IMG') {
|
||||
ed.dom.setAttribs(el, args);
|
||||
tinyMCEPopup.editor.execCommand('mceRepaint');
|
||||
tinyMCEPopup.editor.focus();
|
||||
} else {
|
||||
tinymce.each(args, function(value, name) {
|
||||
if (value === "") {
|
||||
delete args[name];
|
||||
}
|
||||
});
|
||||
|
||||
ed.execCommand('mceInsertContent', false, tinyMCEPopup.editor.dom.createHTML('img', args), {skip_undo : 1});
|
||||
ed.undoManager.add();
|
||||
}
|
||||
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
updateStyle : function() {
|
||||
var dom = tinyMCEPopup.dom, st = {}, v, f = document.forms[0];
|
||||
|
||||
if (tinyMCEPopup.editor.settings.inline_styles) {
|
||||
tinymce.each(tinyMCEPopup.dom.parseStyle(this.styleVal), function(value, key) {
|
||||
st[key] = value;
|
||||
});
|
||||
|
||||
// Handle align
|
||||
v = getSelectValue(f, 'align');
|
||||
if (v) {
|
||||
if (v == 'left' || v == 'right') {
|
||||
st['float'] = v;
|
||||
delete st['vertical-align'];
|
||||
} else {
|
||||
st['vertical-align'] = v;
|
||||
delete st['float'];
|
||||
}
|
||||
} else {
|
||||
delete st['float'];
|
||||
delete st['vertical-align'];
|
||||
}
|
||||
|
||||
// Handle border
|
||||
v = f.border.value;
|
||||
if (v || v == '0') {
|
||||
if (v == '0')
|
||||
st['border'] = '0';
|
||||
else
|
||||
st['border'] = v + 'px solid black';
|
||||
} else
|
||||
delete st['border'];
|
||||
|
||||
// Handle hspace
|
||||
v = f.hspace.value;
|
||||
if (v) {
|
||||
delete st['margin'];
|
||||
st['margin-left'] = v + 'px';
|
||||
st['margin-right'] = v + 'px';
|
||||
} else {
|
||||
delete st['margin-left'];
|
||||
delete st['margin-right'];
|
||||
}
|
||||
|
||||
// Handle vspace
|
||||
v = f.vspace.value;
|
||||
if (v) {
|
||||
delete st['margin'];
|
||||
st['margin-top'] = v + 'px';
|
||||
st['margin-bottom'] = v + 'px';
|
||||
} else {
|
||||
delete st['margin-top'];
|
||||
delete st['margin-bottom'];
|
||||
}
|
||||
|
||||
// Merge
|
||||
st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st), 'img');
|
||||
this.styleVal = dom.serializeStyle(st, 'img');
|
||||
}
|
||||
},
|
||||
|
||||
getAttrib : function(e, at) {
|
||||
var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2;
|
||||
|
||||
if (ed.settings.inline_styles) {
|
||||
switch (at) {
|
||||
case 'align':
|
||||
if (v = dom.getStyle(e, 'float'))
|
||||
return v;
|
||||
|
||||
if (v = dom.getStyle(e, 'vertical-align'))
|
||||
return v;
|
||||
|
||||
break;
|
||||
|
||||
case 'hspace':
|
||||
v = dom.getStyle(e, 'margin-left')
|
||||
v2 = dom.getStyle(e, 'margin-right');
|
||||
if (v && v == v2)
|
||||
return parseInt(v.replace(/[^0-9]/g, ''));
|
||||
|
||||
break;
|
||||
|
||||
case 'vspace':
|
||||
v = dom.getStyle(e, 'margin-top')
|
||||
v2 = dom.getStyle(e, 'margin-bottom');
|
||||
if (v && v == v2)
|
||||
return parseInt(v.replace(/[^0-9]/g, ''));
|
||||
|
||||
break;
|
||||
|
||||
case 'border':
|
||||
v = 0;
|
||||
|
||||
tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) {
|
||||
sv = dom.getStyle(e, 'border-' + sv + '-width');
|
||||
|
||||
// False or not the same as prev
|
||||
if (!sv || (sv != v && v !== 0)) {
|
||||
v = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sv)
|
||||
v = sv;
|
||||
});
|
||||
|
||||
if (v)
|
||||
return parseInt(v.replace(/[^0-9]/g, ''));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (v = dom.getAttrib(e, at))
|
||||
return v;
|
||||
|
||||
return '';
|
||||
},
|
||||
|
||||
resetImageData : function() {
|
||||
var f = document.forms[0];
|
||||
|
||||
f.width.value = f.height.value = "";
|
||||
},
|
||||
|
||||
updateImageData : function() {
|
||||
var f = document.forms[0], t = ImageDialog;
|
||||
|
||||
if (f.width.value == "")
|
||||
f.width.value = t.preloadImg.width;
|
||||
|
||||
if (f.height.value == "")
|
||||
f.height.value = t.preloadImg.height;
|
||||
},
|
||||
|
||||
getImageData : function() {
|
||||
var f = document.forms[0];
|
||||
|
||||
this.preloadImg = new Image();
|
||||
this.preloadImg.onload = this.updateImageData;
|
||||
this.preloadImg.onerror = this.resetImageData;
|
||||
this.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.src.value);
|
||||
}
|
||||
};
|
||||
|
||||
ImageDialog.preInit();
|
||||
tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog);
|
|
@ -1,159 +0,0 @@
|
|||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
var LinkDialog = {
|
||||
preInit : function() {
|
||||
var url;
|
||||
|
||||
if (url = tinyMCEPopup.getParam("external_link_list_url"))
|
||||
document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
|
||||
},
|
||||
|
||||
init : function() {
|
||||
var f = document.forms[0], ed = tinyMCEPopup.editor;
|
||||
|
||||
// Setup browse button
|
||||
document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser', 'href', 'file', 'theme_advanced_link');
|
||||
if (isVisible('hrefbrowser'))
|
||||
document.getElementById('href').style.width = '180px';
|
||||
|
||||
this.fillClassList('class_list');
|
||||
this.fillFileList('link_list', 'tinyMCELinkList');
|
||||
this.fillTargetList('target_list');
|
||||
|
||||
if (e = ed.dom.getParent(ed.selection.getNode(), 'A')) {
|
||||
f.href.value = ed.dom.getAttrib(e, 'href');
|
||||
f.linktitle.value = ed.dom.getAttrib(e, 'title');
|
||||
f.insert.value = ed.getLang('update');
|
||||
selectByValue(f, 'link_list', f.href.value);
|
||||
selectByValue(f, 'target_list', ed.dom.getAttrib(e, 'target'));
|
||||
selectByValue(f, 'class_list', ed.dom.getAttrib(e, 'class'));
|
||||
}
|
||||
},
|
||||
|
||||
update : function() {
|
||||
var f = document.forms[0], ed = tinyMCEPopup.editor, e, b, href = f.href.value.replace(/ /g, '%20');
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
e = ed.dom.getParent(ed.selection.getNode(), 'A');
|
||||
|
||||
// Remove element if there is no href
|
||||
if (!f.href.value) {
|
||||
if (e) {
|
||||
b = ed.selection.getBookmark();
|
||||
ed.dom.remove(e, 1);
|
||||
ed.selection.moveToBookmark(b);
|
||||
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
||||
tinyMCEPopup.close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Create new anchor elements
|
||||
if (e == null) {
|
||||
ed.getDoc().execCommand("unlink", false, null);
|
||||
tinyMCEPopup.execCommand("mceInsertLink", false, "#mce_temp_url#", {skip_undo : 1});
|
||||
|
||||
tinymce.each(ed.dom.select("a"), function(n) {
|
||||
if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
|
||||
e = n;
|
||||
|
||||
ed.dom.setAttribs(e, {
|
||||
href : href,
|
||||
title : f.linktitle.value,
|
||||
target : f.target_list ? getSelectValue(f, "target_list") : null,
|
||||
'class' : f.class_list ? getSelectValue(f, "class_list") : null
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ed.dom.setAttribs(e, {
|
||||
href : href,
|
||||
title : f.linktitle.value
|
||||
});
|
||||
|
||||
if (f.target_list) {
|
||||
ed.dom.setAttrib(e, 'target', getSelectValue(f, "target_list"));
|
||||
}
|
||||
|
||||
if (f.class_list) {
|
||||
ed.dom.setAttrib(e, 'class', getSelectValue(f, "class_list"));
|
||||
}
|
||||
}
|
||||
|
||||
// Don't move caret if selection was image
|
||||
if (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') {
|
||||
ed.focus();
|
||||
ed.selection.select(e);
|
||||
ed.selection.collapse(0);
|
||||
tinyMCEPopup.storeSelection();
|
||||
}
|
||||
|
||||
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
checkPrefix : function(n) {
|
||||
if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email')))
|
||||
n.value = 'mailto:' + n.value;
|
||||
|
||||
if (/^\s*www\./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external')))
|
||||
n.value = 'http://' + n.value;
|
||||
},
|
||||
|
||||
fillFileList : function(id, l) {
|
||||
var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
|
||||
|
||||
l = window[l];
|
||||
|
||||
if (l && l.length > 0) {
|
||||
lst.options[lst.options.length] = new Option('', '');
|
||||
|
||||
tinymce.each(l, function(o) {
|
||||
lst.options[lst.options.length] = new Option(o[0], o[1]);
|
||||
});
|
||||
} else
|
||||
dom.remove(dom.getParent(id, 'tr'));
|
||||
},
|
||||
|
||||
fillClassList : function(id) {
|
||||
var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
|
||||
|
||||
if (v = tinyMCEPopup.getParam('theme_advanced_styles')) {
|
||||
cl = [];
|
||||
|
||||
tinymce.each(v.split(';'), function(v) {
|
||||
var p = v.split('=');
|
||||
|
||||
cl.push({'title' : p[0], 'class' : p[1]});
|
||||
});
|
||||
} else
|
||||
cl = tinyMCEPopup.editor.dom.getClasses();
|
||||
|
||||
if (cl.length > 0) {
|
||||
lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');
|
||||
|
||||
tinymce.each(cl, function(o) {
|
||||
lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']);
|
||||
});
|
||||
} else
|
||||
dom.remove(dom.getParent(id, 'tr'));
|
||||
},
|
||||
|
||||
fillTargetList : function(id) {
|
||||
var dom = tinyMCEPopup.dom, lst = dom.get(id), v;
|
||||
|
||||
lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');
|
||||
lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_same'), '_self');
|
||||
lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_blank'), '_blank');
|
||||
|
||||
if (v = tinyMCEPopup.getParam('theme_advanced_link_targets')) {
|
||||
tinymce.each(v.split(','), function(v) {
|
||||
v = v.split('=');
|
||||
lst.options[lst.options.length] = new Option(v[0], v[1]);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
LinkDialog.preInit();
|
||||
tinyMCEPopup.onInit.add(LinkDialog.init, LinkDialog);
|
|
@ -1,78 +0,0 @@
|
|||
tinyMCEPopup.requireLangPack();
|
||||
tinyMCEPopup.onInit.add(onLoadInit);
|
||||
|
||||
function saveContent() {
|
||||
tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value, {source_view : true});
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
function onLoadInit() {
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
|
||||
// Remove Gecko spellchecking
|
||||
if (tinymce.isGecko)
|
||||
document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck");
|
||||
|
||||
document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true});
|
||||
|
||||
if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) {
|
||||
turnWrapOn();
|
||||
document.getElementById('wraped').checked = true;
|
||||
}
|
||||
|
||||
resizeInputs();
|
||||
}
|
||||
|
||||
function setWrap(val) {
|
||||
var v, n, s = document.getElementById('htmlSource');
|
||||
|
||||
s.wrap = val;
|
||||
|
||||
if (!tinymce.isIE) {
|
||||
v = s.value;
|
||||
n = s.cloneNode(false);
|
||||
n.setAttribute("wrap", val);
|
||||
s.parentNode.replaceChild(n, s);
|
||||
n.value = v;
|
||||
}
|
||||
}
|
||||
|
||||
function setWhiteSpaceCss(value) {
|
||||
var el = document.getElementById('htmlSource');
|
||||
tinymce.DOM.setStyle(el, 'white-space', value);
|
||||
}
|
||||
|
||||
function turnWrapOff() {
|
||||
if (tinymce.isWebKit) {
|
||||
setWhiteSpaceCss('pre');
|
||||
} else {
|
||||
setWrap('off');
|
||||
}
|
||||
}
|
||||
|
||||
function turnWrapOn() {
|
||||
if (tinymce.isWebKit) {
|
||||
setWhiteSpaceCss('pre-wrap');
|
||||
} else {
|
||||
setWrap('soft');
|
||||
}
|
||||
}
|
||||
|
||||
function toggleWordWrap(elm) {
|
||||
if (elm.checked) {
|
||||
turnWrapOn();
|
||||
} else {
|
||||
turnWrapOff();
|
||||
}
|
||||
}
|
||||
|
||||
function resizeInputs() {
|
||||
var vp = tinyMCEPopup.dom.getViewPort(window), el;
|
||||
|
||||
el = document.getElementById('htmlSource');
|
||||
|
||||
if (el) {
|
||||
el.style.width = (vp.w - 20) + 'px';
|
||||
el.style.height = (vp.h - 65) + 'px';
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
tinyMCE.addI18n('en.advanced',{"underline_desc":"Underline (Ctrl+U)","italic_desc":"Italic (Ctrl+I)","bold_desc":"Bold (Ctrl+B)",dd:"Definition Description",dt:"Definition Term ",samp:"Code Sample",code:"Code",blockquote:"Block Quote",h6:"Heading 6",h5:"Heading 5",h4:"Heading 4",h3:"Heading 3",h2:"Heading 2",h1:"Heading 1",pre:"Preformatted",address:"Address",div:"DIV",paragraph:"Paragraph",block:"Format",fontdefault:"Font Family","font_size":"Font Size","style_select":"Styles","anchor_delta_height":"","anchor_delta_width":"","charmap_delta_height":"","charmap_delta_width":"","colorpicker_delta_height":"","colorpicker_delta_width":"","link_delta_height":"","link_delta_width":"","image_delta_height":"","image_delta_width":"","more_colors":"More Colors...","toolbar_focus":"Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X",newdocument:"Are you sure you want clear all contents?",path:"Path","clipboard_msg":"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?","blockquote_desc":"Block Quote","help_desc":"Help","newdocument_desc":"New Document","image_props_desc":"Image Properties","paste_desc":"Paste (Ctrl+V)","copy_desc":"Copy (Ctrl+C)","cut_desc":"Cut (Ctrl+X)","anchor_desc":"Insert/Edit Anchor","visualaid_desc":"show/Hide Guidelines/Invisible Elements","charmap_desc":"Insert Special Character","backcolor_desc":"Select Background Color","forecolor_desc":"Select Text Color","custom1_desc":"Your Custom Description Here","removeformat_desc":"Remove Formatting","hr_desc":"Insert Horizontal Line","sup_desc":"Superscript","sub_desc":"Subscript","code_desc":"Edit HTML Source","cleanup_desc":"Cleanup Messy Code","image_desc":"Insert/Edit Image","unlink_desc":"Unlink","link_desc":"Insert/Edit Link","redo_desc":"Redo (Ctrl+Y)","undo_desc":"Undo (Ctrl+Z)","indent_desc":"Increase Indent","outdent_desc":"Decrease Indent","numlist_desc":"Insert/Remove Numbered List","bullist_desc":"Insert/Remove Bulleted List","justifyfull_desc":"Align Full","justifyright_desc":"Align Right","justifycenter_desc":"Align Center","justifyleft_desc":"Align Left","striketrough_desc":"Strikethrough","help_shortcut":"Press ALT-F10 for toolbar. Press ALT-0 for help","rich_text_area":"Rich Text Area","shortcuts_desc":"Accessability Help",toolbar:"Toolbar"});
|
|
@ -1 +0,0 @@
|
|||
tinyMCE.addI18n('en.advanced_dlg', {"link_list":"Link List","link_is_external":"The URL you entered seems to be an external link. Do you want to add the required http:// prefix?","link_is_email":"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?","link_titlefield":"Title","link_target_blank":"Open Link in a New Window","link_target_same":"Open Link in the Same Window","link_target":"Target","link_url":"Link URL","link_title":"Insert/Edit Link","image_align_right":"Right","image_align_left":"Left","image_align_textbottom":"Text Bottom","image_align_texttop":"Text Top","image_align_bottom":"Bottom","image_align_middle":"Middle","image_align_top":"Top","image_align_baseline":"Baseline","image_align":"Alignment","image_hspace":"Horizontal Space","image_vspace":"Vertical Space","image_dimensions":"Dimensions","image_alt":"Image Description","image_list":"Image List","image_border":"Border","image_src":"Image URL","image_title":"Insert/Edit Image","charmap_title":"Select Special Character", "charmap_usage":"Use left and right arrows to navigate.","colorpicker_name":"Name:","colorpicker_color":"Color:","colorpicker_named_title":"Named Colors","colorpicker_named_tab":"Named","colorpicker_palette_title":"Palette Colors","colorpicker_palette_tab":"Palette","colorpicker_picker_title":"Color Picker","colorpicker_picker_tab":"Picker","colorpicker_title":"Select a Color","code_wordwrap":"Word Wrap","code_title":"HTML Source Editor","anchor_name":"Anchor Name","anchor_title":"Insert/Edit Anchor","about_loaded":"Loaded Plugins","about_version":"Version","about_author":"Author","about_plugin":"Plugin","about_plugins":"Plugins","about_license":"License","about_help":"Help","about_general":"About","about_title":"About TinyMCE","anchor_invalid":"Please specify a valid anchor name.","accessibility_help":"Accessibility Help","accessibility_usage_title":"General Usage","invalid_color_value":"Invalid color value","":""});
|
|
@ -1,58 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!-- Added by Dan S./Zotero -->
|
||||
<title>{#advanced_dlg.link_title}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="../../utils/mctabs.js"></script>
|
||||
<script type="text/javascript" src="../../utils/form_utils.js"></script>
|
||||
<script type="text/javascript" src="../../utils/validate.js"></script>
|
||||
<script type="text/javascript" src="js/link.js"></script>
|
||||
</head>
|
||||
<body id="link" style="display: none">
|
||||
<form onsubmit="LinkDialog.update();return false;" action="#">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.link_title}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel_wrapper">
|
||||
<div id="general_panel" class="panel current">
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="nowrap"><label for="href">{#advanced_dlg.link_url}</label></td>
|
||||
<td><table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input id="href" name="href" type="text" class="mceFocus" value="" style="width: 200px" onchange="LinkDialog.checkPrefix(this);" /></td>
|
||||
<td id="hrefbrowsercontainer"> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="link_list">{#advanced_dlg.link_list}</label></td>
|
||||
<td><select id="link_list" name="link_list" onchange="document.getElementById('href').value=this.options[this.selectedIndex].value;"></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label id="targetlistlabel" for="targetlist">{#advanced_dlg.link_target}</label></td>
|
||||
<td><select id="target_list" name="target_list"></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><label for="linktitle">{#advanced_dlg.link_titlefield}</label></td>
|
||||
<td><input id="linktitle" name="linktitle" type="text" value="" style="width: 200px" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="class_list">{#class_name}</label></td>
|
||||
<td><select id="class_list" name="class_list"></select></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<input type="submit" id="insert" name="insert" value="{#insert}" />
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
|
@ -1,50 +0,0 @@
|
|||
body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}
|
||||
body {background:#FFF;}
|
||||
body.mceForceColors {background:#FFF; color:#000;}
|
||||
body.mceBrowserDefaults {background:transparent; color:inherit; font-size:inherit; font-family:inherit;}
|
||||
h1 {font-size: 2em}
|
||||
h2 {font-size: 1.5em}
|
||||
h3 {font-size: 1.17em}
|
||||
h4 {font-size: 1em}
|
||||
h5 {font-size: .83em}
|
||||
h6 {font-size: .75em}
|
||||
.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}
|
||||
a.mceItemAnchor {display:inline-block; -webkit-user-select:all; -webkit-user-modify:read-only; -moz-user-select:all; -moz-user-modify:read-only; width:11px !important; height:11px !important; background:url(img/items.gif) no-repeat center center}
|
||||
span.mceItemNbsp {background: #DDD}
|
||||
td.mceSelected, th.mceSelected {background-color:#3399ff !important}
|
||||
img {border:0;}
|
||||
table, img, hr, .mceItemAnchor {cursor:default}
|
||||
table td, table th {cursor:text}
|
||||
ins {border-bottom:1px solid green; text-decoration: none; color:green}
|
||||
del {color:red; text-decoration:line-through}
|
||||
cite {border-bottom:1px dashed blue}
|
||||
acronym {border-bottom:1px dotted #CCC; cursor:help}
|
||||
abbr {border-bottom:1px dashed #CCC; cursor:help}
|
||||
|
||||
/* IE */
|
||||
* html body {
|
||||
scrollbar-3dlight-color:#F0F0EE;
|
||||
scrollbar-arrow-color:#676662;
|
||||
scrollbar-base-color:#F0F0EE;
|
||||
scrollbar-darkshadow-color:#DDD;
|
||||
scrollbar-face-color:#E0E0DD;
|
||||
scrollbar-highlight-color:#F0F0EE;
|
||||
scrollbar-shadow-color:#F0F0EE;
|
||||
scrollbar-track-color:#F5F5F5;
|
||||
}
|
||||
|
||||
img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px}
|
||||
font[face=mceinline] {font-family:inherit !important}
|
||||
*[contentEditable]:focus {outline:0}
|
||||
|
||||
.mceItemMedia {border:1px dotted #cc0000; background-position:center; background-repeat:no-repeat; background-color:#ffffcc}
|
||||
.mceItemShockWave {background-image:url(../../img/shockwave.gif)}
|
||||
.mceItemFlash {background-image:url(../../img/flash.gif)}
|
||||
.mceItemQuickTime {background-image:url(../../img/quicktime.gif)}
|
||||
.mceItemWindowsMedia {background-image:url(../../img/windowsmedia.gif)}
|
||||
.mceItemRealMedia {background-image:url(../../img/realmedia.gif)}
|
||||
.mceItemVideo {background-image:url(../../img/video.gif)}
|
||||
.mceItemAudio {background-image:url(../../img/video.gif)}
|
||||
.mceItemEmbeddedAudio {background-image:url(../../img/video.gif)}
|
||||
.mceItemIframe {background-image:url(../../img/iframe.gif)}
|
||||
.mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../../img/pagebreak.gif) no-repeat center top;}
|
|
@ -1,118 +0,0 @@
|
|||
/* Generic */
|
||||
body {
|
||||
font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;
|
||||
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;
|
||||
background:#F0F0EE;
|
||||
padding:0;
|
||||
margin:8px 8px 0 8px;
|
||||
}
|
||||
|
||||
html {background:#F0F0EE;}
|
||||
td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
|
||||
textarea {resize:none;outline:none;}
|
||||
a:link, a:visited {color:black;}
|
||||
a:hover {color:#2B6FB6;}
|
||||
.nowrap {white-space: nowrap}
|
||||
|
||||
/* Forms */
|
||||
fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}
|
||||
legend {color:#2B6FB6; font-weight:bold;}
|
||||
label.msg {display:none;}
|
||||
label.invalid {color:#EE0000; display:inline;}
|
||||
input.invalid {border:1px solid #EE0000;}
|
||||
input {background:#FFF; border:1px solid #CCC;}
|
||||
input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
|
||||
input, select, textarea {border:1px solid #808080;}
|
||||
input.radio {border:1px none #000000; background:transparent; vertical-align:middle;}
|
||||
input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;}
|
||||
.input_noborder {border:0;}
|
||||
|
||||
/* Buttons */
|
||||
#insert, #cancel, input.button, .updateButton {
|
||||
border:0; margin:0; padding:0;
|
||||
font-weight:bold;
|
||||
width:94px; height:26px;
|
||||
background:url(img/buttons.png) 0 -26px;
|
||||
cursor:pointer;
|
||||
padding-bottom:2px;
|
||||
float:left;
|
||||
}
|
||||
|
||||
#insert {background:url(img/buttons.png) 0 -52px}
|
||||
#cancel {background:url(img/buttons.png) 0 0; float:right}
|
||||
|
||||
/* Browse */
|
||||
a.pickcolor, a.browse {text-decoration:none}
|
||||
a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}
|
||||
.mceOldBoxModel a.browse span {width:22px; height:20px;}
|
||||
a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}
|
||||
a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
|
||||
a.browse:hover span.disabled {border:1px solid white; background-color:transparent;}
|
||||
a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;}
|
||||
.mceOldBoxModel a.pickcolor span {width:21px; height:17px;}
|
||||
a.pickcolor:hover span {background-color:#B2BBD0;}
|
||||
a.pickcolor:hover span.disabled {}
|
||||
|
||||
/* Charmap */
|
||||
table.charmap {border:1px solid #AAA; text-align:center}
|
||||
td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;}
|
||||
#charmap a {display:block; color:#000; text-decoration:none; border:0}
|
||||
#charmap a:hover {background:#CCC;color:#2B6FB6}
|
||||
#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center}
|
||||
#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center}
|
||||
|
||||
/* Source */
|
||||
.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;}
|
||||
.mceActionPanel {margin-top:5px;}
|
||||
|
||||
/* Tabs classes */
|
||||
.tabs {width:100%; height:18px; line-height:normal; background:url(img/tabs.gif) repeat-x 0 -72px;}
|
||||
.tabs ul {margin:0; padding:0; list-style:none;}
|
||||
.tabs li {float:left; background:url(img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;}
|
||||
.tabs li.current {background:url(img/tabs.gif) no-repeat 0 -18px; margin-right:2px;}
|
||||
.tabs span {float:left; display:block; background:url(img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;}
|
||||
.tabs .current span {background:url(img/tabs.gif) no-repeat right -54px;}
|
||||
.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;}
|
||||
.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;}
|
||||
|
||||
/* Panels */
|
||||
.panel_wrapper div.panel {display:none;}
|
||||
.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;}
|
||||
.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;}
|
||||
|
||||
/* Columns */
|
||||
.column {float:left;}
|
||||
.properties {width:100%;}
|
||||
.properties .column1 {}
|
||||
.properties .column2 {text-align:left;}
|
||||
|
||||
/* Titles */
|
||||
h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;}
|
||||
h3 {font-size:14px;}
|
||||
.title {font-size:12px; font-weight:bold; color:#2B6FB6;}
|
||||
|
||||
/* Dialog specific */
|
||||
#link .panel_wrapper, #link div.current {height:125px;}
|
||||
#image .panel_wrapper, #image div.current {height:200px;}
|
||||
#plugintable thead {font-weight:bold; background:#DDD;}
|
||||
#plugintable, #about #plugintable td {border:1px solid #919B9C;}
|
||||
#plugintable {width:96%; margin-top:10px;}
|
||||
#pluginscontainer {height:290px; overflow:auto;}
|
||||
#colorpicker #preview {display:inline-block; padding-left:40px; height:14px; border:1px solid black; margin-left:5px; margin-right: 5px}
|
||||
#colorpicker #previewblock {position: relative; top: -3px; padding-left:5px; padding-top: 0px; display:inline}
|
||||
#colorpicker #preview_wrapper { text-align:center; padding-top:4px; white-space: nowrap}
|
||||
#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;}
|
||||
#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;}
|
||||
#colorpicker #light div {overflow:hidden;}
|
||||
#colorpicker .panel_wrapper div.current {height:175px;}
|
||||
#colorpicker #namedcolors {width:150px;}
|
||||
#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}
|
||||
#colorpicker #colornamecontainer {margin-top:5px;}
|
||||
#colorpicker #picker_panel fieldset {margin:auto;width:325px;}
|
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 64 B |
Before Width: | Height: | Size: 68 B |
Before Width: | Height: | Size: 70 B |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.3 KiB |
|
@ -1,219 +0,0 @@
|
|||
/* Reset */
|
||||
.defaultSkin table, .defaultSkin tbody, .defaultSkin a, .defaultSkin img, .defaultSkin tr, .defaultSkin div, .defaultSkin td, .defaultSkin iframe, .defaultSkin span, .defaultSkin *, .defaultSkin .mceText {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate; text-align:left}
|
||||
.defaultSkin a:hover, .defaultSkin a:link, .defaultSkin a:visited, .defaultSkin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000}
|
||||
.defaultSkin table td {vertical-align:middle}
|
||||
|
||||
/* Containers */
|
||||
.defaultSkin table {direction:ltr;background:transparent}
|
||||
.defaultSkin iframe {display:block;}
|
||||
.defaultSkin .mceToolbar {height:26px}
|
||||
.defaultSkin .mceLeft {text-align:left}
|
||||
.defaultSkin .mceRight {text-align:right}
|
||||
|
||||
/* External */
|
||||
.defaultSkin .mceExternalToolbar {position:absolute; border:1px solid #CCC; border-bottom:0; display:none;}
|
||||
.defaultSkin .mceExternalToolbar td.mceToolbar {padding-right:13px;}
|
||||
.defaultSkin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0}
|
||||
|
||||
/* Layout */
|
||||
.defaultSkin table.mceLayout {border:0; border-left:1px solid #CCC; border-right:1px solid #CCC}
|
||||
.defaultSkin table.mceLayout tr.mceFirst td {border-top:1px solid #CCC}
|
||||
.defaultSkin table.mceLayout tr.mceLast td {border-bottom:1px solid #CCC}
|
||||
.defaultSkin table.mceToolbar, .defaultSkin tr.mceFirst .mceToolbar tr td, .defaultSkin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0;}
|
||||
.defaultSkin td.mceToolbar {background:#F0F0EE; padding-top:1px; vertical-align:top}
|
||||
.defaultSkin .mceIframeContainer {border-top:1px solid #CCC; border-bottom:1px solid #CCC}
|
||||
.defaultSkin .mceStatusbar {background:#F0F0EE; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; display:block; height:20px}
|
||||
.defaultSkin .mceStatusbar div {float:left; margin:2px}
|
||||
.defaultSkin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize; outline:0}
|
||||
.defaultSkin .mceStatusbar a:hover {text-decoration:underline}
|
||||
.defaultSkin table.mceToolbar {margin-left:3px}
|
||||
.defaultSkin span.mceIcon, .defaultSkin img.mceIcon {display:block; width:20px; height:20px}
|
||||
.defaultSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px}
|
||||
.defaultSkin td.mceCenter {text-align:center;}
|
||||
.defaultSkin td.mceCenter table {margin:0 auto; text-align:left;}
|
||||
.defaultSkin td.mceRight table {margin:0 0 0 auto;}
|
||||
|
||||
/* Button */
|
||||
.defaultSkin .mceButton {display:block; border:1px solid #F0F0EE; width:20px; height:20px; margin-right:1px}
|
||||
.defaultSkin a.mceButtonEnabled:hover {border:1px solid #0A246A; background-color:#B2BBD0}
|
||||
.defaultSkin a.mceButtonActive, .defaultSkin a.mceButtonSelected {border:1px solid #0A246A; background-color:#C2CBE0}
|
||||
.defaultSkin .mceButtonDisabled .mceIcon {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
|
||||
.defaultSkin .mceButtonLabeled {width:auto}
|
||||
.defaultSkin .mceButtonLabeled span.mceIcon {float:left}
|
||||
.defaultSkin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica}
|
||||
.defaultSkin .mceButtonDisabled .mceButtonLabel {color:#888}
|
||||
|
||||
/* Separator */
|
||||
.defaultSkin .mceSeparator {display:block; background:url(../../img/icons.gif) -180px 0; width:2px; height:20px; margin:2px 2px 0 4px}
|
||||
|
||||
/* ListBox */
|
||||
.defaultSkin .mceListBox, .defaultSkin .mceListBox a {display:block}
|
||||
.defaultSkin .mceListBox .mceText {padding-left:4px; width:70px; text-align:left; border:1px solid #CCC; border-right:0; background:#FFF; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden}
|
||||
.defaultSkin .mceListBox .mceOpen {width:9px; height:20px; background:url(../../img/icons.gif) -741px 0; margin-right:2px; border:1px solid #CCC;}
|
||||
.defaultSkin table.mceListBoxEnabled:hover .mceText, .defaultSkin .mceListBoxHover .mceText, .defaultSkin .mceListBoxSelected .mceText {border:1px solid #A2ABC0; border-right:0; background:#FFF}
|
||||
.defaultSkin table.mceListBoxEnabled:hover .mceOpen, .defaultSkin .mceListBoxHover .mceOpen, .defaultSkin .mceListBoxSelected .mceOpen {background-color:#FFF; border:1px solid #A2ABC0}
|
||||
.defaultSkin .mceListBoxDisabled a.mceText {color:gray; background-color:transparent;}
|
||||
.defaultSkin .mceListBoxMenu {overflow:auto; overflow-x:hidden}
|
||||
.defaultSkin .mceOldBoxModel .mceListBox .mceText {height:22px}
|
||||
.defaultSkin .mceOldBoxModel .mceListBox .mceOpen {width:11px; height:22px;}
|
||||
.defaultSkin select.mceNativeListBox {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:7pt; background:#F0F0EE; border:1px solid gray; margin-right:2px;}
|
||||
|
||||
/* SplitButton */
|
||||
.defaultSkin .mceSplitButton {width:32px; height:20px; direction:ltr}
|
||||
.defaultSkin .mceSplitButton a, .defaultSkin .mceSplitButton span {height:20px; display:block}
|
||||
.defaultSkin .mceSplitButton a.mceAction {width:20px; border:1px solid #F0F0EE; border-right:0;}
|
||||
.defaultSkin .mceSplitButton span.mceAction {width:20px; background-image:url(../../img/icons.gif);}
|
||||
.defaultSkin .mceSplitButton a.mceOpen {width:9px; background:url(../../img/icons.gif) -741px 0; border:1px solid #F0F0EE;}
|
||||
.defaultSkin .mceSplitButton span.mceOpen {display:none}
|
||||
.defaultSkin table.mceSplitButtonEnabled:hover a.mceAction, .defaultSkin .mceSplitButtonHover a.mceAction, .defaultSkin .mceSplitButtonSelected a.mceAction {border:1px solid #0A246A; border-right:0; background-color:#B2BBD0}
|
||||
.defaultSkin table.mceSplitButtonEnabled:hover a.mceOpen, .defaultSkin .mceSplitButtonHover a.mceOpen, .defaultSkin .mceSplitButtonSelected a.mceOpen {background-color:#B2BBD0; border:1px solid #0A246A;}
|
||||
.defaultSkin .mceSplitButtonDisabled .mceAction, .defaultSkin .mceSplitButtonDisabled a.mceOpen {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
|
||||
.defaultSkin .mceSplitButtonActive a.mceAction {border:1px solid #0A246A; background-color:#C2CBE0}
|
||||
.defaultSkin .mceSplitButtonActive a.mceOpen {border-left:0;}
|
||||
|
||||
/* ColorSplitButton */
|
||||
.defaultSkin div.mceColorSplitMenu table {background:#FFF; border:1px solid gray}
|
||||
.defaultSkin .mceColorSplitMenu td {padding:2px}
|
||||
.defaultSkin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden; border:1px solid #808080}
|
||||
.defaultSkin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px}
|
||||
.defaultSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF}
|
||||
.defaultSkin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2}
|
||||
.defaultSkin a.mceMoreColors:hover {border:1px solid #0A246A}
|
||||
.defaultSkin .mceColorPreview {margin-left:2px; width:16px; height:4px; overflow:hidden; background:#9a9b9a}
|
||||
.defaultSkin .mce_forecolor span.mceAction, .defaultSkin .mce_backcolor span.mceAction {overflow:hidden; height:16px}
|
||||
|
||||
/* Menu */
|
||||
.defaultSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #D4D0C8; direction:ltr}
|
||||
.defaultSkin .mceNoIcons span.mceIcon {width:0;}
|
||||
.defaultSkin .mceNoIcons a .mceText {padding-left:10px}
|
||||
.defaultSkin .mceMenu table {background:#FFF}
|
||||
.defaultSkin .mceMenu a, .defaultSkin .mceMenu span, .defaultSkin .mceMenu {display:block}
|
||||
.defaultSkin .mceMenu td {height:20px}
|
||||
.defaultSkin .mceMenu a {position:relative;padding:3px 0 4px 0}
|
||||
.defaultSkin .mceMenu .mceText {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block}
|
||||
.defaultSkin .mceMenu span.mceText, .defaultSkin .mceMenu .mcePreview {font-size:11px}
|
||||
.defaultSkin .mceMenu pre.mceText {font-family:Monospace}
|
||||
.defaultSkin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:22px;}
|
||||
.defaultSkin .mceMenu .mceMenuItemEnabled a:hover, .defaultSkin .mceMenu .mceMenuItemActive {background-color:#dbecf3}
|
||||
.defaultSkin td.mceMenuItemSeparator {background:#DDD; height:1px}
|
||||
.defaultSkin .mceMenuItemTitle a {border:0; background:#EEE; border-bottom:1px solid #DDD}
|
||||
.defaultSkin .mceMenuItemTitle span.mceText {color:#000; font-weight:bold; padding-left:4px}
|
||||
.defaultSkin .mceMenuItemDisabled .mceText {color:#888}
|
||||
.defaultSkin .mceMenuItemSelected .mceIcon {background:url(img/menu_check.gif)}
|
||||
.defaultSkin .mceNoIcons .mceMenuItemSelected a {background:url(img/menu_arrow.gif) no-repeat -6px center}
|
||||
.defaultSkin .mceMenu span.mceMenuLine {display:none}
|
||||
.defaultSkin .mceMenuItemSub a {background:url(img/menu_arrow.gif) no-repeat top right;}
|
||||
.defaultSkin .mceMenuItem td, .defaultSkin .mceMenuItem th {line-height: normal}
|
||||
|
||||
/* Progress,Resize */
|
||||
.defaultSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50); background:#FFF}
|
||||
.defaultSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}
|
||||
|
||||
/* Rtl */
|
||||
.mceRtl .mceListBox .mceText {text-align: right; padding: 0 4px 0 0}
|
||||
.mceRtl .mceMenuItem .mceText {text-align: right}
|
||||
|
||||
/* Formats */
|
||||
.defaultSkin .mce_formatPreview a {font-size:10px}
|
||||
.defaultSkin .mce_p span.mceText {}
|
||||
.defaultSkin .mce_address span.mceText {font-style:italic}
|
||||
.defaultSkin .mce_pre span.mceText {font-family:monospace}
|
||||
.defaultSkin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em}
|
||||
.defaultSkin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em}
|
||||
.defaultSkin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em}
|
||||
.defaultSkin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em}
|
||||
.defaultSkin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em}
|
||||
.defaultSkin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em}
|
||||
|
||||
/* Theme */
|
||||
.defaultSkin span.mce_bold {background-position:0 0}
|
||||
.defaultSkin span.mce_italic {background-position:-60px 0}
|
||||
.defaultSkin span.mce_underline {background-position:-140px 0}
|
||||
.defaultSkin span.mce_strikethrough {background-position:-120px 0}
|
||||
.defaultSkin span.mce_undo {background-position:-160px 0}
|
||||
.defaultSkin span.mce_redo {background-position:-100px 0}
|
||||
.defaultSkin span.mce_cleanup {background-position:-40px 0}
|
||||
.defaultSkin span.mce_bullist {background-position:-20px 0}
|
||||
.defaultSkin span.mce_numlist {background-position:-80px 0}
|
||||
.defaultSkin span.mce_justifyleft {background-position:-460px 0}
|
||||
.defaultSkin span.mce_justifyright {background-position:-480px 0}
|
||||
.defaultSkin span.mce_justifycenter {background-position:-420px 0}
|
||||
.defaultSkin span.mce_justifyfull {background-position:-440px 0}
|
||||
.defaultSkin span.mce_anchor {background-position:-200px 0}
|
||||
.defaultSkin span.mce_indent {background-position:-400px 0}
|
||||
.defaultSkin span.mce_outdent {background-position:-540px 0}
|
||||
.defaultSkin span.mce_link {background-position:-500px 0}
|
||||
.defaultSkin span.mce_unlink {background-position:-640px 0}
|
||||
.defaultSkin span.mce_sub {background-position:-600px 0}
|
||||
.defaultSkin span.mce_sup {background-position:-620px 0}
|
||||
.defaultSkin span.mce_removeformat {background-position:-580px 0}
|
||||
.defaultSkin span.mce_newdocument {background-position:-520px 0}
|
||||
.defaultSkin span.mce_image {background-position:-380px 0}
|
||||
.defaultSkin span.mce_help {background-position:-340px 0}
|
||||
.defaultSkin span.mce_code {background-position:-260px 0}
|
||||
.defaultSkin span.mce_hr {background-position:-360px 0}
|
||||
.defaultSkin span.mce_visualaid {background-position:-660px 0}
|
||||
.defaultSkin span.mce_charmap {background-position:-240px 0}
|
||||
.defaultSkin span.mce_paste {background-position:-560px 0}
|
||||
.defaultSkin span.mce_copy {background-position:-700px 0}
|
||||
.defaultSkin span.mce_cut {background-position:-680px 0}
|
||||
.defaultSkin span.mce_blockquote {background-position:-220px 0}
|
||||
.defaultSkin .mce_forecolor span.mceAction {background-position:-720px 0}
|
||||
.defaultSkin .mce_backcolor span.mceAction {background-position:-760px 0}
|
||||
.defaultSkin span.mce_forecolorpicker {background-position:-720px 0}
|
||||
.defaultSkin span.mce_backcolorpicker {background-position:-760px 0}
|
||||
|
||||
/* Plugins */
|
||||
.defaultSkin span.mce_advhr {background-position:-0px -20px}
|
||||
.defaultSkin span.mce_ltr {background-position:-20px -20px}
|
||||
.defaultSkin span.mce_rtl {background-position:-40px -20px}
|
||||
.defaultSkin span.mce_emotions {background-position:-60px -20px}
|
||||
.defaultSkin span.mce_fullpage {background-position:-80px -20px}
|
||||
.defaultSkin span.mce_fullscreen {background-position:-100px -20px}
|
||||
.defaultSkin span.mce_iespell {background-position:-120px -20px}
|
||||
.defaultSkin span.mce_insertdate {background-position:-140px -20px}
|
||||
.defaultSkin span.mce_inserttime {background-position:-160px -20px}
|
||||
.defaultSkin span.mce_absolute {background-position:-180px -20px}
|
||||
.defaultSkin span.mce_backward {background-position:-200px -20px}
|
||||
.defaultSkin span.mce_forward {background-position:-220px -20px}
|
||||
.defaultSkin span.mce_insert_layer {background-position:-240px -20px}
|
||||
.defaultSkin span.mce_insertlayer {background-position:-260px -20px}
|
||||
.defaultSkin span.mce_movebackward {background-position:-280px -20px}
|
||||
.defaultSkin span.mce_moveforward {background-position:-300px -20px}
|
||||
.defaultSkin span.mce_media {background-position:-320px -20px}
|
||||
.defaultSkin span.mce_nonbreaking {background-position:-340px -20px}
|
||||
.defaultSkin span.mce_pastetext {background-position:-360px -20px}
|
||||
.defaultSkin span.mce_pasteword {background-position:-380px -20px}
|
||||
.defaultSkin span.mce_selectall {background-position:-400px -20px}
|
||||
.defaultSkin span.mce_preview {background-position:-420px -20px}
|
||||
.defaultSkin span.mce_print {background-position:-440px -20px}
|
||||
.defaultSkin span.mce_cancel {background-position:-460px -20px}
|
||||
.defaultSkin span.mce_save {background-position:-480px -20px}
|
||||
.defaultSkin span.mce_replace {background-position:-500px -20px}
|
||||
.defaultSkin span.mce_search {background-position:-520px -20px}
|
||||
.defaultSkin span.mce_styleprops {background-position:-560px -20px}
|
||||
.defaultSkin span.mce_table {background-position:-580px -20px}
|
||||
.defaultSkin span.mce_cell_props {background-position:-600px -20px}
|
||||
.defaultSkin span.mce_delete_table {background-position:-620px -20px}
|
||||
.defaultSkin span.mce_delete_col {background-position:-640px -20px}
|
||||
.defaultSkin span.mce_delete_row {background-position:-660px -20px}
|
||||
.defaultSkin span.mce_col_after {background-position:-680px -20px}
|
||||
.defaultSkin span.mce_col_before {background-position:-700px -20px}
|
||||
.defaultSkin span.mce_row_after {background-position:-720px -20px}
|
||||
.defaultSkin span.mce_row_before {background-position:-740px -20px}
|
||||
.defaultSkin span.mce_merge_cells {background-position:-760px -20px}
|
||||
.defaultSkin span.mce_table_props {background-position:-980px -20px}
|
||||
.defaultSkin span.mce_row_props {background-position:-780px -20px}
|
||||
.defaultSkin span.mce_split_cells {background-position:-800px -20px}
|
||||
.defaultSkin span.mce_template {background-position:-820px -20px}
|
||||
.defaultSkin span.mce_visualchars {background-position:-840px -20px}
|
||||
.defaultSkin span.mce_abbr {background-position:-860px -20px}
|
||||
.defaultSkin span.mce_acronym {background-position:-880px -20px}
|
||||
.defaultSkin span.mce_attribs {background-position:-900px -20px}
|
||||
.defaultSkin span.mce_cite {background-position:-920px -20px}
|
||||
.defaultSkin span.mce_del {background-position:-940px -20px}
|
||||
.defaultSkin span.mce_ins {background-position:-960px -20px}
|
||||
.defaultSkin span.mce_pagebreak {background-position:0 -40px}
|
||||
.defaultSkin span.mce_restoredraft {background-position:-20px -40px}
|
||||
.defaultSkin span.mce_spellchecker {background-position:-540px -20px}
|
||||
.defaultSkin span.mce_visualblocks {background-position: -40px -40px}
|
|
@ -1,26 +0,0 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!-- Added by Dan S./Zotero -->
|
||||
<title>{#advanced_dlg.code_title}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="js/source_editor.js"></script>
|
||||
</head>
|
||||
<body onresize="resizeInputs();" style="display:none; overflow:hidden;" spellcheck="false">
|
||||
<form name="source" onsubmit="saveContent();return false;" action="#">
|
||||
<div style="float: left" class="title"><label for="htmlSource">{#advanced_dlg.code_title}</label></div>
|
||||
|
||||
<div id="wrapline" style="float: right">
|
||||
<input type="checkbox" name="wraped" id="wraped" onclick="toggleWordWrap(this);" class="wordWrapCode" /><label for="wraped">{#advanced_dlg.code_wordwrap}</label>
|
||||
</div>
|
||||
|
||||
<br style="clear: both" />
|
||||
|
||||
<textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,monospace; font-size: 12px;" dir="ltr" wrap="off" class="mceFocus"></textarea>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<input type="submit" role="button" name="insert" value="{#update}" id="insert" />
|
||||
<input type="button" role="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
1339
resource/tinymce/themes/modern/theme.js
Normal file
19021
resource/tinymce/tiny_mce.js
vendored
5
resource/tinymce/tiny_mce_popup.js
vendored
|
@ -1,5 +0,0 @@
|
|||
|
||||
// Uncomment and change this document.domain value if you are loading the script cross subdomains
|
||||
// document.domain = 'moxiecode.com';
|
||||
|
||||
var tinymce=null,tinyMCEPopup,tinyMCE;tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document,{ownEvents:true,proxy:tinyMCEPopup._eventProxy});b.dom.bind(window,"ready",b._onDOMLoaded,b);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return(!window.frameElement&&window.dialogArguments)||opener||parent||top},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},10)},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false&&b.editor.settings.language_load!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('<script type="text/javascript" src="'+tinymce._addVer(a)+'"><\/script>');tinymce.ScriptLoader.markDone(a)}}},pickColor:function(b,a){this.execCommand("mceColorPicker",true,{color:document.getElementById(a).value,func:function(e){document.getElementById(a).value=e;try{document.getElementById(a).onchange()}catch(d){}}})},openBrowser:function(a,c,b){tinyMCEPopup.restoreSelection();this.editor.execCallback("file_browser_callback",a,document.getElementById(a).value,c,window)},confirm:function(b,a,c){this.editor.windowManager.confirm(b,a,c,window)},alert:function(b,a,c){this.editor.windowManager.alert(b,a,c,window)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);tinymce=tinyMCE=a.editor=a.params=a.dom=a.dom.doc=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},_restoreSelection:function(){var a=window.event.srcElement;if(a.nodeName=="INPUT"&&(a.type=="submit"||a.type=="button")){tinyMCEPopup.restoreSelection()}},_onDOMLoaded:function(){var b=tinyMCEPopup,d=document.title,e,c,a;if(b.features.translate_i18n!==false){c=document.body.innerHTML;if(tinymce.isIE){c=c.replace(/ (value|title|alt)=([^"][^\s>]+)/gi,' $1="$2"')}document.dir=b.editor.getParam("directionality","");if((a=b.editor.translate(c))&&a!=c){document.body.innerHTML=a}if((a=b.editor.translate(d))&&a!=d){document.title=d=a}}if(!b.editor.getParam("browser_preferred_colors",false)||!b.isWindow){b.dom.addClass(document.body,"forceColors")}document.body.style.display="";if(tinymce.isIE){document.attachEvent("onmouseup",tinyMCEPopup._restoreSelection);b.dom.add(b.dom.select("head")[0],"base",{target:"_self"})}b.restoreSelection();b.resizeToInnerSize();if(!b.isWindow){b.editor.windowManager.setTitle(window,d)}else{window.focus()}if(!tinymce.isIE&&!b.isWindow){b.dom.bind(document,"focus",function(){b.editor.windowManager.focus(b.id)})}tinymce.each(b.dom.select("select"),function(f){f.onkeydown=tinyMCEPopup._accessHandler});tinymce.each(b.listeners,function(f){f.func.call(f.scope,b.editor)});if(b.getWindowArg("mce_auto_focus",true)){window.focus();tinymce.each(document.forms,function(g){tinymce.each(g.elements,function(f){if(b.dom.hasClass(f,"mceFocus")&&!f.disabled){f.focus();return false}})})}document.onkeyup=tinyMCEPopup._closeWinKeyHandler},_accessHandler:function(a){a=a||window.event;if(a.keyCode==13||a.keyCode==32){var b=a.target||a.srcElement;if(b.onchange){b.onchange()}return tinymce.dom.Event.cancel(a)}},_closeWinKeyHandler:function(a){a=a||window.event;if(a.keyCode==27){tinyMCEPopup.close()}},_eventProxy:function(a){return function(b){tinyMCEPopup.dom.events.callNativeHandler(a,b)}}};tinyMCEPopup.init();
|
48792
resource/tinymce/tinymce.js
Normal file
|
@ -1,70 +0,0 @@
|
|||
/**
|
||||
* editable_selects.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
var TinyMCE_EditableSelects = {
|
||||
editSelectElm : null,
|
||||
|
||||
init : function() {
|
||||
var nl = document.getElementsByTagName("select"), i, d = document, o;
|
||||
|
||||
for (i=0; i<nl.length; i++) {
|
||||
if (nl[i].className.indexOf('mceEditableSelect') != -1) {
|
||||
o = new Option(tinyMCEPopup.editor.translate('value'), '__mce_add_custom__');
|
||||
|
||||
o.className = 'mceAddSelectValue';
|
||||
|
||||
nl[i].options[nl[i].options.length] = o;
|
||||
nl[i].onchange = TinyMCE_EditableSelects.onChangeEditableSelect;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onChangeEditableSelect : function(e) {
|
||||
var d = document, ne, se = window.event ? window.event.srcElement : e.target;
|
||||
|
||||
if (se.options[se.selectedIndex].value == '__mce_add_custom__') {
|
||||
ne = d.createElement("input");
|
||||
ne.id = se.id + "_custom";
|
||||
ne.name = se.name + "_custom";
|
||||
ne.type = "text";
|
||||
|
||||
ne.style.width = se.offsetWidth + 'px';
|
||||
se.parentNode.insertBefore(ne, se);
|
||||
se.style.display = 'none';
|
||||
ne.focus();
|
||||
ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput;
|
||||
ne.onkeydown = TinyMCE_EditableSelects.onKeyDown;
|
||||
TinyMCE_EditableSelects.editSelectElm = se;
|
||||
}
|
||||
},
|
||||
|
||||
onBlurEditableSelectInput : function() {
|
||||
var se = TinyMCE_EditableSelects.editSelectElm;
|
||||
|
||||
if (se) {
|
||||
if (se.previousSibling.value != '') {
|
||||
addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value);
|
||||
selectByValue(document.forms[0], se.id, se.previousSibling.value);
|
||||
} else
|
||||
selectByValue(document.forms[0], se.id, '');
|
||||
|
||||
se.style.display = 'inline';
|
||||
se.parentNode.removeChild(se.previousSibling);
|
||||
TinyMCE_EditableSelects.editSelectElm = null;
|
||||
}
|
||||
},
|
||||
|
||||
onKeyDown : function(e) {
|
||||
e = e || window.event;
|
||||
|
||||
if (e.keyCode == 13)
|
||||
TinyMCE_EditableSelects.onBlurEditableSelectInput();
|
||||
}
|
||||
};
|
|
@ -1,210 +0,0 @@
|
|||
/**
|
||||
* form_utils.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme"));
|
||||
|
||||
function getColorPickerHTML(id, target_form_element) {
|
||||
var h = "", dom = tinyMCEPopup.dom;
|
||||
|
||||
if (label = dom.select('label[for=' + target_form_element + ']')[0]) {
|
||||
label.id = label.id || dom.uniqueId();
|
||||
}
|
||||
|
||||
h += '<a role="button" aria-labelledby="' + id + '_label" id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">';
|
||||
h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> <span id="' + id + '_label" class="mceVoiceLabel mceIconOnly" style="display:none;">' + tinyMCEPopup.getLang('browse') + '</span></span></a>';
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
function updateColor(img_id, form_element_id) {
|
||||
document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
|
||||
}
|
||||
|
||||
function setBrowserDisabled(id, state) {
|
||||
var img = document.getElementById(id);
|
||||
var lnk = document.getElementById(id + "_link");
|
||||
|
||||
if (lnk) {
|
||||
if (state) {
|
||||
lnk.setAttribute("realhref", lnk.getAttribute("href"));
|
||||
lnk.removeAttribute("href");
|
||||
tinyMCEPopup.dom.addClass(img, 'disabled');
|
||||
} else {
|
||||
if (lnk.getAttribute("realhref"))
|
||||
lnk.setAttribute("href", lnk.getAttribute("realhref"));
|
||||
|
||||
tinyMCEPopup.dom.removeClass(img, 'disabled');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getBrowserHTML(id, target_form_element, type, prefix) {
|
||||
var option = prefix + "_" + type + "_browser_callback", cb, html;
|
||||
|
||||
cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback"));
|
||||
|
||||
if (!cb)
|
||||
return "";
|
||||
|
||||
html = "";
|
||||
html += '<a id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;" class="browse">';
|
||||
html += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> </span></a>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function openBrowser(img_id, target_form_element, type, option) {
|
||||
var img = document.getElementById(img_id);
|
||||
|
||||
if (img.className != "mceButtonDisabled")
|
||||
tinyMCEPopup.openBrowser(target_form_element, type, option);
|
||||
}
|
||||
|
||||
function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
|
||||
if (!form_obj || !form_obj.elements[field_name])
|
||||
return;
|
||||
|
||||
if (!value)
|
||||
value = "";
|
||||
|
||||
var sel = form_obj.elements[field_name];
|
||||
|
||||
var found = false;
|
||||
for (var i=0; i<sel.options.length; i++) {
|
||||
var option = sel.options[i];
|
||||
|
||||
if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
|
||||
option.selected = true;
|
||||
found = true;
|
||||
} else
|
||||
option.selected = false;
|
||||
}
|
||||
|
||||
if (!found && add_custom && value != '') {
|
||||
var option = new Option(value, value);
|
||||
option.selected = true;
|
||||
sel.options[sel.options.length] = option;
|
||||
sel.selectedIndex = sel.options.length - 1;
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
function getSelectValue(form_obj, field_name) {
|
||||
var elm = form_obj.elements[field_name];
|
||||
|
||||
if (elm == null || elm.options == null || elm.selectedIndex === -1)
|
||||
return "";
|
||||
|
||||
return elm.options[elm.selectedIndex].value;
|
||||
}
|
||||
|
||||
function addSelectValue(form_obj, field_name, name, value) {
|
||||
var s = form_obj.elements[field_name];
|
||||
var o = new Option(name, value);
|
||||
s.options[s.options.length] = o;
|
||||
}
|
||||
|
||||
function addClassesToList(list_id, specific_option) {
|
||||
// Setup class droplist
|
||||
var styleSelectElm = document.getElementById(list_id);
|
||||
var styles = tinyMCEPopup.getParam('theme_advanced_styles', false);
|
||||
styles = tinyMCEPopup.getParam(specific_option, styles);
|
||||
|
||||
if (styles) {
|
||||
var stylesAr = styles.split(';');
|
||||
|
||||
for (var i=0; i<stylesAr.length; i++) {
|
||||
if (stylesAr != "") {
|
||||
var key, value;
|
||||
|
||||
key = stylesAr[i].split('=')[0];
|
||||
value = stylesAr[i].split('=')[1];
|
||||
|
||||
styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tinymce.each(tinyMCEPopup.editor.dom.getClasses(), function(o) {
|
||||
styleSelectElm.options[styleSelectElm.length] = new Option(o.title || o['class'], o['class']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function isVisible(element_id) {
|
||||
var elm = document.getElementById(element_id);
|
||||
|
||||
return elm && elm.style.display != "none";
|
||||
}
|
||||
|
||||
function convertRGBToHex(col) {
|
||||
var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
|
||||
|
||||
var rgb = col.replace(re, "$1,$2,$3").split(',');
|
||||
if (rgb.length == 3) {
|
||||
r = parseInt(rgb[0]).toString(16);
|
||||
g = parseInt(rgb[1]).toString(16);
|
||||
b = parseInt(rgb[2]).toString(16);
|
||||
|
||||
r = r.length == 1 ? '0' + r : r;
|
||||
g = g.length == 1 ? '0' + g : g;
|
||||
b = b.length == 1 ? '0' + b : b;
|
||||
|
||||
return "#" + r + g + b;
|
||||
}
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
function convertHexToRGB(col) {
|
||||
if (col.indexOf('#') != -1) {
|
||||
col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
|
||||
|
||||
r = parseInt(col.substring(0, 2), 16);
|
||||
g = parseInt(col.substring(2, 4), 16);
|
||||
b = parseInt(col.substring(4, 6), 16);
|
||||
|
||||
return "rgb(" + r + "," + g + "," + b + ")";
|
||||
}
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
function trimSize(size) {
|
||||
return size.replace(/([0-9\.]+)(px|%|in|cm|mm|em|ex|pt|pc)/i, '$1$2');
|
||||
}
|
||||
|
||||
function getCSSSize(size) {
|
||||
size = trimSize(size);
|
||||
|
||||
if (size == "")
|
||||
return "";
|
||||
|
||||
// Add px
|
||||
if (/^[0-9]+$/.test(size))
|
||||
size += 'px';
|
||||
// Sanity check, IE doesn't like broken values
|
||||
else if (!(/^[0-9\.]+(px|%|in|cm|mm|em|ex|pt|pc)$/i.test(size)))
|
||||
return "";
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
function getStyle(elm, attrib, style) {
|
||||
var val = tinyMCEPopup.dom.getAttrib(elm, attrib);
|
||||
|
||||
if (val != '')
|
||||
return '' + val;
|
||||
|
||||
if (typeof(style) == 'undefined')
|
||||
style = attrib;
|
||||
|
||||
return tinyMCEPopup.dom.getStyle(elm, style);
|
||||
}
|
|
@ -1,162 +0,0 @@
|
|||
/**
|
||||
* mctabs.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
function MCTabs() {
|
||||
this.settings = [];
|
||||
this.onChange = tinyMCEPopup.editor.windowManager.createInstance('tinymce.util.Dispatcher');
|
||||
};
|
||||
|
||||
MCTabs.prototype.init = function(settings) {
|
||||
this.settings = settings;
|
||||
};
|
||||
|
||||
MCTabs.prototype.getParam = function(name, default_value) {
|
||||
var value = null;
|
||||
|
||||
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
|
||||
|
||||
// Fix bool values
|
||||
if (value == "true" || value == "false")
|
||||
return (value == "true");
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
MCTabs.prototype.showTab =function(tab){
|
||||
tab.className = 'current';
|
||||
tab.setAttribute("aria-selected", true);
|
||||
tab.setAttribute("aria-expanded", true);
|
||||
tab.tabIndex = 0;
|
||||
};
|
||||
|
||||
MCTabs.prototype.hideTab =function(tab){
|
||||
var t=this;
|
||||
|
||||
tab.className = '';
|
||||
tab.setAttribute("aria-selected", false);
|
||||
tab.setAttribute("aria-expanded", false);
|
||||
tab.tabIndex = -1;
|
||||
};
|
||||
|
||||
MCTabs.prototype.showPanel = function(panel) {
|
||||
panel.className = 'current';
|
||||
panel.setAttribute("aria-hidden", false);
|
||||
};
|
||||
|
||||
MCTabs.prototype.hidePanel = function(panel) {
|
||||
panel.className = 'panel';
|
||||
panel.setAttribute("aria-hidden", true);
|
||||
};
|
||||
|
||||
MCTabs.prototype.getPanelForTab = function(tabElm) {
|
||||
return tinyMCEPopup.dom.getAttrib(tabElm, "aria-controls");
|
||||
};
|
||||
|
||||
MCTabs.prototype.displayTab = function(tab_id, panel_id, avoid_focus) {
|
||||
var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i, t = this;
|
||||
|
||||
tabElm = document.getElementById(tab_id);
|
||||
|
||||
if (panel_id === undefined) {
|
||||
panel_id = t.getPanelForTab(tabElm);
|
||||
}
|
||||
|
||||
panelElm= document.getElementById(panel_id);
|
||||
panelContainerElm = panelElm ? panelElm.parentNode : null;
|
||||
tabContainerElm = tabElm ? tabElm.parentNode : null;
|
||||
selectionClass = t.getParam('selection_class', 'current');
|
||||
|
||||
if (tabElm && tabContainerElm) {
|
||||
nodes = tabContainerElm.childNodes;
|
||||
|
||||
// Hide all other tabs
|
||||
for (i = 0; i < nodes.length; i++) {
|
||||
if (nodes[i].nodeName == "LI") {
|
||||
t.hideTab(nodes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Show selected tab
|
||||
t.showTab(tabElm);
|
||||
}
|
||||
|
||||
if (panelElm && panelContainerElm) {
|
||||
nodes = panelContainerElm.childNodes;
|
||||
|
||||
// Hide all other panels
|
||||
for (i = 0; i < nodes.length; i++) {
|
||||
if (nodes[i].nodeName == "DIV")
|
||||
t.hidePanel(nodes[i]);
|
||||
}
|
||||
|
||||
if (!avoid_focus) {
|
||||
tabElm.focus();
|
||||
}
|
||||
|
||||
// Show selected panel
|
||||
t.showPanel(panelElm);
|
||||
}
|
||||
};
|
||||
|
||||
MCTabs.prototype.getAnchor = function() {
|
||||
var pos, url = document.location.href;
|
||||
|
||||
if ((pos = url.lastIndexOf('#')) != -1)
|
||||
return url.substring(pos + 1);
|
||||
|
||||
return "";
|
||||
};
|
||||
|
||||
|
||||
//Global instance
|
||||
var mcTabs = new MCTabs();
|
||||
|
||||
tinyMCEPopup.onInit.add(function() {
|
||||
var tinymce = tinyMCEPopup.getWin().tinymce, dom = tinyMCEPopup.dom, each = tinymce.each;
|
||||
|
||||
each(dom.select('div.tabs'), function(tabContainerElm) {
|
||||
var keyNav;
|
||||
|
||||
dom.setAttrib(tabContainerElm, "role", "tablist");
|
||||
|
||||
var items = tinyMCEPopup.dom.select('li', tabContainerElm);
|
||||
var action = function(id) {
|
||||
mcTabs.displayTab(id, mcTabs.getPanelForTab(id));
|
||||
mcTabs.onChange.dispatch(id);
|
||||
};
|
||||
|
||||
each(items, function(item) {
|
||||
dom.setAttrib(item, 'role', 'tab');
|
||||
dom.bind(item, 'click', function(evt) {
|
||||
action(item.id);
|
||||
});
|
||||
});
|
||||
|
||||
dom.bind(dom.getRoot(), 'keydown', function(evt) {
|
||||
if (evt.keyCode === 9 && evt.ctrlKey && !evt.altKey) { // Tab
|
||||
keyNav.moveFocus(evt.shiftKey ? -1 : 1);
|
||||
tinymce.dom.Event.cancel(evt);
|
||||
}
|
||||
});
|
||||
|
||||
each(dom.select('a', tabContainerElm), function(a) {
|
||||
dom.setAttrib(a, 'tabindex', '-1');
|
||||
});
|
||||
|
||||
keyNav = tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', {
|
||||
root: tabContainerElm,
|
||||
items: items,
|
||||
onAction: action,
|
||||
actOnFocus: true,
|
||||
enableLeftRight: true,
|
||||
enableUpDown: true
|
||||
}, tinyMCEPopup.dom);
|
||||
});
|
||||
});
|
|
@ -1,252 +0,0 @@
|
|||
/**
|
||||
* validate.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
/**
|
||||
// String validation:
|
||||
|
||||
if (!Validator.isEmail('myemail'))
|
||||
alert('Invalid email.');
|
||||
|
||||
// Form validation:
|
||||
|
||||
var f = document.forms['myform'];
|
||||
|
||||
if (!Validator.isEmail(f.myemail))
|
||||
alert('Invalid email.');
|
||||
*/
|
||||
|
||||
var Validator = {
|
||||
isEmail : function(s) {
|
||||
return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
|
||||
},
|
||||
|
||||
isAbsUrl : function(s) {
|
||||
return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
|
||||
},
|
||||
|
||||
isSize : function(s) {
|
||||
return this.test(s, '^[0-9.]+(%|in|cm|mm|em|ex|pt|pc|px)?$');
|
||||
},
|
||||
|
||||
isId : function(s) {
|
||||
return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
|
||||
},
|
||||
|
||||
isEmpty : function(s) {
|
||||
var nl, i;
|
||||
|
||||
if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
|
||||
return true;
|
||||
|
||||
if (s.type == 'checkbox' && !s.checked)
|
||||
return true;
|
||||
|
||||
if (s.type == 'radio') {
|
||||
for (i=0, nl = s.form.elements; i<nl.length; i++) {
|
||||
if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
|
||||
},
|
||||
|
||||
isNumber : function(s, d) {
|
||||
return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
|
||||
},
|
||||
|
||||
test : function(s, p) {
|
||||
s = s.nodeType == 1 ? s.value : s;
|
||||
|
||||
return s == '' || new RegExp(p).test(s);
|
||||
}
|
||||
};
|
||||
|
||||
var AutoValidator = {
|
||||
settings : {
|
||||
id_cls : 'id',
|
||||
int_cls : 'int',
|
||||
url_cls : 'url',
|
||||
number_cls : 'number',
|
||||
email_cls : 'email',
|
||||
size_cls : 'size',
|
||||
required_cls : 'required',
|
||||
invalid_cls : 'invalid',
|
||||
min_cls : 'min',
|
||||
max_cls : 'max'
|
||||
},
|
||||
|
||||
init : function(s) {
|
||||
var n;
|
||||
|
||||
for (n in s)
|
||||
this.settings[n] = s[n];
|
||||
},
|
||||
|
||||
validate : function(f) {
|
||||
var i, nl, s = this.settings, c = 0;
|
||||
|
||||
nl = this.tags(f, 'label');
|
||||
for (i=0; i<nl.length; i++) {
|
||||
this.removeClass(nl[i], s.invalid_cls);
|
||||
nl[i].setAttribute('aria-invalid', false);
|
||||
}
|
||||
|
||||
c += this.validateElms(f, 'input');
|
||||
c += this.validateElms(f, 'select');
|
||||
c += this.validateElms(f, 'textarea');
|
||||
|
||||
return c == 3;
|
||||
},
|
||||
|
||||
invalidate : function(n) {
|
||||
this.mark(n.form, n);
|
||||
},
|
||||
|
||||
getErrorMessages : function(f) {
|
||||
var nl, i, s = this.settings, field, msg, values, messages = [], ed = tinyMCEPopup.editor;
|
||||
nl = this.tags(f, "label");
|
||||
for (i=0; i<nl.length; i++) {
|
||||
if (this.hasClass(nl[i], s.invalid_cls)) {
|
||||
field = document.getElementById(nl[i].getAttribute("for"));
|
||||
values = { field: nl[i].textContent };
|
||||
if (this.hasClass(field, s.min_cls, true)) {
|
||||
message = ed.getLang('invalid_data_min');
|
||||
values.min = this.getNum(field, s.min_cls);
|
||||
} else if (this.hasClass(field, s.number_cls)) {
|
||||
message = ed.getLang('invalid_data_number');
|
||||
} else if (this.hasClass(field, s.size_cls)) {
|
||||
message = ed.getLang('invalid_data_size');
|
||||
} else {
|
||||
message = ed.getLang('invalid_data');
|
||||
}
|
||||
|
||||
message = message.replace(/{\#([^}]+)\}/g, function(a, b) {
|
||||
return values[b] || '{#' + b + '}';
|
||||
});
|
||||
messages.push(message);
|
||||
}
|
||||
}
|
||||
return messages;
|
||||
},
|
||||
|
||||
reset : function(e) {
|
||||
var t = ['label', 'input', 'select', 'textarea'];
|
||||
var i, j, nl, s = this.settings;
|
||||
|
||||
if (e == null)
|
||||
return;
|
||||
|
||||
for (i=0; i<t.length; i++) {
|
||||
nl = this.tags(e.form ? e.form : e, t[i]);
|
||||
for (j=0; j<nl.length; j++) {
|
||||
this.removeClass(nl[j], s.invalid_cls);
|
||||
nl[j].setAttribute('aria-invalid', false);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
validateElms : function(f, e) {
|
||||
var nl, i, n, s = this.settings, st = true, va = Validator, v;
|
||||
|
||||
nl = this.tags(f, e);
|
||||
for (i=0; i<nl.length; i++) {
|
||||
n = nl[i];
|
||||
|
||||
this.removeClass(n, s.invalid_cls);
|
||||
|
||||
if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.size_cls) && !va.isSize(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.id_cls) && !va.isId(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.min_cls, true)) {
|
||||
v = this.getNum(n, s.min_cls);
|
||||
|
||||
if (isNaN(v) || parseInt(n.value) < parseInt(v))
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.max_cls, true)) {
|
||||
v = this.getNum(n, s.max_cls);
|
||||
|
||||
if (isNaN(v) || parseInt(n.value) > parseInt(v))
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
}
|
||||
|
||||
return st;
|
||||
},
|
||||
|
||||
hasClass : function(n, c, d) {
|
||||
return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
|
||||
},
|
||||
|
||||
getNum : function(n, c) {
|
||||
c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
|
||||
c = c.replace(/[^0-9]/g, '');
|
||||
|
||||
return c;
|
||||
},
|
||||
|
||||
addClass : function(n, c, b) {
|
||||
var o = this.removeClass(n, c);
|
||||
n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
|
||||
},
|
||||
|
||||
removeClass : function(n, c) {
|
||||
c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
|
||||
return n.className = c != ' ' ? c : '';
|
||||
},
|
||||
|
||||
tags : function(f, s) {
|
||||
return f.getElementsByTagName(s);
|
||||
},
|
||||
|
||||
mark : function(f, n) {
|
||||
var s = this.settings;
|
||||
|
||||
this.addClass(n, s.invalid_cls);
|
||||
n.setAttribute('aria-invalid', 'true');
|
||||
this.markLabels(f, n, s.invalid_cls);
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
markLabels : function(f, n, ic) {
|
||||
var nl, i;
|
||||
|
||||
nl = this.tags(f, "label");
|
||||
for (i=0; i<nl.length; i++) {
|
||||
if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
|
||||
this.addClass(nl[i], ic);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|