mirror of
https://github.com/friendica/friendica
synced 2025-04-24 04:30:11 +00:00
TinyMCE 3.5.8 update; some fixes
This commit is contained in:
parent
c9cce9873d
commit
d39a2e8a9d
48 changed files with 2213 additions and 2054 deletions
File diff suppressed because one or more lines are too long
|
@ -287,6 +287,21 @@
|
|||
endX = startX + (cols - 1);
|
||||
endY = startY + (rows - 1);
|
||||
} else {
|
||||
startPos = endPos = null;
|
||||
|
||||
// Calculate start/end pos by checking for selected cells in grid works better with context menu
|
||||
each(grid, function(row, y) {
|
||||
each(row, function(cell, x) {
|
||||
if (isCellSelected(cell)) {
|
||||
if (!startPos) {
|
||||
startPos = {x: x, y: y};
|
||||
}
|
||||
|
||||
endPos = {x: x, y: y};
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Use selection
|
||||
startX = startPos.x;
|
||||
startY = startPos.y;
|
||||
|
@ -551,6 +566,10 @@
|
|||
};
|
||||
|
||||
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;
|
||||
|
@ -599,6 +618,9 @@
|
|||
else
|
||||
dom.insertAfter(row, targetRow);
|
||||
});
|
||||
|
||||
// Remove current selection
|
||||
dom.removeClass(dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
|
||||
};
|
||||
|
||||
function getPos(target) {
|
||||
|
@ -1216,80 +1238,86 @@
|
|||
|
||||
ed.onKeyDown.add(moveSelection);
|
||||
}
|
||||
|
||||
|
||||
// Fixes an issue on Gecko where it's impossible to place the caret behind a table
|
||||
// This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled
|
||||
if (!tinymce.isIE) {
|
||||
function fixTableCaretPos() {
|
||||
var last;
|
||||
function fixTableCaretPos() {
|
||||
var last;
|
||||
|
||||
// Skip empty text nodes form the end
|
||||
for (last = ed.getBody().lastChild; last && last.nodeType == 3 && !last.nodeValue.length; last = last.previousSibling) ;
|
||||
// Skip empty text nodes form the end
|
||||
for (last = ed.getBody().lastChild; last && last.nodeType == 3 && !last.nodeValue.length; last = last.previousSibling) ;
|
||||
|
||||
if (last && last.nodeName == 'TABLE')
|
||||
ed.dom.add(ed.getBody(), 'p', null, '<br mce_bogus="1" />');
|
||||
};
|
||||
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
|
||||
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
|
||||
// and then manually moves the caret infront of the table
|
||||
if (tinymce.isGecko) {
|
||||
ed.onKeyDown.add(function(ed, e) {
|
||||
var rng, table, dom = ed.dom;
|
||||
// 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
|
||||
// and then manually moves the caret infront of the table
|
||||
if (tinymce.isGecko) {
|
||||
ed.onKeyDown.add(function(ed, e) {
|
||||
var rng, table, dom = ed.dom;
|
||||
|
||||
// On gecko it's not possible to place the caret before a table
|
||||
if (e.keyCode == 37 || e.keyCode == 38) {
|
||||
rng = ed.selection.getRng();
|
||||
table = dom.getParent(rng.startContainer, 'table');
|
||||
// On gecko it's not possible to place the caret before a table
|
||||
if (e.keyCode == 37 || e.keyCode == 38) {
|
||||
rng = ed.selection.getRng();
|
||||
table = dom.getParent(rng.startContainer, 'table');
|
||||
|
||||
if (table && ed.getBody().firstChild == table) {
|
||||
if (isAtStart(rng, table)) {
|
||||
rng = dom.createRng();
|
||||
if (table && ed.getBody().firstChild == table) {
|
||||
if (isAtStart(rng, table)) {
|
||||
rng = dom.createRng();
|
||||
|
||||
rng.setStartBefore(table);
|
||||
rng.setEndBefore(table);
|
||||
rng.setStartBefore(table);
|
||||
rng.setEndBefore(table);
|
||||
|
||||
ed.selection.setRng(rng);
|
||||
ed.selection.setRng(rng);
|
||||
|
||||
e.preventDefault();
|
||||
}
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ed.onKeyUp.add(fixTableCaretPos);
|
||||
ed.onSetContent.add(fixTableCaretPos);
|
||||
ed.onVisualAid.add(fixTableCaretPos);
|
||||
|
||||
ed.onPreProcess.add(function(ed, o) {
|
||||
var last = o.node.lastChild;
|
||||
|
||||
if (last && last.childNodes.length == 1 && last.firstChild.nodeName == 'BR')
|
||||
ed.dom.remove(last);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Fixes bug in Gecko where shift-enter in table cell does not place caret on new line
|
||||
*/
|
||||
if (tinymce.isGecko) {
|
||||
ed.onKeyDown.add(function(ed, e) {
|
||||
if (e.keyCode === tinymce.VK.ENTER && e.shiftKey) {
|
||||
var node = ed.selection.getRng().startContainer;
|
||||
var tableCell = dom.getParent(node, 'td,th');
|
||||
if (tableCell) {
|
||||
var zeroSizedNbsp = ed.getDoc().createTextNode("\uFEFF");
|
||||
dom.insertAfter(zeroSizedNbsp, node);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
fixTableCaretPos();
|
||||
ed.startContent = ed.getContent({format : 'raw'});
|
||||
}
|
||||
|
||||
ed.onKeyUp.add(fixTableCaretPos);
|
||||
ed.onSetContent.add(fixTableCaretPos);
|
||||
ed.onVisualAid.add(fixTableCaretPos);
|
||||
|
||||
ed.onPreProcess.add(function(ed, o) {
|
||||
var last = o.node.lastChild;
|
||||
|
||||
if (last && (last.nodeName == "BR" || (last.childNodes.length == 1 && (last.firstChild.nodeName == 'BR' || last.firstChild.nodeValue == '\u00a0'))) && last.previousSibling && last.previousSibling.nodeName == "TABLE") {
|
||||
ed.dom.remove(last);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Fixes bug in Gecko where shift-enter in table cell does not place caret on new line
|
||||
*
|
||||
* Removed: Since the new enter logic seems to fix this one.
|
||||
*/
|
||||
/*
|
||||
if (tinymce.isGecko) {
|
||||
ed.onKeyDown.add(function(ed, e) {
|
||||
if (e.keyCode === tinymce.VK.ENTER && e.shiftKey) {
|
||||
var node = ed.selection.getRng().startContainer;
|
||||
var tableCell = dom.getParent(node, 'td,th');
|
||||
if (tableCell) {
|
||||
var zeroSizedNbsp = ed.getDoc().createTextNode("\uFEFF");
|
||||
dom.insertAfter(zeroSizedNbsp, node);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
fixTableCaretPos();
|
||||
ed.startContent = ed.getContent({format : 'raw'});
|
||||
});
|
||||
|
||||
// Register action commands
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -247,7 +247,10 @@ function insertTable() {
|
|||
|
||||
// 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) {
|
||||
dom.insertAfter(dom.create('p'), node);
|
||||
if (inst.settings.forced_root_block)
|
||||
dom.insertAfter(dom.create(inst.settings.forced_root_block), node);
|
||||
else
|
||||
dom.insertAfter(dom.create('br', {'data-mce-bogus': '1'}), node);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -304,6 +307,15 @@ function init() {
|
|||
var formObj = document.forms[0];
|
||||
var elm = dom.getParent(inst.selection.getNode(), "table");
|
||||
|
||||
// Hide advanced fields that isn't available in the schema
|
||||
tinymce.each("summary id rules dir style frame".split(" "), function(name) {
|
||||
var tr = tinyMCEPopup.dom.getParent(name, "tr") || tinyMCEPopup.dom.getParent("t" + name, "tr");
|
||||
|
||||
if (tr && !tinyMCEPopup.editor.schema.isValid("table", name)) {
|
||||
tr.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
action = tinyMCEPopup.getWindowArg('action');
|
||||
|
||||
if (!action)
|
||||
|
|
|
@ -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>
|
||||
|
@ -83,8 +83,8 @@
|
|||
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="4">
|
||||
<tr>
|
||||
<td class="column1"><label for="id">{#table_dlg.id}</label></td>
|
||||
<td><input id="id" name="id" type="text" value="" style="width: 200px" /></td>
|
||||
<td class="column1"><label for="id">{#table_dlg.id}</label></td>
|
||||
<td><input id="id" name="id" type="text" value="" style="width: 200px" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
@ -93,25 +93,25 @@
|
|||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="dir">{#table_dlg.langdir}</label></td>
|
||||
<td class="column1"><label for="dir">{#table_dlg.langdir}</label></td>
|
||||
<td>
|
||||
<select id="dir" name="dir" style="width: 200px">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="ltr">{#table_dlg.ltr}</option>
|
||||
<option value="rtl">{#table_dlg.rtl}</option>
|
||||
<select id="dir" name="dir" style="width: 200px">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="ltr">{#table_dlg.ltr}</option>
|
||||
<option value="rtl">{#table_dlg.rtl}</option>
|
||||
</select>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="lang">{#table_dlg.langcode}</label></td>
|
||||
<td class="column1"><label for="lang">{#table_dlg.langcode}</label></td>
|
||||
<td>
|
||||
<input id="lang" name="lang" type="text" value="" style="width: 200px" />
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
|
||||
<td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
|
@ -119,11 +119,11 @@
|
|||
<td id="backgroundimagebrowsercontainer"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="bgcolor" id="bgcolor_label">{#table_dlg.bgcolor}</label></td>
|
||||
<td class="column1"><label for="bgcolor" id="bgcolor_label">{#table_dlg.bgcolor}</label></td>
|
||||
<td>
|
||||
<span role="group" aria-labelledby="bgcolor_label">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
|
@ -133,7 +133,7 @@
|
|||
</tr>
|
||||
</table>
|
||||
</span>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue