diff -r 51386f1852b8 -r f26a69c40431 includes/clientside/tinymce/tiny_mce_src.js
--- a/includes/clientside/tinymce/tiny_mce_src.js Thu Mar 06 20:45:46 2008 -0500
+++ b/includes/clientside/tinymce/tiny_mce_src.js Thu Mar 06 20:47:11 2008 -0500
@@ -3,8 +3,8 @@
var tinymce = {
majorVersion : '3',
- minorVersion : '0.1',
- releaseDate : '2008-02-21',
+ minorVersion : '0.3',
+ releaseDate : '2008-03-03',
_init : function() {
var t = this, ua = navigator.userAgent, i, nl, n, base;
@@ -1031,8 +1031,16 @@
},
get : function(e) {
- if (typeof(e) == 'string')
- return this.doc.getElementById(e);
+ var n;
+
+ if (typeof(e) == 'string') {
+ n = e;
+ e = this.doc.getElementById(e);
+
+ // IE and Opera returns meta elements when they match the specified input ID, but getElementsByName seems to do the trick
+ if (e && e.id !== n)
+ return this.doc.getElementsByName(n)[1];
+ }
return e;
},
@@ -1558,11 +1566,11 @@
r = n;
while (r) {
- // Opera 9.25 bug fix, fixed in 9.50
- if (!tinymce.isOpera || r.nodeName != 'TR') {
+ // Opera 9.25 bug fix, fixed in 9.50 seems to be fixed in Opera 9.26 too
+ /* if (!tinymce.isOpera || r.nodeName != 'TR') {
x -= r.scrollLeft || 0;
y -= r.scrollTop || 0;
- }
+ }*/
r = r.parentNode;
@@ -1789,14 +1797,21 @@
e.innerHTML = '
' + h;
e.removeChild(e.firstChild);
} catch (ex) {
- // IE sometimes produces an unknown runtime error on innerHTML
- // This seems to fix this issue, don't know why.
+ // IE sometimes produces an unknown runtime error on innerHTML if it's an block element within a block element for example a div inside a p
+ // This seems to fix this problem
+
+ // Remove all child nodes
+ while (e.firstChild)
+ e.firstChild.removeNode();
+
+ // Create new div with HTML contents and a BR infront to keep comments
x = t.create('div');
x.innerHTML = '
' + h;
+ // Add all children from div to target
each (x.childNodes, function(n, i) {
- // Skip the BR
- if (i > 1)
+ // Skip br element
+ if (i)
e.appendChild(n);
});
}
@@ -1985,11 +2000,18 @@
},
decode : function(s) {
- var e = document.createElement("div");
-
- e.innerHTML = s;
-
- return !e.firstChild ? s : e.firstChild.nodeValue;
+ var e;
+
+ // Look for entities to decode
+ if (/&[^;]+;/.test(s)) {
+ // Decode the entities using a div element not super efficient but less code
+ e = this.doc.createElement("div");
+ e.innerHTML = s;
+
+ return !e.firstChild ? s : e.firstChild.nodeValue;
+ }
+
+ return s;
},
encode : function(s) {
@@ -2781,7 +2803,7 @@
return d;
}
- p += n.nodeValue ? n.nodeValue.length : 0;
+ p += n.nodeValue ? tinymce.trim(n.nodeValue).length : 0;
}
return null;
@@ -2798,7 +2820,8 @@
start : e.start + s.anchorOffset,
end : e.end + s.focusOffset,
scrollX : sx,
- scrollY : sy
+ scrollY : sy,
+ beg : s.anchorOffset == 0
};
} else {
e = getPos(ro, r.startContainer, r.endContainer);
@@ -2810,7 +2833,8 @@
start : e.start + r.startOffset,
end : e.end + r.endOffset,
scrollX : sx,
- scrollY : sy
+ scrollY : sy,
+ beg : r.startOffset == 0
};
}
},
@@ -2819,20 +2843,25 @@
var t = this, r = t.getRng(), s = t.getSel(), ro = t.dom.getRoot(), sd;
function getPos(r, sp, ep) {
- var w = document.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {};
+ var w = document.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {}, o, v;
while ((n = w.nextNode()) != null) {
- p += n.nodeValue ? n.nodeValue.length : 0;
+ p += n.nodeValue ? tinymce.trim(n.nodeValue).length : 0;
if (p >= sp && !d.startNode) {
+ o = sp - (p - n.nodeValue.length);
+
+ // Fix for odd quirk in FF
+ if (b.beg && o >= n.nodeValue.length)
+ continue;
+
d.startNode = n;
- d.startOffset = sp - (p - n.nodeValue.length);
+ d.startOffset = o;
}
if (p >= ep) {
d.endNode = n;
d.endOffset = ep - (p - n.nodeValue.length);
-
return d;
}
}
@@ -2906,6 +2935,7 @@
if (is(b.start) && is(b.end)) {
try {
sd = getPos(ro, b.start, b.end);
+
if (sd) {
r = t.dom.doc.createRange();
r.setStart(sd.startNode, sd.startOffset);
@@ -3339,7 +3369,18 @@
t.key = 0;
t.onPreProcess = new Dispatcher(t);
t.onPostProcess = new Dispatcher(t);
- t.writer = tinymce.relaxedDomain && tinymce.isGecko ? new tinymce.dom.StringWriter() : new tinymce.dom.XMLWriter();
+
+ if (tinymce.relaxedDomain && tinymce.isGecko) {
+ // Gecko has a bug where we can't create a new XML document if domain relaxing is used
+ t.writer = new tinymce.dom.StringWriter();
+ } else {
+ try {
+ t.writer = new tinymce.dom.XMLWriter();
+ } catch (ex) {
+ // IE might throw exception if ActiveX is disabled so we then switch to the slightly slower StringWriter
+ t.writer = new tinymce.dom.StringWriter();
+ }
+ }
// Default settings
t.settings = s = extend({
@@ -3848,17 +3889,17 @@
if (s.remove_linebreaks) {
h = h.replace(/(<[^>]+>)\s+/g, '$1 ');
h = h.replace(/\s+(<\/[^>]+>)/g, ' $1');
- h = h.replace(/<(p|h[1-6]|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object) ([^>]+)>\s+/g, '<$1 $2>'); // Trim block start
- h = h.replace(/<(p|h[1-6]|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>\s+/g, '<$1>'); // Trim block start
- h = h.replace(/\s+<\/(p|h[1-6]|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>/g, '$1>'); // Trim block end
+ h = h.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object) ([^>]+)>\s+/g, '<$1 $2>'); // Trim block start
+ h = h.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>\s+/g, '<$1>'); // Trim block start
+ h = h.replace(/\s+<\/(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>/g, '$1>'); // Trim block end
}
// Simple indentation
if (s.apply_source_formatting && s.indent_mode == 'simple') {
// Add line breaks before and after block elements
h = h.replace(/<(\/?)(ul|hr|table|meta|link|tbody|tr|object|body|head|html|map)(|[^>]+)>\s*/g, '\n<$1$2$3>\n');
- h = h.replace(/\s*<(p|h[1-6]|div|title|style|pre|script|td|li|area)(|[^>]+)>/g, '\n<$1$2>');
- h = h.replace(/<\/(p|h[1-6]|div|title|style|pre|script|td|li)>\s*/g, '$1>\n');
+ h = h.replace(/\s*<(p|h[1-6]|blockquote|div|title|style|pre|script|td|li|area)(|[^>]+)>/g, '\n<$1$2>');
+ h = h.replace(/<\/(p|h[1-6]|blockquote|div|title|style|pre|script|td|li)>\s*/g, '$1>\n');
h = h.replace(/\n\n/g, '\n');
}
}
@@ -4030,18 +4071,22 @@
o.items = o.items || [];
function enc(s) {
- return s.replace(/[\r\n]/g, function(c) {
+ return s.replace(/[\r\n\\]/g, function(c) {
if (c === '\n')
return '\\n';
+ else if (c === '\\')
+ return '\\\\';
return '\\r';
});
};
function dec(s) {
- return s.replace(/\\[rn]/g, function(c) {
+ return s.replace(/\\[\\rn]/g, function(c) {
if (c === '\\n')
return '\n';
+ else if (c === '\\\\')
+ return '\\';
return '\r';
});
@@ -4133,7 +4178,7 @@
} else {
// Remove internal mceItemXX classes when content is extracted from editor
if (na == 'class' && this.processObj.get)
- v = v.replace(/\bmceItem\w+\b/g, '');
+ v = v.replace(/\s?mceItem\w+\s?/g, '');
}
if (v === '')
@@ -4158,6 +4203,10 @@
this.lookup = {};
},
+ isDone : function(u) {
+ return this.lookup[u] ? this.lookup[u].state == 2 : 0;
+ },
+
markDone : function(u) {
this.lookup[u] = {state : 2, url : u};
},
@@ -4648,12 +4697,15 @@
s.vp_offset_y = s.vp_offset_y || 0;
if (is(s.icons) && !s.icons)
- s['class'] += ' noIcons';
+ s['class'] += ' mceNoIcons';
this.parent(id, s);
this.onShowMenu = new tinymce.util.Dispatcher(this);
this.onHideMenu = new tinymce.util.Dispatcher(this);
this.classPrefix = 'mceMenu';
+
+ // Fix for odd IE bug: #1903622
+ this.fixIE = tinymce.isIE && window.top != window;
},
createMenu : function(s) {
@@ -4743,7 +4795,7 @@
t.element.update();
t.isMenuVisible = 1;
- t.mouseClickFunc = Event.add(co, 'click', function(e) {
+ t.mouseClickFunc = Event.add(co, t.fixIE ? 'mousedown' : 'click', function(e) {
var m;
e = e.target;
@@ -4805,7 +4857,7 @@
return;
Event.remove(co, 'mouseover', t.mouseOverFunc);
- Event.remove(co, 'click', t.mouseClickFunc);
+ Event.remove(co, t.fixIE ? 'mousedown' : 'click', t.mouseClickFunc);
DOM.hide(co);
t.isMenuVisible = 0;
@@ -4888,7 +4940,7 @@
DOM.add(ro, 'td', {'class' : 'mceMenuItemSeparator'});
if (n = ro.previousSibling)
- DOM.addClass(n, 'last');
+ DOM.addClass(n, 'mceLast');
return;
}
@@ -4899,25 +4951,25 @@
DOM.addClass(it, s['class']);
// n = DOM.add(n, 'span', {'class' : 'item'});
- DOM.add(n, 'span', {'class' : 'icon' + (s.icon ? ' ' + s.icon : '')});
- n = DOM.add(n, s.element || 'span', {'class' : 'text', title : o.settings.title}, o.settings.title);
+ DOM.add(n, 'span', {'class' : 'mceIcon' + (s.icon ? ' mce_' + s.icon : '')});
+ n = DOM.add(n, s.element || 'span', {'class' : 'mceText', title : o.settings.title}, o.settings.title);
if (o.settings.style)
DOM.setAttrib(n, 'style', o.settings.style);
if (tb.childNodes.length == 1)
- DOM.addClass(ro, 'first');
+ DOM.addClass(ro, 'mceFirst');
if ((n = ro.previousSibling) && DOM.hasClass(n, 'mceMenuItemSeparator'))
- DOM.addClass(ro, 'first');
+ DOM.addClass(ro, 'mceFirst');
if (o.collapse)
DOM.addClass(ro, 'mceMenuItemSub');
if (n = ro.previousSibling)
- DOM.removeClass(n, 'last');
-
- DOM.addClass(ro, 'last');
+ DOM.removeClass(n, 'mceLast');
+
+ DOM.addClass(ro, 'mceLast');
}
});
@@ -4937,9 +4989,9 @@
var s = this.settings, h = '';
if (s.image)
- h += '';
+ h += '';
else
- h += '';
+ h += '';
return h;
},
@@ -4994,11 +5046,11 @@
// If no item was found then present title
if (!fv) {
DOM.setHTML(e, DOM.encode(t.settings.title));
- DOM.addClass(e, 'title');
+ DOM.addClass(e, 'mceTitle');
e = 0;
return;
} else
- DOM.removeClass(e, 'title');
+ DOM.removeClass(e, 'mceTitle');
}
e = 0;
@@ -5025,8 +5077,8 @@
var h = '', t = this, s = t.settings;
h = '
' + DOM.createHTML('a', {id : t.id + '_text', href : 'javascript:;', 'class' : 'text', onclick : "return false;", onmousedown : 'return false;'}, DOM.encode(t.settings.title)) + ' | '; - h += '' + DOM.createHTML('a', {id : t.id + '_open', href : 'javascript:;', 'class' : 'open', onclick : "return false;", onmousedown : 'return false;'}, '') + ' | '; + h += '' + DOM.createHTML('a', {id : t.id + '_text', href : 'javascript:;', 'class' : 'mceText', onclick : "return false;", onmousedown : 'return false;'}, DOM.encode(t.settings.title)) + ' | '; + h += '' + DOM.createHTML('a', {id : t.id + '_open', href : 'javascript:;', 'class' : 'mceOpen', onclick : "return false;", onmousedown : 'return false;'}, '') + ' | '; h += '