Upgrade to TinyMCE 4.5.1
- New flat theme (with padding tightened a bit from the default to fit in right-hand pane) - Adds search/replace within notes - Adds URL autolinking - Image pasting/dragging is now properly disallowed (though TinyMCE 4 has hooks that may allow us to actually support this by automatically creating attachments) - New blockquote style with color bar - Replaces custom context menu on link click with built-in version To-do: - Fix display of pop-ups, which are now modal dialogs within the note frame instead of pop-up windows, to stay fully within the frame - Localize (more important now that there are tooltips) - Support image dragging - Update elements list for HTML5, for better drag-and-drop? - Move directionality control to context menu instead of taking up toolbar space? - Evaluate other plugins for potential inclusion - Show additional controls in separate note window? - Fix opacity of text in tooltips Closes #451, closes #421
This commit is contained in:
parent
ab959cd858
commit
dc04a1231c
67 changed files with 54823 additions and 25007 deletions
64
resource/tinymce/plugins/directionality/plugin.js
Normal file
64
resource/tinymce/plugins/directionality/plugin.js
Normal file
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('directionality', function(editor) {
|
||||
function setDir(dir) {
|
||||
var dom = editor.dom, curDir, blocks = editor.selection.getSelectedBlocks();
|
||||
|
||||
if (blocks.length) {
|
||||
curDir = dom.getAttrib(blocks[0], "dir");
|
||||
|
||||
tinymce.each(blocks, function(block) {
|
||||
// Add dir to block if the parent block doesn't already have that dir
|
||||
if (!dom.getParent(block.parentNode, "*[dir='" + dir + "']", dom.getRoot())) {
|
||||
if (curDir != dir) {
|
||||
dom.setAttrib(block, "dir", dir);
|
||||
} else {
|
||||
dom.setAttrib(block, "dir", null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
editor.nodeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
function generateSelector(dir) {
|
||||
var selector = [];
|
||||
|
||||
tinymce.each('h1 h2 h3 h4 h5 h6 div p'.split(' '), function(name) {
|
||||
selector.push(name + '[dir=' + dir + ']');
|
||||
});
|
||||
|
||||
return selector.join(',');
|
||||
}
|
||||
|
||||
editor.addCommand('mceDirectionLTR', function() {
|
||||
setDir("ltr");
|
||||
});
|
||||
|
||||
editor.addCommand('mceDirectionRTL', function() {
|
||||
setDir("rtl");
|
||||
});
|
||||
|
||||
editor.addButton('ltr', {
|
||||
title: 'Left to right',
|
||||
cmd: 'mceDirectionLTR',
|
||||
stateSelector: generateSelector('ltr')
|
||||
});
|
||||
|
||||
editor.addButton('rtl', {
|
||||
title: 'Right to left',
|
||||
cmd: 'mceDirectionRTL',
|
||||
stateSelector: generateSelector('rtl')
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue