summaryrefslogtreecommitdiff
path: root/program/js/tiny_mce/tiny_mce_src.js
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-03-28 17:08:23 +0000
committeralecpl <alec@alec.pl>2010-03-28 17:08:23 +0000
commit79990754f61617615cc30a2470672c7db3658e7d (patch)
treefe889fc5a8b76871a888f3fc346a1bdaeec19d25 /program/js/tiny_mce/tiny_mce_src.js
parentce467384e263d459f70915742baccc87c2aa9b79 (diff)
- TinyMCE 3.3.2
Diffstat (limited to 'program/js/tiny_mce/tiny_mce_src.js')
-rw-r--r--program/js/tiny_mce/tiny_mce_src.js81
1 files changed, 67 insertions, 14 deletions
diff --git a/program/js/tiny_mce/tiny_mce_src.js b/program/js/tiny_mce/tiny_mce_src.js
index 5cbcced76..c4a626508 100644
--- a/program/js/tiny_mce/tiny_mce_src.js
+++ b/program/js/tiny_mce/tiny_mce_src.js
@@ -5,9 +5,9 @@
var tinymce = {
majorVersion : '3',
- minorVersion : '3.1',
+ minorVersion : '3.2',
- releaseDate : '2010-03-18',
+ releaseDate : '2010-03-25',
_init : function() {
var t = this, d = document, na = navigator, ua = na.userAgent, i, nl, n, base, p, v;
@@ -2406,7 +2406,7 @@ tinymce.create('static tinymce.util.XHR', {
},
nodeIndex : function(node, normalized) {
- var idx = 0, lastNodeType, nodeType;
+ var idx = 0, lastNodeType, lastNode, nodeType;
if (node) {
for (lastNodeType = node.nodeType, node = node.previousSibling, lastNode = node; node; node = node.previousSibling) {
@@ -5102,7 +5102,7 @@ window.tinymce.dom.Sizzle = Sizzle;
getStart : function() {
var t = this, r = t.getRng(), e;
- if (isIE) {
+ if (r.duplicate || r.item) {
if (r.item)
return r.item(0);
@@ -5130,7 +5130,7 @@ window.tinymce.dom.Sizzle = Sizzle;
getEnd : function() {
var t = this, r = t.getRng(), e, eo;
- if (isIE) {
+ if (r.duplicate || r.item) {
if (r.item)
return r.item(0);
@@ -5176,7 +5176,7 @@ window.tinymce.dom.Sizzle = Sizzle;
function getPoint(rng, start) {
var container = rng[start ? 'startContainer' : 'endContainer'],
- offset = rng[start ? 'startOffset' : 'endOffset'], point = [], childNodes, after = 0;
+ offset = rng[start ? 'startOffset' : 'endOffset'], point = [], node, childNodes, after = 0;
if (container.nodeType == 3) {
if (normalized) {
@@ -5467,7 +5467,7 @@ window.tinymce.dom.Sizzle = Sizzle;
// This can occur when the editor is placed in a hidden container element on Gecko
// Or on IE when there was an exception
if (!r)
- r = isIE ? t.win.document.body.createTextRange() : t.win.document.createRange();
+ r = t.win.document.createRange ? t.win.document.createRange() : t.win.document.body.createTextRange();
return r;
},
@@ -5509,7 +5509,7 @@ window.tinymce.dom.Sizzle = Sizzle;
getNode : function() {
var t = this, rng = t.getRng(), sel = t.getSel(), elm;
- if (!isIE) {
+ if (rng.setStart) {
// Range maybe lost after the editor is made visible again
if (!rng)
return t.dom.getRoot();
@@ -8179,7 +8179,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
},
getLength : function() {
- return DOM.get(this.id).options.length - 1;
+ return this.items.length;
},
renderHTML : function() {
@@ -9522,7 +9522,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
hilitecolor : {inline : 'span', styles : {backgroundColor : '%value'}},
fontname : {inline : 'span', styles : {fontFamily : '%value'}},
fontsize : {inline : 'span', styles : {fontSize : '%value'}},
- blockquote : {block : 'blockquote', wrapper : 1},
+ blockquote : {block : 'blockquote', wrapper : 1, remove : 'all'},
removeformat : [
{selector : 'b,strong,em,i,font,u,strike', remove : 'all', split : true, expand : false, block_expand : true, deep : true},
@@ -9533,7 +9533,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
// Register default block formats
each('p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp'.split(/\s/), function(name) {
- t.formatter.register(name, {block : name});
+ t.formatter.register(name, {block : name, remove : 'all'});
});
// Register user defined formats
@@ -9882,7 +9882,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
},
nodeChanged : function(o) {
- var t = this, s = t.selection, n = s.getNode() || t.getBody();
+ var t = this, s = t.selection, n = (isIE ? s.getNode() : s.getStart()) || t.getBody();
// Fix for bug #1896577 it seems that this can not be fired while the editor is loading
if (t.initialized) {
@@ -12562,6 +12562,10 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
undefined,
pendingFormats = {apply : [], remove : []};
+ function isArray(obj) {
+ return obj instanceof Array;
+ };
+
function getParents(node, selector) {
return dom.getParents(node, selector, dom.getRoot());
};
@@ -13106,6 +13110,54 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
return FALSE;
};
+ function matchAll(names, vars) {
+ var startElement, matchedFormatNames = [], checkedMap = {}, i, ni, name;
+
+ // If the selection is collapsed then check pending formats
+ if (selection.isCollapsed()) {
+ for (ni = 0; ni < names.length; ni++) {
+ // If the name is to be removed, then stop it from being added
+ for (i = pendingFormats.remove.length - 1; i >= 0; i--) {
+ name = names[ni];
+
+ if (pendingFormats.remove[i].name == name) {
+ checkedMap[name] = true;
+ break;
+ }
+ }
+ }
+
+ // If the format is to be applied
+ for (i = pendingFormats.apply.length - 1; i >= 0; i--) {
+ for (ni = 0; ni < names.length; ni++) {
+ name = names[ni];
+
+ if (!checkedMap[name] && pendingFormats.apply[i].name == name) {
+ checkedMap[name] = true;
+ matchedFormatNames.push(name);
+ }
+ }
+ }
+ }
+
+ // Check start of selection for formats
+ startElement = selection.getStart();
+ dom.getParent(startElement, function(node) {
+ var i, name;
+
+ for (i = 0; i < names.length; i++) {
+ name = names[i];
+
+ if (!checkedMap[name] && matchNode(node, name, vars)) {
+ checkedMap[name] = true;
+ matchedFormatNames.push(name);
+ }
+ }
+ });
+
+ return matchedFormatNames;
+ };
+
function canApply(name) {
var formatList = get(name), startNode, parents, i, x, selector;
@@ -13138,6 +13190,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
remove : remove,
toggle : toggle,
match : match,
+ matchAll : matchAll,
matchNode : matchNode,
canApply : canApply
});
@@ -13162,8 +13215,8 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
str1 = str1 || '';
str2 = str2 || '';
- str1 = str1.nodeName || str1;
- str2 = str2.nodeName || str2;
+ str1 = '' + (str1.nodeName || str1);
+ str2 = '' + (str2.nodeName || str2);
return str1.toLowerCase() == str2.toLowerCase();
};