| 1 |
define(["dojo/_base/array", "dijit/_BidiSupport"], function(array, _BidiSupport){ |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
var common = {}; |
| 11 |
common.enforceTextDirWithUcc = function(text, textDir){ |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
if(textDir){ |
| 23 |
textDir = (textDir === "auto") ? _BidiSupport.prototype._checkContextual(text) : textDir; |
| 24 |
return ((textDir === "rtl") ? common.MARK.RLE : common.MARK.LRE) + text + common.MARK.PDF; |
| 25 |
} |
| 26 |
return text; |
| 27 |
}; |
| 28 |
|
| 29 |
common.removeUCCFromText = function(text){ |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
if (!text){ |
| 35 |
return text; |
| 36 |
} |
| 37 |
return text.replace(/\u202A|\u202B|\u202C/g,""); |
| 38 |
}; |
| 39 |
|
| 40 |
common.setTextDirForButtons = function(widget){ |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
var children = widget.getChildren(); |
| 46 |
if (children && widget.textDir){ |
| 47 |
array.forEach(children, function(ch){ |
| 48 |
ch.set("textDir", widget.textDir); |
| 49 |
}, widget); |
| 50 |
} |
| 51 |
}; |
| 52 |
|
| 53 |
|
| 54 |
common.MARK = { |
| 55 |
LRE : '\u202A', |
| 56 |
RLE : '\u202B', |
| 57 |
PDF : '\u202C' |
| 58 |
}; |
| 59 |
|
| 60 |
return common; |
| 61 |
}); |