mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Fix some more tabs/spaces in bidi work
This commit is contained in:
parent
6ad71bd222
commit
b17c34402d
@ -21,11 +21,12 @@ RED.text.bidi = (function() {
|
||||
PDF = "\u202C";
|
||||
|
||||
function isRTLValue(stringValue) {
|
||||
for (var ch in stringValue) {
|
||||
if (isBidiChar(stringValue.charCodeAt(ch))) {
|
||||
var length = stringValue.length;
|
||||
for (var i=0;i<length;i++) {
|
||||
if (isBidiChar(stringValue.charCodeAt(i))) {
|
||||
return true;
|
||||
}
|
||||
else if(isLatinChar(stringValue.charCodeAt(ch))) {
|
||||
else if(isLatinChar(stringValue.charCodeAt(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -33,36 +34,16 @@ RED.text.bidi = (function() {
|
||||
}
|
||||
|
||||
function isBidiChar(c) {
|
||||
if (c >= 0x05d0 && c <= 0x05ff) {
|
||||
return true;
|
||||
}
|
||||
else if (c >= 0x0600 && c <= 0x065f) {
|
||||
return true;
|
||||
}
|
||||
else if (c >= 0x066a && c <= 0x06ef) {
|
||||
return true;
|
||||
}
|
||||
else if (c >= 0x06fa && c <= 0x07ff) {
|
||||
return true;
|
||||
}
|
||||
else if (c >= 0xfb1d && c <= 0xfdff) {
|
||||
return true;
|
||||
}
|
||||
else if (c >= 0xfe70 && c <= 0xfefc) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return (c >= 0x05d0 && c <= 0x05ff)||
|
||||
(c >= 0x0600 && c <= 0x065f)||
|
||||
(c >= 0x066a && c <= 0x06ef)||
|
||||
(c >= 0x06fa && c <= 0x07ff)||
|
||||
(c >= 0xfb1d && c <= 0xfdff)||
|
||||
(c >= 0xfe70 && c <= 0xfefc);
|
||||
}
|
||||
|
||||
function isLatinChar(c){
|
||||
if((c > 64 && c < 91)||(c > 96 && c < 123)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return (c > 64 && c < 91)||(c > 96 && c < 123)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,7 +68,8 @@ RED.text.bidi = (function() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Listens to keyup, paste and cut events of a given input field. Upon one of these events the text direction is computed again
|
||||
* Listens to keyup, paste and cut events of a given input field. Upon one
|
||||
* of these events the text direction is computed again
|
||||
* @param input - the input field
|
||||
*/
|
||||
function initInputEvents(input) {
|
||||
@ -95,7 +77,8 @@ RED.text.bidi = (function() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Enforces the text direction of a given string by adding UCC (Unicode Control Characters)
|
||||
* Enforces the text direction of a given string by adding
|
||||
* UCC (Unicode Control Characters)
|
||||
* @param value - the string
|
||||
*/
|
||||
function enforceTextDirectionWithUCC(value) {
|
||||
@ -112,7 +95,8 @@ RED.text.bidi = (function() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Enforces the text direction for all the spans with style bidiAware under workpsace or sidebar div
|
||||
* Enforces the text direction for all the spans with style bidiAware under
|
||||
* workspace or sidebar div
|
||||
*/
|
||||
function enforceTextDirectionOnPage() {
|
||||
$("#workspace").find('span.bidiAware').each(function() {
|
||||
|
@ -475,7 +475,7 @@ RED.text.format = (function() {
|
||||
// handler: main handler (default - dbidi/stt/handlers/common)
|
||||
// guiDir: GUI direction (default - "ltr")
|
||||
// dir: main stt direction (default - guiDir)
|
||||
// subDir: direction of subsegments
|
||||
// subDir: direction of subsegments
|
||||
// points: array of delimiters (default - [])
|
||||
// bounds: array of definitions of bounds in which handler works
|
||||
// subs: object defines special handling for some substring if found
|
||||
|
@ -295,7 +295,7 @@ RED.editor = (function() {
|
||||
* @param node - the node being edited
|
||||
* @param property - the name of the field
|
||||
* @param prefix - the prefix to use in the input element ids (node-input|node-config-input)
|
||||
* @param definition - the definition of the field
|
||||
* @param definition - the definition of the field
|
||||
*/
|
||||
function preparePropertyEditor(node,property,prefix,definition) {
|
||||
var input = $("#"+prefix+"-"+property);
|
||||
@ -1298,7 +1298,7 @@ RED.editor = (function() {
|
||||
});
|
||||
|
||||
$("#subflow-input-name").val(subflow.name).attr("dir", RED.text.bidi.resolveBaseTextDir(subflow.name));
|
||||
RED.text.bidi.initInputEvents($("#subflow-input-name"));
|
||||
RED.text.bidi.initInputEvents($("#subflow-input-name"));
|
||||
subflowEditor.getSession().setValue(subflow.info||"",-1);
|
||||
var userCount = 0;
|
||||
var subflowType = "subflow:"+editing_node.id;
|
||||
|
@ -127,7 +127,7 @@ RED.tabs = (function() {
|
||||
$('<img src="'+tab.icon+'" class="red-ui-tab-icon"/>').appendTo(link);
|
||||
}
|
||||
var span = $('<span/>',{class:"bidiAware"}).text(tab.label).appendTo(link);
|
||||
span.attr('dir', RED.text.bidi.resolveBaseTextDir(tab.label));
|
||||
span.attr('dir', RED.text.bidi.resolveBaseTextDir(tab.label));
|
||||
|
||||
link.on("click",onTabClick);
|
||||
link.on("dblclick",onTabDblClick);
|
||||
|
@ -1792,7 +1792,7 @@ RED.view = (function() {
|
||||
l = d._def.label;
|
||||
try {
|
||||
l = (typeof l === "function" ? l.call(d) : l)||"";
|
||||
l = RED.text.bidi.enforceTextDirectionWithUCC(l);
|
||||
l = RED.text.bidi.enforceTextDirectionWithUCC(l);
|
||||
} catch(err) {
|
||||
console.log("Definition error: "+d.type+".label",err);
|
||||
l = d.type;
|
||||
@ -2155,8 +2155,8 @@ RED.view = (function() {
|
||||
).classed("link_selected", false);
|
||||
}
|
||||
|
||||
RED.text.bidi.enforceTextDirectionOnPage();
|
||||
|
||||
RED.text.bidi.enforceTextDirectionOnPage();
|
||||
|
||||
if (d3.event) {
|
||||
d3.event.preventDefault();
|
||||
}
|
||||
@ -2360,11 +2360,11 @@ RED.view = (function() {
|
||||
snapGrid = state;
|
||||
redraw();
|
||||
},
|
||||
toggleTextDir: function(value) {
|
||||
toggleTextDir: function(value) {
|
||||
RED.text.bidi.setTextDirection(value);
|
||||
RED.nodes.eachNode(function(n) { n.dirty = true;});
|
||||
redraw();
|
||||
RED.palette.refresh();
|
||||
RED.palette.refresh();
|
||||
},
|
||||
scale: function() {
|
||||
return scaleFactor;
|
||||
|
@ -110,7 +110,7 @@ RED.workspaces = (function() {
|
||||
$('<input type="text" style="display: none;" />').prependTo(dialogForm);
|
||||
dialogForm.submit(function(e) { e.preventDefault();});
|
||||
$("#node-input-name").val(workspace.label).attr("dir", RED.text.bidi.resolveBaseTextDir(workspace.label));
|
||||
RED.text.bidi.initInputEvents($("#node-input-name"));
|
||||
RED.text.bidi.initInputEvents($("#node-input-name"));
|
||||
dialogForm.i18n();
|
||||
},
|
||||
close: function() {
|
||||
|
Loading…
Reference in New Issue
Block a user