- TinyMCE 3.3.2

release-0.6
alecpl 15 years ago
parent ce467384e2
commit 79990754f6

File diff suppressed because one or more lines are too long

@ -522,7 +522,7 @@
}, },
resizeTo : function(w, h) { resizeTo : function(w, h) {
var ed = this.editor, s = ed.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr'); var ed = this.editor, s = this.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr');
// Boundery fix box // Boundery fix box
w = Math.max(s.theme_advanced_resizing_min_width || 100, w); w = Math.max(s.theme_advanced_resizing_min_width || 100, w);
@ -531,8 +531,17 @@
h = Math.min(s.theme_advanced_resizing_max_height || 0xFFFF, h); h = Math.min(s.theme_advanced_resizing_max_height || 0xFFFF, h);
// Resize iframe and container // Resize iframe and container
DOM.setStyles(e, {width : '', height : ''}); DOM.setStyle(e, 'height', '');
DOM.setStyles(ifr, {width : w, height : h}); DOM.setStyle(ifr, 'height', h);
if (s.theme_advanced_resize_horizontal) {
DOM.setStyle(e, 'width', '');
DOM.setStyle(ifr, 'width', w);
// Make sure that the size is never smaller than the over all ui
if (w < e.clientWidth)
DOM.setStyle(ifr, 'width', e.clientWidth);
}
}, },
destroy : function() { destroy : function() {
@ -752,7 +761,8 @@
ed.onPostRender.add(function() { ed.onPostRender.add(function() {
Event.add(ed.id + '_resize', 'mousedown', function(e) { Event.add(ed.id + '_resize', 'mousedown', function(e) {
var mouseMoveHandler1, mouseMoveHandler2, mouseUpHandler, var mouseMoveHandler1, mouseMoveHandler2,
mouseUpHandler1, mouseUpHandler2,
startX, startY, startWidth, startHeight, width, height, ifrElm; startX, startY, startWidth, startHeight, width, height, ifrElm;
function resizeOnMove(e) { function resizeOnMove(e) {
@ -762,6 +772,22 @@
t.resizeTo(width, height); t.resizeTo(width, height);
}; };
function endResize(e) {
// Stop listening
Event.remove(DOM.doc, 'mousemove', mouseMoveHandler1);
Event.remove(ed.getDoc(), 'mousemove', mouseMoveHandler2);
Event.remove(DOM.doc, 'mouseup', mouseUpHandler1);
Event.remove(ed.getDoc(), 'mouseup', mouseUpHandler2);
// Store away the size
if (s.theme_advanced_resizing_use_cookie) {
Cookie.setHash("TinyMCE_" + ed.id + "_size", {
cw : width,
ch : height
});
}
};
e.preventDefault(); e.preventDefault();
// Get the current rect size // Get the current rect size
@ -774,20 +800,8 @@
// Register envent handlers // Register envent handlers
mouseMoveHandler1 = Event.add(DOM.doc, 'mousemove', resizeOnMove); mouseMoveHandler1 = Event.add(DOM.doc, 'mousemove', resizeOnMove);
mouseMoveHandler2 = Event.add(ed.getDoc(), 'mousemove', resizeOnMove); mouseMoveHandler2 = Event.add(ed.getDoc(), 'mousemove', resizeOnMove);
mouseUpHandler = Event.add(DOM.doc, 'mouseup', function(e) { mouseUpHandler1 = Event.add(DOM.doc, 'mouseup', endResize);
// Stop listening mouseUpHandler2 = Event.add(ed.getDoc(), 'mouseup', endResize);
Event.remove(DOM.doc, 'mousemove', mouseMoveHandler1);
Event.remove(ed.getDoc(), 'mousemove', mouseMoveHandler2);
Event.remove(DOM.doc, 'mouseup', mouseUpHandler);
// Store away the size
if (s.theme_advanced_resizing_use_cookie) {
Cookie.setHash("TinyMCE_" + ed.id + "_size", {
cw : width,
ch : height
});
}
});
}); });
}); });
} }
@ -797,7 +811,7 @@
}, },
_nodeChanged : function(ed, cm, n, co, ob) { _nodeChanged : function(ed, cm, n, co, ob) {
var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn; var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn, formatNames, matches;
tinymce.each(t.stateControls, function(c) { tinymce.each(t.stateControls, function(c) {
cm.setActive(c, ed.queryCommandState(t.controls[c][1])); cm.setActive(c, ed.queryCommandState(t.controls[c][1]));
@ -847,10 +861,13 @@
if (c = cm.get('styleselect')) { if (c = cm.get('styleselect')) {
t._importClasses(); t._importClasses();
// Check each format and update formatNames = [];
c.select(function(fmt) { each(c.items, function(item) {
return !!ed.formatter.match(fmt); formatNames.push(item.value);
}); });
matches = ed.formatter.matchAll(formatNames);
c.select(matches[0]);
} }
if (c = cm.get('formatselect')) { if (c = cm.get('formatselect')) {

File diff suppressed because one or more lines are too long

@ -5,9 +5,9 @@
var tinymce = { var tinymce = {
majorVersion : '3', majorVersion : '3',
minorVersion : '3.1', minorVersion : '3.2',
releaseDate : '2010-03-18', releaseDate : '2010-03-25',
_init : function() { _init : function() {
var t = this, d = document, na = navigator, ua = na.userAgent, i, nl, n, base, p, v; 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) { nodeIndex : function(node, normalized) {
var idx = 0, lastNodeType, nodeType; var idx = 0, lastNodeType, lastNode, nodeType;
if (node) { if (node) {
for (lastNodeType = node.nodeType, node = node.previousSibling, lastNode = node; node; node = node.previousSibling) { for (lastNodeType = node.nodeType, node = node.previousSibling, lastNode = node; node; node = node.previousSibling) {
@ -5102,7 +5102,7 @@ window.tinymce.dom.Sizzle = Sizzle;
getStart : function() { getStart : function() {
var t = this, r = t.getRng(), e; var t = this, r = t.getRng(), e;
if (isIE) { if (r.duplicate || r.item) {
if (r.item) if (r.item)
return r.item(0); return r.item(0);
@ -5130,7 +5130,7 @@ window.tinymce.dom.Sizzle = Sizzle;
getEnd : function() { getEnd : function() {
var t = this, r = t.getRng(), e, eo; var t = this, r = t.getRng(), e, eo;
if (isIE) { if (r.duplicate || r.item) {
if (r.item) if (r.item)
return r.item(0); return r.item(0);
@ -5176,7 +5176,7 @@ window.tinymce.dom.Sizzle = Sizzle;
function getPoint(rng, start) { function getPoint(rng, start) {
var container = rng[start ? 'startContainer' : 'endContainer'], 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 (container.nodeType == 3) {
if (normalized) { 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 // This can occur when the editor is placed in a hidden container element on Gecko
// Or on IE when there was an exception // Or on IE when there was an exception
if (!r) 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; return r;
}, },
@ -5509,7 +5509,7 @@ window.tinymce.dom.Sizzle = Sizzle;
getNode : function() { getNode : function() {
var t = this, rng = t.getRng(), sel = t.getSel(), elm; 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 // Range maybe lost after the editor is made visible again
if (!rng) if (!rng)
return t.dom.getRoot(); return t.dom.getRoot();
@ -8179,7 +8179,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
}, },
getLength : function() { getLength : function() {
return DOM.get(this.id).options.length - 1; return this.items.length;
}, },
renderHTML : function() { renderHTML : function() {
@ -9522,7 +9522,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
hilitecolor : {inline : 'span', styles : {backgroundColor : '%value'}}, hilitecolor : {inline : 'span', styles : {backgroundColor : '%value'}},
fontname : {inline : 'span', styles : {fontFamily : '%value'}}, fontname : {inline : 'span', styles : {fontFamily : '%value'}},
fontsize : {inline : 'span', styles : {fontSize : '%value'}}, fontsize : {inline : 'span', styles : {fontSize : '%value'}},
blockquote : {block : 'blockquote', wrapper : 1}, blockquote : {block : 'blockquote', wrapper : 1, remove : 'all'},
removeformat : [ removeformat : [
{selector : 'b,strong,em,i,font,u,strike', remove : 'all', split : true, expand : false, block_expand : true, deep : true}, {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 // Register default block formats
each('p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp'.split(/\s/), function(name) { 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 // Register user defined formats
@ -9882,7 +9882,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
}, },
nodeChanged : function(o) { 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 // Fix for bug #1896577 it seems that this can not be fired while the editor is loading
if (t.initialized) { if (t.initialized) {
@ -12562,6 +12562,10 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
undefined, undefined,
pendingFormats = {apply : [], remove : []}; pendingFormats = {apply : [], remove : []};
function isArray(obj) {
return obj instanceof Array;
};
function getParents(node, selector) { function getParents(node, selector) {
return dom.getParents(node, selector, dom.getRoot()); return dom.getParents(node, selector, dom.getRoot());
}; };
@ -13106,6 +13110,54 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
return FALSE; 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) { function canApply(name) {
var formatList = get(name), startNode, parents, i, x, selector; var formatList = get(name), startNode, parents, i, x, selector;
@ -13138,6 +13190,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
remove : remove, remove : remove,
toggle : toggle, toggle : toggle,
match : match, match : match,
matchAll : matchAll,
matchNode : matchNode, matchNode : matchNode,
canApply : canApply canApply : canApply
}); });
@ -13162,8 +13215,8 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
str1 = str1 || ''; str1 = str1 || '';
str2 = str2 || ''; str2 = str2 || '';
str1 = str1.nodeName || str1; str1 = '' + (str1.nodeName || str1);
str2 = str2.nodeName || str2; str2 = '' + (str2.nodeName || str2);
return str1.toLowerCase() == str2.toLowerCase(); return str1.toLowerCase() == str2.toLowerCase();
}; };

Loading…
Cancel
Save