mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-02 05:01:38 +02:00
Split into utilDisplayName / utilDisplayNameForPath
This is because utilDisplayName gets called a bunch of places and we only want to add the Arabic reversal code for textpath labels
This commit is contained in:
@@ -3,6 +3,7 @@ export { utilEntitySelector } from './util';
|
||||
export { utilEntityOrMemberSelector } from './util';
|
||||
export { utilGetAllNodes } from './util';
|
||||
export { utilDisplayName } from './util';
|
||||
export { utilDisplayNameForPath } from './util';
|
||||
export { utilDisplayType } from './util';
|
||||
export { utilStringQs } from './util';
|
||||
export { utilQsString } from './util';
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// see https://github.com/openstreetmap/iD/pull/3707
|
||||
// https://gist.github.com/mapmeld/556b09ddec07a2044c76e1ef45f01c60
|
||||
|
||||
var chars = {
|
||||
// madda above alef
|
||||
1570: { initial: 'آ', isolated: 'ﺁ', medial: 'ﺁ', final: 'ﺂ' },
|
||||
|
||||
@@ -69,9 +69,16 @@ export function utilDisplayName(entity) {
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
export function utilDisplayNameForPath(entity) {
|
||||
var name = utilDisplayName(entity);
|
||||
var isFirefox = utilDetect().browser.toLowerCase().indexOf('firefox') > -1;
|
||||
var arabicRegex = /[\u0600-\u06FF]/g;
|
||||
if (!isFirefox && name && (entity.tags.highway || entity.tags.railway) && arabicRegex.test(name)) {
|
||||
|
||||
if (!isFirefox && name && arabicRegex.test(name)) {
|
||||
name = fixArabicScriptTextForSvg(name);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user