1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Move setting text direction into bidi module

This commit is contained in:
Nick O'Leary 2016-08-26 00:40:01 +01:00
parent b17c34402d
commit c60fb3bc25
3 changed files with 8 additions and 13 deletions

View File

@ -177,10 +177,10 @@ var RED = (function() {
{id:"menu-item-status",label:RED._("menu.label.displayStatus"),toggle:true,onselect:toggleStatus, selected: true},
null,
{id:"menu-item-bidi",label:RED._("menu.label.view.textDir"),options:[
{id:"menu-item-bidi-default",toggle:"text-direction",label:RED._("menu.label.view.defaultDir"),selected: true, onselect:function(s) { if(s){RED.view.toggleTextDir("")}}},
{id:"menu-item-bidi-ltr",toggle:"text-direction",label:RED._("menu.label.view.ltr"), onselect:function(s) { if(s){RED.view.toggleTextDir("ltr")}}},
{id:"menu-item-bidi-rtl",toggle:"text-direction",label:RED._("menu.label.view.rtl"), onselect:function(s) { if(s){RED.view.toggleTextDir("rtl")}}},
{id:"menu-item-bidi-auto",toggle:"text-direction",label:RED._("menu.label.view.auto"), onselect:function(s) { if(s){RED.view.toggleTextDir("auto")}}}
{id:"menu-item-bidi-default",toggle:"text-direction",label:RED._("menu.label.view.defaultDir"),selected: true, onselect:function(s) { if(s){RED.text.bidi.setTextDirection("")}}},
{id:"menu-item-bidi-ltr",toggle:"text-direction",label:RED._("menu.label.view.ltr"), onselect:function(s) { if(s){RED.text.bidi.setTextDirection("ltr")}}},
{id:"menu-item-bidi-rtl",toggle:"text-direction",label:RED._("menu.label.view.rtl"), onselect:function(s) { if(s){RED.text.bidi.setTextDirection("rtl")}}},
{id:"menu-item-bidi-auto",toggle:"text-direction",label:RED._("menu.label.view.auto"), onselect:function(s) { if(s){RED.text.bidi.setTextDirection("auto")}}}
]},
null,
{id:"menu-item-sidebar",label:RED._("menu.label.sidebar.show"),toggle:true,onselect:RED.sidebar.toggleSidebar, selected: true}

View File

@ -113,11 +113,14 @@ RED.text.bidi = (function() {
*/
function setTextDirection(dir) {
textDir = dir;
RED.nodes.eachNode(function(n) { n.dirty = true;});
RED.view.redraw();
RED.palette.refresh();
enforceTextDirectionOnPage();
}
return {
setTextDirection: setTextDirection,
enforceTextDirectionOnPage: enforceTextDirectionOnPage,
enforceTextDirectionWithUCC: enforceTextDirectionWithUCC,
resolveBaseTextDir: resolveBaseTextDir,
initInputEvents: initInputEvents

View File

@ -2155,8 +2155,6 @@ RED.view = (function() {
).classed("link_selected", false);
}
RED.text.bidi.enforceTextDirectionOnPage();
if (d3.event) {
d3.event.preventDefault();
}
@ -2360,12 +2358,6 @@ RED.view = (function() {
snapGrid = state;
redraw();
},
toggleTextDir: function(value) {
RED.text.bidi.setTextDirection(value);
RED.nodes.eachNode(function(n) { n.dirty = true;});
redraw();
RED.palette.refresh();
},
scale: function() {
return scaleFactor;
},