mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Compare commits
	
		
			1 Commits
		
	
	
		
			4396-fix-g
			...
			bidi-17
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 1532d9b6e2 | 
| @@ -16,6 +16,8 @@ | |||||||
| RED.text = {}; | RED.text = {}; | ||||||
| RED.text.bidi = (function() { | RED.text.bidi = (function() { | ||||||
|     var textDir = "";     |     var textDir = "";     | ||||||
|  |     var textDirPref = "auto"; | ||||||
|  |     var bidiEnabled = false; | ||||||
|     var LRE = "\u202A", |     var LRE = "\u202A", | ||||||
|         RLE = "\u202B", |         RLE = "\u202B", | ||||||
|         PDF = "\u202C"; |         PDF = "\u202C"; | ||||||
| @@ -110,8 +112,8 @@ RED.text.bidi = (function() { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Sets the text direction preference |      * Sets the text direction | ||||||
|      * @param dir - the text direction preference |      * @param dir - the actual text direction | ||||||
|      */ |      */ | ||||||
|     function setTextDirection(dir) { |     function setTextDirection(dir) { | ||||||
|         textDir = dir; |         textDir = dir; | ||||||
| @@ -121,8 +123,43 @@ RED.text.bidi = (function() { | |||||||
|         enforceTextDirectionOnPage(); |         enforceTextDirectionOnPage(); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     /** | ||||||
|  |      * Gets the bidi enabled preference | ||||||
|  |      */ | ||||||
|  |     function getBidiEnabled() { | ||||||
|  |         return bidiEnabled; | ||||||
|  |     } | ||||||
|  |          | ||||||
|  |     /** | ||||||
|  |      * Sets the bidi enabled preference | ||||||
|  |      * @param state - the bidi enabled preference | ||||||
|  |      */ | ||||||
|  |     function setBidiEnabled(state) { | ||||||
|  |         bidiEnabled = state; | ||||||
|  |         setTextDirection((state ? textDirPref : "")); | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     /** | ||||||
|  |      * Gets the text direction preference | ||||||
|  |      */ | ||||||
|  |     function getTextDirPref() {         | ||||||
|  |         return textDirPref; | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     /** | ||||||
|  |      * Sets the text direction preference | ||||||
|  |      * @param dirPref - text direction preference | ||||||
|  |      */ | ||||||
|  |     function setTextDirPref(dirPref) { | ||||||
|  |         textDirPref = dirPref; | ||||||
|  |         setTextDirection(textDirPref); | ||||||
|  |     } | ||||||
|  |     | ||||||
|     return { |     return { | ||||||
|         setTextDirection: setTextDirection, |         setBidiEnabled: setBidiEnabled, | ||||||
|  |         setTextDirPref: setTextDirPref, | ||||||
|  |         getBidiEnabled: getBidiEnabled, | ||||||
|  |         getTextDirPref: getTextDirPref, | ||||||
|         enforceTextDirectionWithUCC: enforceTextDirectionWithUCC, |         enforceTextDirectionWithUCC: enforceTextDirectionWithUCC, | ||||||
|         resolveBaseTextDir: resolveBaseTextDir, |         resolveBaseTextDir: resolveBaseTextDir, | ||||||
|         prepareInput: prepareInput |         prepareInput: prepareInput | ||||||
|   | |||||||
| @@ -142,9 +142,35 @@ RED.userSettings = (function() { | |||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|         }) |         }) | ||||||
|  |         addBidiPreferences(pane); | ||||||
|         return pane; |         return pane; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     function addBidiPreferences(pane) { | ||||||
|  |         $('<h3></h3>').text(RED._("menu.label.bidi")).appendTo(pane);                 | ||||||
|  |         var row; | ||||||
|  |          | ||||||
|  |         // Bidi enabled toggle | ||||||
|  |         row = $('<div class="user-settings-row"></div>').appendTo(pane); | ||||||
|  |         var input = $('<label for="user-settings-view-bidi-enabled"><input id="user-settings-view-bidi-enabled" type="checkbox"> '+RED._("menu.label.bidiSupport") +'</label>').appendTo(row).find("input"); | ||||||
|  |         input.prop('checked',RED.text.bidi.getBidiEnabled()); | ||||||
|  |          | ||||||
|  |         // Text Direction combo | ||||||
|  |         row = $('<div class="user-settings-row"></div>').appendTo(pane); | ||||||
|  |         $('<label for="user-settings-view-text-direction">'+RED._("menu.label.view.textDir")+'</label>').appendTo(row); | ||||||
|  |         var select = $('<select id="user-settings-view-text-direction"><option value="ltr">' + RED._("menu.label.view.ltr") + '</option><option value="rtl">'  + RED._("menu.label.view.rtl") + '</option><option value="auto">'  + RED._("menu.label.view.auto") + '</option></select>').appendTo(row);         | ||||||
|  |         select.val(RED.text.bidi.getTextDirPref()); | ||||||
|  |         select.prop('disabled', !RED.text.bidi.getBidiEnabled()); | ||||||
|  |          | ||||||
|  |         input.change(function() { | ||||||
|  |             RED.text.bidi.setBidiEnabled(input.prop('checked')); | ||||||
|  |             select.prop('disabled', !RED.text.bidi.getBidiEnabled()); | ||||||
|  |         }); | ||||||
|  |         select.change(function() { | ||||||
|  |             RED.text.bidi.setTextDirPref(select.val()); | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     function setSelected(id, value) { |     function setSelected(id, value) { | ||||||
|         var opt = allSettings[id]; |         var opt = allSettings[id]; | ||||||
|         RED.settings.set(opt.setting,value); |         RED.settings.set(opt.setting,value); | ||||||
|   | |||||||
| @@ -67,7 +67,9 @@ | |||||||
|             "editPalette":"Manage palette", |             "editPalette":"Manage palette", | ||||||
|             "other": "Other", |             "other": "Other", | ||||||
|             "showTips": "Show tips", |             "showTips": "Show tips", | ||||||
|             "help": "Node-RED website" |             "help": "Node-RED website", | ||||||
|  | 			"bidi": "Bidi", | ||||||
|  | 			"bidiSupport": "Enable Bidi support" | ||||||
|         } |         } | ||||||
|     }, |     }, | ||||||
|     "user": { |     "user": { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user