diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:56:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:56:49 +0000 |
commit | a415c29efee45520ae252d2aa28f1083a521cd7b (patch) | |
tree | f4ade4b6668ecc0765de7e1424f7c1427ad433ff /wp-includes/js/tinymce/plugins/directionality | |
parent | Initial commit. (diff) | |
download | wordpress-a415c29efee45520ae252d2aa28f1083a521cd7b.tar.xz wordpress-a415c29efee45520ae252d2aa28f1083a521cd7b.zip |
Adding upstream version 6.4.3+dfsg1.upstream/6.4.3+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wp-includes/js/tinymce/plugins/directionality')
-rw-r--r-- | wp-includes/js/tinymce/plugins/directionality/plugin.js | 66 | ||||
-rw-r--r-- | wp-includes/js/tinymce/plugins/directionality/plugin.min.js | 1 |
2 files changed, 67 insertions, 0 deletions
diff --git a/wp-includes/js/tinymce/plugins/directionality/plugin.js b/wp-includes/js/tinymce/plugins/directionality/plugin.js new file mode 100644 index 0000000..4b8669b --- /dev/null +++ b/wp-includes/js/tinymce/plugins/directionality/plugin.js @@ -0,0 +1,66 @@ +(function () { +var directionality = (function () { + 'use strict'; + + var global = tinymce.util.Tools.resolve('tinymce.PluginManager'); + + var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools'); + + var setDir = function (editor, dir) { + var dom = editor.dom; + var curDir; + var blocks = editor.selection.getSelectedBlocks(); + if (blocks.length) { + curDir = dom.getAttrib(blocks[0], 'dir'); + global$1.each(blocks, function (block) { + if (!dom.getParent(block.parentNode, '*[dir="' + dir + '"]', dom.getRoot())) { + dom.setAttrib(block, 'dir', curDir !== dir ? dir : null); + } + }); + editor.nodeChanged(); + } + }; + var Direction = { setDir: setDir }; + + var register = function (editor) { + editor.addCommand('mceDirectionLTR', function () { + Direction.setDir(editor, 'ltr'); + }); + editor.addCommand('mceDirectionRTL', function () { + Direction.setDir(editor, 'rtl'); + }); + }; + var Commands = { register: register }; + + var generateSelector = function (dir) { + var selector = []; + global$1.each('h1 h2 h3 h4 h5 h6 div p'.split(' '), function (name) { + selector.push(name + '[dir=' + dir + ']'); + }); + return selector.join(','); + }; + var register$1 = function (editor) { + editor.addButton('ltr', { + title: 'Left to right', + cmd: 'mceDirectionLTR', + stateSelector: generateSelector('ltr') + }); + editor.addButton('rtl', { + title: 'Right to left', + cmd: 'mceDirectionRTL', + stateSelector: generateSelector('rtl') + }); + }; + var Buttons = { register: register$1 }; + + global.add('directionality', function (editor) { + Commands.register(editor); + Buttons.register(editor); + }); + function Plugin () { + } + + return Plugin; + +}()); +})(); diff --git a/wp-includes/js/tinymce/plugins/directionality/plugin.min.js b/wp-includes/js/tinymce/plugins/directionality/plugin.min.js new file mode 100644 index 0000000..bb48bcf --- /dev/null +++ b/wp-includes/js/tinymce/plugins/directionality/plugin.min.js @@ -0,0 +1 @@ +!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),c=tinymce.util.Tools.resolve("tinymce.util.Tools"),e=function(t,e){var i,n=t.dom,o=t.selection.getSelectedBlocks();o.length&&(i=n.getAttrib(o[0],"dir"),c.each(o,function(t){n.getParent(t.parentNode,'*[dir="'+e+'"]',n.getRoot())||n.setAttrib(t,"dir",i!==e?e:null)}),t.nodeChanged())},i=function(t){t.addCommand("mceDirectionLTR",function(){e(t,"ltr")}),t.addCommand("mceDirectionRTL",function(){e(t,"rtl")})},n=function(e){var i=[];return c.each("h1 h2 h3 h4 h5 h6 div p".split(" "),function(t){i.push(t+"[dir="+e+"]")}),i.join(",")},o=function(t){t.addButton("ltr",{title:"Left to right",cmd:"mceDirectionLTR",stateSelector:n("ltr")}),t.addButton("rtl",{title:"Right to left",cmd:"mceDirectionRTL",stateSelector:n("rtl")})};t.add("directionality",function(t){i(t),o(t)})}();
\ No newline at end of file |