mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
Tinymce v3.5.8 with fixes
This commit is contained in:
parent
10411a2dc3
commit
e03a97718e
File diff suppressed because one or more lines are too long
@ -150,7 +150,7 @@
|
|||||||
|
|
||||||
init : function(ed, url) {
|
init : function(ed, url) {
|
||||||
var t = this, s, v, o;
|
var t = this, s, v, o;
|
||||||
|
|
||||||
t.editor = ed;
|
t.editor = ed;
|
||||||
t.url = url;
|
t.url = url;
|
||||||
t.onResolveName = new tinymce.util.Dispatcher(this);
|
t.onResolveName = new tinymce.util.Dispatcher(this);
|
||||||
@ -167,7 +167,7 @@
|
|||||||
theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap"
|
theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap"
|
||||||
}, s);
|
}, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default settings
|
// Default settings
|
||||||
t.settings = s = extend({
|
t.settings = s = extend({
|
||||||
theme_advanced_path : true,
|
theme_advanced_path : true,
|
||||||
@ -678,7 +678,7 @@
|
|||||||
if (DOM.get(ed.id + '_path_row')) {
|
if (DOM.get(ed.id + '_path_row')) {
|
||||||
Event.add(ed.id + '_tbl', 'mouseover', function(e) {
|
Event.add(ed.id + '_tbl', 'mouseover', function(e) {
|
||||||
var re;
|
var re;
|
||||||
|
|
||||||
e = e.target;
|
e = e.target;
|
||||||
|
|
||||||
if (e.nodeName == 'SPAN' && DOM.hasClass(e.parentNode, 'mceButton')) {
|
if (e.nodeName == 'SPAN' && DOM.hasClass(e.parentNode, 'mceButton')) {
|
||||||
@ -956,7 +956,7 @@
|
|||||||
a = s.theme_advanced_toolbar_align.toLowerCase();
|
a = s.theme_advanced_toolbar_align.toLowerCase();
|
||||||
a = 'mce' + t._ufirst(a);
|
a = 'mce' + t._ufirst(a);
|
||||||
|
|
||||||
n = DOM.add(DOM.add(c, 'tr', {role: 'presentation'}), 'td', {'class' : 'mceToolbar ' + a, "role":"presentation"});
|
n = DOM.add(DOM.add(c, 'tr', {role: 'presentation'}), 'td', {'class' : 'mceToolbar ' + a, "role":"toolbar"});
|
||||||
|
|
||||||
// Create toolbar and add the controls
|
// Create toolbar and add the controls
|
||||||
for (i=1; (v = s['theme_advanced_buttons' + i]); i++) {
|
for (i=1; (v = s['theme_advanced_buttons' + i]); i++) {
|
||||||
@ -986,7 +986,7 @@
|
|||||||
var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td;
|
var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td;
|
||||||
|
|
||||||
n = DOM.add(tb, 'tr');
|
n = DOM.add(tb, 'tr');
|
||||||
n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'});
|
n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'});
|
||||||
n = DOM.add(n, 'div', {id : ed.id + '_path_row', 'role': 'group', 'aria-labelledby': ed.id + '_path_voice'});
|
n = DOM.add(n, 'div', {id : ed.id + '_path_row', 'role': 'group', 'aria-labelledby': ed.id + '_path_voice'});
|
||||||
if (s.theme_advanced_path) {
|
if (s.theme_advanced_path) {
|
||||||
DOM.add(n, 'span', {id: ed.id + '_path_voice'}, ed.translate('advanced.path'));
|
DOM.add(n, 'span', {id: ed.id + '_path_voice'}, ed.translate('advanced.path'));
|
||||||
@ -994,7 +994,7 @@
|
|||||||
} else {
|
} else {
|
||||||
DOM.add(n, 'span', {}, ' ');
|
DOM.add(n, 'span', {}, ' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (s.theme_advanced_resizing) {
|
if (s.theme_advanced_resizing) {
|
||||||
DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize', tabIndex:"-1"});
|
DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize', tabIndex:"-1"});
|
||||||
@ -1154,7 +1154,7 @@
|
|||||||
|
|
||||||
if (!fn && n.style.fontFamily)
|
if (!fn && n.style.fontFamily)
|
||||||
fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase();
|
fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase();
|
||||||
|
|
||||||
if (!fc && n.style.color)
|
if (!fc && n.style.color)
|
||||||
fc = n.style.color;
|
fc = n.style.color;
|
||||||
|
|
||||||
@ -1185,7 +1185,7 @@
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s.theme_advanced_show_current_color) {
|
if (s.theme_advanced_show_current_color) {
|
||||||
function updateColor(controlId, color) {
|
function updateColor(controlId, color) {
|
||||||
if (c = cm.get(controlId)) {
|
if (c = cm.get(controlId)) {
|
||||||
|
2
e107_plugins/tinymce/tiny_mce.js
vendored
2
e107_plugins/tinymce/tiny_mce.js
vendored
File diff suppressed because one or more lines are too long
285
e107_plugins/tinymce/tiny_mce_src.js
vendored
285
e107_plugins/tinymce/tiny_mce_src.js
vendored
@ -6,9 +6,9 @@
|
|||||||
var tinymce = {
|
var tinymce = {
|
||||||
majorVersion : '3',
|
majorVersion : '3',
|
||||||
|
|
||||||
minorVersion : '5.6',
|
minorVersion : '5.8',
|
||||||
|
|
||||||
releaseDate : '2012-07-26',
|
releaseDate : '2012-11-20',
|
||||||
|
|
||||||
_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;
|
||||||
@ -107,12 +107,16 @@
|
|||||||
if (!t)
|
if (!t)
|
||||||
return o !== undef;
|
return o !== undef;
|
||||||
|
|
||||||
if (t == 'array' && (o.hasOwnProperty && o instanceof Array))
|
if (t == 'array' && tinymce.isArray(o))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return typeof(o) == t;
|
return typeof(o) == t;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isArray: Array.isArray || function(obj) {
|
||||||
|
return Object.prototype.toString.call(obj) === "[object Array]";
|
||||||
|
},
|
||||||
|
|
||||||
makeMap : function(items, delim, map) {
|
makeMap : function(items, delim, map) {
|
||||||
var i;
|
var i;
|
||||||
|
|
||||||
@ -1173,7 +1177,7 @@ tinymce.create('tinymce.util.Dispatcher', {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (t == 'object') {
|
if (t == 'object') {
|
||||||
if (o.hasOwnProperty && o instanceof Array) {
|
if (o.hasOwnProperty && Object.prototype.toString.call(o) === '[object Array]') {
|
||||||
for (i=0, v = '['; i<o.length; i++)
|
for (i=0, v = '['; i<o.length; i++)
|
||||||
v += (i > 0 ? ',' : '') + serialize(o[i], quote);
|
v += (i > 0 ? ',' : '') + serialize(o[i], quote);
|
||||||
|
|
||||||
@ -1345,7 +1349,8 @@ tinymce.create('static tinymce.util.XHR', {
|
|||||||
})(tinymce);
|
})(tinymce);
|
||||||
|
|
||||||
tinymce.util.Quirks = function(editor) {
|
tinymce.util.Quirks = function(editor) {
|
||||||
var VK = tinymce.VK, BACKSPACE = VK.BACKSPACE, DELETE = VK.DELETE, dom = editor.dom, selection = editor.selection, settings = editor.settings;
|
var VK = tinymce.VK, BACKSPACE = VK.BACKSPACE, DELETE = VK.DELETE, dom = editor.dom, selection = editor.selection,
|
||||||
|
settings = editor.settings, parser = editor.parser, serializer = editor.serializer, each = tinymce.each;
|
||||||
|
|
||||||
function setEditorCommandState(cmd, state) {
|
function setEditorCommandState(cmd, state) {
|
||||||
try {
|
try {
|
||||||
@ -1361,6 +1366,10 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
return documentMode ? documentMode : 6;
|
return documentMode ? documentMode : 6;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function isDefaultPrevented(e) {
|
||||||
|
return e.isDefaultPrevented();
|
||||||
|
};
|
||||||
|
|
||||||
function cleanupStylesWhenDeleting() {
|
function cleanupStylesWhenDeleting() {
|
||||||
function removeMergedFormatSpans(isDelete) {
|
function removeMergedFormatSpans(isDelete) {
|
||||||
var rng, blockElm, node, clonedSpan;
|
var rng, blockElm, node, clonedSpan;
|
||||||
@ -1371,46 +1380,54 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
blockElm = dom.getParent(rng.startContainer, dom.isBlock);
|
blockElm = dom.getParent(rng.startContainer, dom.isBlock);
|
||||||
|
|
||||||
// On delete clone the root span of the next block element
|
// On delete clone the root span of the next block element
|
||||||
if (isDelete)
|
if (isDelete) {
|
||||||
blockElm = dom.getNext(blockElm, dom.isBlock);
|
blockElm = dom.getNext(blockElm, dom.isBlock);
|
||||||
|
}
|
||||||
|
|
||||||
// Locate root span element and clone it since it would otherwise get merged by the "apple-style-span" on delete/backspace
|
// Locate root span element and clone it since it would otherwise get merged by the "apple-style-span" on delete/backspace
|
||||||
if (blockElm) {
|
if (blockElm) {
|
||||||
node = blockElm.firstChild;
|
node = blockElm.firstChild;
|
||||||
|
|
||||||
// Ignore empty text nodes
|
// Ignore empty text nodes
|
||||||
while (node && node.nodeType == 3 && node.nodeValue.length === 0)
|
while (node && node.nodeType == 3 && node.nodeValue.length === 0) {
|
||||||
node = node.nextSibling;
|
node = node.nextSibling;
|
||||||
|
}
|
||||||
|
|
||||||
if (node && node.nodeName === 'SPAN') {
|
if (node && node.nodeName === 'SPAN') {
|
||||||
clonedSpan = node.cloneNode(false);
|
clonedSpan = node.cloneNode(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
each(dom.select('span', blockElm), function(span) {
|
||||||
|
span.setAttribute('data-mce-mark', '1');
|
||||||
|
});
|
||||||
|
|
||||||
// Do the backspace/delete action
|
// Do the backspace/delete action
|
||||||
editor.getDoc().execCommand(isDelete ? 'ForwardDelete' : 'Delete', false, null);
|
editor.getDoc().execCommand(isDelete ? 'ForwardDelete' : 'Delete', false, null);
|
||||||
|
|
||||||
// Find all odd apple-style-spans
|
// Find all odd apple-style-spans
|
||||||
blockElm = dom.getParent(rng.startContainer, dom.isBlock);
|
blockElm = dom.getParent(rng.startContainer, dom.isBlock);
|
||||||
tinymce.each(dom.select('span.Apple-style-span,font.Apple-style-span', blockElm), function(span) {
|
each(dom.select('span', blockElm), function(span) {
|
||||||
var bm = selection.getBookmark();
|
var bm = selection.getBookmark();
|
||||||
|
|
||||||
if (clonedSpan) {
|
if (clonedSpan) {
|
||||||
dom.replace(clonedSpan.cloneNode(false), span, true);
|
dom.replace(clonedSpan.cloneNode(false), span, true);
|
||||||
} else {
|
} else if (!span.getAttribute('data-mce-mark')) {
|
||||||
dom.remove(span, true);
|
dom.remove(span, true);
|
||||||
|
} else {
|
||||||
|
span.removeAttribute('data-mce-mark');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore the selection
|
// Restore the selection
|
||||||
selection.moveToBookmark(bm);
|
selection.moveToBookmark(bm);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
editor.onKeyDown.add(function(editor, e) {
|
editor.onKeyDown.add(function(editor, e) {
|
||||||
var isDelete;
|
var isDelete;
|
||||||
|
|
||||||
isDelete = e.keyCode == DELETE;
|
isDelete = e.keyCode == DELETE;
|
||||||
if (!e.isDefaultPrevented() && (isDelete || e.keyCode == BACKSPACE) && !VK.modifierPressed(e)) {
|
if (!isDefaultPrevented(e) && (isDelete || e.keyCode == BACKSPACE) && !VK.modifierPressed(e)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
removeMergedFormatSpans(isDelete);
|
removeMergedFormatSpans(isDelete);
|
||||||
}
|
}
|
||||||
@ -1441,7 +1458,7 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
var keyCode = e.keyCode, isCollapsed;
|
var keyCode = e.keyCode, isCollapsed;
|
||||||
|
|
||||||
// Empty the editor if it's needed for example backspace at <p><b>|</b></p>
|
// Empty the editor if it's needed for example backspace at <p><b>|</b></p>
|
||||||
if (!e.isDefaultPrevented() && (keyCode == DELETE || keyCode == BACKSPACE)) {
|
if (!isDefaultPrevented(e) && (keyCode == DELETE || keyCode == BACKSPACE)) {
|
||||||
isCollapsed = editor.selection.isCollapsed();
|
isCollapsed = editor.selection.isCollapsed();
|
||||||
|
|
||||||
// Selection is collapsed but the editor isn't empty
|
// Selection is collapsed but the editor isn't empty
|
||||||
@ -1469,7 +1486,7 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
|
|
||||||
function selectAll() {
|
function selectAll() {
|
||||||
editor.onKeyDown.add(function(editor, e) {
|
editor.onKeyDown.add(function(editor, e) {
|
||||||
if (e.keyCode == 65 && VK.metaKeyPressed(e)) {
|
if (!isDefaultPrevented(e) && e.keyCode == 65 && VK.metaKeyPressed(e)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
editor.execCommand('SelectAll');
|
editor.execCommand('SelectAll');
|
||||||
}
|
}
|
||||||
@ -1495,7 +1512,7 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
|
|
||||||
function removeHrOnBackspace() {
|
function removeHrOnBackspace() {
|
||||||
editor.onKeyDown.add(function(editor, e) {
|
editor.onKeyDown.add(function(editor, e) {
|
||||||
if (!e.isDefaultPrevented() && e.keyCode === BACKSPACE) {
|
if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) {
|
||||||
if (selection.isCollapsed() && selection.getRng(true).startOffset === 0) {
|
if (selection.isCollapsed() && selection.getRng(true).startOffset === 0) {
|
||||||
var node = selection.getNode();
|
var node = selection.getNode();
|
||||||
var previousSibling = node.previousSibling;
|
var previousSibling = node.previousSibling;
|
||||||
@ -1514,7 +1531,7 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
// wouldn't get proper focus if the user clicked on the HTML element
|
// wouldn't get proper focus if the user clicked on the HTML element
|
||||||
if (!Range.prototype.getClientRects) { // Detect getClientRects got introduced in FF 4
|
if (!Range.prototype.getClientRects) { // Detect getClientRects got introduced in FF 4
|
||||||
editor.onMouseDown.add(function(editor, e) {
|
editor.onMouseDown.add(function(editor, e) {
|
||||||
if (e.target.nodeName === "HTML") {
|
if (!isDefaultPrevented(e) && e.target.nodeName === "HTML") {
|
||||||
var body = editor.getBody();
|
var body = editor.getBody();
|
||||||
|
|
||||||
// Blur the body it's focused but not correctly focused
|
// Blur the body it's focused but not correctly focused
|
||||||
@ -1558,7 +1575,7 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
if (target !== editor.getBody()) {
|
if (target !== editor.getBody()) {
|
||||||
dom.setAttrib(target, "style", null);
|
dom.setAttrib(target, "style", null);
|
||||||
|
|
||||||
tinymce.each(template, function(attr) {
|
each(template, function(attr) {
|
||||||
target.setAttributeNode(attr.cloneNode(true));
|
target.setAttributeNode(attr.cloneNode(true));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1577,7 +1594,7 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
editor.onKeyPress.add(function(editor, e) {
|
editor.onKeyPress.add(function(editor, e) {
|
||||||
var applyAttributes;
|
var applyAttributes;
|
||||||
|
|
||||||
if ((e.keyCode == 8 || e.keyCode == 46) && isSelectionAcrossElements()) {
|
if (!isDefaultPrevented(e) && (e.keyCode == 8 || e.keyCode == 46) && isSelectionAcrossElements()) {
|
||||||
applyAttributes = getAttributeApplyFunction();
|
applyAttributes = getAttributeApplyFunction();
|
||||||
editor.getDoc().execCommand('delete', false, null);
|
editor.getDoc().execCommand('delete', false, null);
|
||||||
applyAttributes();
|
applyAttributes();
|
||||||
@ -1589,7 +1606,7 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
dom.bind(editor.getDoc(), 'cut', function(e) {
|
dom.bind(editor.getDoc(), 'cut', function(e) {
|
||||||
var applyAttributes;
|
var applyAttributes;
|
||||||
|
|
||||||
if (isSelectionAcrossElements()) {
|
if (!isDefaultPrevented(e) && isSelectionAcrossElements()) {
|
||||||
applyAttributes = getAttributeApplyFunction();
|
applyAttributes = getAttributeApplyFunction();
|
||||||
editor.onKeyUp.addToTop(blockEvent);
|
editor.onKeyUp.addToTop(blockEvent);
|
||||||
|
|
||||||
@ -1628,7 +1645,7 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
|
|
||||||
function disableBackspaceIntoATable() {
|
function disableBackspaceIntoATable() {
|
||||||
editor.onKeyDown.add(function(editor, e) {
|
editor.onKeyDown.add(function(editor, e) {
|
||||||
if (!e.isDefaultPrevented() && e.keyCode === BACKSPACE) {
|
if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) {
|
||||||
if (selection.isCollapsed() && selection.getRng(true).startOffset === 0) {
|
if (selection.isCollapsed() && selection.getRng(true).startOffset === 0) {
|
||||||
var previousSibling = selection.getNode().previousSibling;
|
var previousSibling = selection.getNode().previousSibling;
|
||||||
if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "table") {
|
if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "table") {
|
||||||
@ -1652,7 +1669,7 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
dom.addClass(editor.getBody(), 'mceHideBrInPre');
|
dom.addClass(editor.getBody(), 'mceHideBrInPre');
|
||||||
|
|
||||||
// Adds a \n before all BR elements in PRE to get them visual
|
// Adds a \n before all BR elements in PRE to get them visual
|
||||||
editor.parser.addNodeFilter('pre', function(nodes, name) {
|
parser.addNodeFilter('pre', function(nodes, name) {
|
||||||
var i = nodes.length, brNodes, j, brElm, sibling;
|
var i = nodes.length, brNodes, j, brElm, sibling;
|
||||||
|
|
||||||
while (i--) {
|
while (i--) {
|
||||||
@ -1673,7 +1690,7 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Removes any \n before BR elements in PRE since other browsers and in contentEditable=false mode they will be visible
|
// Removes any \n before BR elements in PRE since other browsers and in contentEditable=false mode they will be visible
|
||||||
editor.serializer.addNodeFilter('pre', function(nodes, name) {
|
serializer.addNodeFilter('pre', function(nodes, name) {
|
||||||
var i = nodes.length, brNodes, j, brElm, sibling;
|
var i = nodes.length, brNodes, j, brElm, sibling;
|
||||||
|
|
||||||
while (i--) {
|
while (i--) {
|
||||||
@ -1716,7 +1733,7 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
var isDelete, rng, container, offset, brElm, sibling, collapsed;
|
var isDelete, rng, container, offset, brElm, sibling, collapsed;
|
||||||
|
|
||||||
isDelete = e.keyCode == DELETE;
|
isDelete = e.keyCode == DELETE;
|
||||||
if (!e.isDefaultPrevented() && (isDelete || e.keyCode == BACKSPACE) && !VK.modifierPressed(e)) {
|
if (!isDefaultPrevented(e) && (isDelete || e.keyCode == BACKSPACE) && !VK.modifierPressed(e)) {
|
||||||
rng = selection.getRng();
|
rng = selection.getRng();
|
||||||
container = rng.startContainer;
|
container = rng.startContainer;
|
||||||
offset = rng.startOffset;
|
offset = rng.startOffset;
|
||||||
@ -1756,7 +1773,7 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
editor.onKeyDown.add(function(editor, e) {
|
editor.onKeyDown.add(function(editor, e) {
|
||||||
var rng, container, offset, root, parent;
|
var rng, container, offset, root, parent;
|
||||||
|
|
||||||
if (e.isDefaultPrevented() || e.keyCode != VK.BACKSPACE) {
|
if (isDefaultPrevented(e) || e.keyCode != VK.BACKSPACE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1780,10 +1797,10 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
editor.formatter.toggle('blockquote', null, parent);
|
editor.formatter.toggle('blockquote', null, parent);
|
||||||
|
|
||||||
// Move the caret to the beginning of container
|
// Move the caret to the beginning of container
|
||||||
|
rng = dom.createRng();
|
||||||
rng.setStart(container, 0);
|
rng.setStart(container, 0);
|
||||||
rng.setEnd(container, 0);
|
rng.setEnd(container, 0);
|
||||||
selection.setRng(rng);
|
selection.setRng(rng);
|
||||||
selection.collapse(false);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -1808,7 +1825,7 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
|
|
||||||
function addBrAfterLastLinks() {
|
function addBrAfterLastLinks() {
|
||||||
function fixLinks(editor, o) {
|
function fixLinks(editor, o) {
|
||||||
tinymce.each(dom.select('a'), function(node) {
|
each(dom.select('a'), function(node) {
|
||||||
var parentNode = node.parentNode, root = dom.getRoot();
|
var parentNode = node.parentNode, root = dom.getRoot();
|
||||||
|
|
||||||
if (parentNode.lastChild === node) {
|
if (parentNode.lastChild === node) {
|
||||||
@ -1858,7 +1875,7 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
editor.onKeyDown.add(function(editor, e) {
|
editor.onKeyDown.add(function(editor, e) {
|
||||||
var rng;
|
var rng;
|
||||||
|
|
||||||
if (!e.isDefaultPrevented() && e.keyCode == BACKSPACE) {
|
if (!isDefaultPrevented(e) && e.keyCode == BACKSPACE) {
|
||||||
rng = editor.getDoc().selection.createRange();
|
rng = editor.getDoc().selection.createRange();
|
||||||
if (rng && rng.item) {
|
if (rng && rng.item) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -1876,7 +1893,7 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
// IE10+
|
// IE10+
|
||||||
if (getDocumentMode() >= 10) {
|
if (getDocumentMode() >= 10) {
|
||||||
emptyBlocksCSS = '';
|
emptyBlocksCSS = '';
|
||||||
tinymce.each('p div h1 h2 h3 h4 h5 h6'.split(' '), function(name, i) {
|
each('p div h1 h2 h3 h4 h5 h6'.split(' '), function(name, i) {
|
||||||
emptyBlocksCSS += (i > 0 ? ',' : '') + name + ':empty';
|
emptyBlocksCSS += (i > 0 ? ',' : '') + name + ':empty';
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1993,7 +2010,7 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
width = height = 0;
|
width = height = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
tinymce.each(resizeHandles, function(handle, name) {
|
each(resizeHandles, function(handle, name) {
|
||||||
var handleElm;
|
var handleElm;
|
||||||
|
|
||||||
// Get existing or render resize handle
|
// Get existing or render resize handle
|
||||||
@ -2090,7 +2107,7 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
var controlElm = dom.getParent(selection.getNode(), 'table,img');
|
var controlElm = dom.getParent(selection.getNode(), 'table,img');
|
||||||
|
|
||||||
// Remove data-mce-selected from all elements since they might have been copied using Ctrl+c/v
|
// Remove data-mce-selected from all elements since they might have been copied using Ctrl+c/v
|
||||||
tinymce.each(dom.select('img[data-mce-selected]'), function(img) {
|
each(dom.select('img[data-mce-selected]'), function(img) {
|
||||||
img.removeAttribute('data-mce-selected');
|
img.removeAttribute('data-mce-selected');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2117,6 +2134,46 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function keepNoScriptContents() {
|
||||||
|
if (getDocumentMode() < 9) {
|
||||||
|
parser.addNodeFilter('noscript', function(nodes) {
|
||||||
|
var i = nodes.length, node, textNode;
|
||||||
|
|
||||||
|
while (i--) {
|
||||||
|
node = nodes[i];
|
||||||
|
textNode = node.firstChild;
|
||||||
|
|
||||||
|
if (textNode) {
|
||||||
|
node.attr('data-mce-innertext', textNode.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
serializer.addNodeFilter('noscript', function(nodes) {
|
||||||
|
var i = nodes.length, node, textNode, value;
|
||||||
|
|
||||||
|
while (i--) {
|
||||||
|
node = nodes[i];
|
||||||
|
textNode = nodes[i].firstChild;
|
||||||
|
|
||||||
|
if (textNode) {
|
||||||
|
textNode.value = tinymce.html.Entities.decode(textNode.value);
|
||||||
|
} else {
|
||||||
|
// Old IE can't retain noscript value so an attribute is used to store it
|
||||||
|
value = node.attributes.map['data-mce-innertext'];
|
||||||
|
if (value) {
|
||||||
|
node.attr('data-mce-innertext', null);
|
||||||
|
textNode = new tinymce.html.Node('#text', 3);
|
||||||
|
textNode.value = value;
|
||||||
|
textNode.raw = true;
|
||||||
|
node.append(textNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// All browsers
|
// All browsers
|
||||||
disableBackspaceIntoATable();
|
disableBackspaceIntoATable();
|
||||||
removeBlockQuoteOnBackSpace();
|
removeBlockQuoteOnBackSpace();
|
||||||
@ -2147,6 +2204,7 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
removePreSerializedStylesWhenSelectingControls();
|
removePreSerializedStylesWhenSelectingControls();
|
||||||
deleteControlItemOnBackSpace();
|
deleteControlItemOnBackSpace();
|
||||||
renderEmptyBlocksFix();
|
renderEmptyBlocksFix();
|
||||||
|
keepNoScriptContents();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gecko
|
// Gecko
|
||||||
@ -2701,7 +2759,7 @@ tinymce.html.Styles = function(settings, schema) {
|
|||||||
'form[A|accept-charset|action|autocomplete|enctype|method|name|novalidate|target][C]' +
|
'form[A|accept-charset|action|autocomplete|enctype|method|name|novalidate|target][C]' +
|
||||||
'fieldset[A|disabled|form|name][C|legend]' +
|
'fieldset[A|disabled|form|name][C|legend]' +
|
||||||
'label[A|form|for][B]' +
|
'label[A|form|for][B]' +
|
||||||
'input[A|type|accept|alt|autocomplete|checked|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|height|list|max|maxlength|min|' +
|
'input[A|type|accept|alt|autocomplete|autofocus|checked|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|height|list|max|maxlength|min|' +
|
||||||
'multiple|pattern|placeholder|readonly|required|size|src|step|width|files|value|name][]' +
|
'multiple|pattern|placeholder|readonly|required|size|src|step|width|files|value|name][]' +
|
||||||
'button[A|autofocus|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|name|value|type][B]' +
|
'button[A|autofocus|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|name|value|type][B]' +
|
||||||
'select[A|autofocus|disabled|form|multiple|name|size][option|optgroup]' +
|
'select[A|autofocus|disabled|form|multiple|name|size][option|optgroup]' +
|
||||||
@ -2905,14 +2963,15 @@ tinymce.html.Styles = function(settings, schema) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup map objects
|
// Setup map objects
|
||||||
whiteSpaceElementsMap = createLookupTable('whitespace_elements', 'pre script style textarea');
|
whiteSpaceElementsMap = createLookupTable('whitespace_elements', 'pre script noscript style textarea');
|
||||||
selfClosingElementsMap = createLookupTable('self_closing_elements', 'colgroup dd dt li option p td tfoot th thead tr');
|
selfClosingElementsMap = createLookupTable('self_closing_elements', 'colgroup dd dt li option p td tfoot th thead tr');
|
||||||
shortEndedElementsMap = createLookupTable('short_ended_elements', 'area base basefont br col frame hr img input isindex link meta param embed source wbr');
|
shortEndedElementsMap = createLookupTable('short_ended_elements', 'area base basefont br col frame hr img input isindex link meta param embed source wbr');
|
||||||
boolAttrMap = createLookupTable('boolean_attributes', 'checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls');
|
boolAttrMap = createLookupTable('boolean_attributes', 'checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls');
|
||||||
nonEmptyElementsMap = createLookupTable('non_empty_elements', 'td th iframe video audio object', shortEndedElementsMap);
|
nonEmptyElementsMap = createLookupTable('non_empty_elements', 'td th iframe video audio object', shortEndedElementsMap);
|
||||||
blockElementsMap = createLookupTable('block_elements', 'h1 h2 h3 h4 h5 h6 hr p div address pre form table tbody thead tfoot ' +
|
textBlockElementsMap = createLookupTable('text_block_elements', 'h1 h2 h3 h4 h5 h6 p div address pre form ' +
|
||||||
'th tr td li ol ul caption blockquote center dl dt dd dir fieldset ' +
|
'blockquote center dir fieldset header footer article section hgroup aside nav figure');
|
||||||
'noscript menu isindex samp header footer article section hgroup aside nav figure option datalist select optgroup');
|
blockElementsMap = createLookupTable('block_elements', 'hr table tbody thead tfoot ' +
|
||||||
|
'th tr td li ol ul caption dl dt dd noscript menu isindex samp option datalist select optgroup', textBlockElementsMap);
|
||||||
|
|
||||||
// Converts a wildcard expression string to a regexp for example *a will become /.*a/.
|
// Converts a wildcard expression string to a regexp for example *a will become /.*a/.
|
||||||
function patternToRegExp(str) {
|
function patternToRegExp(str) {
|
||||||
@ -3086,8 +3145,15 @@ tinymce.html.Styles = function(settings, schema) {
|
|||||||
customElementsMap[name] = cloneName;
|
customElementsMap[name] = cloneName;
|
||||||
|
|
||||||
// If it's not marked as inline then add it to valid block elements
|
// If it's not marked as inline then add it to valid block elements
|
||||||
if (!inline)
|
if (!inline) {
|
||||||
|
blockElementsMap[name.toUpperCase()] = {};
|
||||||
blockElementsMap[name] = {};
|
blockElementsMap[name] = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add elements clone if needed
|
||||||
|
if (!elements[name]) {
|
||||||
|
elements[name] = elements[cloneName];
|
||||||
|
}
|
||||||
|
|
||||||
// Add custom elements at span/div positions
|
// Add custom elements at span/div positions
|
||||||
each(children, function(element, child) {
|
each(children, function(element, child) {
|
||||||
@ -3212,6 +3278,10 @@ tinymce.html.Styles = function(settings, schema) {
|
|||||||
return blockElementsMap;
|
return blockElementsMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.getTextBlockElements = function() {
|
||||||
|
return textBlockElementsMap;
|
||||||
|
};
|
||||||
|
|
||||||
self.getShortEndedElements = function() {
|
self.getShortEndedElements = function() {
|
||||||
return shortEndedElementsMap;
|
return shortEndedElementsMap;
|
||||||
};
|
};
|
||||||
@ -3277,6 +3347,8 @@ tinymce.html.Styles = function(settings, schema) {
|
|||||||
self.addCustomElements = addCustomElements;
|
self.addCustomElements = addCustomElements;
|
||||||
|
|
||||||
self.addValidChildren = addValidChildren;
|
self.addValidChildren = addValidChildren;
|
||||||
|
|
||||||
|
self.elements = elements;
|
||||||
};
|
};
|
||||||
})(tinymce);
|
})(tinymce);
|
||||||
|
|
||||||
@ -3375,10 +3447,10 @@ tinymce.html.Styles = function(settings, schema) {
|
|||||||
'(?:!DOCTYPE([\\w\\W]*?)>)|' + // DOCTYPE
|
'(?:!DOCTYPE([\\w\\W]*?)>)|' + // DOCTYPE
|
||||||
'(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|' + // PI
|
'(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|' + // PI
|
||||||
'(?:\\/([^>]+)>)|' + // End element
|
'(?:\\/([^>]+)>)|' + // End element
|
||||||
'(?:([A-Za-z0-9\\-\\:]+)((?:\\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\\/|\\s+)>)' + // Start element
|
'(?:([A-Za-z0-9\\-\\:\\.]+)((?:\\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\\/|\\s+)>)' + // Start element
|
||||||
')', 'g');
|
')', 'g');
|
||||||
|
|
||||||
attrRegExp = /([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:\\.|[^\"])*)\")|(?:\'((?:\\.|[^\'])*)\')|([^>\s]+)))?/g;
|
attrRegExp = /([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:[^\"])*)\")|(?:\'((?:[^\'])*)\')|([^>\s]+)))?/g;
|
||||||
specialElements = {
|
specialElements = {
|
||||||
'script' : /<\/script[^>]*>/gi,
|
'script' : /<\/script[^>]*>/gi,
|
||||||
'style' : /<\/style[^>]*>/gi,
|
'style' : /<\/style[^>]*>/gi,
|
||||||
@ -3861,7 +3933,7 @@ tinymce.html.Styles = function(settings, schema) {
|
|||||||
i = node.attributes.length;
|
i = node.attributes.length;
|
||||||
while (i--) {
|
while (i--) {
|
||||||
name = node.attributes[i].name;
|
name = node.attributes[i].name;
|
||||||
if (name === "name" || name.indexOf('data-') === 0)
|
if (name === "name" || name.indexOf('data-mce-') === 0)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3917,18 +3989,41 @@ tinymce.html.Styles = function(settings, schema) {
|
|||||||
|
|
||||||
function fixInvalidChildren(nodes) {
|
function fixInvalidChildren(nodes) {
|
||||||
var ni, node, parent, parents, newParent, currentNode, tempNode, childNode, i,
|
var ni, node, parent, parents, newParent, currentNode, tempNode, childNode, i,
|
||||||
childClone, nonEmptyElements, nonSplitableElements, sibling, nextNode;
|
childClone, nonEmptyElements, nonSplitableElements, textBlockElements, sibling, nextNode;
|
||||||
|
|
||||||
nonSplitableElements = tinymce.makeMap('tr,td,th,tbody,thead,tfoot,table');
|
nonSplitableElements = tinymce.makeMap('tr,td,th,tbody,thead,tfoot,table');
|
||||||
nonEmptyElements = schema.getNonEmptyElements();
|
nonEmptyElements = schema.getNonEmptyElements();
|
||||||
|
textBlockElements = schema.getTextBlockElements();
|
||||||
|
|
||||||
for (ni = 0; ni < nodes.length; ni++) {
|
for (ni = 0; ni < nodes.length; ni++) {
|
||||||
node = nodes[ni];
|
node = nodes[ni];
|
||||||
|
|
||||||
// Already removed
|
// Already removed or fixed
|
||||||
if (!node.parent)
|
if (!node.parent || node.fixed)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// If the invalid element is a text block and the text block is within a parent LI element
|
||||||
|
// Then unwrap the first text block and convert other sibling text blocks to LI elements similar to Word/Open Office
|
||||||
|
if (textBlockElements[node.name] && node.parent.name == 'li') {
|
||||||
|
// Move sibling text blocks after LI element
|
||||||
|
sibling = node.next;
|
||||||
|
while (sibling) {
|
||||||
|
if (textBlockElements[sibling.name]) {
|
||||||
|
sibling.name = 'li';
|
||||||
|
sibling.fixed = true;
|
||||||
|
node.parent.insert(sibling, node.parent);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
sibling = sibling.next;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unwrap current text block
|
||||||
|
node.unwrap(node);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Get list of all parent nodes until we find a valid parent to stick the child into
|
// Get list of all parent nodes until we find a valid parent to stick the child into
|
||||||
parents = [node];
|
parents = [node];
|
||||||
for (parent = node.parent; parent && !schema.isValidChild(parent.name, node.name) && !nonSplitableElements[parent.name]; parent = parent.parent)
|
for (parent = node.parent; parent && !schema.isValidChild(parent.name, node.name) && !nonSplitableElements[parent.name]; parent = parent.parent)
|
||||||
@ -4306,7 +4401,8 @@ tinymce.html.Styles = function(settings, schema) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Trim start white space
|
// Trim start white space
|
||||||
textNode = node.prev;
|
// Removed due to: #5424
|
||||||
|
/*textNode = node.prev;
|
||||||
if (textNode && textNode.type === 3) {
|
if (textNode && textNode.type === 3) {
|
||||||
text = textNode.value.replace(startWhiteSpaceRegExp, '');
|
text = textNode.value.replace(startWhiteSpaceRegExp, '');
|
||||||
|
|
||||||
@ -4314,7 +4410,7 @@ tinymce.html.Styles = function(settings, schema) {
|
|||||||
textNode.value = text;
|
textNode.value = text;
|
||||||
else
|
else
|
||||||
textNode.remove();
|
textNode.remove();
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we exited a whitespace preserved element
|
// Check if we exited a whitespace preserved element
|
||||||
@ -4824,6 +4920,12 @@ tinymce.dom = {};
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Page already loaded then fire it directly
|
||||||
|
if (doc.readyState == "complete") {
|
||||||
|
readyHandler();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Use W3C method
|
// Use W3C method
|
||||||
if (w3cEventModel) {
|
if (w3cEventModel) {
|
||||||
addEvent(win, 'DOMContentLoaded', readyHandler);
|
addEvent(win, 'DOMContentLoaded', readyHandler);
|
||||||
@ -5367,6 +5469,11 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
|
|||||||
blockElementsMap = s.schema ? s.schema.getBlockElements() : {};
|
blockElementsMap = s.schema ? s.schema.getBlockElements() : {};
|
||||||
|
|
||||||
t.isBlock = function(node) {
|
t.isBlock = function(node) {
|
||||||
|
// Fix for #5446
|
||||||
|
if (!node) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// This function is called in module pattern style since it might be executed with the wrong this scope
|
// This function is called in module pattern style since it might be executed with the wrong this scope
|
||||||
var type = node.nodeType;
|
var type = node.nodeType;
|
||||||
|
|
||||||
@ -9000,6 +9107,16 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
|
|||||||
return self;
|
return self;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
scrollIntoView: function(elm) {
|
||||||
|
var y, viewPort, self = this, dom = self.dom;
|
||||||
|
|
||||||
|
viewPort = dom.getViewPort(self.editor.getWin());
|
||||||
|
y = dom.getPos(elm).y;
|
||||||
|
if (y < viewPort.y || y + 25 > viewPort.y + viewPort.h) {
|
||||||
|
self.editor.getWin().scrollTo(0, y < viewPort.y ? y : y - viewPort.h + 25);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
destroy : function(manual) {
|
destroy : function(manual) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
@ -9172,6 +9289,18 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
htmlParser.addNodeFilter('noscript', function(nodes) {
|
||||||
|
var i = nodes.length, node;
|
||||||
|
|
||||||
|
while (i--) {
|
||||||
|
node = nodes[i].firstChild;
|
||||||
|
|
||||||
|
if (node) {
|
||||||
|
node.value = tinymce.html.Entities.decode(node.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Force script into CDATA sections and remove the mce- prefix also add comments around styles
|
// Force script into CDATA sections and remove the mce- prefix also add comments around styles
|
||||||
htmlParser.addNodeFilter('script,style', function(nodes, name) {
|
htmlParser.addNodeFilter('script,style', function(nodes, name) {
|
||||||
var i = nodes.length, node, value;
|
var i = nodes.length, node, value;
|
||||||
@ -11813,6 +11942,9 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
|
|||||||
if (id === undef)
|
if (id === undef)
|
||||||
return this.editors;
|
return this.editors;
|
||||||
|
|
||||||
|
if (!this.editors.hasOwnProperty(id))
|
||||||
|
return undef;
|
||||||
|
|
||||||
return this.editors[id];
|
return this.editors[id];
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -12339,10 +12471,12 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
|
|||||||
t.iframeHTML += '<base href="' + t.documentBaseURI.getURI() + '" />';
|
t.iframeHTML += '<base href="' + t.documentBaseURI.getURI() + '" />';
|
||||||
|
|
||||||
// IE8 doesn't support carets behind images setting ie7_compat would force IE8+ to run in IE7 compat mode.
|
// IE8 doesn't support carets behind images setting ie7_compat would force IE8+ to run in IE7 compat mode.
|
||||||
if (s.ie7_compat)
|
if (tinymce.isIE8) {
|
||||||
t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=7" />';
|
if (s.ie7_compat)
|
||||||
else
|
t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=7" />';
|
||||||
t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=edge" />';
|
else
|
||||||
|
t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=edge" />';
|
||||||
|
}
|
||||||
|
|
||||||
t.iframeHTML += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
|
t.iframeHTML += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
|
||||||
|
|
||||||
@ -12970,6 +13104,8 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
|
|||||||
|
|
||||||
// We must save before we hide so Safari doesn't crash
|
// We must save before we hide so Safari doesn't crash
|
||||||
self.save();
|
self.save();
|
||||||
|
|
||||||
|
// defer the call to hide to prevent an IE9 crash #4921
|
||||||
DOM.hide(self.getContainer());
|
DOM.hide(self.getContainer());
|
||||||
DOM.setStyle(self.id, 'display', self.orgDisplay);
|
DOM.setStyle(self.id, 'display', self.orgDisplay);
|
||||||
},
|
},
|
||||||
@ -13249,11 +13385,19 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
remove : function() {
|
remove : function() {
|
||||||
var self = this, elm = self.getContainer();
|
var self = this, elm = self.getContainer(), doc = self.getDoc();
|
||||||
|
|
||||||
if (!self.removed) {
|
if (!self.removed) {
|
||||||
self.removed = 1; // Cancels post remove event execution
|
self.removed = 1; // Cancels post remove event execution
|
||||||
self.hide();
|
|
||||||
|
// Fixed bug where IE has a blinking cursor left from the editor
|
||||||
|
if (isIE && doc)
|
||||||
|
doc.execCommand('SelectAll');
|
||||||
|
|
||||||
|
// We must save before we hide so Safari doesn't crash
|
||||||
|
self.save();
|
||||||
|
|
||||||
|
DOM.setStyle(self.id, 'display', self.orgDisplay);
|
||||||
|
|
||||||
// Don't clear the window or document if content editable
|
// Don't clear the window or document if content editable
|
||||||
// is enabled since other instances might still be present
|
// is enabled since other instances might still be present
|
||||||
@ -14246,7 +14390,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
|
|||||||
// Add undo level on save contents, drag end and blur/focusout
|
// Add undo level on save contents, drag end and blur/focusout
|
||||||
editor.onSaveContent.add(addNonTypingUndoLevel);
|
editor.onSaveContent.add(addNonTypingUndoLevel);
|
||||||
editor.dom.bind(editor.dom.getRoot(), 'dragend', addNonTypingUndoLevel);
|
editor.dom.bind(editor.dom.getRoot(), 'dragend', addNonTypingUndoLevel);
|
||||||
editor.dom.bind(editor.getDoc(), tinymce.isGecko ? 'blur' : 'focusout', function(e) {
|
editor.dom.bind(editor.getBody(), 'focusout', function(e) {
|
||||||
if (!editor.removed && self.typing) {
|
if (!editor.removed && self.typing) {
|
||||||
addNonTypingUndoLevel();
|
addNonTypingUndoLevel();
|
||||||
}
|
}
|
||||||
@ -15029,6 +15173,7 @@ tinymce.ForceBlocks = function(editor) {
|
|||||||
TreeWalker = tinymce.dom.TreeWalker,
|
TreeWalker = tinymce.dom.TreeWalker,
|
||||||
rangeUtils = new tinymce.dom.RangeUtils(dom),
|
rangeUtils = new tinymce.dom.RangeUtils(dom),
|
||||||
isValid = ed.schema.isValidChild,
|
isValid = ed.schema.isValidChild,
|
||||||
|
isArray = tinymce.isArray,
|
||||||
isBlock = dom.isBlock,
|
isBlock = dom.isBlock,
|
||||||
forcedRootBlock = ed.settings.forced_root_block,
|
forcedRootBlock = ed.settings.forced_root_block,
|
||||||
nodeIndex = dom.nodeIndex,
|
nodeIndex = dom.nodeIndex,
|
||||||
@ -15040,9 +15185,9 @@ tinymce.ForceBlocks = function(editor) {
|
|||||||
undef,
|
undef,
|
||||||
getContentEditable = dom.getContentEditable;
|
getContentEditable = dom.getContentEditable;
|
||||||
|
|
||||||
function isArray(obj) {
|
function isTextBlock(name) {
|
||||||
return obj instanceof Array;
|
return !!ed.schema.getTextBlocks()[name.toLowerCase()];
|
||||||
};
|
}
|
||||||
|
|
||||||
function getParents(node, selector) {
|
function getParents(node, selector) {
|
||||||
return dom.getParents(node, selector, dom.getRoot());
|
return dom.getParents(node, selector, dom.getRoot());
|
||||||
@ -15608,6 +15753,11 @@ tinymce.ForceBlocks = function(editor) {
|
|||||||
function process(node) {
|
function process(node) {
|
||||||
var children, i, l, localContentEditable, lastContentEditable, hasContentEditableState;
|
var children, i, l, localContentEditable, lastContentEditable, hasContentEditableState;
|
||||||
|
|
||||||
|
// Skip on text nodes as they have neither format to remove nor children
|
||||||
|
if (node.nodeType === 3) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Node has a contentEditable value
|
// Node has a contentEditable value
|
||||||
if (node.nodeType === 1 && getContentEditable(node)) {
|
if (node.nodeType === 1 && getContentEditable(node)) {
|
||||||
lastContentEditable = contentEditable;
|
lastContentEditable = contentEditable;
|
||||||
@ -16101,6 +16251,10 @@ tinymce.ForceBlocks = function(editor) {
|
|||||||
siblingName = start ? 'previousSibling' : 'nextSibling';
|
siblingName = start ? 'previousSibling' : 'nextSibling';
|
||||||
root = dom.getRoot();
|
root = dom.getRoot();
|
||||||
|
|
||||||
|
function isBogusBr(node) {
|
||||||
|
return node.nodeName == "BR" && node.getAttribute('data-mce-bogus') && !node.nextSibling;
|
||||||
|
};
|
||||||
|
|
||||||
// If it's a text node and the offset is inside the text
|
// If it's a text node and the offset is inside the text
|
||||||
if (container.nodeType == 3 && !isWhiteSpaceNode(container)) {
|
if (container.nodeType == 3 && !isWhiteSpaceNode(container)) {
|
||||||
if (start ? startOffset > 0 : endOffset < container.nodeValue.length) {
|
if (start ? startOffset > 0 : endOffset < container.nodeValue.length) {
|
||||||
@ -16115,7 +16269,7 @@ tinymce.ForceBlocks = function(editor) {
|
|||||||
|
|
||||||
// Walk left/right
|
// Walk left/right
|
||||||
for (sibling = parent[siblingName]; sibling; sibling = sibling[siblingName]) {
|
for (sibling = parent[siblingName]; sibling; sibling = sibling[siblingName]) {
|
||||||
if (!isBookmarkNode(sibling) && !isWhiteSpaceNode(sibling)) {
|
if (!isBookmarkNode(sibling) && !isWhiteSpaceNode(sibling) && !isBogusBr(sibling)) {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -16274,7 +16428,7 @@ tinymce.ForceBlocks = function(editor) {
|
|||||||
|
|
||||||
// Expand to first wrappable block element or any block element
|
// Expand to first wrappable block element or any block element
|
||||||
if (!node)
|
if (!node)
|
||||||
node = dom.getParent(container.nodeType == 3 ? container.parentNode : container, isBlock);
|
node = dom.getParent(container.nodeType == 3 ? container.parentNode : container, isTextBlock);
|
||||||
|
|
||||||
// Exclude inner lists from wrapping
|
// Exclude inner lists from wrapping
|
||||||
if (node && format[0].wrapper)
|
if (node && format[0].wrapper)
|
||||||
@ -17221,6 +17375,11 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
|
|||||||
if (settings.keep_styles !== false) {
|
if (settings.keep_styles !== false) {
|
||||||
do {
|
do {
|
||||||
if (/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(node.nodeName)) {
|
if (/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(node.nodeName)) {
|
||||||
|
// Never clone a caret containers
|
||||||
|
if (node.id == '_mce_caret') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
clonedNode = node.cloneNode(false);
|
clonedNode = node.cloneNode(false);
|
||||||
dom.setAttrib(clonedNode, 'id', ''); // Remove ID since it needs to be document unique
|
dom.setAttrib(clonedNode, 'id', ''); // Remove ID since it needs to be document unique
|
||||||
|
|
||||||
@ -17237,7 +17396,7 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
|
|||||||
|
|
||||||
// BR is needed in empty blocks on non IE browsers
|
// BR is needed in empty blocks on non IE browsers
|
||||||
if (!tinymce.isIE) {
|
if (!tinymce.isIE) {
|
||||||
caretNode.innerHTML = '<br>';
|
caretNode.innerHTML = '<br data-mce-bogus="1">';
|
||||||
}
|
}
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
@ -17413,7 +17572,7 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
|
|||||||
|
|
||||||
// Inserts a BR element if the forced_root_block option is set to false or empty string
|
// Inserts a BR element if the forced_root_block option is set to false or empty string
|
||||||
function insertBr() {
|
function insertBr() {
|
||||||
var brElm, extraBr;
|
var brElm, extraBr, marker;
|
||||||
|
|
||||||
if (container && container.nodeType == 3 && offset >= container.nodeValue.length) {
|
if (container && container.nodeType == 3 && offset >= container.nodeValue.length) {
|
||||||
// Insert extra BR element at the end block elements
|
// Insert extra BR element at the end block elements
|
||||||
@ -17434,6 +17593,12 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
|
|||||||
brElm.parentNode.insertBefore(dom.doc.createTextNode('\r'), brElm);
|
brElm.parentNode.insertBefore(dom.doc.createTextNode('\r'), brElm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Insert temp marker and scroll to that
|
||||||
|
marker = dom.create('span', {}, ' ');
|
||||||
|
brElm.parentNode.insertBefore(marker, brElm);
|
||||||
|
selection.scrollIntoView(marker);
|
||||||
|
dom.remove(marker);
|
||||||
|
|
||||||
if (!extraBr) {
|
if (!extraBr) {
|
||||||
rng.setStartAfter(brElm);
|
rng.setStartAfter(brElm);
|
||||||
rng.setEndAfter(brElm);
|
rng.setEndAfter(brElm);
|
||||||
@ -17553,6 +17718,12 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
|
|||||||
parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5
|
parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5
|
||||||
containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5
|
containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5
|
||||||
|
|
||||||
|
// Enter inside block contained within a LI then split or insert before/after LI
|
||||||
|
if (containerBlockName == 'LI' && !evt.ctrlKey) {
|
||||||
|
parentBlock = containerBlock;
|
||||||
|
parentBlockName = containerBlockName;
|
||||||
|
}
|
||||||
|
|
||||||
// Handle enter in LI
|
// Handle enter in LI
|
||||||
if (parentBlockName == 'LI') {
|
if (parentBlockName == 'LI') {
|
||||||
if (!newBlockName && shiftKey) {
|
if (!newBlockName && shiftKey) {
|
||||||
|
@ -60,7 +60,11 @@ class wysiwyg
|
|||||||
$text .= "\n /* TinyMce Config: ".$this->configName." */";
|
$text .= "\n /* TinyMce Config: ".$this->configName." */";
|
||||||
$text .= $this->tinyMce_config();
|
$text .= $this->tinyMce_config();
|
||||||
|
|
||||||
$text .= "\t\t start_tinyMce(); \n";
|
$text .= "\t\t
|
||||||
|
$(document).ready(function()
|
||||||
|
{
|
||||||
|
start_tinyMce(); \n
|
||||||
|
}); ";
|
||||||
|
|
||||||
$text .= "
|
$text .= "
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user