Merged in bugfix/FBI-1646 (pull request #6209)
FBI-1646: Updates tinyMCE library from v3.5.7 to v.3.5.12 Approved-by: Rodrigo Quelca <rockoinfo@yahoo.com>
This commit is contained in:
@@ -1,4 +1,52 @@
|
||||
Version 3.5.12 (2016-10-31)
|
||||
Added new option table_style_by_css for the table plugin to set table styling with css rather than table attributes.
|
||||
Added new option theme_advanced_default_font_size allows you to specify a default font size for the body.
|
||||
Added new option theme_advanced_default_font_family allows you to specify a default font family for the body.
|
||||
Fixed bug where params tags for width and height were being stripped from object tags in the media plugin.
|
||||
Fixed font families in order to provide appropriate web-safe fonts.
|
||||
Version 3.5.11 (2014-05-08)
|
||||
Added new option noneditable_prevent_delete to the non-editable plugin to prevent deletion of non-editable text.
|
||||
Added functionality to the media plugin to handle objects without source attributes correctly.
|
||||
Fixed bug in paste plugin word import with lists that have strikethrough on numbers.
|
||||
Fixed bug in word count plugin where characters with diacritical marks were split as seperate words.
|
||||
Fixed bug in IE 11 where the selection of images would fail when they where at the end of blocks.
|
||||
Fixed bug where input method would produce new lines when inserting contents to an empty editor.
|
||||
Fixed bug in non-editable plugin where backspace deletes too much text.
|
||||
Fixed bug where formatting a nested list would break the list moving list items.
|
||||
Fixed bug where the caret were not appended as child of the body but as sibling.
|
||||
Fixed bug where nested lists did not get the style updated.
|
||||
Fixed bug where the isDirty method would report a false positive when a plugin modifies the initial content.
|
||||
Fixed bug where empty tag doesn't preserve inner whitespace.
|
||||
Version 3.5.10 (2013-10-24)
|
||||
Fixed bug where dialogs using inlinepopups plugin would display incorrectly sometimes
|
||||
Fixed bug in paste plugin word import that was removing type from lists
|
||||
Fixed bug where IE 11 wouldn't be properly detected if IE 10 emulation was enabled.
|
||||
Version 3.5.9 (2013-10-10)
|
||||
Added IE 11 compatibility. IE 11 is treated as Gecko but it has still many IE bugs.
|
||||
Fixed bug where importing CSS classes would fail if it contained @import rules to remote domain on Gecko.
|
||||
Fixed bug in spelling plugin where misspelt words are not always marked.
|
||||
Fixed bug where script tag was removed when nested inside a div or p.
|
||||
Fixed full screen plugin state migration from original editor.
|
||||
Fixed edgecase on up/down arrow keys scrolling with native lists.
|
||||
Fixed bug where space can scroll webpage when using keyboard to access toolbar buttons.
|
||||
Fixed bug where up/down arrow keys scroll entire webpage when using keyboard nav in menu ui.
|
||||
Fixed bug where applying ins/del as inline elements would apply them as blocks.
|
||||
Fixed bug where backspace on a space after an image would produce a BR on WebKit.
|
||||
Fixed bug where it wasn't possible to change block type of text blocks.
|
||||
Version 3.5.8 (2012-11-20)
|
||||
Fixed bug where html5 data attributes where stripped from contents.
|
||||
Fixed bug where toolbar was annouced multiple times with JAWS on Firefox.
|
||||
Fixed bug where the editor view whouldn't scroll to BR elements when using shift+enter or br enter mode.
|
||||
Fixed bug where a JS error would be thrown when trying to paste table rows then the rows clipboard was empty.
|
||||
Fixed bug with auto detection logic for youtube urls in the media plugin.
|
||||
Fixed bug where the formatter would throw errors if you used the jQuery version of TinyMCE and the latest jQuery.
|
||||
Fixed bug where the latest WebKit versions would produce span elements when deleting text between blocks.
|
||||
Fixed bug where the autolink plugin would produce DOM exceptions when pressing shift+enter inside a block element.
|
||||
Fixed bug where toggling of blockquotes when using br enter mode would produce an exception.
|
||||
Fixed bug where focusing out of the body of the editor wouldn't properly add an undo level.
|
||||
Fixed issue with warning message being displayed on IE 9+ about the meta header fix for IE 8.
|
||||
Version 3.5.7 (2012-09-20)
|
||||
Changed table row properties dialog to not update multiple rows when row type is header or footer.
|
||||
Fixed bug in hyperlink dialog for IE9 where links with no target attr set had target value of --
|
||||
Changing toolbars to have a toolbar role for FF keyboard navigation works correctly.
|
||||
Fixed bug where applying formatting to an empty block element would produce redundant spans.
|
||||
|
||||
@@ -20,7 +20,7 @@ free software--to make sure the software is free for all its users.
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
can use it too, but we suggest you first think carefuly about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
(function(){tinymce.create("tinymce.plugins.AutolinkPlugin",{init:function(a,b){var c=this;a.onKeyDown.addToTop(function(d,f){if(f.keyCode==13){return c.handleEnter(d)}});if(tinyMCE.isIE){return}a.onKeyPress.add(function(d,f){if(f.which==41){return c.handleEclipse(d)}});a.onKeyUp.add(function(d,f){if(f.keyCode==32){return c.handleSpacebar(d)}})},handleEclipse:function(a){this.parseCurrentLine(a,-1,"(",true)},handleSpacebar:function(a){this.parseCurrentLine(a,0,"",true)},handleEnter:function(a){this.parseCurrentLine(a,-1,"",false)},parseCurrentLine:function(i,d,b,g){var a,f,c,n,k,m,h,e,j;a=i.selection.getRng(true).cloneRange();if(a.startOffset<5){e=a.endContainer.previousSibling;if(e==null){if(a.endContainer.firstChild==null||a.endContainer.firstChild.nextSibling==null){return}e=a.endContainer.firstChild.nextSibling}j=e.length;a.setStart(e,j);a.setEnd(e,j);if(a.endOffset<5){return}f=a.endOffset;n=e}else{n=a.endContainer;if(n.nodeType!=3&&n.firstChild){while(n.nodeType!=3&&n.firstChild){n=n.firstChild}if(n.nodeType==3){a.setStart(n,0);a.setEnd(n,n.nodeValue.length)}}if(a.endOffset==1){f=2}else{f=a.endOffset-1-d}}c=f;do{a.setStart(n,f-2);a.setEnd(n,f-1);f-=1}while(a.toString()!=" "&&a.toString()!=""&&a.toString().charCodeAt(0)!=160&&(f-2)>=0&&a.toString()!=b);if(a.toString()==b||a.toString().charCodeAt(0)==160){a.setStart(n,f);a.setEnd(n,c);f+=1}else{if(a.startOffset==0){a.setStart(n,0);a.setEnd(n,c)}else{a.setStart(n,f);a.setEnd(n,c)}}var m=a.toString();if(m.charAt(m.length-1)=="."){a.setEnd(n,c-1)}m=a.toString();h=m.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+-]+@)(.+)$/i);if(h){if(h[1]=="www."){h[1]="http://www."}else{if(/@$/.test(h[1])&&!/^mailto:/.test(h[1])){h[1]="mailto:"+h[1]}}k=i.selection.getBookmark();i.selection.setRng(a);tinyMCE.execCommand("createlink",false,h[1]+h[2]);i.selection.moveToBookmark(k);i.nodeChanged();if(tinyMCE.isWebKit){i.selection.collapse(false);var l=Math.min(n.length,c+1);a.setStart(n,l);a.setEnd(n,l);i.selection.setRng(a)}}},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}}});tinymce.PluginManager.add("autolink",tinymce.plugins.AutolinkPlugin)})();
|
||||
(function(){tinymce.create("tinymce.plugins.AutolinkPlugin",{init:function(a,b){var c=this;a.onKeyDown.addToTop(function(d,f){if(f.keyCode==13){return c.handleEnter(d)}});if(tinyMCE.isIE){return}a.onKeyPress.add(function(d,f){if(f.which==41){return c.handleEclipse(d)}});a.onKeyUp.add(function(d,f){if(f.keyCode==32){return c.handleSpacebar(d)}})},handleEclipse:function(a){this.parseCurrentLine(a,-1,"(",true)},handleSpacebar:function(a){this.parseCurrentLine(a,0,"",true)},handleEnter:function(a){this.parseCurrentLine(a,-1,"",false)},parseCurrentLine:function(i,d,b,g){var a,f,c,n,k,m,h,e,j;a=i.selection.getRng(true).cloneRange();if(a.startOffset<5){e=a.endContainer.previousSibling;if(e==null){if(a.endContainer.firstChild==null||a.endContainer.firstChild.nextSibling==null){return}e=a.endContainer.firstChild.nextSibling}j=e.length;a.setStart(e,j);a.setEnd(e,j);if(a.endOffset<5){return}f=a.endOffset;n=e}else{n=a.endContainer;if(n.nodeType!=3&&n.firstChild){while(n.nodeType!=3&&n.firstChild){n=n.firstChild}if(n.nodeType==3){a.setStart(n,0);a.setEnd(n,n.nodeValue.length)}}if(a.endOffset==1){f=2}else{f=a.endOffset-1-d}}c=f;do{a.setStart(n,f>=2?f-2:0);a.setEnd(n,f>=1?f-1:0);f-=1}while(a.toString()!=" "&&a.toString()!=""&&a.toString().charCodeAt(0)!=160&&(f-2)>=0&&a.toString()!=b);if(a.toString()==b||a.toString().charCodeAt(0)==160){a.setStart(n,f);a.setEnd(n,c);f+=1}else{if(a.startOffset==0){a.setStart(n,0);a.setEnd(n,c)}else{a.setStart(n,f);a.setEnd(n,c)}}var m=a.toString();if(m.charAt(m.length-1)=="."){a.setEnd(n,c-1)}m=a.toString();h=m.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+-]+@)(.+)$/i);if(h){if(h[1]=="www."){h[1]="http://www."}else{if(/@$/.test(h[1])&&!/^mailto:/.test(h[1])){h[1]="mailto:"+h[1]}}k=i.selection.getBookmark();i.selection.setRng(a);tinyMCE.execCommand("createlink",false,h[1]+h[2]);i.selection.moveToBookmark(k);i.nodeChanged();if(tinyMCE.isWebKit){i.selection.collapse(false);var l=Math.min(n.length,c+1);a.setStart(n,l);a.setEnd(n,l);i.selection.setRng(a)}}},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}}});tinymce.PluginManager.add("autolink",tinymce.plugins.AutolinkPlugin)})();
|
||||
@@ -107,8 +107,8 @@
|
||||
do
|
||||
{
|
||||
// Move the selection one character backwards.
|
||||
r.setStart(endContainer, end - 2);
|
||||
r.setEnd(endContainer, end - 1);
|
||||
r.setStart(endContainer, end >= 2 ? end - 2 : 0);
|
||||
r.setEnd(endContainer, end >= 1 ? end - 1 : 0);
|
||||
end -= 1;
|
||||
|
||||
// Loop until one of the following is found: a blank space, , delimeter, (end-2) >= 0
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates control instances based in the incomming name. This method is normally not
|
||||
* Creates control instances based in the incoming name. This method is normally not
|
||||
* needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
|
||||
* but you sometimes need to create more complex controls like listboxes, split buttons etc then this
|
||||
* method can be used to create those.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -50,13 +50,13 @@
|
||||
// Private plugin internal methods
|
||||
|
||||
_htmlToData : function() {
|
||||
var headerFragment = this._parseHeader(), data = {}, nodes, elm, matches, editor = this.editor;
|
||||
var headerFragment = this._parseHeader(), data = {}, elm, matches, editor = this.editor;
|
||||
|
||||
function getAttr(elm, name) {
|
||||
var value = elm.attr(name);
|
||||
|
||||
return value || '';
|
||||
};
|
||||
}
|
||||
|
||||
// Default some values
|
||||
data.fontface = editor.getParam("fullpage_default_fontface", "");
|
||||
@@ -67,14 +67,16 @@
|
||||
if (elm.type == 7) {
|
||||
data.xml_pi = true;
|
||||
matches = /encoding="([^"]+)"/.exec(elm.value);
|
||||
if (matches)
|
||||
if (matches) {
|
||||
data.docencoding = matches[1];
|
||||
}
|
||||
}
|
||||
|
||||
// Parse doctype
|
||||
elm = headerFragment.getAll('#doctype')[0];
|
||||
if (elm)
|
||||
if (elm) {
|
||||
data.doctype = '<!DOCTYPE' + elm.value + ">";
|
||||
}
|
||||
|
||||
// Parse title element
|
||||
elm = headerFragment.getAll('title')[0];
|
||||
@@ -86,25 +88,28 @@
|
||||
each(headerFragment.getAll('meta'), function(meta) {
|
||||
var name = meta.attr('name'), httpEquiv = meta.attr('http-equiv'), matches;
|
||||
|
||||
if (name)
|
||||
if (name) {
|
||||
data['meta' + name.toLowerCase()] = meta.attr('content');
|
||||
else if (httpEquiv == "Content-Type") {
|
||||
} else if (httpEquiv == "Content-Type") {
|
||||
matches = /charset\s*=\s*(.*)\s*/gi.exec(meta.attr('content'));
|
||||
|
||||
if (matches)
|
||||
if (matches) {
|
||||
data.docencoding = matches[1];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Parse html attribs
|
||||
elm = headerFragment.getAll('html')[0];
|
||||
if (elm)
|
||||
if (elm) {
|
||||
data.langcode = getAttr(elm, 'lang') || getAttr(elm, 'xml:lang');
|
||||
}
|
||||
|
||||
// Parse stylesheet
|
||||
elm = headerFragment.getAll('link')[0];
|
||||
if (elm && elm.attr('rel') == 'stylesheet')
|
||||
if (elm && elm.attr('rel') == 'stylesheet') {
|
||||
data.stylesheet = elm.attr('href');
|
||||
}
|
||||
|
||||
// Parse body parts
|
||||
elm = headerFragment.getAll('body')[0];
|
||||
@@ -124,14 +129,15 @@
|
||||
|
||||
function setAttr(elm, name, value) {
|
||||
elm.attr(name, value ? value : undefined);
|
||||
};
|
||||
}
|
||||
|
||||
function addHeadNode(node) {
|
||||
if (headElement.firstChild)
|
||||
if (headElement.firstChild) {
|
||||
headElement.insert(node, headElement.firstChild);
|
||||
else
|
||||
} else {
|
||||
headElement.append(node);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
headerFragment = this._parseHeader();
|
||||
headElement = headerFragment.getAll('head')[0];
|
||||
@@ -139,19 +145,21 @@
|
||||
elm = headerFragment.getAll('html')[0];
|
||||
headElement = new Node('head', 1);
|
||||
|
||||
if (elm.firstChild)
|
||||
if (elm.firstChild) {
|
||||
elm.insert(headElement, elm.firstChild, true);
|
||||
else
|
||||
} else {
|
||||
elm.append(headElement);
|
||||
}
|
||||
}
|
||||
|
||||
// Add/update/remove XML-PI
|
||||
elm = headerFragment.firstChild;
|
||||
if (data.xml_pi) {
|
||||
value = 'version="1.0"';
|
||||
|
||||
if (data.docencoding)
|
||||
if (data.docencoding) {
|
||||
value += ' encoding="' + data.docencoding + '"';
|
||||
}
|
||||
|
||||
if (elm.type != 7) {
|
||||
elm = new Node('xml', 7);
|
||||
@@ -159,8 +167,9 @@
|
||||
}
|
||||
|
||||
elm.value = value;
|
||||
} else if (elm && elm.type == 7)
|
||||
} else if (elm && elm.type == 7) {
|
||||
elm.remove();
|
||||
}
|
||||
|
||||
// Add/update/remove doctype
|
||||
elm = headerFragment.getAll('#doctype')[0];
|
||||
@@ -168,15 +177,17 @@
|
||||
if (!elm) {
|
||||
elm = new Node('#doctype', 10);
|
||||
|
||||
if (data.xml_pi)
|
||||
if (data.xml_pi) {
|
||||
headerFragment.insert(elm, headerFragment.firstChild);
|
||||
else
|
||||
} else {
|
||||
addHeadNode(elm);
|
||||
}
|
||||
}
|
||||
|
||||
elm.value = data.doctype.substring(9, data.doctype.length - 1);
|
||||
} else if (elm)
|
||||
} else if (elm) {
|
||||
elm.remove();
|
||||
}
|
||||
|
||||
// Add/update/remove title
|
||||
elm = headerFragment.getAll('title')[0];
|
||||
@@ -192,8 +203,9 @@
|
||||
if (data.docencoding) {
|
||||
elm = null;
|
||||
each(headerFragment.getAll('meta'), function(meta) {
|
||||
if (meta.attr('http-equiv') == 'Content-Type')
|
||||
if (meta.attr('http-equiv') == 'Content-Type') {
|
||||
elm = meta;
|
||||
}
|
||||
});
|
||||
|
||||
if (!elm) {
|
||||
@@ -214,10 +226,11 @@
|
||||
meta = nodes[i];
|
||||
|
||||
if (meta.attr('name') == name) {
|
||||
if (value)
|
||||
if (value) {
|
||||
meta.attr('content', value);
|
||||
else
|
||||
} else {
|
||||
meta.remove();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -236,10 +249,11 @@
|
||||
// Add/update/delete link
|
||||
elm = headerFragment.getAll('link')[0];
|
||||
if (elm && elm.attr('rel') == 'stylesheet') {
|
||||
if (data.stylesheet)
|
||||
if (data.stylesheet) {
|
||||
elm.attr('href', data.stylesheet);
|
||||
else
|
||||
} else {
|
||||
elm.remove();
|
||||
}
|
||||
} else if (data.stylesheet) {
|
||||
elm = new Node('link', 1);
|
||||
elm.attr({
|
||||
@@ -304,15 +318,17 @@
|
||||
function low(s) {
|
||||
return s.replace(/<\/?[A-Z]+/g, function(a) {
|
||||
return a.toLowerCase();
|
||||
})
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
// Ignore raw updated if we already have a head, this will fix issues with undo/redo keeping the head/foot separate
|
||||
if (o.format == 'raw' && self.head)
|
||||
if (o.format == 'raw' && self.head) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (o.source_view && ed.getParam('fullpage_hide_in_source_view'))
|
||||
if (o.source_view && ed.getParam('fullpage_hide_in_source_view')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Parse out head, body and footer
|
||||
content = content.replace(/<(\/?)BODY/gi, '<$1body');
|
||||
@@ -323,8 +339,9 @@
|
||||
self.head = low(content.substring(0, startPos + 1));
|
||||
|
||||
endPos = content.indexOf('</body', startPos);
|
||||
if (endPos == -1)
|
||||
if (endPos == -1) {
|
||||
endPos = content.length;
|
||||
}
|
||||
|
||||
o.content = content.substring(startPos + 1, endPos);
|
||||
self.foot = low(content.substring(endPos));
|
||||
@@ -336,8 +353,9 @@
|
||||
// Parse header and update iframe
|
||||
headerFragment = self._parseHeader();
|
||||
each(headerFragment.getAll('style'), function(node) {
|
||||
if (node.firstChild)
|
||||
if (node.firstChild) {
|
||||
styles += node.firstChild.value;
|
||||
}
|
||||
});
|
||||
|
||||
elm = headerFragment.getAll('body')[0];
|
||||
@@ -358,34 +376,41 @@
|
||||
|
||||
// Needed for IE 6/7
|
||||
elm = dom.get('fullpage_styles');
|
||||
if (elm.styleSheet)
|
||||
if (elm.styleSheet) {
|
||||
elm.styleSheet.cssText = styles;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_getDefaultHeader : function() {
|
||||
var header = '', editor = this.editor, value, styles = '';
|
||||
|
||||
if (editor.getParam('fullpage_default_xml_pi'))
|
||||
if (editor.getParam('fullpage_default_xml_pi')) {
|
||||
header += '<?xml version="1.0" encoding="' + editor.getParam('fullpage_default_encoding', 'ISO-8859-1') + '" ?>\n';
|
||||
}
|
||||
|
||||
header += editor.getParam('fullpage_default_doctype', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
|
||||
header += '\n<html>\n<head>\n';
|
||||
|
||||
if (value = editor.getParam('fullpage_default_title'))
|
||||
if (value = editor.getParam('fullpage_default_title')) {
|
||||
header += '<title>' + value + '</title>\n';
|
||||
}
|
||||
|
||||
if (value = editor.getParam('fullpage_default_encoding'))
|
||||
if (value = editor.getParam('fullpage_default_encoding')) {
|
||||
header += '<meta http-equiv="Content-Type" content="text/html; charset=' + value + '" />\n';
|
||||
}
|
||||
|
||||
if (value = editor.getParam('fullpage_default_font_family'))
|
||||
if (value = editor.getParam('fullpage_default_font_family')) {
|
||||
styles += 'font-family: ' + value + ';';
|
||||
}
|
||||
|
||||
if (value = editor.getParam('fullpage_default_font_size'))
|
||||
if (value = editor.getParam('fullpage_default_font_size')) {
|
||||
styles += 'font-size: ' + value + ';';
|
||||
}
|
||||
|
||||
if (value = editor.getParam('fullpage_default_text_color'))
|
||||
if (value = editor.getParam('fullpage_default_text_color')) {
|
||||
styles += 'color: ' + value + ';';
|
||||
}
|
||||
|
||||
header += '</head>\n<body' + (styles ? ' style="' + styles + '"' : '') + '>\n';
|
||||
|
||||
@@ -395,9 +420,10 @@
|
||||
_getContent : function(ed, o) {
|
||||
var self = this;
|
||||
|
||||
if (!o.source_view || !ed.getParam('fullpage_hide_in_source_view'))
|
||||
if (!o.source_view || !ed.getParam('fullpage_hide_in_source_view')) {
|
||||
o.content = tinymce.trim(self.head) + '\n' + tinymce.trim(o.content) + '\n' + tinymce.trim(self.foot);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
'Korean (iso-2022-kr)=iso-2022-kr,' +
|
||||
'ASCII (us-ascii)=us-ascii';
|
||||
|
||||
var defaultFontNames = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';
|
||||
var defaultFontNames = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact,sans-serif;WingDings=wingdings';
|
||||
var defaultFontSizes = '10px,11px,12px,13px,14px,15px,16px';
|
||||
|
||||
function setVal(id, value) {
|
||||
@@ -40,26 +40,29 @@
|
||||
if (elm) {
|
||||
value = value || '';
|
||||
|
||||
if (elm.nodeName == "SELECT")
|
||||
if (elm.nodeName == "SELECT") {
|
||||
selectByValue(document.forms[0], id, value);
|
||||
else if (elm.type == "checkbox")
|
||||
} else if (elm.type == "checkbox") {
|
||||
elm.checked = !!value;
|
||||
else
|
||||
} else {
|
||||
elm.value = value;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function getVal(id) {
|
||||
var elm = document.getElementById(id);
|
||||
|
||||
if (elm.nodeName == "SELECT")
|
||||
if (elm.nodeName == "SELECT") {
|
||||
return elm.options[elm.selectedIndex].value;
|
||||
}
|
||||
|
||||
if (elm.type == "checkbox")
|
||||
if (elm.type == "checkbox") {
|
||||
return elm.checked;
|
||||
}
|
||||
|
||||
return elm.value;
|
||||
};
|
||||
}
|
||||
|
||||
window.FullPageDialog = {
|
||||
changedStyle : function() {
|
||||
@@ -69,10 +72,11 @@
|
||||
setVal('fontsize', styles['font-size']);
|
||||
setVal('textcolor', styles['color']);
|
||||
|
||||
if (val = styles['background-image'])
|
||||
if (val = styles['background-image']) {
|
||||
setVal('bgimage', val.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"));
|
||||
else
|
||||
} else {
|
||||
setVal('bgimage', '');
|
||||
}
|
||||
|
||||
setVal('bgcolor', styles['background-color']);
|
||||
|
||||
@@ -91,17 +95,21 @@
|
||||
styles['margin-left'] = val[3] || val[0] || '';
|
||||
}
|
||||
|
||||
if (val = styles['margin-top'])
|
||||
if (val = styles['margin-top']) {
|
||||
setVal('topmargin', val.replace(/px/, ''));
|
||||
}
|
||||
|
||||
if (val = styles['margin-right'])
|
||||
if (val = styles['margin-right']) {
|
||||
setVal('rightmargin', val.replace(/px/, ''));
|
||||
}
|
||||
|
||||
if (val = styles['margin-bottom'])
|
||||
if (val = styles['margin-bottom']) {
|
||||
setVal('bottommargin', val.replace(/px/, ''));
|
||||
}
|
||||
|
||||
if (val = styles['margin-left'])
|
||||
if (val = styles['margin-left']) {
|
||||
setVal('leftmargin', val.replace(/px/, ''));
|
||||
}
|
||||
|
||||
updateColor('bgcolor_pick', 'bgcolor');
|
||||
updateColor('textcolor_pick', 'textcolor');
|
||||
|
||||
@@ -1 +1 @@
|
||||
(function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(d,e){var f=this,g={},c,b;f.editor=d;d.addCommand("mceFullScreen",function(){var i,j=a.doc.documentElement;if(d.getParam("fullscreen_is_enabled")){if(d.getParam("fullscreen_new_window")){closeFullscreen()}else{a.win.setTimeout(function(){tinymce.dom.Event.remove(a.win,"resize",f.resizeFunc);tinyMCE.get(d.getParam("fullscreen_editor_id")).setContent(d.getContent());tinyMCE.remove(d);a.remove("mce_fullscreen_container");j.style.overflow=d.getParam("fullscreen_html_overflow");a.setStyle(a.doc.body,"overflow",d.getParam("fullscreen_overflow"));a.win.scrollTo(d.getParam("fullscreen_scrollx"),d.getParam("fullscreen_scrolly"));tinyMCE.settings=tinyMCE.oldSettings},10)}return}if(d.getParam("fullscreen_new_window")){i=a.win.open(e+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{i.resizeTo(screen.availWidth,screen.availHeight)}catch(h){}}else{tinyMCE.oldSettings=tinyMCE.settings;g.fullscreen_overflow=a.getStyle(a.doc.body,"overflow",1)||"auto";g.fullscreen_html_overflow=a.getStyle(j,"overflow",1);c=a.getViewPort();g.fullscreen_scrollx=c.x;g.fullscreen_scrolly=c.y;if(tinymce.isOpera&&g.fullscreen_overflow=="visible"){g.fullscreen_overflow="auto"}if(tinymce.isIE&&g.fullscreen_overflow=="scroll"){g.fullscreen_overflow="auto"}if(tinymce.isIE&&(g.fullscreen_html_overflow=="visible"||g.fullscreen_html_overflow=="scroll")){g.fullscreen_html_overflow="auto"}if(g.fullscreen_overflow=="0px"){g.fullscreen_overflow=""}a.setStyle(a.doc.body,"overflow","hidden");j.style.overflow="hidden";c=a.getViewPort();a.win.scrollTo(0,0);if(tinymce.isIE){c.h-=1}if(tinymce.isIE6||document.compatMode=="BackCompat"){b="absolute;top:"+c.y}else{b="fixed;top:0"}n=a.add(a.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+b+";left:0;width:"+c.w+"px;height:"+c.h+"px;z-index:200000;"});a.add(n,"div",{id:"mce_fullscreen"});tinymce.each(d.settings,function(k,l){g[l]=k});g.id="mce_fullscreen";g.width=n.clientWidth;g.height=n.clientHeight-15;g.fullscreen_is_enabled=true;g.fullscreen_editor_id=d.id;g.theme_advanced_resizing=false;g.save_onsavecallback=function(){d.setContent(tinyMCE.get(g.id).getContent());d.execCommand("mceSave")};tinymce.each(d.getParam("fullscreen_settings"),function(m,l){g[l]=m});if(g.theme_advanced_toolbar_location==="external"){g.theme_advanced_toolbar_location="top"}f.fullscreenEditor=new tinymce.Editor("mce_fullscreen",g);f.fullscreenEditor.onInit.add(function(){f.fullscreenEditor.setContent(d.getContent());f.fullscreenEditor.focus()});f.fullscreenEditor.render();f.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");f.fullscreenElement.update();f.resizeFunc=tinymce.dom.Event.add(a.win,"resize",function(){var o=tinymce.DOM.getViewPort(),l=f.fullscreenEditor,k,m;k=l.dom.getSize(l.getContainer().getElementsByTagName("table")[0]);m=l.dom.getSize(l.getContainer().getElementsByTagName("iframe")[0]);l.theme.resizeTo(o.w-k.w+m.w,o.h-k.h+m.h)})}});d.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});d.onNodeChange.add(function(i,h){h.setActive("fullscreen",i.getParam("fullscreen_is_enabled"))})},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})();
|
||||
(function(){var b=tinymce.DOM;var a=function(d,f,e){var c=function(g){var i=d.controlManager.get(g);var h=f.controlManager.get(g);if(i&&h){h.displayColor(i.value)}};c("forecolor");c("backcolor");f.setContent(d.getContent({format:"raw"}),{format:"raw"});f.selection.moveToBookmark(e);if(d.plugins.spellchecker&&f.plugins.spellchecker){f.plugins.spellchecker.setLanguage(d.plugins.spellchecker.selectedLang)}};tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(i,c){var l=this,m={},k=b.doc.documentElement,d,o,h,g,f,e,j;i.addCommand("mceFullScreen",function(){var q,r;if(i.getParam("fullscreen_is_enabled")){if(i.getParam("fullscreen_new_window")){closeFullscreen()}else{b.win.setTimeout(function(){var t=i;var s=tinyMCE.get(t.getParam("fullscreen_editor_id"));s.plugins.fullscreen.saveState(t);tinyMCE.remove(t)},10)}return}if(i.getParam("fullscreen_new_window")){l.fullscreenSettings={bookmark:i.selection.getBookmark()};q=b.win.open(c+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{q.resizeTo(screen.availWidth,screen.availHeight)}catch(p){}}else{o=b.getStyle(b.doc.body,"overflow",1)||"auto";h=b.getStyle(k,"overflow",1);d=b.getViewPort();g=d.x;f=d.y;if(tinymce.isOpera&&o=="visible"){o="auto"}if(tinymce.isIE&&o=="scroll"){o="auto"}if(tinymce.isIE&&(h=="visible"||h=="scroll")){h="auto"}if(o=="0px"){o=""}b.setStyle(b.doc.body,"overflow","hidden");k.style.overflow="hidden";d=b.getViewPort();b.win.scrollTo(0,0);if(tinymce.isIE){d.h-=1}if(tinymce.isIE6||document.compatMode=="BackCompat"){e="absolute;top:"+d.y}else{e="fixed;top:0"}n=b.add(b.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+e+";left:0;width:"+d.w+"px;height:"+d.h+"px;z-index:200000;"});b.add(n,"div",{id:"mce_fullscreen"});tinymce.each(i.settings,function(s,t){m[t]=s});m.id="mce_fullscreen";m.width=n.clientWidth;m.height=n.clientHeight-15;m.fullscreen_is_enabled=true;m.fullscreen_editor_id=i.id;m.theme_advanced_resizing=false;m.save_onsavecallback=function(){i.setContent(tinyMCE.get(m.id).getContent());i.execCommand("mceSave")};tinymce.each(i.getParam("fullscreen_settings"),function(t,s){m[s]=t});l.fullscreenSettings={bookmark:i.selection.getBookmark(),fullscreen_overflow:o,fullscreen_html_overflow:h,fullscreen_scrollx:g,fullscreen_scrolly:f};if(m.theme_advanced_toolbar_location==="external"){m.theme_advanced_toolbar_location="top"}tinyMCE.oldSettings=tinyMCE.settings;l.fullscreenEditor=new tinymce.Editor("mce_fullscreen",m);l.fullscreenEditor.onInit.add(function(){l.loadState(l.fullscreenEditor)});l.fullscreenEditor.render();l.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");l.fullscreenElement.update();l.resizeFunc=tinymce.dom.Event.add(b.win,"resize",function(){var v=tinymce.DOM.getViewPort(),t=l.fullscreenEditor,s,u;s=t.dom.getSize(t.getContainer().getElementsByTagName("table")[0]);u=t.dom.getSize(t.getContainer().getElementsByTagName("iframe")[0]);t.theme.resizeTo(v.w-s.w+u.w,v.h-s.h+u.h)})}});i.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});i.onNodeChange.add(function(q,p){p.setActive("fullscreen",q.getParam("fullscreen_is_enabled"))});l.loadState=function(p){if(!(p&&l.fullscreenSettings)){throw"No fullscreen editor to load to"}a(i,p,l.fullscreenSettings.bookmark);p.focus()};l.saveState=function(q){if(!(q&&l.fullscreenSettings)){throw"No fullscreen editor to restore from"}var p=l.fullscreenSettings;a(q,i,q.selection.getBookmark());if(!i.getParam("fullscreen_new_window")){tinymce.dom.Event.remove(b.win,"resize",l.resizeFunc);delete l.resizeFunc;b.remove("mce_fullscreen_container");b.doc.documentElement.style.overflow=p.fullscreen_html_overflow;b.setStyle(b.doc.body,"overflow",p.fullscreen_overflow);b.win.scrollTo(p.fullscreen_scrollx,p.fullscreen_scrolly)}tinyMCE.settings=tinyMCE.oldSettings;delete tinyMCE.oldSettings;delete l.fullscreenEditor;delete l.fullscreenElement;delete l.fullscreenSettings;b.win.setTimeout(function(){i.selection.moveToBookmark(j);i.focus()},10)}},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})();
|
||||
@@ -11,29 +11,48 @@
|
||||
(function() {
|
||||
var DOM = tinymce.DOM;
|
||||
|
||||
// State Transfer function
|
||||
var transferState = function(oldEditor, newEditor, bookmark) {
|
||||
var transferColorButtonState = function(swapme) {
|
||||
var c = oldEditor.controlManager.get(swapme);
|
||||
var newC = newEditor.controlManager.get(swapme);
|
||||
|
||||
if (c && newC) {
|
||||
newC.displayColor(c.value);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
transferColorButtonState('forecolor');
|
||||
transferColorButtonState('backcolor');
|
||||
newEditor.setContent(oldEditor.getContent({format : 'raw'}), {format : 'raw'});
|
||||
newEditor.selection.moveToBookmark(bookmark);
|
||||
|
||||
if (oldEditor.plugins.spellchecker && newEditor.plugins.spellchecker) {
|
||||
newEditor.plugins.spellchecker.setLanguage(oldEditor.plugins.spellchecker.selectedLang);
|
||||
}
|
||||
};
|
||||
|
||||
tinymce.create('tinymce.plugins.FullScreenPlugin', {
|
||||
init : function(ed, url) {
|
||||
var t = this, s = {}, vp, posCss;
|
||||
|
||||
t.editor = ed;
|
||||
var t = this, s = {}, de = DOM.doc.documentElement, vp, fullscreen_overflow, fullscreen_html_overflow, fullscreen_scrollx, fullscreen_scrolly, posCss, bookmark;
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('mceFullScreen', function() {
|
||||
var win, de = DOM.doc.documentElement;
|
||||
var win, oed;
|
||||
|
||||
if (ed.getParam('fullscreen_is_enabled')) {
|
||||
if (ed.getParam('fullscreen_new_window'))
|
||||
closeFullscreen(); // Call to close in new window
|
||||
closeFullscreen(); // Call to close in fullscreen.htm
|
||||
else {
|
||||
DOM.win.setTimeout(function() {
|
||||
tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc);
|
||||
tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent());
|
||||
tinyMCE.remove(ed);
|
||||
DOM.remove('mce_fullscreen_container');
|
||||
de.style.overflow = ed.getParam('fullscreen_html_overflow');
|
||||
DOM.setStyle(DOM.doc.body, 'overflow', ed.getParam('fullscreen_overflow'));
|
||||
DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'), ed.getParam('fullscreen_scrolly'));
|
||||
tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings
|
||||
var fullscreenEditor = ed;
|
||||
|
||||
// find the editor that opened this one, execute restore function there
|
||||
var originalEditor = tinyMCE.get(fullscreenEditor.getParam('fullscreen_editor_id'));
|
||||
originalEditor.plugins.fullscreen.saveState(fullscreenEditor);
|
||||
|
||||
tinyMCE.remove(fullscreenEditor);
|
||||
}, 10);
|
||||
}
|
||||
|
||||
@@ -41,6 +60,9 @@
|
||||
}
|
||||
|
||||
if (ed.getParam('fullscreen_new_window')) {
|
||||
t.fullscreenSettings = {
|
||||
bookmark: ed.selection.getBookmark()
|
||||
};
|
||||
win = DOM.win.open(url + "/fullscreen.htm", "mceFullScreenPopup", "fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width=" + screen.availWidth + ",height=" + screen.availHeight);
|
||||
try {
|
||||
win.resizeTo(screen.availWidth, screen.availHeight);
|
||||
@@ -48,27 +70,26 @@
|
||||
// Ignore
|
||||
}
|
||||
} else {
|
||||
tinyMCE.oldSettings = tinyMCE.settings; // Store old settings
|
||||
s.fullscreen_overflow = DOM.getStyle(DOM.doc.body, 'overflow', 1) || 'auto';
|
||||
s.fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1);
|
||||
fullscreen_overflow = DOM.getStyle(DOM.doc.body, 'overflow', 1) || 'auto';
|
||||
fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1);
|
||||
vp = DOM.getViewPort();
|
||||
s.fullscreen_scrollx = vp.x;
|
||||
s.fullscreen_scrolly = vp.y;
|
||||
fullscreen_scrollx = vp.x;
|
||||
fullscreen_scrolly = vp.y;
|
||||
|
||||
// Fixes an Opera bug where the scrollbars doesn't reappear
|
||||
if (tinymce.isOpera && s.fullscreen_overflow == 'visible')
|
||||
s.fullscreen_overflow = 'auto';
|
||||
if (tinymce.isOpera && fullscreen_overflow == 'visible')
|
||||
fullscreen_overflow = 'auto';
|
||||
|
||||
// Fixes an IE bug where horizontal scrollbars would appear
|
||||
if (tinymce.isIE && s.fullscreen_overflow == 'scroll')
|
||||
s.fullscreen_overflow = 'auto';
|
||||
if (tinymce.isIE && fullscreen_overflow == 'scroll')
|
||||
fullscreen_overflow = 'auto';
|
||||
|
||||
// Fixes an IE bug where the scrollbars doesn't reappear
|
||||
if (tinymce.isIE && (s.fullscreen_html_overflow == 'visible' || s.fullscreen_html_overflow == 'scroll'))
|
||||
s.fullscreen_html_overflow = 'auto';
|
||||
if (tinymce.isIE && (fullscreen_html_overflow == 'visible' || fullscreen_html_overflow == 'scroll'))
|
||||
fullscreen_html_overflow = 'auto';
|
||||
|
||||
if (s.fullscreen_overflow == '0px')
|
||||
s.fullscreen_overflow = '';
|
||||
if (fullscreen_overflow == '0px')
|
||||
fullscreen_overflow = '';
|
||||
|
||||
DOM.setStyle(DOM.doc.body, 'overflow', 'hidden');
|
||||
de.style.overflow = 'hidden'; //Fix for IE6/7
|
||||
@@ -108,13 +129,21 @@
|
||||
s[k] = v;
|
||||
});
|
||||
|
||||
t.fullscreenSettings = {
|
||||
bookmark: ed.selection.getBookmark(),
|
||||
fullscreen_overflow: fullscreen_overflow,
|
||||
fullscreen_html_overflow: fullscreen_html_overflow,
|
||||
fullscreen_scrollx: fullscreen_scrollx,
|
||||
fullscreen_scrolly: fullscreen_scrolly
|
||||
};
|
||||
|
||||
if (s.theme_advanced_toolbar_location === 'external')
|
||||
s.theme_advanced_toolbar_location = 'top';
|
||||
|
||||
tinyMCE.oldSettings = tinyMCE.settings; // Store old settings, the Editor constructor overwrites them
|
||||
t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s);
|
||||
t.fullscreenEditor.onInit.add(function() {
|
||||
t.fullscreenEditor.setContent(ed.getContent());
|
||||
t.fullscreenEditor.focus();
|
||||
t.loadState(t.fullscreenEditor);
|
||||
});
|
||||
|
||||
t.fullscreenEditor.render();
|
||||
@@ -141,6 +170,52 @@
|
||||
ed.onNodeChange.add(function(ed, cm) {
|
||||
cm.setActive('fullscreen', ed.getParam('fullscreen_is_enabled'));
|
||||
});
|
||||
|
||||
// fullscreenEditor is a param here because in window mode we don't create it
|
||||
t.loadState = function(fullscreenEditor) {
|
||||
if (!(fullscreenEditor && t.fullscreenSettings)) {
|
||||
throw "No fullscreen editor to load to";
|
||||
}
|
||||
|
||||
transferState(ed, fullscreenEditor, t.fullscreenSettings.bookmark);
|
||||
fullscreenEditor.focus();
|
||||
|
||||
};
|
||||
|
||||
// fullscreenEditor is a param here because in window mode we don't create it
|
||||
t.saveState = function(fullscreenEditor) {
|
||||
if (!(fullscreenEditor && t.fullscreenSettings)) {
|
||||
throw "No fullscreen editor to restore from";
|
||||
}
|
||||
var settings = t.fullscreenSettings;
|
||||
|
||||
transferState(fullscreenEditor, ed, fullscreenEditor.selection.getBookmark());
|
||||
|
||||
// cleanup only required if window mode isn't used
|
||||
if (!ed.getParam('fullscreen_new_window')) {
|
||||
tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc);
|
||||
delete t.resizeFunc;
|
||||
|
||||
DOM.remove('mce_fullscreen_container');
|
||||
|
||||
DOM.doc.documentElement.style.overflow = settings.fullscreen_html_overflow;
|
||||
DOM.setStyle(DOM.doc.body, 'overflow', settings.fullscreen_overflow);
|
||||
DOM.win.scrollTo(settings.fullscreen_scrollx, settings.fullscreen_scrolly);
|
||||
}
|
||||
tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings
|
||||
|
||||
// clear variables
|
||||
delete tinyMCE.oldSettings;
|
||||
delete t.fullscreenEditor;
|
||||
delete t.fullscreenElement;
|
||||
delete t.fullscreenSettings;
|
||||
|
||||
// allow the fullscreen editor to be removed before restoring focus and selection
|
||||
DOM.win.setTimeout(function() {
|
||||
ed.selection.moveToBookmark(bookmark);
|
||||
ed.focus();
|
||||
}, 10);
|
||||
};
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
settings['strict_loading_mode'] = true;
|
||||
|
||||
settings.save_onsavecallback = function() {
|
||||
window.opener.tinyMCE.get(oeID).setContent(tinyMCE.get('fullscreenarea').getContent({format : 'raw'}), {format : 'raw'});
|
||||
moveContent();
|
||||
window.opener.tinyMCE.get(oeID).execCommand('mceSave');
|
||||
window.close();
|
||||
};
|
||||
@@ -56,11 +56,15 @@
|
||||
}
|
||||
|
||||
function moveContent() {
|
||||
window.opener.tinyMCE.get(oeID).setContent(tinyMCE.activeEditor.getContent());
|
||||
// find the original editor, execute restore state in it's plugin instance
|
||||
window.opener.tinyMCE.get(oeID).plugins.fullscreen.saveState(tinyMCE.activeEditor);
|
||||
|
||||
// prevent moveContent from being called twice - e.g. if the unloadHandler runs after moveContent()
|
||||
tinymce.dom.Event.remove(window, "beforeunload", unloadHandler);
|
||||
}
|
||||
|
||||
function closeFullscreen() {
|
||||
moveContent();
|
||||
// moveContent() will be called by the unload handler
|
||||
window.close();
|
||||
}
|
||||
|
||||
@@ -78,17 +82,20 @@
|
||||
function render() {
|
||||
var e = document.getElementById('fullscreenarea'), vp, ed, ow, oh, dom = tinymce.DOM;
|
||||
|
||||
e.value = window.opener.tinyMCE.get(oeID).getContent();
|
||||
|
||||
vp = dom.getViewPort();
|
||||
settings.width = vp.w;
|
||||
settings.height = vp.h - 15;
|
||||
|
||||
settings.oninit = function() {
|
||||
var ed = tinyMCE.activeEditor;
|
||||
window.opener.tinyMCE.get(oeID).plugins.fullscreen.loadState(ed);
|
||||
|
||||
tinymce.dom.Event.add(window, 'resize', function() {
|
||||
var vp = dom.getViewPort();
|
||||
|
||||
tinyMCE.activeEditor.theme.resizeTo(vp.w, vp.h);
|
||||
});
|
||||
}
|
||||
|
||||
tinyMCE.init(settings);
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -60,7 +60,7 @@
|
||||
if (!f.type)
|
||||
t.bookmark = ed.selection.getBookmark(1);
|
||||
|
||||
id = DOM.uniqueId();
|
||||
id = DOM.uniqueId("mce_inlinepopups_"); // Use a prefix so this can't conflict with other ids
|
||||
vp = DOM.getViewPort();
|
||||
f.width = parseInt(f.width || 320);
|
||||
f.height = parseInt(f.height || 240) + (tinymce.isIE ? 8 : 0);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -9,8 +9,9 @@
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var rootAttributes = tinymce.explode('id,name,width,height,style,align,class,hspace,vspace,bgcolor,type'), excludedAttrs = tinymce.makeMap(rootAttributes.join(',')), Node = tinymce.html.Node,
|
||||
mediaTypes, scriptRegExp, JSON = tinymce.util.JSON, mimeTypes;
|
||||
var subRootAttributes = tinymce.explode('id,name,style,align,class,hspace,vspace,bgcolor,type'), subExcludedAttrs = tinymce.makeMap(subRootAttributes.join(',')),
|
||||
rootAttributes = subRootAttributes.concat(tinymce.explode('width, height')), excludedAttrs = tinymce.makeMap(rootAttributes.join(',')), Node = tinymce.html.Node,
|
||||
mediaTypes, scriptRegExp, JSON = tinymce.util.JSON;
|
||||
|
||||
// Media types supported by this plugin
|
||||
mediaTypes = [
|
||||
@@ -25,7 +26,8 @@
|
||||
["Iframe"],
|
||||
["Video"],
|
||||
["EmbeddedAudio"],
|
||||
["Audio"]
|
||||
["Audio"],
|
||||
["Object"]
|
||||
];
|
||||
|
||||
function normalizeSize(size) {
|
||||
@@ -33,23 +35,20 @@
|
||||
}
|
||||
|
||||
function toArray(obj) {
|
||||
var undef, out, i;
|
||||
|
||||
var out, i;
|
||||
if (obj && !obj.splice) {
|
||||
out = [];
|
||||
|
||||
for (i = 0; true; i++) {
|
||||
if (obj[i])
|
||||
if (obj[i]) {
|
||||
out[i] = obj[i];
|
||||
else
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
}
|
||||
|
||||
tinymce.create('tinymce.plugins.MediaPlugin', {
|
||||
init : function(ed, url) {
|
||||
@@ -57,7 +56,7 @@
|
||||
|
||||
function isMediaImg(node) {
|
||||
return node && node.nodeName === 'IMG' && ed.dom.hasClass(node, 'mceItemMedia');
|
||||
};
|
||||
}
|
||||
|
||||
self.editor = ed;
|
||||
self.url = url;
|
||||
@@ -74,11 +73,13 @@
|
||||
codebase : mediaTypes[i][3]
|
||||
};
|
||||
|
||||
for (y = 0; y < item.clsids.length; y++)
|
||||
for (y = 0; y < item.clsids.length; y++) {
|
||||
lookup['clsid:' + item.clsids[y]] = item;
|
||||
}
|
||||
|
||||
for (y = 0; y < item.mimes.length; y++)
|
||||
for (y = 0; y < item.mimes.length; y++) {
|
||||
lookup[item.mimes[y]] = item;
|
||||
}
|
||||
|
||||
lookup['mceItem' + name] = item;
|
||||
lookup[name.toLowerCase()] = item;
|
||||
@@ -106,9 +107,10 @@
|
||||
for (i = 0; i < extensions.length; i++) {
|
||||
type = lookup[item[0].toLowerCase()];
|
||||
|
||||
if (type)
|
||||
if (type) {
|
||||
lookup[extensions[i]] = type;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
scriptRegExp = new RegExp('write(' + scriptRegExp + ')\\(([^)]+)\\)');
|
||||
@@ -122,8 +124,9 @@
|
||||
ed.parser.addNodeFilter('object,embed,video,audio,script,iframe', function(nodes) {
|
||||
var i = nodes.length;
|
||||
|
||||
while (i--)
|
||||
while (i--) {
|
||||
self.objectToImg(nodes[i]);
|
||||
}
|
||||
});
|
||||
|
||||
// Convert image placeholders to video elements
|
||||
@@ -132,9 +135,10 @@
|
||||
|
||||
while (i--) {
|
||||
node = nodes[i];
|
||||
if ((node.attr('class') || '').indexOf('mceItemMedia') !== -1)
|
||||
if ((node.attr('class') || '').indexOf('mceItemMedia') !== -1) {
|
||||
self.imgToObject(node, args);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -142,16 +146,18 @@
|
||||
// Display "media" instead of "img" in element path
|
||||
if (ed.theme && ed.theme.onResolveName) {
|
||||
ed.theme.onResolveName.add(function(theme, path_object) {
|
||||
if (path_object.name === 'img' && ed.dom.hasClass(path_object.node, 'mceItemMedia'))
|
||||
if (path_object.name === 'img' && ed.dom.hasClass(path_object.node, 'mceItemMedia')) {
|
||||
path_object.name = 'media';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Add contect menu if it's loaded
|
||||
if (ed && ed.plugins.contextmenu) {
|
||||
ed.plugins.contextmenu.onContextMenu.add(function(plugin, menu, element) {
|
||||
if (element.nodeName === 'IMG' && element.className.indexOf('mceItemMedia') !== -1)
|
||||
if (element.nodeName === 'IMG' && element.className.indexOf('mceItemMedia') !== -1) {
|
||||
menu.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -170,8 +176,9 @@
|
||||
tinymce.each(rootAttributes, function(name) {
|
||||
var value = ed.dom.getAttrib(img, name);
|
||||
|
||||
if (value)
|
||||
if (value) {
|
||||
data[name] = value;
|
||||
}
|
||||
});
|
||||
|
||||
data.type = self.getType(img.className).name.toLowerCase();
|
||||
@@ -211,11 +218,13 @@
|
||||
urlConverter = settings.url_converter,
|
||||
urlConverterScope = settings.url_converter_scope || self;
|
||||
|
||||
if (!url)
|
||||
if (!url) {
|
||||
return url;
|
||||
}
|
||||
|
||||
if (force_absolute)
|
||||
if (force_absolute) {
|
||||
return editor.documentBaseURI.toAbsolute(url);
|
||||
}
|
||||
|
||||
return urlConverter.call(urlConverterScope, url, 'src', 'object');
|
||||
},
|
||||
@@ -234,22 +243,25 @@
|
||||
* Converts the JSON data object to an img node.
|
||||
*/
|
||||
dataToImg : function(data, force_absolute) {
|
||||
var self = this, editor = self.editor, baseUri = editor.documentBaseURI, sources, attrs, img, i;
|
||||
var self = this, sources, attrs, img, i;
|
||||
|
||||
data.params.src = self.convertUrl(data.params.src, force_absolute);
|
||||
|
||||
attrs = data.video.attrs;
|
||||
if (attrs)
|
||||
if (attrs) {
|
||||
attrs.src = self.convertUrl(attrs.src, force_absolute);
|
||||
}
|
||||
|
||||
if (attrs)
|
||||
if (attrs) {
|
||||
attrs.poster = self.convertUrl(attrs.poster, force_absolute);
|
||||
}
|
||||
|
||||
sources = toArray(data.video.sources);
|
||||
if (sources) {
|
||||
for (i = 0; i < sources.length; i++)
|
||||
for (i = 0; i < sources.length; i++) {
|
||||
sources[i].src = self.convertUrl(sources[i].src, force_absolute);
|
||||
}
|
||||
}
|
||||
|
||||
img = self.editor.dom.create('img', {
|
||||
id : data.id,
|
||||
@@ -298,8 +310,9 @@
|
||||
tinymce.each(rootAttributes, function(name) {
|
||||
var value = img.attr(name);
|
||||
|
||||
if (value)
|
||||
if (value) {
|
||||
data[name] = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -321,17 +334,19 @@
|
||||
for (i = 0; i < values.length; i++) {
|
||||
typeItem = this.lookup[values[i]];
|
||||
|
||||
if (typeItem)
|
||||
if (typeItem) {
|
||||
return typeItem;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Converts a tinymce.html.Node image element to video/object/embed.
|
||||
*/
|
||||
imgToObject : function(node, args) {
|
||||
var self = this, editor = self.editor, video, object, embed, iframe, name, value, data,
|
||||
source, sources, params, param, typeItem, i, item, mp4Source, replacement,
|
||||
var self = this, editor = self.editor, video, object, embed, name, value, data,
|
||||
source, sources, param, typeItem, i, mp4Source, replacement,
|
||||
posterSrc, style, audio;
|
||||
|
||||
// Adds the flash player
|
||||
@@ -357,12 +372,14 @@
|
||||
value = value.replace(/\$url/, video_src || '');
|
||||
value = value.replace(/\$poster/, poster_src || '');
|
||||
|
||||
if (value.length > 0)
|
||||
if (value.length > 0) {
|
||||
flashVarsOutput += (flashVarsOutput ? '&' : '') + name + '=' + escape(value);
|
||||
}
|
||||
});
|
||||
|
||||
if (flashVarsOutput.length)
|
||||
if (flashVarsOutput.length) {
|
||||
data.params.flashvars = flashVarsOutput;
|
||||
}
|
||||
|
||||
params = editor.getParam('flash_video_player_params', {
|
||||
allowfullscreen: true,
|
||||
@@ -373,11 +390,62 @@
|
||||
data.params[name] = "" + value;
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function createObject (node, style, rootAttributes, data) {
|
||||
object = new Node('object', 1).attr({
|
||||
id : node.attr('id'),
|
||||
width: normalizeSize(node.attr('width')),
|
||||
height: normalizeSize(node.attr('height')),
|
||||
style : style
|
||||
});
|
||||
|
||||
tinymce.each(rootAttributes, function(name) {
|
||||
var value = data[name];
|
||||
|
||||
if (name == 'class' && value) {
|
||||
value = value.replace(/mceItem.+ ?/g, '');
|
||||
}
|
||||
|
||||
if (value && name != 'type') {
|
||||
object.attr(name, value);
|
||||
}
|
||||
});
|
||||
|
||||
for (var name in data.params) {
|
||||
var param;
|
||||
param = new Node('param', 1);
|
||||
param.shortEnded = true;
|
||||
value = data.params[name];
|
||||
|
||||
// Windows media needs to use url instead of src for the media URL
|
||||
if (name === 'src' && typeItem.name === 'WindowsMedia') {
|
||||
name = 'url';
|
||||
}
|
||||
|
||||
param.attr({name: name, value: value});
|
||||
object.append(param);
|
||||
}
|
||||
|
||||
if (data.object_html) {
|
||||
value = new Node('#text', 3);
|
||||
value.raw = true;
|
||||
value.value = data.object_html;
|
||||
object.append(value);
|
||||
}
|
||||
|
||||
// Append object to video element if it exists
|
||||
if (video) {
|
||||
video.append(object);
|
||||
}
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
data = node.attr('data-mce-json');
|
||||
if (!data)
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
|
||||
data = JSON.parse(data);
|
||||
typeItem = this.getType(node.attr('class'));
|
||||
@@ -386,9 +454,10 @@
|
||||
if (!style) {
|
||||
style = node.attr('style');
|
||||
|
||||
if (style)
|
||||
if (style) {
|
||||
style = editor.dom.serializeStyle(editor.dom.parseStyle(style, 'img'));
|
||||
}
|
||||
}
|
||||
|
||||
// Use node width/height to override the data width/height when the placeholder is resized
|
||||
data.width = node.attr('width') || data.width;
|
||||
@@ -401,15 +470,18 @@
|
||||
tinymce.each(rootAttributes, function(name) {
|
||||
var value = node.attr(name);
|
||||
|
||||
if (name == 'class' && value)
|
||||
if (name == 'class' && value) {
|
||||
value = value.replace(/mceItem.+ ?/g, '');
|
||||
}
|
||||
|
||||
if (value && value.length > 0)
|
||||
if (value && value.length > 0) {
|
||||
replacement.attr(name, value);
|
||||
}
|
||||
});
|
||||
|
||||
for (name in data.params)
|
||||
for (name in data.params) {
|
||||
replacement.attr(name, data.params[name]);
|
||||
}
|
||||
|
||||
replacement.attr({
|
||||
style: style,
|
||||
@@ -448,14 +520,16 @@
|
||||
}, data.video.attrs));
|
||||
|
||||
// Get poster source and use that for flash fallback
|
||||
if (data.video.attrs)
|
||||
if (data.video.attrs) {
|
||||
posterSrc = data.video.attrs.poster;
|
||||
}
|
||||
|
||||
sources = data.video.sources = toArray(data.video.sources);
|
||||
for (i = 0; i < sources.length; i++) {
|
||||
if (/\.mp4$/.test(sources[i].src))
|
||||
if (/\.mp4$/.test(sources[i].src)) {
|
||||
mp4Source = sources[i].src;
|
||||
}
|
||||
}
|
||||
|
||||
if (!sources[0].type) {
|
||||
video.attr('src', sources[0].src);
|
||||
@@ -472,9 +546,10 @@
|
||||
if (mp4Source) {
|
||||
addPlayer(mp4Source, posterSrc);
|
||||
typeItem = self.getType('flash');
|
||||
} else
|
||||
} else {
|
||||
data.params.src = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Add HTML5 audio element
|
||||
if (typeItem.name === 'Audio' && data.video.sources[0]) {
|
||||
@@ -487,8 +562,9 @@
|
||||
}, data.video.attrs));
|
||||
|
||||
// Get poster source and use that for flash fallback
|
||||
if (data.video.attrs)
|
||||
if (data.video.attrs) {
|
||||
posterSrc = data.video.attrs.poster;
|
||||
}
|
||||
|
||||
sources = data.video.sources = toArray(data.video.sources);
|
||||
if (!sources[0].type) {
|
||||
@@ -516,12 +592,14 @@
|
||||
type: node.attr('type')
|
||||
});
|
||||
|
||||
for (name in data.params)
|
||||
for (name in data.params) {
|
||||
embed.attr(name, data.params[name]);
|
||||
}
|
||||
|
||||
tinymce.each(rootAttributes, function(name) {
|
||||
if (data[name] && name != 'type')
|
||||
if (data[name] && name != 'type') {
|
||||
embed.attr(name, data[name]);
|
||||
}
|
||||
});
|
||||
|
||||
data.params.src = '';
|
||||
@@ -530,44 +608,16 @@
|
||||
// Do we have a params src then we can generate object
|
||||
if (data.params.src) {
|
||||
// Is flv movie add player for it
|
||||
if (/\.flv$/i.test(data.params.src))
|
||||
if (/\.flv$/i.test(data.params.src)) {
|
||||
addPlayer(data.params.src, '');
|
||||
|
||||
if (args && args.force_absolute)
|
||||
data.params.src = editor.documentBaseURI.toAbsolute(data.params.src);
|
||||
|
||||
// Create new object element
|
||||
object = new Node('object', 1).attr({
|
||||
id : node.attr('id'),
|
||||
width: normalizeSize(node.attr('width')),
|
||||
height: normalizeSize(node.attr('height')),
|
||||
style : style
|
||||
});
|
||||
|
||||
tinymce.each(rootAttributes, function(name) {
|
||||
var value = data[name];
|
||||
|
||||
if (name == 'class' && value)
|
||||
value = value.replace(/mceItem.+ ?/g, '');
|
||||
|
||||
if (value && name != 'type')
|
||||
object.attr(name, value);
|
||||
});
|
||||
|
||||
// Add params
|
||||
for (name in data.params) {
|
||||
param = new Node('param', 1);
|
||||
param.shortEnded = true;
|
||||
value = data.params[name];
|
||||
|
||||
// Windows media needs to use url instead of src for the media URL
|
||||
if (name === 'src' && typeItem.name === 'WindowsMedia')
|
||||
name = 'url';
|
||||
|
||||
param.attr({name: name, value: value});
|
||||
object.append(param);
|
||||
}
|
||||
|
||||
if (args && args.force_absolute) {
|
||||
data.params.src = editor.documentBaseURI.toAbsolute(data.params.src);
|
||||
}
|
||||
|
||||
object = createObject(node, style, rootAttributes, data, video);
|
||||
|
||||
// Setup add type and classid if strict is disabled
|
||||
if (this.editor.getParam('media_strict', true)) {
|
||||
object.attr({
|
||||
@@ -575,10 +625,12 @@
|
||||
type: typeItem.mimes[0]
|
||||
});
|
||||
} else {
|
||||
if(typeItem.clsids[0]) {
|
||||
object.attr({
|
||||
classid: "clsid:" + typeItem.clsids[0],
|
||||
codebase: typeItem.codebase
|
||||
});
|
||||
}
|
||||
|
||||
embed = new Node('embed', 1);
|
||||
embed.shortEnded = true;
|
||||
@@ -590,28 +642,22 @@
|
||||
type: typeItem.mimes[0]
|
||||
});
|
||||
|
||||
for (name in data.params)
|
||||
for (name in data.params) {
|
||||
embed.attr(name, data.params[name]);
|
||||
}
|
||||
|
||||
tinymce.each(rootAttributes, function(name) {
|
||||
if (data[name] && name != 'type')
|
||||
if (data[name] && name != 'type') {
|
||||
embed.attr(name, data[name]);
|
||||
}
|
||||
});
|
||||
|
||||
object.append(embed);
|
||||
}
|
||||
|
||||
// Insert raw HTML
|
||||
if (data.object_html) {
|
||||
value = new Node('#text', 3);
|
||||
value.raw = true;
|
||||
value.value = data.object_html;
|
||||
object.append(value);
|
||||
}
|
||||
|
||||
// Append object to video element if it exists
|
||||
if (video)
|
||||
video.append(object);
|
||||
} else if (typeItem.name === 'Object') {
|
||||
// Remove data.params.src since not in the original object
|
||||
delete data.params.src;
|
||||
object = createObject(node, style, rootAttributes, data, video);
|
||||
}
|
||||
|
||||
if (video) {
|
||||
@@ -635,10 +681,11 @@
|
||||
}
|
||||
|
||||
var n = video || audio || object || embed;
|
||||
if (n)
|
||||
if (n) {
|
||||
node.replace(n);
|
||||
else
|
||||
} else {
|
||||
node.remove();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -662,7 +709,7 @@
|
||||
inner: true,
|
||||
validate: false
|
||||
}).serialize(node);
|
||||
};
|
||||
}
|
||||
|
||||
function lookupAttribute(o, attr) {
|
||||
return lookup[(o.attr(attr) || '').toLowerCase()];
|
||||
@@ -674,16 +721,19 @@
|
||||
}
|
||||
|
||||
// If node isn't in document
|
||||
if (!node.parent)
|
||||
if (!node.parent) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle media scripts
|
||||
if (node.name === 'script') {
|
||||
if (node.firstChild)
|
||||
if (node.firstChild) {
|
||||
matches = scriptRegExp.exec(node.firstChild.value);
|
||||
}
|
||||
|
||||
if (!matches)
|
||||
if (!matches) {
|
||||
return;
|
||||
}
|
||||
|
||||
type = matches[1];
|
||||
data = {video : {}, params : JSON.parse(matches[2])};
|
||||
@@ -716,12 +766,14 @@
|
||||
|
||||
// Get all video attributes
|
||||
attrs = data.video.attrs;
|
||||
for (name in video.attributes.map)
|
||||
for (name in video.attributes.map) {
|
||||
attrs[name] = video.attributes.map[name];
|
||||
}
|
||||
|
||||
source = node.attr('src');
|
||||
if (source)
|
||||
if (source) {
|
||||
data.video.sources.push({src : urlConverter.call(urlConverterScope, source, 'src', node.name)});
|
||||
}
|
||||
|
||||
// Get all sources
|
||||
sources = video.getAll("source");
|
||||
@@ -736,9 +788,10 @@
|
||||
}
|
||||
|
||||
// Convert the poster URL
|
||||
if (attrs.poster)
|
||||
if (attrs.poster) {
|
||||
attrs.poster = urlConverter.call(urlConverterScope, attrs.poster, 'poster', node.name);
|
||||
}
|
||||
}
|
||||
|
||||
// Object element
|
||||
if (node.name === 'object') {
|
||||
@@ -747,8 +800,9 @@
|
||||
}
|
||||
|
||||
// Embed element
|
||||
if (node.name === 'embed')
|
||||
if (node.name === 'embed') {
|
||||
embed = node;
|
||||
}
|
||||
|
||||
// Iframe element
|
||||
if (node.name === 'iframe') {
|
||||
@@ -758,8 +812,6 @@
|
||||
|
||||
if (object) {
|
||||
// Get width/height
|
||||
width = width || object.attr('width');
|
||||
height = height || object.attr('height');
|
||||
style = style || object.attr('style');
|
||||
id = id || object.attr('id');
|
||||
hspace = hspace || object.attr('hspace');
|
||||
@@ -767,16 +819,22 @@
|
||||
align = align || object.attr('align');
|
||||
bgcolor = bgcolor || object.attr('bgcolor');
|
||||
data.name = object.attr('name');
|
||||
data["class"] = object.attr('class');
|
||||
|
||||
// Get all object params
|
||||
params = object.getAll("param");
|
||||
|
||||
for (i = 0; i < params.length; i++) {
|
||||
param = params[i];
|
||||
name = param.remove().attr('name');
|
||||
|
||||
if (!excludedAttrs[name])
|
||||
if (!subExcludedAttrs[name]) {
|
||||
data.params[name] = param.attr('value');
|
||||
}
|
||||
}
|
||||
|
||||
width = width || object.attr('width') || data.params.width;
|
||||
height = height || object.attr('height') || data.params.height;
|
||||
|
||||
data.params.src = data.params.src || object.attr('data');
|
||||
}
|
||||
@@ -794,11 +852,13 @@
|
||||
|
||||
// Get all embed attributes
|
||||
for (name in embed.attributes.map) {
|
||||
if (!excludedAttrs[name] && !data.params[name])
|
||||
if (!excludedAttrs[name] && !data.params[name]) {
|
||||
data.params[name] = embed.attributes.map[name];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (iframe) {
|
||||
// Get width/height
|
||||
width = normalizeSize(iframe.attr('width'));
|
||||
@@ -816,10 +876,11 @@
|
||||
|
||||
// Get all iframe attributes
|
||||
for (name in iframe.attributes.map) {
|
||||
if (!excludedAttrs[name] && !data.params[name])
|
||||
if (!excludedAttrs[name] && !data.params[name]) {
|
||||
data.params[name] = iframe.attributes.map[name];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Use src not movie
|
||||
if (data.params.movie) {
|
||||
@@ -828,22 +889,25 @@
|
||||
}
|
||||
|
||||
// Convert the URL to relative/absolute depending on configuration
|
||||
if (data.params.src)
|
||||
if (data.params.src) {
|
||||
data.params.src = urlConverter.call(urlConverterScope, data.params.src, 'src', 'object');
|
||||
|
||||
if (video) {
|
||||
if (node.name === 'video')
|
||||
type = lookup.video.name;
|
||||
else if (node.name === 'audio')
|
||||
type = lookup.audio.name;
|
||||
}
|
||||
|
||||
if (object && !type)
|
||||
type = (lookupAttribute(object, 'clsid') || lookupAttribute(object, 'classid') || lookupAttribute(object, 'type') || {}).name;
|
||||
if (video) {
|
||||
if (node.name === 'video') {
|
||||
type = lookup.video.name;
|
||||
} else if (node.name === 'audio') {
|
||||
type = lookup.audio.name;
|
||||
}
|
||||
}
|
||||
|
||||
if (embed && !type)
|
||||
if (embed && !type) {
|
||||
type = (lookupAttribute(embed, 'type') || lookupExtension(data.params.src) || {}).name;
|
||||
}
|
||||
|
||||
if (object && !type) {
|
||||
type = (lookupAttribute(object, 'clsid') || lookupAttribute(object, 'classid') || lookupAttribute(object, 'type') || {name: 'Object'}).name;
|
||||
}
|
||||
// for embedded audio we preserve the original specified type
|
||||
if (embed && type == 'EmbeddedAudio') {
|
||||
data.params.type = embed.attr('type');
|
||||
@@ -852,25 +916,26 @@
|
||||
// Replace the video/object/embed element with a placeholder image containing the data
|
||||
node.replace(img);
|
||||
|
||||
// Remove embed
|
||||
if (embed)
|
||||
if (embed) {
|
||||
embed.remove();
|
||||
}
|
||||
|
||||
// Serialize the inner HTML of the object element
|
||||
if (object) {
|
||||
html = getInnerHTML(object.remove());
|
||||
|
||||
if (html)
|
||||
if (html) {
|
||||
data.object_html = html;
|
||||
}
|
||||
}
|
||||
|
||||
// Serialize the inner HTML of the video element
|
||||
if (video) {
|
||||
html = getInnerHTML(video.remove());
|
||||
|
||||
if (html)
|
||||
if (html) {
|
||||
data.video_html = html;
|
||||
}
|
||||
}
|
||||
|
||||
data.hspace = hspace;
|
||||
data.vspace = vspace;
|
||||
|
||||
@@ -295,8 +295,17 @@
|
||||
} else {
|
||||
src = getVal("src");
|
||||
|
||||
// YouTube Embed
|
||||
if (src.match(/youtube\.com\/embed\/\w+/)) {
|
||||
data.width = 425;
|
||||
data.height = 350;
|
||||
data.params.frameborder = '0';
|
||||
data.type = 'iframe';
|
||||
setVal('src', src);
|
||||
setVal('media_type', data.type);
|
||||
} else {
|
||||
// YouTube *NEW*
|
||||
if (src.match(/youtu.be\/[a-z1-9.-_]+/)) {
|
||||
if (src.match(/youtu\.be\/[a-z1-9.-_]+/)) {
|
||||
data.width = 425;
|
||||
data.height = 350;
|
||||
data.params.frameborder = '0';
|
||||
@@ -307,7 +316,7 @@
|
||||
}
|
||||
|
||||
// YouTube
|
||||
if (src.match(/youtube.com(.+)v=([^&]+)/)) {
|
||||
if (src.match(/youtube\.com(.+)v=([^&]+)/)) {
|
||||
data.width = 425;
|
||||
data.height = 350;
|
||||
data.params.frameborder = '0';
|
||||
@@ -316,9 +325,10 @@
|
||||
setVal('src', src);
|
||||
setVal('media_type', data.type);
|
||||
}
|
||||
}
|
||||
|
||||
// Google video
|
||||
if (src.match(/video.google.com(.+)docid=([^&]+)/)) {
|
||||
if (src.match(/video\.google\.com(.+)docid=([^&]+)/)) {
|
||||
data.width = 425;
|
||||
data.height = 326;
|
||||
data.type = 'flash';
|
||||
@@ -328,7 +338,7 @@
|
||||
}
|
||||
|
||||
// Vimeo
|
||||
if (src.match(/vimeo.com\/([0-9]+)/)) {
|
||||
if (src.match(/vimeo\.com\/([0-9]+)/)) {
|
||||
data.width = 425;
|
||||
data.height = 350;
|
||||
data.params.frameborder = '0';
|
||||
@@ -339,7 +349,7 @@
|
||||
}
|
||||
|
||||
// stream.cz
|
||||
if (src.match(/stream.cz\/((?!object).)*\/([0-9]+)/)) {
|
||||
if (src.match(/stream\.cz\/((?!object).)*\/([0-9]+)/)) {
|
||||
data.width = 425;
|
||||
data.height = 350;
|
||||
data.params.frameborder = '0';
|
||||
@@ -350,7 +360,7 @@
|
||||
}
|
||||
|
||||
// Google maps
|
||||
if (src.match(/maps.google.([a-z]{2,3})\/maps\/(.+)msid=(.+)/)) {
|
||||
if (src.match(/maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/)) {
|
||||
data.width = 425;
|
||||
data.height = 350;
|
||||
data.params.frameborder = '0';
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -12,9 +12,12 @@
|
||||
var TreeWalker = tinymce.dom.TreeWalker;
|
||||
var externalName = 'contenteditable', internalName = 'data-mce-' + externalName;
|
||||
var VK = tinymce.VK;
|
||||
var editClass, nonEditClass, nonEditableRegExps;
|
||||
|
||||
function handleContentEditableSelection(ed) {
|
||||
var dom = ed.dom, selection = ed.selection, invisibleChar, caretContainerId = 'mce_noneditablecaret', invisibleChar = '\uFEFF';
|
||||
var dom = ed.dom, selection = ed.selection, caretContainerId = 'mce_noneditablecaret', invisibleChar = '\uFEFF',
|
||||
nondeletable = ed.getParam('noneditable_prevent_delete');
|
||||
|
||||
|
||||
// Returns the content editable state of a node "true/false" or null
|
||||
function getContentEditable(node) {
|
||||
@@ -119,7 +122,7 @@
|
||||
|
||||
// Removes any caret container except the one we might be in
|
||||
function removeCaretContainer(caretContainer) {
|
||||
var child, currentCaretContainer, lastContainer;
|
||||
var child, currentCaretContainer, lastContainer, rng;
|
||||
|
||||
if (caretContainer) {
|
||||
rng = selection.getRng(true);
|
||||
@@ -213,11 +216,13 @@
|
||||
// If it's a caret selection then look left/right to see if we need to move the caret out side or expand
|
||||
if (isCollapsed) {
|
||||
nonEditableStart = nonEditableStart || nonEditableEnd;
|
||||
var start = selection.getStart();
|
||||
if (element = hasSideContent(nonEditableStart, true)) {
|
||||
|
||||
if (hasSideContent(nonEditableStart, true)) {
|
||||
element = hasSideContent(nonEditableStart, true);
|
||||
// We have no contents to the left of the caret then insert a caret container before the noneditable element
|
||||
insertCaretContainerOrExpandToBlock(element, true);
|
||||
} else if (element = hasSideContent(nonEditableStart, false)) {
|
||||
} else if (hasSideContent(nonEditableStart, false)) {
|
||||
element = hasSideContent(nonEditableStart, false);
|
||||
// We have no contents to the right of the caret then insert a caret container after the noneditable element
|
||||
insertCaretContainerOrExpandToBlock(element, false);
|
||||
} else {
|
||||
@@ -243,7 +248,8 @@
|
||||
};
|
||||
|
||||
function handleKey(ed, e) {
|
||||
var keyCode = e.keyCode, nonEditableParent, caretContainer, startElement, endElement;
|
||||
var keyCode = e.keyCode, nonEditableParent, caretContainer, startElement, endElement, htmlSelection,
|
||||
selectionContainsNonEditable = false, selectedRegion;
|
||||
|
||||
function getNonEmptyTextNodeSibling(node, prev) {
|
||||
while (node = node[prev ? 'previousSibling' : 'nextSibling']) {
|
||||
@@ -293,7 +299,9 @@
|
||||
|
||||
// Found non editable node
|
||||
if (getContentEditable(node) === "false") {
|
||||
if (!nondeletable)
|
||||
removeNodeIfNotParent(node);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -306,12 +314,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
if (selection.isCollapsed()) {
|
||||
rng = selection.getRng(true);
|
||||
container = rng.startContainer;
|
||||
offset = rng.startOffset;
|
||||
container = getParentCaretContainer(container) || container;
|
||||
|
||||
if (selection.isCollapsed()) {
|
||||
// Is in noneditable parent
|
||||
if (nonEditableParent = getNonEditableParent(container)) {
|
||||
removeNodeIfNotParent(nonEditableParent);
|
||||
@@ -334,14 +342,79 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Is in noneditable parent
|
||||
if (getNonEditableParent(container)) {
|
||||
nonEditableParent = getNonEditableParent(container);
|
||||
removeNodeIfNotParent(nonEditableParent);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
startElement = selection.getStart()
|
||||
/**
|
||||
* handleDirectionalStroke handles when the user presses a button within a caret container, and
|
||||
* make sure the direction of the cursor or of the deletion is within the
|
||||
* user expectations.
|
||||
*
|
||||
* @param {string} keyCode is the current keycode
|
||||
* @param {object} caretContainer is the caretContainer
|
||||
* @param {string} side left (backspace and left arrow) or right (delete and right arrow)
|
||||
* @param {object} e is the currenlty handled event
|
||||
* @return {null}
|
||||
*/
|
||||
function handleDirectionalStroke(keyCode, caretContainer, e) {
|
||||
var nonEditableParent;
|
||||
var side = (keyCode === VK.LEFT) || (keyCode === VK.BACKSPACE) ? 'left' : 'right';
|
||||
var arrow = side === 'left' ? VK.LEFT : VK.RIGHT;
|
||||
var action = side === 'left' ? VK.BACKSPACE : VK.DELETE;
|
||||
var next = side === 'left' ? true : false;
|
||||
var caret = selection.getRng(true);
|
||||
|
||||
|
||||
if (keyCode === arrow || keyCode === action) {
|
||||
nonEditableParent = getNonEmptyTextNodeSibling(caretContainer, next);
|
||||
|
||||
if (nonEditableParent && getContentEditable(nonEditableParent) === "false") {
|
||||
|
||||
if (keyCode === arrow) {
|
||||
positionCaretOnElement(nonEditableParent, next);
|
||||
}
|
||||
|
||||
if (keyCode === action && (caretContainer.innerHTML === invisibleChar || !tinymce.trim(caretContainer.innerText || caretContainer.textContent)) ) {
|
||||
e.preventDefault();
|
||||
positionCaretOnElement(nonEditableParent, next);
|
||||
if (!nondeletable) {
|
||||
dom.remove(nonEditableParent);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (!nondeletable) {
|
||||
removeCaretContainer(caretContainer);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
startElement = selection.getStart();
|
||||
endElement = selection.getEnd();
|
||||
|
||||
// Disable all key presses in contentEditable=false except delete or backspace
|
||||
nonEditableParent = getNonEditableParent(startElement) || getNonEditableParent(endElement);
|
||||
|
||||
if (nondeletable && !selection.isCollapsed()) {
|
||||
var rng = selection.getRng(true);
|
||||
var rngContents = rng.cloneContents();
|
||||
|
||||
var selectionContainsNonEditable = false;
|
||||
tinymce.walk(rngContents, function(n) {
|
||||
selectionContainsNonEditable = getContentEditable(n) === 'false';
|
||||
return !selectionContainsNonEditable;
|
||||
}, 'childNodes');
|
||||
}
|
||||
|
||||
if (nonEditableParent && (keyCode < 112 || keyCode > 124) && keyCode != VK.DELETE && keyCode != VK.BACKSPACE) {
|
||||
// Is Ctrl+c, Ctrl+v or Ctrl+x then use default browser behavior
|
||||
if ((tinymce.isMac ? e.metaKey : e.ctrlKey) && (keyCode == 67 || keyCode == 88 || keyCode == 86)) {
|
||||
@@ -368,68 +441,42 @@
|
||||
if (keyCode == VK.LEFT || keyCode == VK.RIGHT || keyCode == VK.BACKSPACE || keyCode == VK.DELETE) {
|
||||
caretContainer = getParentCaretContainer(startElement);
|
||||
if (caretContainer) {
|
||||
// Arrow left or backspace
|
||||
if (keyCode == VK.LEFT || keyCode == VK.BACKSPACE) {
|
||||
nonEditableParent = getNonEmptyTextNodeSibling(caretContainer, true);
|
||||
|
||||
if (nonEditableParent && getContentEditable(nonEditableParent) === "false") {
|
||||
e.preventDefault();
|
||||
|
||||
if (keyCode == VK.LEFT) {
|
||||
positionCaretOnElement(nonEditableParent, true);
|
||||
} else {
|
||||
dom.remove(nonEditableParent);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
removeCaretContainer(caretContainer);
|
||||
}
|
||||
}
|
||||
|
||||
// Arrow right or delete
|
||||
if (keyCode == VK.RIGHT || keyCode == VK.DELETE) {
|
||||
nonEditableParent = getNonEmptyTextNodeSibling(caretContainer);
|
||||
|
||||
if (nonEditableParent && getContentEditable(nonEditableParent) === "false") {
|
||||
e.preventDefault();
|
||||
|
||||
if (keyCode == VK.RIGHT) {
|
||||
positionCaretOnElement(nonEditableParent, false);
|
||||
} else {
|
||||
dom.remove(nonEditableParent);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
removeCaretContainer(caretContainer);
|
||||
}
|
||||
}
|
||||
handleDirectionalStroke(keyCode, caretContainer, e);
|
||||
}
|
||||
|
||||
if ((keyCode == VK.BACKSPACE || keyCode == VK.DELETE) && !canDelete(keyCode == VK.BACKSPACE)) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ed.onMouseDown.addToTop(function(ed, e) {
|
||||
var node = ed.selection.getNode();
|
||||
|
||||
if (getContentEditable(node) === "false" && node == e.target) {
|
||||
// Expand selection on mouse down we can't block the default event since it's used for drag/drop
|
||||
moveSelection();
|
||||
if (nondeletable && selectionContainsNonEditable) {
|
||||
var confirmDeleting = confirm(ed.getLang("noneditable.confirm_delete"));
|
||||
if (!confirmDeleting) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ed.onMouseUp.addToTop(moveSelection);
|
||||
ed.onMouseDown.addToTop(moveSelection);
|
||||
ed.onKeyDown.addToTop(handleKey);
|
||||
ed.onKeyUp.addToTop(moveSelection);
|
||||
};
|
||||
|
||||
function getEditClass(ed) {
|
||||
return " " + tinymce.trim(ed.getParam("noneditable_editable_class", "mceEditable")) + " ";
|
||||
}
|
||||
function getNonEditClass(ed) {
|
||||
return " " + tinymce.trim(ed.getParam("noneditable_noneditable_class", "mceNonEditable")) + " ";
|
||||
}
|
||||
|
||||
tinymce.PluginManager.requireLangPack('noneditable');
|
||||
|
||||
tinymce.create('tinymce.plugins.NonEditablePlugin', {
|
||||
init : function(ed, url) {
|
||||
var editClass, nonEditClass, nonEditableRegExps;
|
||||
init : function(ed) {
|
||||
|
||||
// Converts configured regexps to noneditable span items
|
||||
function convertRegExpsToNonEditable(ed, args) {
|
||||
@@ -454,10 +501,10 @@
|
||||
}
|
||||
|
||||
args.content = content;
|
||||
};
|
||||
}
|
||||
|
||||
editClass = " " + tinymce.trim(ed.getParam("noneditable_editable_class", "mceEditable")) + " ";
|
||||
nonEditClass = " " + tinymce.trim(ed.getParam("noneditable_noneditable_class", "mceNonEditable")) + " ";
|
||||
editClass = getEditClass(ed);
|
||||
nonEditClass = getNonEditClass(ed);
|
||||
|
||||
// Setup noneditable regexps array
|
||||
nonEditableRegExps = ed.getParam("noneditable_regexp");
|
||||
@@ -490,7 +537,7 @@
|
||||
});
|
||||
|
||||
// Remove internal name
|
||||
ed.serializer.addAttributeFilter(internalName, function(nodes, name) {
|
||||
ed.serializer.addAttributeFilter(internalName, function(nodes) {
|
||||
var i = nodes.length, node;
|
||||
|
||||
while (i--) {
|
||||
@@ -509,7 +556,7 @@
|
||||
});
|
||||
|
||||
// Convert external name into internal name
|
||||
ed.parser.addAttributeFilter(externalName, function(nodes, name) {
|
||||
ed.parser.addAttributeFilter(externalName, function(nodes) {
|
||||
var i = nodes.length, node;
|
||||
|
||||
while (i--) {
|
||||
|
||||
1
gulliver/js/tinymce/jscripts/tiny_mce/plugins/noneditable/langs/en.js
vendored
Normal file
1
gulliver/js/tinymce/jscripts/tiny_mce/plugins/noneditable/langs/en.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinyMCE.addI18n('en.noneditable',{ confirm_delete : 'The selection contains non-editable text. Are you sure you want to continue?' });
|
||||
File diff suppressed because one or more lines are too long
@@ -413,7 +413,9 @@
|
||||
// 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;
|
||||
h = h.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1");
|
||||
// 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
|
||||
@@ -717,7 +719,7 @@
|
||||
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*/, '');
|
||||
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));
|
||||
|
||||
@@ -14,6 +14,7 @@ var SearchReplaceDialog = {
|
||||
mcTabs.onChange.add(function(tab_id, panel_id) {
|
||||
t.switchMode(tab_id.substring(0, tab_id.indexOf('_')));
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
switchMode : function(m) {
|
||||
@@ -39,6 +40,10 @@ var SearchReplaceDialog = {
|
||||
searchNext : function(a) {
|
||||
var ed = tinyMCEPopup.editor, se = ed.selection, r = se.getRng(), f, m = this.lastMode, s, b, fl = 0, w = ed.getWin(), wm = ed.windowManager, fo = 0;
|
||||
|
||||
function createTextRange() {
|
||||
return ed.getDoc().selection ? ed.getDoc().selection.createRange() : ed.getDoc().body.createTextRange();
|
||||
}
|
||||
|
||||
// Get input
|
||||
f = document.forms[0];
|
||||
s = f[m + '_panel_searchstring'].value;
|
||||
@@ -47,7 +52,7 @@ var SearchReplaceDialog = {
|
||||
rs = f['replace_panel_replacestring'].value;
|
||||
|
||||
if (tinymce.isIE) {
|
||||
r = ed.getDoc().selection.createRange();
|
||||
r = createTextRange();
|
||||
}
|
||||
|
||||
if (s == '')
|
||||
@@ -77,7 +82,7 @@ var SearchReplaceDialog = {
|
||||
|
||||
if (tinymce.isIE) {
|
||||
ed.focus();
|
||||
r = ed.getDoc().selection.createRange();
|
||||
r = createTextRange();
|
||||
|
||||
while (r.findText(s, b ? -1 : 1, fl)) {
|
||||
r.scrollIntoView();
|
||||
@@ -87,6 +92,10 @@ var SearchReplaceDialog = {
|
||||
|
||||
if (b) {
|
||||
r.moveEnd("character", -(rs.length)); // Otherwise will loop forever
|
||||
} else {
|
||||
// to avoid looping for ever in MSIE 9/10 when just
|
||||
// changing the case
|
||||
r.moveStart("character", rs.length);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +130,7 @@ var SearchReplaceDialog = {
|
||||
|
||||
if (tinymce.isIE) {
|
||||
ed.focus();
|
||||
r = ed.getDoc().selection.createRange();
|
||||
r = createTextRange();
|
||||
|
||||
if (r.findText(s, b ? -1 : 1, fl)) {
|
||||
r.scrollIntoView();
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -126,6 +126,7 @@
|
||||
|
||||
c.onRenderMenu.add(function(c, m) {
|
||||
m.add({title : 'spellchecker.langs', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
|
||||
t.menuItems = {};
|
||||
each(t.languages, function(v, k) {
|
||||
var o = {icon : 1}, mi;
|
||||
|
||||
@@ -133,27 +134,60 @@
|
||||
if (v == t.selectedLang) {
|
||||
return;
|
||||
}
|
||||
mi.setSelected(1);
|
||||
t.selectedItem.setSelected(0);
|
||||
t.selectedItem = mi;
|
||||
t._updateMenu(mi);
|
||||
t.selectedLang = v;
|
||||
};
|
||||
|
||||
o.title = k;
|
||||
mi = m.add(o);
|
||||
mi.setSelected(v == t.selectedLang);
|
||||
|
||||
t.menuItems[v] = mi;
|
||||
if (v == t.selectedLang)
|
||||
t.selectedItem = mi;
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
return c;
|
||||
}
|
||||
},
|
||||
|
||||
setLanguage: function(lang) {
|
||||
var t = this;
|
||||
|
||||
if (lang == t.selectedLang) {
|
||||
// allowed
|
||||
return;
|
||||
}
|
||||
|
||||
if (tinymce.grep(t.languages, function(v) { return v === lang; }).length === 0) {
|
||||
throw "Unknown language: " + lang;
|
||||
}
|
||||
|
||||
t.selectedLang = lang;
|
||||
|
||||
// if the menu has been shown, update it as well
|
||||
if (t.menuItems) {
|
||||
t._updateMenu(t.menuItems[lang]);
|
||||
}
|
||||
|
||||
if (t.active) {
|
||||
// clear error in the old language.
|
||||
t._done();
|
||||
|
||||
// Don't immediately block the UI to check spelling in the new language, this is an API not a user action.
|
||||
}
|
||||
},
|
||||
|
||||
// Internal functions
|
||||
|
||||
_updateMenu: function(mi) {
|
||||
mi.setSelected(1);
|
||||
this.selectedItem.setSelected(0);
|
||||
this.selectedItem = mi;
|
||||
},
|
||||
|
||||
_walk : function(n, f) {
|
||||
var d = this.editor.getDoc(), w;
|
||||
|
||||
@@ -235,6 +269,7 @@
|
||||
each(nl, function(n) {
|
||||
var node, elem, txt, pos, v = n.nodeValue;
|
||||
|
||||
rx.lastIndex = 0;
|
||||
if (rx.test(v)) {
|
||||
// Encode the content
|
||||
v = dom.encode(v);
|
||||
|
||||
@@ -76,7 +76,6 @@
|
||||
<td><label for="height">{#table_dlg.height}</label></td>
|
||||
<td><input id="height" name="height" type="text" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>
|
||||
</tr>
|
||||
|
||||
<tr id="styleSelectRow">
|
||||
<td><label for="class">{#class_name}</label></td>
|
||||
<td colspan="3">
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#action {
|
||||
margin-bottom: 3px;
|
||||
margin-up: 3px;
|
||||
}
|
||||
|
||||
#class {
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#action {
|
||||
margin-bottom: 3px;
|
||||
margin-up: 3px;
|
||||
}
|
||||
|
||||
#rowtype,#align,#valign,#class,#height {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -7,7 +7,7 @@
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
/* jshint loopfunc: true */
|
||||
(function(tinymce) {
|
||||
var each = tinymce.each;
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
elm.appendChild(rng2.cloneContents());
|
||||
|
||||
// Check for text characters of other elements that should be treated as content
|
||||
return elm.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi, '-').replace(/<[^>]+>/g, '').length == 0;
|
||||
};
|
||||
return elm.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi, '-').replace(/<[^>]+>/g, '').length === 0;
|
||||
}
|
||||
|
||||
function getSpanVal(td, name) {
|
||||
return parseInt(td.getAttribute(name) || 1);
|
||||
return parseInt(td.getAttribute(name) || 1, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,14 +35,6 @@
|
||||
function TableGrid(table, dom, selection) {
|
||||
var grid, startPos, endPos, selectedCell;
|
||||
|
||||
buildGrid();
|
||||
selectedCell = dom.getParent(selection.getStart(), 'th,td');
|
||||
if (selectedCell) {
|
||||
startPos = getPos(selectedCell);
|
||||
endPos = findEndPos();
|
||||
selectedCell = getCell(startPos.x, startPos.y);
|
||||
}
|
||||
|
||||
function cloneNode(node, children) {
|
||||
node = node.cloneNode(children);
|
||||
node.removeAttribute('id');
|
||||
@@ -66,9 +58,10 @@
|
||||
|
||||
// Skip over existing cells produced by rowspan
|
||||
if (grid[y]) {
|
||||
while (grid[y][x])
|
||||
while (grid[y][x]) {
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
// Get col/rowspan from cell
|
||||
rowspan = getSpanVal(td, 'rowspan');
|
||||
@@ -76,8 +69,9 @@
|
||||
|
||||
// Fill out rowspan/colspan right and down
|
||||
for (y2 = y; y2 < y + rowspan; y2++) {
|
||||
if (!grid[y2])
|
||||
if (!grid[y2]) {
|
||||
grid[y2] = [];
|
||||
}
|
||||
|
||||
for (x2 = x; x2 < x + colspan; x2++) {
|
||||
grid[y2][x2] = {
|
||||
@@ -94,30 +88,32 @@
|
||||
|
||||
startY += rows.length;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function getCell(x, y) {
|
||||
var row;
|
||||
|
||||
row = grid[y];
|
||||
if (row)
|
||||
if (row) {
|
||||
return row[x];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function setSpanVal(td, name, val) {
|
||||
if (td) {
|
||||
val = parseInt(val);
|
||||
val = parseInt(val, 10);
|
||||
|
||||
if (val === 1)
|
||||
if (val === 1) {
|
||||
td.removeAttribute(name, 1);
|
||||
else
|
||||
} else {
|
||||
td.setAttribute(name, val, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isCellSelected(cell) {
|
||||
return cell && (dom.hasClass(cell.elm, 'mceSelected') || cell == selectedCell);
|
||||
};
|
||||
}
|
||||
|
||||
function getSelectedRows() {
|
||||
var rows = [];
|
||||
@@ -132,7 +128,7 @@
|
||||
});
|
||||
|
||||
return rows;
|
||||
};
|
||||
}
|
||||
|
||||
function deleteTable() {
|
||||
var rng = dom.createRng();
|
||||
@@ -143,7 +139,7 @@
|
||||
selection.setRng(rng);
|
||||
|
||||
dom.remove(table);
|
||||
};
|
||||
}
|
||||
|
||||
function cloneCell(cell) {
|
||||
var formatNode;
|
||||
@@ -156,17 +152,19 @@
|
||||
each(dom.getParents(node.parentNode, null, cell).reverse(), function(node) {
|
||||
node = cloneNode(node, false);
|
||||
|
||||
if (!formatNode)
|
||||
if (!formatNode) {
|
||||
formatNode = curNode = node;
|
||||
else if (curNode)
|
||||
} else if (curNode) {
|
||||
curNode.appendChild(node);
|
||||
}
|
||||
|
||||
curNode = node;
|
||||
});
|
||||
|
||||
// Add something to the inner node
|
||||
if (curNode)
|
||||
curNode.innerHTML = tinymce.isIE ? ' ' : '<br data-mce-bogus="1" />';
|
||||
if (curNode) {
|
||||
curNode.innerHTML = tinymce.isIE && !tinymce.isIE11 ? ' ' : '<br data-mce-bogus="1" />';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -179,24 +177,26 @@
|
||||
if (formatNode) {
|
||||
cell.appendChild(formatNode);
|
||||
} else {
|
||||
if (!tinymce.isIE)
|
||||
if (!tinymce.isIE || tinymce.isIE11) {
|
||||
cell.innerHTML = '<br data-mce-bogus="1" />';
|
||||
}
|
||||
}
|
||||
|
||||
return cell;
|
||||
};
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
var rng = dom.createRng();
|
||||
var rng = dom.createRng(), row;
|
||||
|
||||
// Empty rows
|
||||
each(dom.select('tr', table), function(tr) {
|
||||
if (tr.cells.length == 0)
|
||||
if (tr.cells.length === 0) {
|
||||
dom.remove(tr);
|
||||
}
|
||||
});
|
||||
|
||||
// Empty table
|
||||
if (dom.select('tr', table).length == 0) {
|
||||
if (dom.select('tr', table).length === 0) {
|
||||
rng.setStartAfter(table);
|
||||
rng.setEndAfter(table);
|
||||
selection.setRng(rng);
|
||||
@@ -206,8 +206,9 @@
|
||||
|
||||
// Empty header/body/footer
|
||||
each(dom.select('thead,tbody,tfoot', table), function(part) {
|
||||
if (part.rows.length == 0)
|
||||
if (part.rows.length === 0) {
|
||||
dom.remove(part);
|
||||
}
|
||||
});
|
||||
|
||||
// Restore selection to start position if it still exists
|
||||
@@ -219,7 +220,7 @@
|
||||
selection.select(row[Math.min(row.length - 1, startPos.x)].elm, true);
|
||||
selection.collapse(true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function fillLeftDown(x, y, rows, cols) {
|
||||
var tr, x2, r, c, cell;
|
||||
@@ -235,8 +236,9 @@
|
||||
|
||||
if (cell.parentNode == tr) {
|
||||
// Append clones after
|
||||
for (c = 1; c <= cols; c++)
|
||||
for (c = 1; c <= cols; c++) {
|
||||
dom.insertAfter(cloneCell(cell), cell);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -244,17 +246,18 @@
|
||||
|
||||
if (x2 == -1) {
|
||||
// Insert nodes before first cell
|
||||
for (c = 1; c <= cols; c++)
|
||||
for (c = 1; c <= cols; c++) {
|
||||
tr.insertBefore(cloneCell(tr.cells[0]), tr.cells[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function split() {
|
||||
each(grid, function(row, y) {
|
||||
each(row, function(cell, x) {
|
||||
var colSpan, rowSpan, newCell, i;
|
||||
var colSpan, rowSpan, i;
|
||||
|
||||
if (isCellSelected(cell)) {
|
||||
cell = cell.elm;
|
||||
@@ -266,18 +269,19 @@
|
||||
setSpanVal(cell, 'colSpan', 1);
|
||||
|
||||
// Insert cells right
|
||||
for (i = 0; i < colSpan - 1; i++)
|
||||
for (i = 0; i < colSpan - 1; i++) {
|
||||
dom.insertAfter(cloneCell(cell), cell);
|
||||
}
|
||||
|
||||
fillLeftDown(x, y, rowSpan - 1, colSpan);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function merge(cell, cols, rows) {
|
||||
var startX, startY, endX, endY, x, y, startCell, endCell, cell, children, count;
|
||||
var startX, startY, endX, endY, x, y, startCell, endCell, children, count, pos;
|
||||
|
||||
// Use specified cell and cols/rows
|
||||
if (cell) {
|
||||
@@ -327,8 +331,9 @@
|
||||
// Remove other cells and add it's contents to the start cell
|
||||
for (y = startY; y <= endY; y++) {
|
||||
for (x = startX; x <= endX; x++) {
|
||||
if (!grid[y] || !grid[y][x])
|
||||
if (!grid[y] || !grid[y][x]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
cell = grid[y][x].elm;
|
||||
|
||||
@@ -344,8 +349,9 @@
|
||||
children = tinymce.grep(startCell.childNodes);
|
||||
count = 0;
|
||||
each(children, function(node) {
|
||||
if (node.nodeName == 'BR' && dom.getAttrib(node, 'data-mce-bogus') && count++ < children.length - 1)
|
||||
if (node.nodeName == 'BR' && dom.getAttrib(node, 'data-mce-bogus') && count++ < children.length - 1) {
|
||||
startCell.removeChild(node);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -358,33 +364,36 @@
|
||||
// Remove empty rows etc and restore caret location
|
||||
cleanup();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function insertRow(before) {
|
||||
var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell, rowSpan;
|
||||
|
||||
// Find first/last row
|
||||
each(grid, function(row, y) {
|
||||
each(row, function(cell, x) {
|
||||
each(row, function(cell) {
|
||||
if (isCellSelected(cell)) {
|
||||
cell = cell.elm;
|
||||
rowElm = cell.parentNode;
|
||||
newRow = cloneNode(rowElm, false);
|
||||
posY = y;
|
||||
|
||||
if (before)
|
||||
if (before) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (before)
|
||||
if (before) {
|
||||
return !posY;
|
||||
}
|
||||
});
|
||||
|
||||
for (x = 0; x < grid[0].length; x++) {
|
||||
// Cell not found could be because of an invalid table structure
|
||||
if (!grid[posY][x])
|
||||
if (!grid[posY][x]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
cell = grid[posY][x].elm;
|
||||
|
||||
@@ -418,36 +427,40 @@
|
||||
}
|
||||
|
||||
if (newRow.hasChildNodes()) {
|
||||
if (!before)
|
||||
if (!before) {
|
||||
dom.insertAfter(newRow, rowElm);
|
||||
else
|
||||
} else {
|
||||
rowElm.parentNode.insertBefore(newRow, rowElm);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function insertCol(before) {
|
||||
var posX, lastCell;
|
||||
|
||||
// Find first/last column
|
||||
each(grid, function(row, y) {
|
||||
each(grid, function(row) {
|
||||
each(row, function(cell, x) {
|
||||
if (isCellSelected(cell)) {
|
||||
posX = x;
|
||||
|
||||
if (before)
|
||||
if (before) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (before)
|
||||
if (before) {
|
||||
return !posX;
|
||||
}
|
||||
});
|
||||
|
||||
each(grid, function(row, y) {
|
||||
var cell, rowSpan, colSpan;
|
||||
|
||||
if (!row[posX])
|
||||
if (!row[posX]) {
|
||||
return;
|
||||
}
|
||||
|
||||
cell = row[posX].elm;
|
||||
if (cell != lastCell) {
|
||||
@@ -462,19 +475,20 @@
|
||||
cell.parentNode.insertBefore(cloneCell(cell), cell);
|
||||
fillLeftDown(posX, y, rowSpan - 1, colSpan);
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
setSpanVal(cell, 'colSpan', cell.colSpan + 1);
|
||||
}
|
||||
|
||||
lastCell = cell;
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function deleteCols() {
|
||||
var cols = [];
|
||||
|
||||
// Get selected column indexes
|
||||
each(grid, function(row, y) {
|
||||
each(grid, function(row) {
|
||||
each(row, function(cell, x) {
|
||||
if (isCellSelected(cell) && tinymce.inArray(cols, x) === -1) {
|
||||
each(grid, function(row) {
|
||||
@@ -482,10 +496,11 @@
|
||||
|
||||
colSpan = getSpanVal(cell, 'colSpan');
|
||||
|
||||
if (colSpan > 1)
|
||||
if (colSpan > 1) {
|
||||
setSpanVal(cell, 'colSpan', colSpan - 1);
|
||||
else
|
||||
} else {
|
||||
dom.remove(cell);
|
||||
}
|
||||
});
|
||||
|
||||
cols.push(x);
|
||||
@@ -494,15 +509,15 @@
|
||||
});
|
||||
|
||||
cleanup();
|
||||
};
|
||||
}
|
||||
|
||||
function deleteRows() {
|
||||
var rows;
|
||||
|
||||
function deleteRow(tr) {
|
||||
var nextTr, pos, lastCell;
|
||||
var pos, lastCell;
|
||||
|
||||
nextTr = dom.getNext(tr, 'tr');
|
||||
// nextTr = dom.getNext(tr, 'tr');
|
||||
|
||||
// Move down row spanned cells
|
||||
each(tr.cells, function(cell) {
|
||||
@@ -525,15 +540,16 @@
|
||||
if (cell != lastCell) {
|
||||
rowSpan = getSpanVal(cell, 'rowSpan');
|
||||
|
||||
if (rowSpan <= 1)
|
||||
if (rowSpan <= 1) {
|
||||
dom.remove(cell);
|
||||
else
|
||||
} else {
|
||||
setSpanVal(cell, 'rowSpan', rowSpan - 1);
|
||||
}
|
||||
|
||||
lastCell = cell;
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// Get selected rows and move selection out of scope
|
||||
rows = getSelectedRows();
|
||||
@@ -544,7 +560,7 @@
|
||||
});
|
||||
|
||||
cleanup();
|
||||
};
|
||||
}
|
||||
|
||||
function cutRows() {
|
||||
var rows = getSelectedRows();
|
||||
@@ -553,7 +569,7 @@
|
||||
cleanup();
|
||||
|
||||
return rows;
|
||||
};
|
||||
}
|
||||
|
||||
function copyRows() {
|
||||
var rows = getSelectedRows();
|
||||
@@ -563,9 +579,14 @@
|
||||
});
|
||||
|
||||
return rows;
|
||||
};
|
||||
}
|
||||
|
||||
function pasteRows(rows, before) {
|
||||
// If we don't have any rows in the clipboard, return immediately
|
||||
if (!rows) {
|
||||
return;
|
||||
}
|
||||
|
||||
var selectedRows = getSelectedRows(),
|
||||
targetRow = selectedRows[before ? 0 : selectedRows.length - 1],
|
||||
targetCellCount = targetRow.cells.length;
|
||||
@@ -575,23 +596,27 @@
|
||||
var match;
|
||||
|
||||
targetCellCount = 0;
|
||||
each(row, function(cell, x) {
|
||||
if (cell.real)
|
||||
each(row, function(cell) {
|
||||
if (cell.real) {
|
||||
targetCellCount += cell.colspan;
|
||||
}
|
||||
|
||||
if (cell.elm.parentNode == targetRow)
|
||||
if (cell.elm.parentNode == targetRow) {
|
||||
match = 1;
|
||||
}
|
||||
});
|
||||
|
||||
if (match)
|
||||
if (match) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if (!before)
|
||||
if (!before) {
|
||||
rows.reverse();
|
||||
}
|
||||
|
||||
each(rows, function(row) {
|
||||
var cellCount = row.cells.length, cell;
|
||||
var cellCount = row.cells.length, cell, i;
|
||||
|
||||
// Remove col/rowspans
|
||||
for (i = 0; i < cellCount; i++) {
|
||||
@@ -601,23 +626,26 @@
|
||||
}
|
||||
|
||||
// Needs more cells
|
||||
for (i = cellCount; i < targetCellCount; i++)
|
||||
for (i = cellCount; i < targetCellCount; i++) {
|
||||
row.appendChild(cloneCell(row.cells[cellCount - 1]));
|
||||
}
|
||||
|
||||
// Needs less cells
|
||||
for (i = targetCellCount; i < cellCount; i++)
|
||||
for (i = targetCellCount; i < cellCount; i++) {
|
||||
dom.remove(row.cells[i]);
|
||||
}
|
||||
|
||||
// Add before/after
|
||||
if (before)
|
||||
if (before) {
|
||||
targetRow.parentNode.insertBefore(row, targetRow);
|
||||
else
|
||||
} else {
|
||||
dom.insertAfter(row, targetRow);
|
||||
}
|
||||
});
|
||||
|
||||
// Remove current selection
|
||||
dom.removeClass(dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
|
||||
};
|
||||
}
|
||||
|
||||
function getPos(target) {
|
||||
var pos;
|
||||
@@ -634,14 +662,14 @@
|
||||
});
|
||||
|
||||
return pos;
|
||||
};
|
||||
}
|
||||
|
||||
function setStartCell(cell) {
|
||||
startPos = getPos(cell);
|
||||
};
|
||||
}
|
||||
|
||||
function findEndPos() {
|
||||
var pos, maxX, maxY;
|
||||
var maxX, maxY;
|
||||
|
||||
maxX = maxY = 0;
|
||||
|
||||
@@ -652,35 +680,39 @@
|
||||
if (isCellSelected(cell)) {
|
||||
cell = grid[y][x];
|
||||
|
||||
if (x > maxX)
|
||||
if (x > maxX) {
|
||||
maxX = x;
|
||||
}
|
||||
|
||||
if (y > maxY)
|
||||
if (y > maxY) {
|
||||
maxY = y;
|
||||
}
|
||||
|
||||
if (cell.real) {
|
||||
colSpan = cell.colspan - 1;
|
||||
rowSpan = cell.rowspan - 1;
|
||||
|
||||
if (colSpan) {
|
||||
if (x + colSpan > maxX)
|
||||
if (x + colSpan > maxX) {
|
||||
maxX = x + colSpan;
|
||||
}
|
||||
}
|
||||
|
||||
if (rowSpan) {
|
||||
if (y + rowSpan > maxY)
|
||||
if (y + rowSpan > maxY) {
|
||||
maxY = y + rowSpan;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return {x : maxX, y : maxY};
|
||||
};
|
||||
}
|
||||
|
||||
function setEndCell(cell) {
|
||||
var startX, startY, endX, endY, maxX, maxY, colSpan, rowSpan;
|
||||
var startX, startY, endX, endY, maxX, maxY, colSpan, rowSpan, y, x;
|
||||
|
||||
endPos = getPos(cell);
|
||||
|
||||
@@ -700,20 +732,22 @@
|
||||
cell = grid[y][startX];
|
||||
|
||||
if (!cell.real) {
|
||||
if (startX - (cell.colspan - 1) < startX)
|
||||
if (startX - (cell.colspan - 1) < startX) {
|
||||
startX -= cell.colspan - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Expand startY
|
||||
for (x = startX; x <= maxX; x++) {
|
||||
cell = grid[startY][x];
|
||||
|
||||
if (!cell.real) {
|
||||
if (startY - (cell.rowspan - 1) < startY)
|
||||
if (startY - (cell.rowspan - 1) < startY) {
|
||||
startY -= cell.rowspan - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find max X, Y
|
||||
for (y = startY; y <= endY; y++) {
|
||||
@@ -725,17 +759,19 @@
|
||||
rowSpan = cell.rowspan - 1;
|
||||
|
||||
if (colSpan) {
|
||||
if (x + colSpan > maxX)
|
||||
if (x + colSpan > maxX) {
|
||||
maxX = x + colSpan;
|
||||
}
|
||||
}
|
||||
|
||||
if (rowSpan) {
|
||||
if (y + rowSpan > maxY)
|
||||
if (y + rowSpan > maxY) {
|
||||
maxY = y + rowSpan;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove current selection
|
||||
dom.removeClass(dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
|
||||
@@ -743,12 +779,21 @@
|
||||
// Add new selection
|
||||
for (y = startY; y <= maxY; y++) {
|
||||
for (x = startX; x <= maxX; x++) {
|
||||
if (grid[y][x])
|
||||
if (grid[y][x]) {
|
||||
dom.addClass(grid[y][x].elm, 'mceSelected');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
buildGrid();
|
||||
selectedCell = dom.getParent(selection.getStart(), 'th,td');
|
||||
if (selectedCell) {
|
||||
startPos = getPos(selectedCell);
|
||||
endPos = findEndPos();
|
||||
selectedCell = getCell(startPos.x, startPos.y);
|
||||
}
|
||||
|
||||
// Expose to public
|
||||
tinymce.extend(this, {
|
||||
@@ -766,7 +811,7 @@
|
||||
setStartCell : setStartCell,
|
||||
setEndCell : setEndCell
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
tinymce.create('tinymce.plugins.TablePlugin', {
|
||||
init : function(ed, url) {
|
||||
@@ -775,9 +820,10 @@
|
||||
function createTableGrid(node) {
|
||||
var selection = ed.selection, tblElm = ed.dom.getParent(node || selection.getNode(), 'table');
|
||||
|
||||
if (tblElm)
|
||||
if (tblElm) {
|
||||
return new TableGrid(tblElm, ed.dom, selection);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
// Restore selection possibilities
|
||||
@@ -787,7 +833,7 @@
|
||||
ed.dom.removeClass(ed.dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
|
||||
hasCellSelection = false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Register buttons
|
||||
each([
|
||||
@@ -849,8 +895,9 @@
|
||||
cm.setActive('table', n.nodeName === 'TABLE' || !!p);
|
||||
|
||||
// Disable table tools if we are in caption
|
||||
if (p && p.nodeName === 'CAPTION')
|
||||
if (p && p.nodeName === 'CAPTION') {
|
||||
p = 0;
|
||||
}
|
||||
|
||||
cm.setDisabled('delete_table', !p);
|
||||
cm.setDisabled('delete_col', !p);
|
||||
@@ -902,10 +949,11 @@
|
||||
sel = ed.selection.getSel();
|
||||
|
||||
try {
|
||||
if (sel.removeAllRanges)
|
||||
if (sel.removeAllRanges) {
|
||||
sel.removeAllRanges();
|
||||
else
|
||||
} else {
|
||||
sel.empty();
|
||||
}
|
||||
} catch (ex) {
|
||||
// IE9 might throw errors here
|
||||
}
|
||||
@@ -914,38 +962,41 @@
|
||||
}
|
||||
});
|
||||
|
||||
ed.onMouseUp.add(function(ed, e) {
|
||||
var rng, sel = ed.selection, selectedCells, nativeSel = sel.getSel(), walker, node, lastNode, endNode;
|
||||
|
||||
// Move selection to startCell
|
||||
if (startCell) {
|
||||
if (tableGrid)
|
||||
ed.getBody().style.webkitUserSelect = '';
|
||||
ed.onMouseUp.add(function(ed) {
|
||||
var rng, sel = ed.selection, selectedCells, walker, node, lastNode;
|
||||
|
||||
function setPoint(node, start) {
|
||||
var walker = new tinymce.dom.TreeWalker(node, node);
|
||||
|
||||
do {
|
||||
// Text node
|
||||
if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length != 0) {
|
||||
if (start)
|
||||
if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length !== 0) {
|
||||
if (start) {
|
||||
rng.setStart(node, 0);
|
||||
else
|
||||
} else {
|
||||
rng.setEnd(node, node.nodeValue.length);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// BR element
|
||||
if (node.nodeName == 'BR') {
|
||||
if (start)
|
||||
if (start) {
|
||||
rng.setStartBefore(node);
|
||||
else
|
||||
} else {
|
||||
rng.setEndBefore(node);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
} while (node = (start ? walker.next() : walker.prev()));
|
||||
node = (start ? walker.next() : walker.prev());
|
||||
} while (node);
|
||||
}
|
||||
// Move selection to startCell
|
||||
if (startCell) {
|
||||
if (tableGrid) {
|
||||
ed.getBody().style.webkitUserSelect = '';
|
||||
}
|
||||
|
||||
// Try to expand text selection as much as we can only Gecko supports cell selection
|
||||
@@ -953,7 +1004,7 @@
|
||||
if (selectedCells.length > 0) {
|
||||
rng = dom.createRng();
|
||||
node = selectedCells[0];
|
||||
endNode = selectedCells[selectedCells.length - 1];
|
||||
// endNode = selectedCells[selectedCells.length - 1];
|
||||
rng.setStartBefore(node);
|
||||
rng.setEndAfter(node);
|
||||
|
||||
@@ -962,12 +1013,14 @@
|
||||
|
||||
do {
|
||||
if (node.nodeName == 'TD' || node.nodeName == 'TH') {
|
||||
if (!dom.hasClass(node, 'mceSelected'))
|
||||
if (!dom.hasClass(node, 'mceSelected')) {
|
||||
break;
|
||||
}
|
||||
|
||||
lastNode = node;
|
||||
}
|
||||
} while (node = walker.next());
|
||||
node = walker.next();
|
||||
} while (node);
|
||||
|
||||
setPoint(lastNode);
|
||||
|
||||
@@ -979,15 +1032,15 @@
|
||||
}
|
||||
});
|
||||
|
||||
ed.onKeyUp.add(function(ed, e) {
|
||||
ed.onKeyUp.add(function() {
|
||||
cleanup();
|
||||
});
|
||||
|
||||
ed.onKeyDown.add(function (ed, e) {
|
||||
ed.onKeyDown.add(function(ed) {
|
||||
fixTableCellSelection(ed);
|
||||
});
|
||||
|
||||
ed.onMouseDown.add(function (ed, e) {
|
||||
ed.onMouseDown.add(function(ed, e) {
|
||||
if (e.button != 2) {
|
||||
fixTableCellSelection(ed);
|
||||
}
|
||||
@@ -999,43 +1052,48 @@
|
||||
// or the parent of the table (in the case of the selection containing the last cell of a table).
|
||||
var TEXT_NODE = 3, table = ed.dom.getParent(rng.startContainer, 'TABLE'),
|
||||
tableParent, allOfCellSelected, tableCellSelection;
|
||||
if (table)
|
||||
if (table) {
|
||||
tableParent = table.parentNode;
|
||||
allOfCellSelected =rng.startContainer.nodeType == TEXT_NODE &&
|
||||
rng.startOffset == 0 &&
|
||||
rng.endOffset == 0 &&
|
||||
}
|
||||
allOfCellSelected = rng.startContainer.nodeType == TEXT_NODE &&
|
||||
rng.startOffset === 0 &&
|
||||
rng.endOffset === 0 &&
|
||||
currentCell &&
|
||||
(n.nodeName=="TR" || n==tableParent);
|
||||
tableCellSelection = (n.nodeName=="TD"||n.nodeName=="TH")&& !currentCell;
|
||||
(n.nodeName === "TR" || n === tableParent);
|
||||
tableCellSelection = (n.nodeName === "TD" || n.nodeName === "TH") && !currentCell;
|
||||
return allOfCellSelected || tableCellSelection;
|
||||
// return false;
|
||||
}
|
||||
|
||||
// this nasty hack is here to work around some WebKit selection bugs.
|
||||
function fixTableCellSelection(ed) {
|
||||
if (!tinymce.isWebKit)
|
||||
if (!tinymce.isWebKit) {
|
||||
return;
|
||||
}
|
||||
|
||||
var rng = ed.selection.getRng();
|
||||
var n = ed.selection.getNode();
|
||||
var currentCell = ed.dom.getParent(rng.startContainer, 'TD,TH');
|
||||
|
||||
if (!tableCellSelected(ed, rng, n, currentCell))
|
||||
if (!tableCellSelected(ed, rng, n, currentCell)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!currentCell) {
|
||||
currentCell=n;
|
||||
currentCell = n;
|
||||
}
|
||||
|
||||
// Get the very last node inside the table cell
|
||||
var end = currentCell.lastChild;
|
||||
while (end.lastChild)
|
||||
while (end.lastChild) {
|
||||
end = end.lastChild;
|
||||
}
|
||||
|
||||
// Select the entire table cell. Nothing outside of the table cell should be selected.
|
||||
rng.setEnd(end, end.nodeValue.length);
|
||||
ed.selection.setRng(rng);
|
||||
}
|
||||
ed.plugins.table.fixTableCellSelection=fixTableCellSelection;
|
||||
ed.plugins.table.fixTableCellSelection = fixTableCellSelection;
|
||||
|
||||
// Add context menu
|
||||
if (ed && ed.plugins.contextmenu) {
|
||||
@@ -1084,13 +1142,13 @@
|
||||
sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'});
|
||||
sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'});
|
||||
sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'});
|
||||
} else
|
||||
} else {
|
||||
m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable'});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Fix to allow navigating up and down in a table in WebKit browsers.
|
||||
if (tinymce.isWebKit) {
|
||||
function moveSelection(ed, e) {
|
||||
var VK = tinymce.VK;
|
||||
var key = e.keyCode;
|
||||
@@ -1139,7 +1197,9 @@
|
||||
|
||||
function moveToRowInTarget(upBool, targetParent, sourceNode, event) {
|
||||
var targetRow = getChildForDirection(targetParent, upBool);
|
||||
targetRow && moveCursorToRow(ed, sourceNode, targetRow, upBool);
|
||||
if (targetRow) {
|
||||
moveCursorToRow(ed, sourceNode, targetRow, upBool);
|
||||
}
|
||||
tinymce.dom.Event.cancel(event);
|
||||
return true;
|
||||
}
|
||||
@@ -1197,8 +1257,9 @@
|
||||
each(rowElement.children, function(cell, i) {
|
||||
c = c + getSpanVal(cell, "colspan");
|
||||
r = i;
|
||||
if (c > columnIndex)
|
||||
if (c > columnIndex) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return r;
|
||||
}
|
||||
@@ -1215,7 +1276,7 @@
|
||||
var newNode = ed.selection.getNode();
|
||||
var newParent = ed.dom.getParent(newNode, 'td,th');
|
||||
var oldParent = ed.dom.getParent(preBrowserNode, 'td,th');
|
||||
return newParent && newParent !== oldParent && checkSameParentTable(newParent, oldParent)
|
||||
return newParent && newParent !== oldParent && checkSameParentTable(newParent, oldParent);
|
||||
}
|
||||
|
||||
function checkSameParentTable(nodeOne, NodeTwo) {
|
||||
@@ -1231,7 +1292,7 @@
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (tinymce.isWebKit) {
|
||||
ed.onKeyDown.add(moveSelection);
|
||||
}
|
||||
|
||||
@@ -1241,15 +1302,19 @@
|
||||
var last;
|
||||
|
||||
// Skip empty text nodes form the end
|
||||
for (last = ed.getBody().lastChild; last && last.nodeType == 3 && !last.nodeValue.length; last = last.previousSibling) ;
|
||||
last = ed.getBody().lastChild;
|
||||
while (last && last.nodeType == 3 && !last.nodeValue.length) {
|
||||
last = last.previousSibling;
|
||||
}
|
||||
|
||||
if (last && last.nodeName == 'TABLE') {
|
||||
if (ed.settings.forced_root_block)
|
||||
ed.dom.add(ed.getBody(), ed.settings.forced_root_block, null, tinymce.isIE ? ' ' : '<br data-mce-bogus="1" />');
|
||||
else
|
||||
if (last && last.nodeName === 'TABLE') {
|
||||
if (ed.settings.forced_root_block) {
|
||||
ed.dom.add(ed.getBody(), ed.settings.forced_root_block, null, tinymce.isIE && !tinymce.isIE11 ? ' ' : '<br data-mce-bogus="1" />');
|
||||
} else {
|
||||
ed.dom.add(ed.getBody(), 'br', {'data-mce-bogus': '1'});
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Fixes an bug where it's impossible to place the caret before a table in Gecko
|
||||
// this fix solves it by detecting when the caret is at the beginning of such a table
|
||||
@@ -1291,7 +1356,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Fixes bug in Gecko where shift-enter in table cell does not place caret on new line
|
||||
*
|
||||
@@ -1334,8 +1398,8 @@
|
||||
if (!ed.dom.select('td.mceSelected,th.mceSelected').length) {
|
||||
winMan.open({
|
||||
url : url + '/merge_cells.htm',
|
||||
width : 240 + parseInt(ed.getLang('table.merge_cells_delta_width', 0)),
|
||||
height : 110 + parseInt(ed.getLang('table.merge_cells_delta_height', 0)),
|
||||
width : 240 + parseInt(ed.getLang('table.merge_cells_delta_width', 0), 10),
|
||||
height : 110 + parseInt(ed.getLang('table.merge_cells_delta_height', 0), 10),
|
||||
inline : 1
|
||||
}, {
|
||||
rows : rowSpan,
|
||||
@@ -1345,8 +1409,9 @@
|
||||
},
|
||||
plugin_url : url
|
||||
});
|
||||
} else
|
||||
} else {
|
||||
grid.merge();
|
||||
}
|
||||
},
|
||||
|
||||
mceTableInsertRowBefore : function(grid) {
|
||||
@@ -1409,8 +1474,8 @@
|
||||
mceInsertTable : function(val) {
|
||||
winMan.open({
|
||||
url : url + '/table.htm',
|
||||
width : 400 + parseInt(ed.getLang('table.table_delta_width', 0)),
|
||||
height : 320 + parseInt(ed.getLang('table.table_delta_height', 0)),
|
||||
width : 400 + parseInt(ed.getLang('table.table_delta_width', 0), 10),
|
||||
height : 320 + parseInt(ed.getLang('table.table_delta_height', 0), 10),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url,
|
||||
@@ -1421,8 +1486,8 @@
|
||||
mceTableRowProps : function() {
|
||||
winMan.open({
|
||||
url : url + '/row.htm',
|
||||
width : 400 + parseInt(ed.getLang('table.rowprops_delta_width', 0)),
|
||||
height : 295 + parseInt(ed.getLang('table.rowprops_delta_height', 0)),
|
||||
width : 400 + parseInt(ed.getLang('table.rowprops_delta_width', 0), 10),
|
||||
height : 295 + parseInt(ed.getLang('table.rowprops_delta_height', 0), 10),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
@@ -1432,8 +1497,8 @@
|
||||
mceTableCellProps : function() {
|
||||
winMan.open({
|
||||
url : url + '/cell.htm',
|
||||
width : 400 + parseInt(ed.getLang('table.cellprops_delta_width', 0)),
|
||||
height : 295 + parseInt(ed.getLang('table.cellprops_delta_height', 0)),
|
||||
width : 400 + parseInt(ed.getLang('table.cellprops_delta_width', 0), 10),
|
||||
height : 295 + parseInt(ed.getLang('table.cellprops_delta_height', 0), 10),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
|
||||
@@ -17,8 +17,8 @@ function init() {
|
||||
|
||||
// Get table cell data
|
||||
var celltype = tdElm.nodeName.toLowerCase();
|
||||
var align = ed.dom.getAttrib(tdElm, 'align');
|
||||
var valign = ed.dom.getAttrib(tdElm, 'valign');
|
||||
var align = ed.dom.getAttrib(tdElm, 'align') || getStyle(tdElm, 'text-align');
|
||||
var valign = ed.dom.getAttrib(tdElm, 'valign') || getStyle(tdElm, 'vertical-align');
|
||||
var width = trimSize(getStyle(tdElm, 'width', 'width'));
|
||||
var height = trimSize(getStyle(tdElm, 'height', 'height'));
|
||||
var bordercolor = convertRGBToHex(getStyle(tdElm, 'bordercolor', 'borderLeftColor'));
|
||||
@@ -201,8 +201,6 @@ function updateCell(td, skip_id) {
|
||||
if (!skip_id)
|
||||
dom.setAttrib(td, 'id', formObj.id.value);
|
||||
|
||||
dom.setAttrib(td, 'align', formObj.align.value);
|
||||
dom.setAttrib(td, 'vAlign', formObj.valign.value);
|
||||
dom.setAttrib(td, 'lang', formObj.lang.value);
|
||||
dom.setAttrib(td, 'dir', getSelectValue(formObj, 'dir'));
|
||||
dom.setAttrib(td, 'style', ed.dom.serializeStyle(ed.dom.parseStyle(formObj.style.value)));
|
||||
@@ -210,6 +208,8 @@ function updateCell(td, skip_id) {
|
||||
dom.setAttrib(td, 'class', getSelectValue(formObj, 'class'));
|
||||
|
||||
// Clear deprecated attributes
|
||||
ed.dom.setAttrib(td, 'align', '');
|
||||
ed.dom.setAttrib(td, 'vAlign', '');
|
||||
ed.dom.setAttrib(td, 'width', '');
|
||||
ed.dom.setAttrib(td, 'height', '');
|
||||
ed.dom.setAttrib(td, 'bgColor', '');
|
||||
@@ -219,13 +219,9 @@ function updateCell(td, skip_id) {
|
||||
// Set styles
|
||||
td.style.width = getCSSSize(formObj.width.value);
|
||||
td.style.height = getCSSSize(formObj.height.value);
|
||||
if (formObj.bordercolor.value != "") {
|
||||
td.style.textAlign = formObj.align.value;
|
||||
td.style.verticalAlign = formObj.valign.value;
|
||||
td.style.borderColor = formObj.bordercolor.value;
|
||||
td.style.borderStyle = td.style.borderStyle == "" ? "solid" : td.style.borderStyle;
|
||||
td.style.borderWidth = td.style.borderWidth == "" ? "1px" : td.style.borderWidth;
|
||||
} else
|
||||
td.style.borderColor = '';
|
||||
|
||||
td.style.backgroundColor = formObj.bgcolor.value;
|
||||
|
||||
if (formObj.backgroundimage.value != "")
|
||||
@@ -314,6 +310,12 @@ function changedStyle() {
|
||||
formObj.bordercolor.value = st['border-color'];
|
||||
updateColor('bordercolor_pick','bordercolor');
|
||||
}
|
||||
|
||||
if (st['text-align'])
|
||||
formObj.align.value = st['text-align'];
|
||||
|
||||
if (st['vertical-align'])
|
||||
formObj.valign.value = st['vertical-align'];
|
||||
}
|
||||
|
||||
tinyMCEPopup.onInit.add(init);
|
||||
|
||||
@@ -25,6 +25,7 @@ function init() {
|
||||
var dir = dom.getAttrib(trElm, 'dir');
|
||||
|
||||
selectByValue(formObj, 'rowtype', rowtype);
|
||||
setActionforRowType(formObj, rowtype);
|
||||
|
||||
// Any cells selected
|
||||
if (dom.select('td.mceSelected,th.mceSelected', trElm).length == 0) {
|
||||
@@ -234,4 +235,20 @@ function changedColor() {
|
||||
formObj.style.value = dom.serializeStyle(st);
|
||||
}
|
||||
|
||||
function changedRowType() {
|
||||
var formObj = document.forms[0];
|
||||
var rowtype = getSelectValue(formObj, 'rowtype');
|
||||
|
||||
setActionforRowType(formObj, rowtype);
|
||||
|
||||
}
|
||||
|
||||
function setActionforRowType(formObj, rowtype) {
|
||||
if (rowtype === "tbody") {
|
||||
formObj.action.disabled = false;
|
||||
} else {
|
||||
selectByValue(formObj, 'action', "row");
|
||||
formObj.action.disabled = true;
|
||||
}
|
||||
}
|
||||
tinyMCEPopup.onInit.add(init);
|
||||
|
||||
@@ -8,6 +8,7 @@ function insertTable() {
|
||||
var cols = 2, rows = 2, border = 0, cellpadding = -1, cellspacing = -1, align, width, height, className, caption, frame, rules;
|
||||
var html = '', capEl, elm;
|
||||
var cellLimit, rowLimit, colLimit;
|
||||
var cellStyles, newCellStyles, parsedStyles;
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
|
||||
@@ -21,9 +22,9 @@ function insertTable() {
|
||||
// Get form data
|
||||
cols = formObj.elements['cols'].value;
|
||||
rows = formObj.elements['rows'].value;
|
||||
border = formObj.elements['border'].value != "" ? formObj.elements['border'].value : 0;
|
||||
cellpadding = formObj.elements['cellpadding'].value != "" ? formObj.elements['cellpadding'].value : "";
|
||||
cellspacing = formObj.elements['cellspacing'].value != "" ? formObj.elements['cellspacing'].value : "";
|
||||
border = formObj.elements['border'].value !== "" ? formObj.elements['border'].value : "";
|
||||
cellpadding = formObj.elements['cellpadding'].value !== "" ? formObj.elements['cellpadding'].value : "";
|
||||
cellspacing = formObj.elements['cellspacing'].value !== "" ? formObj.elements['cellspacing'].value : "";
|
||||
align = getSelectValue(formObj, "align");
|
||||
frame = getSelectValue(formObj, "tframe");
|
||||
rules = getSelectValue(formObj, "rules");
|
||||
@@ -58,20 +59,6 @@ function insertTable() {
|
||||
|
||||
// Update table
|
||||
if (action == "update") {
|
||||
dom.setAttrib(elm, 'cellPadding', cellpadding, true);
|
||||
dom.setAttrib(elm, 'cellSpacing', cellspacing, true);
|
||||
|
||||
if (!isCssSize(border)) {
|
||||
dom.setAttrib(elm, 'border', border);
|
||||
} else {
|
||||
dom.setAttrib(elm, 'border', '');
|
||||
}
|
||||
|
||||
if (border == '') {
|
||||
dom.setStyle(elm, 'border-width', '');
|
||||
dom.setStyle(elm, 'border', '');
|
||||
dom.setAttrib(elm, 'border', '');
|
||||
}
|
||||
|
||||
dom.setAttrib(elm, 'align', align);
|
||||
dom.setAttrib(elm, 'frame', frame);
|
||||
@@ -91,7 +78,7 @@ function insertTable() {
|
||||
if (!capEl && caption) {
|
||||
capEl = elm.ownerDocument.createElement('caption');
|
||||
|
||||
if (!tinymce.isIE)
|
||||
if (!tinymce.isIE || tinymce.isIE11)
|
||||
capEl.innerHTML = '<br data-mce-bogus="1"/>';
|
||||
|
||||
elm.insertBefore(capEl, elm.firstChild);
|
||||
@@ -128,12 +115,54 @@ function insertTable() {
|
||||
elm.style.width = getCSSSize(width);
|
||||
}*/
|
||||
|
||||
if (bordercolor != "") {
|
||||
if (!inst.settings.table_style_by_css) {
|
||||
dom.setAttrib(elm, 'cellPadding', nonCssSize(cellpadding), true);
|
||||
} else {
|
||||
dom.setAttrib(elm, 'cellPadding', '');
|
||||
}
|
||||
|
||||
if (cellspacing !== "") {
|
||||
elm.style.borderSpacing = cssSize(cellspacing);
|
||||
} else {
|
||||
elm.style.borderSpacing = "";
|
||||
}
|
||||
|
||||
if (!inst.settings.table_style_by_css && !isCssSize(border)) {
|
||||
dom.setAttrib(elm, 'border', border);
|
||||
} else if (inst.settings.table_style_by_css || (border !== '' && isCssSize(border))) {
|
||||
dom.setAttrib(elm, 'border', '');
|
||||
}
|
||||
|
||||
if (border === "") {
|
||||
dom.setStyle(elm, 'border-width', '');
|
||||
dom.setStyle(elm, 'border', '');
|
||||
dom.setAttrib(elm, 'border', '');
|
||||
}
|
||||
|
||||
elm.style.borderColor = bordercolor;
|
||||
elm.style.borderStyle = elm.style.borderStyle == "" ? "solid" : elm.style.borderStyle;
|
||||
elm.style.borderWidth = cssSize(border);
|
||||
} else
|
||||
elm.style.borderColor = '';
|
||||
|
||||
if (inst.settings.table_style_by_css) {
|
||||
|
||||
parsedStyles = dom.parseStyle(style);
|
||||
|
||||
if (parsedStyles.border) {
|
||||
styleTDTH(elm, "border", parsedStyles.border);
|
||||
}
|
||||
if (border !== "") {
|
||||
styleTDTH(elm, "border-width", cssSize(border));
|
||||
} else {
|
||||
styleTDTH(elm, "border-width", '');
|
||||
}
|
||||
if (cellpadding !== "") {
|
||||
styleTDTH(elm, "padding", cssSize(cellpadding));
|
||||
} else {
|
||||
styleTDTH(elm, "padding", '');
|
||||
}
|
||||
|
||||
styleTDTH(elm, "border-color", bordercolor);
|
||||
|
||||
styleTDTH(elm, "border-style", elm.style.borderStyle);
|
||||
}
|
||||
|
||||
elm.style.backgroundColor = bgcolor;
|
||||
elm.style.height = getCSSSize(height);
|
||||
@@ -158,12 +187,14 @@ function insertTable() {
|
||||
html += '<table';
|
||||
|
||||
html += makeAttrib('id', id);
|
||||
if (!isCssSize(border)) {
|
||||
if (!inst.settings.table_style_by_css && !isCssSize(border)) {
|
||||
html += makeAttrib('border', border);
|
||||
}
|
||||
|
||||
html += makeAttrib('cellpadding', cellpadding);
|
||||
html += makeAttrib('cellspacing', cellspacing);
|
||||
if (!inst.settings.table_style_by_css) {
|
||||
html += makeAttrib('cellpadding', nonCssSize(cellpadding));
|
||||
}
|
||||
|
||||
html += makeAttrib('data-mce-new', '1');
|
||||
|
||||
if (width && inst.settings.inline_styles) {
|
||||
@@ -199,20 +230,51 @@ function insertTable() {
|
||||
html += '>';
|
||||
|
||||
if (caption) {
|
||||
if (!tinymce.isIE)
|
||||
if (!tinymce.isIE || tinymce.isIE11)
|
||||
html += '<caption><br data-mce-bogus="1"/></caption>';
|
||||
else
|
||||
html += '<caption></caption>';
|
||||
}
|
||||
|
||||
if (inst.settings.table_style_by_css) {
|
||||
|
||||
parsedStyles = dom.parseStyle(style);
|
||||
|
||||
newCellStyles = {};
|
||||
if (parsedStyles.border) {
|
||||
newCellStyles.border = parsedStyles.border;
|
||||
}
|
||||
if (border !== "") {
|
||||
newCellStyles["border-width"] = cssSize(border);
|
||||
}
|
||||
if (cellpadding !== "") {
|
||||
newCellStyles.padding = cssSize(cellpadding);
|
||||
}
|
||||
if (bordercolor !== "") {
|
||||
newCellStyles["border-color"] = bordercolor;
|
||||
}
|
||||
if (parsedStyles["border-style"]) {
|
||||
newCellStyles["border-style"] = parsedStyles["border-style"];
|
||||
}
|
||||
|
||||
if (dom.serializeStyle(newCellStyles) !== "") {
|
||||
cellStyles = " style='" + dom.serializeStyle(newCellStyles) +"'";
|
||||
} else {
|
||||
cellStyles = "";
|
||||
}
|
||||
|
||||
} else {
|
||||
cellStyles = "";
|
||||
}
|
||||
|
||||
for (var y=0; y<rows; y++) {
|
||||
html += "<tr>";
|
||||
|
||||
for (var x=0; x<cols; x++) {
|
||||
if (!tinymce.isIE)
|
||||
html += '<td><br data-mce-bogus="1"/></td>';
|
||||
if (!tinymce.isIE || tinymce.isIE11)
|
||||
html += '<td' + cellStyles + '><br data-mce-bogus="1"/></td>';
|
||||
else
|
||||
html += '<td></td>';
|
||||
html += '<td' + cellStyles + '></td>';
|
||||
}
|
||||
|
||||
html += "</tr>";
|
||||
@@ -246,7 +308,7 @@ function insertTable() {
|
||||
var tdorth = dom.select('td,th', node);
|
||||
|
||||
// Fixes a bug in IE where the caret cannot be placed after the table if the table is at the end of the document
|
||||
if (tinymce.isIE && node.nextSibling == null) {
|
||||
if (tinymce.isIE && !tinymce.isIE11 && node.nextSibling == null) {
|
||||
if (inst.settings.forced_root_block)
|
||||
dom.insertAfter(dom.create(inst.settings.forced_root_block), node);
|
||||
else
|
||||
@@ -269,6 +331,42 @@ function insertTable() {
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
function styleTDTH (elm, name, value) {
|
||||
if (elm.tagName === "TD" || elm.tagName === "TH") {
|
||||
dom.setStyle(elm, name, value);
|
||||
} else {
|
||||
if (elm.children) {
|
||||
for (var i = 0; i < elm.children.length; i++) {
|
||||
styleTDTH(elm.children[i], name, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getTDTHOverallStyle (elm, name) {
|
||||
var cells = dom.select("td,th", elm), firstChildStyle;
|
||||
|
||||
function checkChildren(firstChildStyle, elms) {
|
||||
|
||||
for (var i = 0; i < elms.length; i++) {
|
||||
var currentStyle = dom.getStyle(elms[i], name);
|
||||
if (typeof firstChildStyle === "undefined") {
|
||||
firstChildStyle = currentStyle;
|
||||
}
|
||||
if (firstChildStyle != currentStyle) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
return firstChildStyle;
|
||||
|
||||
}
|
||||
|
||||
firstChildStyle = checkChildren(firstChildStyle, cells);
|
||||
|
||||
return firstChildStyle;
|
||||
}
|
||||
|
||||
function makeAttrib(attrib, value) {
|
||||
var formObj = document.forms[0];
|
||||
var valueElm = formObj.elements[attrib];
|
||||
@@ -300,9 +398,9 @@ function init() {
|
||||
document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor');
|
||||
document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
|
||||
|
||||
var cols = 2, rows = 2, border = tinyMCEPopup.getParam('table_default_border', '0'), cellpadding = tinyMCEPopup.getParam('table_default_cellpadding', ''), cellspacing = tinyMCEPopup.getParam('table_default_cellspacing', '');
|
||||
var cols = 2, rows = 2, border = tinyMCEPopup.getParam('table_default_border', ''), cellpadding = tinyMCEPopup.getParam('table_default_cellpadding', ''), cellspacing = tinyMCEPopup.getParam('table_default_cellspacing', '');
|
||||
var align = "", width = "", height = "", bordercolor = "", bgcolor = "", className = "";
|
||||
var id = "", summary = "", style = "", dir = "", lang = "", background = "", bgcolor = "", bordercolor = "", rules = "", frame = "";
|
||||
var id = "", summary = "", style = "", dir = "", lang = "", background = "", rules = "", frame = "";
|
||||
var inst = tinyMCEPopup.editor, dom = inst.dom;
|
||||
var formObj = document.forms[0];
|
||||
var elm = dom.getParent(inst.selection.getNode(), "table");
|
||||
@@ -323,7 +421,7 @@ function init() {
|
||||
|
||||
if (elm && action != "insert") {
|
||||
var rowsAr = elm.rows;
|
||||
var cols = 0;
|
||||
cols = 0;
|
||||
for (var i=0; i<rowsAr.length; i++)
|
||||
if (rowsAr[i].cells.length > cols)
|
||||
cols = rowsAr[i].cells.length;
|
||||
@@ -333,8 +431,8 @@ function init() {
|
||||
|
||||
st = dom.parseStyle(dom.getAttrib(elm, "style"));
|
||||
border = trimSize(getStyle(elm, 'border', 'borderWidth'));
|
||||
cellpadding = dom.getAttrib(elm, 'cellpadding', "");
|
||||
cellspacing = dom.getAttrib(elm, 'cellspacing', "");
|
||||
cellpadding = dom.getAttrib(elm, 'cellpadding', '') || getTDTHOverallStyle(elm, 'padding');
|
||||
cellspacing = dom.getAttrib(elm, 'cellspacing', '') || trimSize(getStyle(elm, 'border-spacing'));
|
||||
width = trimSize(getStyle(elm, 'width', 'width'));
|
||||
height = trimSize(getStyle(elm, 'height', 'height'));
|
||||
bordercolor = convertRGBToHex(getStyle(elm, 'bordercolor', 'borderLeftColor'));
|
||||
@@ -429,6 +527,11 @@ function cssSize(value, def) {
|
||||
return value;
|
||||
}
|
||||
|
||||
function nonCssSize(value) {
|
||||
var parsedInt = parseInt(value, 10) || "";
|
||||
return parsedInt.toString();
|
||||
}
|
||||
|
||||
function changedBackgroundImage() {
|
||||
var formObj = document.forms[0];
|
||||
var st = dom.parseStyle(formObj.style.value);
|
||||
@@ -443,7 +546,7 @@ function changedBorder() {
|
||||
var st = dom.parseStyle(formObj.style.value);
|
||||
|
||||
// Update border width if the element has a color
|
||||
if (formObj.border.value != "" && (isCssSize(formObj.border.value) || formObj.bordercolor.value != ""))
|
||||
if (formObj.border.value !== "" && (tinyMCEPopup.editor.settings.table_style_by_css || isCssSize(formObj.border.value)))
|
||||
st['border-width'] = cssSize(formObj.border.value);
|
||||
else {
|
||||
if (!formObj.border.value) {
|
||||
@@ -455,20 +558,27 @@ function changedBorder() {
|
||||
formObj.style.value = dom.serializeStyle(st);
|
||||
}
|
||||
|
||||
function changedCellSpacing() {
|
||||
var formObj = document.forms[0];
|
||||
var st = dom.parseStyle(formObj.style.value);
|
||||
|
||||
if (formObj.cellspacing.value !== "")
|
||||
st['border-spacing'] = cssSize(formObj.cellspacing.value);
|
||||
else {
|
||||
st['border-spacing'] = '';
|
||||
}
|
||||
|
||||
formObj.style.value = dom.serializeStyle(st);
|
||||
}
|
||||
|
||||
function changedColor() {
|
||||
var formObj = document.forms[0];
|
||||
var st = dom.parseStyle(formObj.style.value);
|
||||
|
||||
st['background-color'] = formObj.bgcolor.value;
|
||||
|
||||
if (formObj.bordercolor.value != "") {
|
||||
st['border-color'] = formObj.bordercolor.value;
|
||||
|
||||
// Add border-width if it's missing
|
||||
if (!st['border-width'])
|
||||
st['border-width'] = cssSize(formObj.border.value, 1);
|
||||
}
|
||||
|
||||
formObj.style.value = dom.serializeStyle(st);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<tr>
|
||||
<td><label for="rowtype">{#table_dlg.rowtype}</label></td>
|
||||
<td class="col2">
|
||||
<select id="rowtype" name="rowtype" class="mceFocus">
|
||||
<select id="rowtype" name="rowtype" class="mceFocus" onChange="changedRowType();">
|
||||
<option value="thead">{#table_dlg.thead}</option>
|
||||
<option value="tbody">{#table_dlg.tbody}</option>
|
||||
<option value="tfoot">{#table_dlg.tfoot}</option>
|
||||
|
||||
@@ -33,9 +33,9 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label id="cellpaddinglabel" for="cellpadding">{#table_dlg.cellpadding}</label></td>
|
||||
<td><input id="cellpadding" name="cellpadding" type="text" value="" size="3" maxlength="3" class="number" /></td>
|
||||
<td><input id="cellpadding" name="cellpadding" type="text" value="" size="3" maxlength="5" class="size" /></td>
|
||||
<td><label id="cellspacinglabel" for="cellspacing">{#table_dlg.cellspacing}</label></td>
|
||||
<td><input id="cellspacing" name="cellspacing" type="text" value="" size="3" maxlength="3" class="number" /></td>
|
||||
<td><input id="cellspacing" name="cellspacing" type="text" value="" size="3" maxlength="5" onchange="changedCellSpacing();" class="size" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label id="alignlabel" for="align">{#table_dlg.align}</label></td>
|
||||
|
||||
@@ -1 +1 @@
|
||||
(function(){tinymce.create("tinymce.plugins.WordCount",{block:0,id:null,countre:null,cleanre:null,init:function(c,d){var e=this,f=0,g=tinymce.VK;e.countre=c.getParam("wordcount_countregex",/[\w\u2019\'-]+/g);e.cleanre=c.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$?\'\"_+=\\\/-]*/g);e.update_rate=c.getParam("wordcount_update_rate",2000);e.update_on_delete=c.getParam("wordcount_update_on_delete",false);e.id=c.id+"-word-count";c.onPostRender.add(function(i,h){var j,k;k=i.getParam("wordcount_target_id");if(!k){j=tinymce.DOM.get(i.id+"_path_row");if(j){tinymce.DOM.add(j.parentNode,"div",{style:"float: right"},i.getLang("wordcount.words","Words: ")+'<span id="'+e.id+'">0</span>')}}else{tinymce.DOM.add(k,"span",{},'<span id="'+e.id+'">0</span>')}});c.onInit.add(function(h){h.selection.onSetContent.add(function(){e._count(h)});e._count(h)});c.onSetContent.add(function(h){e._count(h)});function b(h){return h!==f&&(h===g.ENTER||f===g.SPACEBAR||a(f))}function a(h){return h===g.DELETE||h===g.BACKSPACE}c.onKeyUp.add(function(h,i){if(b(i.keyCode)||e.update_on_delete&&a(i.keyCode)){e._count(h)}f=i.keyCode})},_getCount:function(c){var a=0;var b=c.getContent({format:"raw"});if(b){b=b.replace(/\.\.\./g," ");b=b.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," ");b=b.replace(/(\w+)(&.+?;)+(\w+)/,"$1$3").replace(/&.+?;/g," ");b=b.replace(this.cleanre,"");var d=b.match(this.countre);if(d){a=d.length}}return a},_count:function(a){var b=this;if(b.block){return}b.block=1;setTimeout(function(){if(!a.destroyed){var c=b._getCount(a);tinymce.DOM.setHTML(b.id,c.toString());setTimeout(function(){b.block=0},b.update_rate)}},1)},getInfo:function(){return{longname:"Word Count plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("wordcount",tinymce.plugins.WordCount)})();
|
||||
(function(){tinymce.create("tinymce.plugins.WordCount",{block:0,id:null,countre:null,cleanre:null,init:function(c,d){var e=this,f=0,g=tinymce.VK;e.countre=c.getParam("wordcount_countregex",/[\w\u2019\u00co-\u00ff^\uc397^u00f7\'-]+/g);e.cleanre=c.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$?\'\"_+=\\\/-]*/g);e.update_rate=c.getParam("wordcount_update_rate",2000);e.update_on_delete=c.getParam("wordcount_update_on_delete",false);e.id=c.id+"-word-count";c.onPostRender.add(function(i,h){var j,k;k=i.getParam("wordcount_target_id");if(!k){j=tinymce.DOM.get(i.id+"_path_row");if(j){tinymce.DOM.add(j.parentNode,"div",{style:"float: right"},i.getLang("wordcount.words","Words: ")+'<span id="'+e.id+'">0</span>')}}else{tinymce.DOM.add(k,"span",{},'<span id="'+e.id+'">0</span>')}});c.onInit.add(function(h){h.selection.onSetContent.add(function(){e._count(h)});e._count(h)});c.onSetContent.add(function(h){e._count(h)});function b(h){return h!==f&&(h===g.ENTER||f===g.SPACEBAR||a(f))}function a(h){return h===g.DELETE||h===g.BACKSPACE}c.onKeyUp.add(function(h,i){if(b(i.keyCode)||e.update_on_delete&&a(i.keyCode)){e._count(h)}f=i.keyCode})},_getCount:function(c){var a=0;var b=c.getContent({format:"raw"});if(b){b=b.replace(/\.\.\./g," ");b=b.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," ");b=b.replace(/(\w+)(&.+?;)+(\w+)/,"$1$3").replace(/&.+?;/g," ");b=b.replace(this.cleanre,"");var d=b.match(this.countre);if(d){a=d.length}}return a},_count:function(a){var b=this;if(b.block){return}b.block=1;setTimeout(function(){if(!a.destroyed){var c=b._getCount(a);tinymce.DOM.setHTML(b.id,c.toString());setTimeout(function(){b.block=0},b.update_rate)}},1)},getInfo:function(){return{longname:"Word Count plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("wordcount",tinymce.plugins.WordCount)})();
|
||||
@@ -18,7 +18,7 @@
|
||||
init : function(ed, url) {
|
||||
var t = this, last = 0, VK = tinymce.VK;
|
||||
|
||||
t.countre = ed.getParam('wordcount_countregex', /[\w\u2019\'-]+/g); // u2019 == ’
|
||||
t.countre = ed.getParam('wordcount_countregex', /[\w\u2019\u00co-\u00ff^\uc397^u00f7\'-]+/g); // u2019 == ’ u00c0-u00ff extended latin chars with diacritical marks. exclude uc397 multiplication & u00f7 division
|
||||
t.cleanre = ed.getParam('wordcount_cleanregex', /[0-9.(),;:!?%#$?\'\"_+=\\\/-]*/g);
|
||||
t.update_rate = ed.getParam('wordcount_update_rate', 2000);
|
||||
t.update_on_delete = ed.getParam('wordcount_update_on_delete', false);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -11,6 +11,25 @@
|
||||
(function(tinymce) {
|
||||
var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode;
|
||||
|
||||
var applyDefaultFont = function (body, settings) {
|
||||
var fontSize = settings.theme_advanced_default_font_size;
|
||||
var fontFamily = settings.theme_advanced_default_font_family;
|
||||
|
||||
if (fontSize) {
|
||||
body.style.fontSize = fontSize;
|
||||
}
|
||||
|
||||
if (fontFamily) {
|
||||
body.style.fontFamily = fontFamily;
|
||||
}
|
||||
};
|
||||
|
||||
var hasDefaultFontSizeOrFamily = function (settings) {
|
||||
var fontSize = settings.theme_advanced_default_font_size;
|
||||
var fontFamily = settings.theme_advanced_default_font_family;
|
||||
return !!(fontSize || fontFamily);
|
||||
};
|
||||
|
||||
// Generates a preview for a format
|
||||
function getPreviewCss(ed, fmt) {
|
||||
var name, previewElm, dom = ed.dom, previewCss = '', parentFontSize, previewStylesName;
|
||||
@@ -175,7 +194,7 @@
|
||||
theme_advanced_blockformats : "p,address,pre,h1,h2,h3,h4,h5,h6",
|
||||
theme_advanced_toolbar_align : "left",
|
||||
theme_advanced_statusbar_location : "bottom",
|
||||
theme_advanced_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",
|
||||
theme_advanced_fonts : "Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats",
|
||||
theme_advanced_more_colors : 1,
|
||||
theme_advanced_row_height : 23,
|
||||
theme_advanced_resize_horizontal : 1,
|
||||
@@ -234,6 +253,8 @@
|
||||
t._updateUndoStatus(ed);
|
||||
});
|
||||
}
|
||||
|
||||
applyDefaultFont(ed.getBody(), ed.settings);
|
||||
});
|
||||
|
||||
ed.onSetProgressState.add(function(ed, b, ti) {
|
||||
@@ -956,7 +977,7 @@
|
||||
a = s.theme_advanced_toolbar_align.toLowerCase();
|
||||
a = 'mce' + t._ufirst(a);
|
||||
|
||||
n = DOM.add(DOM.add(c, 'tr', {role: 'toolbar'}), 'td', {'class' : 'mceToolbar ' + a, "role":"toolbar"});
|
||||
n = DOM.add(DOM.add(c, 'tr', {role: 'presentation'}), 'td', {'class' : 'mceToolbar ' + a, "role":"toolbar"});
|
||||
|
||||
// Create toolbar and add the controls
|
||||
for (i=1; (v = s['theme_advanced_buttons' + i]); i++) {
|
||||
@@ -1079,8 +1100,8 @@
|
||||
cm.setActive(c, ed.queryCommandState(t.controls[c][1]));
|
||||
});
|
||||
|
||||
function getParent(name) {
|
||||
var i, parents = ob.parents, func = name;
|
||||
var getElement = function (elements, name) {
|
||||
var i, elements, func = name;
|
||||
|
||||
if (typeof(name) == 'string') {
|
||||
func = function(node) {
|
||||
@@ -1088,12 +1109,20 @@
|
||||
};
|
||||
}
|
||||
|
||||
for (i = 0; i < parents.length; i++) {
|
||||
if (func(parents[i]))
|
||||
return parents[i];
|
||||
for (i = 0; i < elements.length; i++) {
|
||||
if (func(elements[i]))
|
||||
return elements[i];
|
||||
}
|
||||
};
|
||||
|
||||
function getParent(name) {
|
||||
return getElement(ob.parents, name);
|
||||
};
|
||||
|
||||
function getParentIncBody(name) {
|
||||
return getElement([].concat(ob.parents).concat([ed.getBody()]), name);
|
||||
};
|
||||
|
||||
cm.setActive('visualaid', ed.hasVisual);
|
||||
t._updateUndoStatus(ed);
|
||||
cm.setDisabled('outdent', !ed.queryCommandState('Outdent'));
|
||||
@@ -1142,13 +1171,16 @@
|
||||
}
|
||||
|
||||
// Find out current fontSize, fontFamily and fontClass
|
||||
getParent(function(n) {
|
||||
getParentIncBody(function(n) {
|
||||
var matchesSelector;
|
||||
|
||||
if (n.nodeName === 'SPAN') {
|
||||
if (!cl && n.className)
|
||||
cl = n.className;
|
||||
}
|
||||
|
||||
if (ed.dom.is(n, s.theme_advanced_font_selector)) {
|
||||
matchesSelector = ed.dom.is(n, s.theme_advanced_font_selector);
|
||||
if (matchesSelector || hasDefaultFontSizeOrFamily(ed.settings)) {
|
||||
if (!fz && n.style.fontSize)
|
||||
fz = n.style.fontSize;
|
||||
|
||||
|
||||
@@ -73,6 +73,6 @@ function resizeInputs() {
|
||||
|
||||
if (el) {
|
||||
el.style.width = (vp.w - 20) + 'px';
|
||||
el.style.height = (vp.h - 70) + 'px';
|
||||
el.style.height = (vp.h - 65) + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ font[face=mceinline] {font-family:inherit !important}
|
||||
.mceItemRealMedia {background-image:url(../../img/realmedia.gif)}
|
||||
.mceItemVideo {background-image:url(../../img/video.gif)}
|
||||
.mceItemAudio {background-image:url(../../img/video.gif)}
|
||||
.mceItemObject {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;}
|
||||
|
||||
@@ -84,7 +84,7 @@ td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #A
|
||||
|
||||
/* Panels */
|
||||
.panel_wrapper div.panel {display:none;}
|
||||
.panel_wrapper div.current {display:block; width:100%; height:220px; overflow:visible;}
|
||||
.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 */
|
||||
@@ -116,4 +116,3 @@ h3 {font-size:14px;}
|
||||
#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;}
|
||||
#prev {margin:0; border:1px solid #000; width:428px; height:150px; overflow:auto;}
|
||||
|
||||
@@ -73,7 +73,7 @@ td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #A
|
||||
|
||||
/* Panels */
|
||||
.panel_wrapper div.panel {display:none;}
|
||||
.panel_wrapper div.current {display:block; width:100%; height:220px; overflow:visible;}
|
||||
.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;}
|
||||
.panel_wrapper {border:1px solid #919B9C; padding:10px; padding-top:5px; clear:both; background:white;}
|
||||
|
||||
/* Columns */
|
||||
@@ -104,4 +104,3 @@ h3 {font-size:14px;}
|
||||
#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;}
|
||||
#prev {margin:0; border:1px solid #000; width:428px; height:150px; overflow:auto;}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
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;}
|
||||
h1 {font-size: 1em}
|
||||
h2 {font-size: 1em}
|
||||
h3 {font-size: 1em}
|
||||
h1 {font-size: 2em}
|
||||
h2 {font-size: 1.5em}
|
||||
h3 {font-size: 1.17em}
|
||||
h4 {font-size: 1em}
|
||||
h5 {font-size: 3em}
|
||||
h6 {font-size: 7em}
|
||||
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; width:11px !important; height:11px !important; background:url(../default/img/items.gif) no-repeat 0 0;}
|
||||
span.mceItemNbsp {background: #DDD}
|
||||
|
||||
@@ -84,7 +84,7 @@ td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #A
|
||||
|
||||
/* Panels */
|
||||
.panel_wrapper div.panel {display:none;}
|
||||
.panel_wrapper div.current {display:block; width:100%; height:220px; overflow:visible;}
|
||||
.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 */
|
||||
@@ -116,4 +116,3 @@ h3 {font-size:14px;}
|
||||
#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;}
|
||||
#prev {margin:0; border:1px solid #000; width:428px; height:150px; overflow:auto;}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Reset */
|
||||
.o2k7Skin table, .o2k7Skin tbody, .o2k7Skin a, .o2k7Skin img, .o2k7Skin tr, .o2k7Skin div, .o2k7Skin td, .o2k7Skin iframe, .o2k7Skin span, .o2k7Skin *, .o2k7Skin .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}
|
||||
.o2k7Skin a:hover, .o2k7Skin a:link, .o2k7Skin a:visited, .o2k7Skin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000}
|
||||
.o2k7Skin table td {vertical-align:top; background-color: white;}
|
||||
.o2k7Skin table td {vertical-align:middle}
|
||||
|
||||
/* Containers */
|
||||
.o2k7Skin table {background:transparent}
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
/* Layout */
|
||||
.o2k7Skin table.mceLayout {border:0; border-left:1px solid #ABC6DD; border-right:1px solid #ABC6DD}
|
||||
.o2k7Skin table.mceLayout tr.mceLast {height:1px !important}
|
||||
.o2k7Skin table.mceLayout tr.mceFirst td {border-top:1px solid #ABC6DD}
|
||||
.o2k7Skin table.mceLayout tr.mceLast td {border-bottom:1px solid #ABC6DD}
|
||||
.o2k7Skin table.mceToolbar, .o2k7Skin tr.mceFirst .mceToolbar tr td, .o2k7Skin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0}
|
||||
@@ -221,8 +220,3 @@
|
||||
.o2k7Skin span.mce_restoredraft {background-position:-20px -40px}
|
||||
.o2k7Skin span.mce_spellchecker {background-position:-540px -20px}
|
||||
.o2k7Skin span.mce_visualblocks {background-position: -40px -40px}
|
||||
|
||||
|
||||
a.mce_pmSimpleUploader, a.mce_pmVariablePicker, a.mce_pmGrids { border: 1px solid #BBBBBB; border-width: 1px 0 1px 0; background: #EEEEEE !important;}
|
||||
a.mce_pmSimpleUploader:hover, a.mce_pmVariablePicker:hover, a.mce_pmGrids:hover {background: #FFDB6F !important;}
|
||||
a.mce_pmSimpleUploader img, a.mce_pmVariablePicker img, a.mce_pmGrids img {margin: 0.25em 0 0 0.25em !important; width: 14px !important; height: 14px !important;}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -2,4 +2,4 @@
|
||||
// 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();
|
||||
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(a){var a=(a&&a.target)||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&&!tinymce.isIE11){document.attachEvent("onmouseup",tinyMCEPopup._restoreSelection);b.dom.add(b.dom.select("head")[0],"base",{target:"_self"})}else{if(tinymce.isIE11){document.addEventListener("mouseup",tinyMCEPopup._restoreSelection,false)}}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();
|
||||
1221
gulliver/js/tinymce/jscripts/tiny_mce/tiny_mce_src.js
vendored
1221
gulliver/js/tinymce/jscripts/tiny_mce/tiny_mce_src.js
vendored
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user