From 4cd91acc35bd1923b9c2bfd5c377c0ac2e157d23 Mon Sep 17 00:00:00 2001 From: iionly Date: Tue, 19 Feb 2013 20:15:34 +0100 Subject: Tinymce plugin: update to version 3.5.8 of Tinymce editor --- .../plugins/directionality/editor_plugin_src.js | 41 ++++++++++++---------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/directionality/editor_plugin_src.js') diff --git a/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/directionality/editor_plugin_src.js b/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/directionality/editor_plugin_src.js index 4444959bf..b13401412 100644 --- a/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/directionality/editor_plugin_src.js +++ b/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/directionality/editor_plugin_src.js @@ -15,30 +15,33 @@ t.editor = ed; - ed.addCommand('mceDirectionLTR', function() { - var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock); - - if (e) { - if (ed.dom.getAttrib(e, "dir") != "ltr") - ed.dom.setAttrib(e, "dir", "ltr"); - else - ed.dom.setAttrib(e, "dir", ""); + function setDir(dir) { + var dom = ed.dom, curDir, blocks = ed.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); + } + } + }); + + ed.nodeChanged(); } + } - ed.nodeChanged(); + ed.addCommand('mceDirectionLTR', function() { + setDir("ltr"); }); ed.addCommand('mceDirectionRTL', function() { - var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock); - - if (e) { - if (ed.dom.getAttrib(e, "dir") != "rtl") - ed.dom.setAttrib(e, "dir", "rtl"); - else - ed.dom.setAttrib(e, "dir", ""); - } - - ed.nodeChanged(); + setDir("rtl"); }); ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'}); -- cgit v1.2.3