textbrowser 0.48.0 → 0.48.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +3 -1
- package/CHANGES.md +11 -0
- package/README.md +2 -6
- package/dist/WorkInfo-es.js +972 -344
- package/dist/activateCallback-es.js +2 -2
- package/dist/index-es.js +2713 -1105
- package/dist/index-es.min.js +4 -4
- package/dist/sw-helper.js +10 -6
- package/index.html +2 -0
- package/package.json +33 -33
- package/resources/activateCallback.js +2 -2
- package/resources/index.js +4 -4
- package/resources/resultsDisplay.js +44 -39
- package/resources/templates/languageSelect.js +3 -3
- package/resources/templates/resultsDisplayServerOrClient.js +76 -65
- package/resources/templates/workDisplay.js +123 -103
- package/resources/templates/workSelect.js +4 -4
- package/resources/utils/IntlURLSearchParams.js +1 -1
- package/resources/utils/Languages.js +3 -1
- package/resources/utils/Metadata.js +22 -21
- package/resources/utils/Plugin.js +4 -4
- package/resources/utils/ServiceWorker.js +7 -11
- package/resources/utils/WorkInfo.js +4 -4
- package/resources/utils/dialogs.js +2 -1
- package/resources/utils/getLocaleFallbackResults.js +3 -3
- package/resources/utils/sanitize.js +3 -3
- package/resources/workDisplay.js +13 -14
- package/resources/workSelect.js +3 -2
- package/server/main.js +6 -4
- package/dist/index-umd.js +0 -18864
- package/dist/index-umd.min.js +0 -19
- /package/dist/assets/{index-c987c995.css → index-_11XnUty.css} +0 -0
- /package/dist/assets/{languages-fcf1c836.json → languages-1sAACTKG.json} +0 -0
|
@@ -15,14 +15,15 @@ const getDataForSerializingParamsAsURL = () => ({
|
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
export default {
|
|
18
|
-
bdo
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
['div', {style: 'display: inline; direction: ' + fallbackDirection}, [message]]
|
|
18
|
+
bdo ({fallbackDirection, message}) {
|
|
19
|
+
// Displaying as div with inline display instead of span since
|
|
20
|
+
// Firefox puts punctuation at left otherwise (bdo dir
|
|
21
|
+
// seemed to have issues in Firefox)
|
|
22
|
+
return ['div', {style: 'display: inline; direction: ' + fallbackDirection}, [message]];
|
|
23
|
+
},
|
|
23
24
|
columnsTable: ({
|
|
24
25
|
lDirectional, fieldInfo, $p, lElement, lIndexedParam, l,
|
|
25
|
-
metadataObj, preferredLocale, schemaItems,
|
|
26
|
+
// metadataObj, preferredLocale, schemaItems,
|
|
26
27
|
fieldMatchesLocale
|
|
27
28
|
}) => ['table', {
|
|
28
29
|
border: '1', cellpadding: '5', align: 'center'
|
|
@@ -71,19 +72,21 @@ export default {
|
|
|
71
72
|
})
|
|
72
73
|
]),
|
|
73
74
|
lElement('check-sequence', 'td', 'title', {}, [
|
|
74
|
-
['select', {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
75
|
+
['select', {
|
|
76
|
+
name: lIndexedParam('field') + idx,
|
|
77
|
+
id: fieldIndex,
|
|
78
|
+
size: '1'
|
|
79
|
+
}, fieldInfo.map(({field, fieldAliasOrName}, j) => {
|
|
80
|
+
const matchedFieldParam = fieldParam && fieldParam === fieldAliasOrName;
|
|
81
|
+
return ['option', {
|
|
82
|
+
dataset: {name: field},
|
|
83
|
+
value: fieldAliasOrName,
|
|
84
|
+
selected: (
|
|
85
|
+
matchedFieldParam ||
|
|
86
|
+
(j === i && !$p.has(fieldIndex))
|
|
87
|
+
)
|
|
88
|
+
}, [fieldAliasOrName]];
|
|
89
|
+
})]
|
|
87
90
|
]),
|
|
88
91
|
['td', [ // Todo: Make as tag selector with fields as options
|
|
89
92
|
lElement('interlinear-tips', 'input', 'title', {
|
|
@@ -128,7 +131,7 @@ export default {
|
|
|
128
131
|
type: 'button',
|
|
129
132
|
$on: {
|
|
130
133
|
click () {
|
|
131
|
-
fieldInfo.forEach(({field}, i) => {
|
|
134
|
+
fieldInfo.forEach((/* {field} */_, i) => {
|
|
132
135
|
const idx = i + 1;
|
|
133
136
|
// The following is redundant with 'field' but may need to
|
|
134
137
|
// retrieve later out of order?
|
|
@@ -278,22 +281,20 @@ export default {
|
|
|
278
281
|
dir: 'ltr'
|
|
279
282
|
}, [
|
|
280
283
|
lDirectional('font_stretch'), nbsp,
|
|
281
|
-
['select', {name: lParam('fontstretch')},
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
})
|
|
296
|
-
]
|
|
284
|
+
['select', {name: lParam('fontstretch')}, [
|
|
285
|
+
'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed',
|
|
286
|
+
'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'
|
|
287
|
+
].map((stretch) => {
|
|
288
|
+
const atts = {
|
|
289
|
+
value: lDirectional(['param_values', 'font-stretch', stretch]),
|
|
290
|
+
selected: null
|
|
291
|
+
};
|
|
292
|
+
if ($p.get('fontstretch') === stretch ||
|
|
293
|
+
(!$p.has('fontstretch') && stretch === 'normal')) {
|
|
294
|
+
atts.selected = 'selected';
|
|
295
|
+
}
|
|
296
|
+
return ['option', atts, [lDirectional(['param_values', 'font-stretch', stretch])]];
|
|
297
|
+
})]
|
|
297
298
|
]],
|
|
298
299
|
/**/
|
|
299
300
|
['br'], ['br'],
|
|
@@ -326,8 +327,8 @@ export default {
|
|
|
326
327
|
['yes', lDirectional(['param_values', 'y'])],
|
|
327
328
|
['no', lDirectional(['param_values', 'n'])],
|
|
328
329
|
['none', lDirectional(['param_values', '0'])]
|
|
329
|
-
].map(([key, val], i, arr) =>
|
|
330
|
-
['label', [
|
|
330
|
+
].map(([key, val], i, arr) => {
|
|
331
|
+
return ['label', [
|
|
331
332
|
['input', {
|
|
332
333
|
name: lParam('header'),
|
|
333
334
|
type: 'radio',
|
|
@@ -336,8 +337,8 @@ export default {
|
|
|
336
337
|
(!$p.has('header') && i === 1)
|
|
337
338
|
}],
|
|
338
339
|
lDirectional(key), (i === arr.length - 1 ? '' : nbsp3)
|
|
339
|
-
]]
|
|
340
|
-
))
|
|
340
|
+
]];
|
|
341
|
+
}))
|
|
341
342
|
]],
|
|
342
343
|
['div', [
|
|
343
344
|
lDirectional('footer_wstyles'), nbsp2,
|
|
@@ -345,8 +346,8 @@ export default {
|
|
|
345
346
|
['yes', lDirectional(['param_values', 'y'])],
|
|
346
347
|
['no', lDirectional(['param_values', 'n'])],
|
|
347
348
|
['none', lDirectional(['param_values', '0'])]
|
|
348
|
-
].map(([key, val], i, arr) =>
|
|
349
|
-
['label', [
|
|
349
|
+
].map(([key, val], i, arr) => {
|
|
350
|
+
return ['label', [
|
|
350
351
|
['input', {
|
|
351
352
|
name: lParam('footer'),
|
|
352
353
|
type: 'radio',
|
|
@@ -355,8 +356,8 @@ export default {
|
|
|
355
356
|
(!$p.has('footer') && i === 2)
|
|
356
357
|
}],
|
|
357
358
|
lDirectional(key), (i === arr.length - 1 ? '' : nbsp3)
|
|
358
|
-
]]
|
|
359
|
-
))
|
|
359
|
+
]];
|
|
360
|
+
}))
|
|
360
361
|
]],
|
|
361
362
|
['label', [
|
|
362
363
|
['input', {
|
|
@@ -374,8 +375,8 @@ export default {
|
|
|
374
375
|
['yes', lDirectional(['param_values', 'y'])],
|
|
375
376
|
['no', lDirectional(['param_values', 'n'])],
|
|
376
377
|
['none', lDirectional(['param_values', '0'])]
|
|
377
|
-
].map(([key, val], i, arr) =>
|
|
378
|
-
['label', [
|
|
378
|
+
].map(([key, val], i, arr) => {
|
|
379
|
+
return ['label', [
|
|
379
380
|
['input', {
|
|
380
381
|
name: lParam('caption'),
|
|
381
382
|
type: 'radio',
|
|
@@ -384,8 +385,8 @@ export default {
|
|
|
384
385
|
(!$p.has('caption') && i === 2)
|
|
385
386
|
}],
|
|
386
387
|
lDirectional(key), (i === arr.length - 1 ? '' : nbsp3)
|
|
387
|
-
]]
|
|
388
|
-
))
|
|
388
|
+
]];
|
|
389
|
+
}))
|
|
389
390
|
]],
|
|
390
391
|
['br'],
|
|
391
392
|
['div', [
|
|
@@ -512,7 +513,9 @@ export default {
|
|
|
512
513
|
lParam, lDirectional, l, lElement, $p, serializeParamsAsURL, content
|
|
513
514
|
}) {
|
|
514
515
|
const addRowContent = (rowContent) => {
|
|
515
|
-
if (!rowContent || !rowContent.length) {
|
|
516
|
+
if (!rowContent || !rowContent.length) {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
516
519
|
content.push(['tr', rowContent]);
|
|
517
520
|
};
|
|
518
521
|
[
|
|
@@ -562,10 +565,11 @@ export default {
|
|
|
562
565
|
].forEach(addRowContent);
|
|
563
566
|
},
|
|
564
567
|
getPreferences: ({
|
|
565
|
-
languageParam, workI18n,
|
|
568
|
+
// languageParam, workI18n, groups,
|
|
569
|
+
paramsSetter, replaceHash,
|
|
566
570
|
getFieldAliasOrNames, work,
|
|
567
571
|
langs, languageI18n, l, localizeParamNames, namespace,
|
|
568
|
-
hideFormattingSection,
|
|
572
|
+
hideFormattingSection, preferencesPlugin
|
|
569
573
|
}) => ['div', {
|
|
570
574
|
style: {textAlign: 'left'}, id: 'preferences', hidden: 'true'
|
|
571
575
|
}, [
|
|
@@ -611,9 +615,9 @@ export default {
|
|
|
611
615
|
change ({target: {selectedOptions}}) {
|
|
612
616
|
// Todo: EU disclaimer re: storage?
|
|
613
617
|
localStorage.setItem(namespace + '-langCodes', JSON.stringify(
|
|
614
|
-
[...selectedOptions].map((opt) =>
|
|
615
|
-
opt.value
|
|
616
|
-
)
|
|
618
|
+
[...selectedOptions].map((opt) => {
|
|
619
|
+
return opt.value;
|
|
620
|
+
})
|
|
617
621
|
));
|
|
618
622
|
}
|
|
619
623
|
}
|
|
@@ -632,15 +636,20 @@ export default {
|
|
|
632
636
|
]];
|
|
633
637
|
})]
|
|
634
638
|
]],
|
|
635
|
-
(preferencesPlugin
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
+
(preferencesPlugin
|
|
640
|
+
? preferencesPlugin({
|
|
641
|
+
$, l, jml, paramsSetter, getDataForSerializingParamsAsURL, work,
|
|
642
|
+
replaceHash, getFieldAliasOrNames
|
|
643
|
+
})
|
|
644
|
+
: ''
|
|
645
|
+
)
|
|
639
646
|
]],
|
|
640
647
|
addBrowseFields ({browseFields, fieldInfo, lDirectional, i, lIndexedParam, $p, content}) {
|
|
641
648
|
const work = $p.get('work');
|
|
642
649
|
const addRowContent = (rowContent) => {
|
|
643
|
-
if (!rowContent || !rowContent.length) {
|
|
650
|
+
if (!rowContent || !rowContent.length) {
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
644
653
|
content.push(['tr', rowContent]);
|
|
645
654
|
};
|
|
646
655
|
[
|
|
@@ -652,8 +661,8 @@ export default {
|
|
|
652
661
|
: '',
|
|
653
662
|
[
|
|
654
663
|
...(() => {
|
|
655
|
-
const addBrowseFieldSet = (setType) =>
|
|
656
|
-
browseFields.reduce((rowContent, {
|
|
664
|
+
const addBrowseFieldSet = (setType) => {
|
|
665
|
+
return browseFields.reduce((rowContent, {
|
|
657
666
|
fieldName, aliases, fieldSchema: {minimum, maximum}
|
|
658
667
|
}, j) => {
|
|
659
668
|
// Namespace by work for sake of browser auto-complete caching
|
|
@@ -664,36 +673,41 @@ export default {
|
|
|
664
673
|
['label', {for: name}, [fieldName]]
|
|
665
674
|
]],
|
|
666
675
|
['td', [
|
|
667
|
-
aliases
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
) {
|
|
680
|
-
bf.
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
676
|
+
aliases
|
|
677
|
+
? ['datalist', {
|
|
678
|
+
id: 'dl-' + id
|
|
679
|
+
}, aliases.map((alias) => ['option', [alias]])]
|
|
680
|
+
: '',
|
|
681
|
+
aliases
|
|
682
|
+
? ['input', {
|
|
683
|
+
name, id, class: 'browseField',
|
|
684
|
+
list: 'dl-' + id,
|
|
685
|
+
value: $p.get(name, true),
|
|
686
|
+
$on: setType === 'start'
|
|
687
|
+
? {change (e) {
|
|
688
|
+
$$('input.browseField').forEach((bf) => {
|
|
689
|
+
if (bf.id.includes((i + 1) + '-' +
|
|
690
|
+
(j + 1))
|
|
691
|
+
) {
|
|
692
|
+
bf.value = e.target.value;
|
|
693
|
+
}
|
|
694
|
+
});
|
|
695
|
+
}}
|
|
696
|
+
: undefined
|
|
697
|
+
}]
|
|
698
|
+
: ['input', {
|
|
699
|
+
name, id,
|
|
700
|
+
type: 'number',
|
|
701
|
+
min: minimum,
|
|
702
|
+
max: maximum,
|
|
703
|
+
value: $p.get(name, true)
|
|
704
|
+
}],
|
|
692
705
|
nbsp3
|
|
693
706
|
]]
|
|
694
707
|
);
|
|
695
708
|
return rowContent;
|
|
696
709
|
}, {'#': []});
|
|
710
|
+
};
|
|
697
711
|
return [
|
|
698
712
|
addBrowseFieldSet('start'),
|
|
699
713
|
['td', [
|
|
@@ -708,7 +722,7 @@ export default {
|
|
|
708
722
|
]]
|
|
709
723
|
],
|
|
710
724
|
[
|
|
711
|
-
['td', {colspan: 4 * browseFields.length + 2 + 1, align: 'center'}, [
|
|
725
|
+
['td', {colspan: (4 * browseFields.length) + 2 + 1, align: 'center'}, [
|
|
712
726
|
['table', [
|
|
713
727
|
['tr', [
|
|
714
728
|
browseFields.reduce((
|
|
@@ -724,9 +738,11 @@ export default {
|
|
|
724
738
|
['label', {for: name}, [fieldName]]
|
|
725
739
|
]],
|
|
726
740
|
['td', [
|
|
727
|
-
aliases
|
|
728
|
-
|
|
729
|
-
|
|
741
|
+
aliases
|
|
742
|
+
? ['datalist', {
|
|
743
|
+
id: 'dl-' + id
|
|
744
|
+
}, aliases.map((alias) => ['option', [alias]])]
|
|
745
|
+
: '',
|
|
730
746
|
aliases
|
|
731
747
|
? ['input', {
|
|
732
748
|
name, id, class: 'browseField',
|
|
@@ -752,15 +768,16 @@ export default {
|
|
|
752
768
|
['td', [
|
|
753
769
|
['label', [
|
|
754
770
|
lDirectional('field') + nbsp2,
|
|
755
|
-
['select', {
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
return ['option', [fieldAliasOrName]];
|
|
762
|
-
}
|
|
763
|
-
|
|
771
|
+
['select', {
|
|
772
|
+
name: lIndexedParam('anchorfield') + (i + 1),
|
|
773
|
+
size: '1'
|
|
774
|
+
}, fieldInfo.map(({fieldAliasOrName}) => {
|
|
775
|
+
const val = $p.get(lIndexedParam('anchorfield') + (i + 1), true);
|
|
776
|
+
if (val === fieldAliasOrName) {
|
|
777
|
+
return ['option', {selected: true}, [fieldAliasOrName]];
|
|
778
|
+
}
|
|
779
|
+
return ['option', [fieldAliasOrName]];
|
|
780
|
+
})]
|
|
764
781
|
]]
|
|
765
782
|
]]
|
|
766
783
|
]]
|
|
@@ -771,7 +788,8 @@ export default {
|
|
|
771
788
|
},
|
|
772
789
|
main ({
|
|
773
790
|
workI18n, languageParam,
|
|
774
|
-
l, namespace, heading, fallbackDirection,
|
|
791
|
+
l, namespace, heading, // fallbackDirection,
|
|
792
|
+
languageI18n, langs, fieldInfo, localizeParamNames,
|
|
775
793
|
serializeParamsAsURL, paramsSetter, replaceHash,
|
|
776
794
|
getFieldAliasOrNames,
|
|
777
795
|
hideFormattingSection, $p,
|
|
@@ -784,9 +802,10 @@ export default {
|
|
|
784
802
|
{...getDataForSerializingParamsAsURL(), type}
|
|
785
803
|
);
|
|
786
804
|
};
|
|
787
|
-
const lOption = (key, atts) =>
|
|
788
|
-
['option', atts, [
|
|
789
|
-
l(
|
|
805
|
+
const lOption = (key, atts) => {
|
|
806
|
+
return ['option', atts, [
|
|
807
|
+
l(
|
|
808
|
+
key
|
|
790
809
|
// Ensure `intl-dom` supports
|
|
791
810
|
// , fallback ({message}) {
|
|
792
811
|
// atts.dir = fallbackDirection;
|
|
@@ -794,6 +813,7 @@ export default {
|
|
|
794
813
|
// }
|
|
795
814
|
)
|
|
796
815
|
]];
|
|
816
|
+
};
|
|
797
817
|
// Returns element with localized or fallback attribute value (as Jamilih);
|
|
798
818
|
// also adds direction
|
|
799
819
|
jml(
|
|
@@ -38,11 +38,11 @@ export default ({groups, workI18n, getNextAlias, $p, followParams}) => {
|
|
|
38
38
|
}
|
|
39
39
|
}, [
|
|
40
40
|
['option', {value: ''}, ['--']],
|
|
41
|
-
...group.files.map(({name: fileName}) =>
|
|
42
|
-
['option', {
|
|
41
|
+
...group.files.map(({name: fileName}) => {
|
|
42
|
+
return ['option', {
|
|
43
43
|
value: workI18n(['workNames', group.id, fileName])
|
|
44
|
-
}, [getNextAlias()]]
|
|
45
|
-
)
|
|
44
|
+
}, [getNextAlias()]];
|
|
45
|
+
})
|
|
46
46
|
]]
|
|
47
47
|
// Todo: Add in Go button (with 'submitgo' localization string) to
|
|
48
48
|
// avoid need for pull-down if using first selection?
|
|
@@ -14,7 +14,7 @@ function _prepareParam (param, skip) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
// start, end, toggle
|
|
17
|
-
const endNums = /\d+(-\d+)?$/;
|
|
17
|
+
const endNums = /\d+(-\d+)?$/;
|
|
18
18
|
const indexed = param.match(endNums);
|
|
19
19
|
if (indexed) {
|
|
20
20
|
// Todo: We could i18nize numbers as well
|
|
@@ -36,7 +36,9 @@ export class Languages {
|
|
|
36
36
|
// || new Intl.DisplayNames([locale], {type: 'language'}).of(code);
|
|
37
37
|
}
|
|
38
38
|
getFieldNameFromPluginNameAndLocales ({
|
|
39
|
-
pluginName,
|
|
39
|
+
pluginName,
|
|
40
|
+
// locales,
|
|
41
|
+
workI18n, targetLanguage, applicableFieldI18N, meta, metaApplicableField
|
|
40
42
|
}) {
|
|
41
43
|
return workI18n(['plugins', pluginName, 'fieldname'], {
|
|
42
44
|
...meta,
|
|
@@ -3,8 +3,9 @@ import {getPreferredLanguages} from './Languages.js';
|
|
|
3
3
|
// Keep this as the last import for Rollup
|
|
4
4
|
import JsonRefs from 'json-refs'; // eslint-disable-line import/order
|
|
5
5
|
|
|
6
|
-
const getCurrDir = () =>
|
|
7
|
-
window.location.href.replace(/(index\.html)?#.*$/, '');
|
|
6
|
+
const getCurrDir = () => {
|
|
7
|
+
return window.location.href.replace(/(index\.html)?#.*$/, '');
|
|
8
|
+
};
|
|
8
9
|
|
|
9
10
|
export const getMetaProp = function getMetaProp (lang, metadataObj, properties, allowObjects) {
|
|
10
11
|
let prop;
|
|
@@ -38,8 +39,8 @@ export const getMetadata = async (file, property, basePath) => {
|
|
|
38
39
|
url.pathname = file;
|
|
39
40
|
url.hash = property ? '#/' + property : '';
|
|
40
41
|
|
|
41
|
-
return (await JsonRefs
|
|
42
|
-
|
|
42
|
+
return (await JsonRefs.
|
|
43
|
+
resolveRefsAt(
|
|
43
44
|
url.toString(),
|
|
44
45
|
{
|
|
45
46
|
loaderOptions: {
|
|
@@ -59,9 +60,9 @@ export const getMetadata = async (file, property, basePath) => {
|
|
|
59
60
|
export const getFieldNameAndValueAliases = function ({
|
|
60
61
|
field, schemaItems, metadataObj, getFieldAliasOrName, lang
|
|
61
62
|
}) {
|
|
62
|
-
const fieldSchemaIndex = schemaItems.findIndex((item) =>
|
|
63
|
-
item.title === field
|
|
64
|
-
);
|
|
63
|
+
const fieldSchemaIndex = schemaItems.findIndex((item) => {
|
|
64
|
+
return item.title === field;
|
|
65
|
+
});
|
|
65
66
|
const fieldSchema = schemaItems[fieldSchemaIndex];
|
|
66
67
|
|
|
67
68
|
const fieldInfo = metadataObj.fields[field];
|
|
@@ -118,13 +119,13 @@ export const getFieldNameAndValueAliases = function ({
|
|
|
118
119
|
// We'll assume the longest version is best for auto-complete
|
|
119
120
|
ret.aliases.push(
|
|
120
121
|
...(
|
|
121
|
-
aliases.filter((v) =>
|
|
122
|
-
aliases.every((x) =>
|
|
123
|
-
x === v || !(
|
|
122
|
+
aliases.filter((v) => {
|
|
123
|
+
return aliases.every((x) => {
|
|
124
|
+
return x === v || !(
|
|
124
125
|
x.toLowerCase().startsWith(v.toLowerCase())
|
|
125
|
-
)
|
|
126
|
-
)
|
|
127
|
-
).map((v) => v + ' (' + key + ')') // Todo: i18nize
|
|
126
|
+
);
|
|
127
|
+
});
|
|
128
|
+
}).map((v) => v + ' (' + key + ')') // Todo: i18nize
|
|
128
129
|
)
|
|
129
130
|
);
|
|
130
131
|
});
|
|
@@ -152,13 +153,13 @@ export const getBrowseFieldData = function ({
|
|
|
152
153
|
// Todo: Deal with ['td', [['h3', [lDirectional(browseFieldObject.name)]]]]
|
|
153
154
|
// as kind of fieldset
|
|
154
155
|
|
|
155
|
-
const browseFields = fieldSets.map((field) =>
|
|
156
|
-
getFieldNameAndValueAliases({
|
|
156
|
+
const browseFields = fieldSets.map((field) => {
|
|
157
|
+
return getFieldNameAndValueAliases({
|
|
157
158
|
lang,
|
|
158
159
|
field, schemaItems, metadataObj,
|
|
159
160
|
getFieldAliasOrName
|
|
160
|
-
})
|
|
161
|
-
);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
162
163
|
callback({setName, browseFields, i, presort}); // eslint-disable-line n/no-callback-literal
|
|
163
164
|
});
|
|
164
165
|
};
|
|
@@ -199,7 +200,7 @@ export class Metadata {
|
|
|
199
200
|
// If this is a localized field (e.g., enum), we don't want
|
|
200
201
|
// to avoid as may be translated (should check though)
|
|
201
202
|
const hasFieldValue = localeStrings &&
|
|
202
|
-
Object.keys(localeStrings).some(lng => {
|
|
203
|
+
Object.keys(localeStrings).some((lng) => {
|
|
203
204
|
const fv = localeStrings[lng] &&
|
|
204
205
|
localeStrings[lng].fieldvalue;
|
|
205
206
|
return fv && fv[field];
|
|
@@ -207,9 +208,9 @@ export class Metadata {
|
|
|
207
208
|
|
|
208
209
|
return hasFieldValue ||
|
|
209
210
|
(metaLang && preferredLanguages.includes(metaLang)) ||
|
|
210
|
-
schemaItems.some(item =>
|
|
211
|
-
item.title === field && item.type !== 'string'
|
|
212
|
-
);
|
|
211
|
+
schemaItems.some((item) => {
|
|
212
|
+
return item.title === field && item.type !== 'string';
|
|
213
|
+
});
|
|
213
214
|
};
|
|
214
215
|
}
|
|
215
216
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
export const escapePluginComponent = (pluginName) => {
|
|
2
|
-
return pluginName.
|
|
3
|
-
|
|
2
|
+
return pluginName.replaceAll('^', '^^'). // Escape our escape
|
|
3
|
+
replaceAll('-', '^0');
|
|
4
4
|
};
|
|
5
5
|
|
|
6
6
|
export const unescapePluginComponent = (pluginName) => {
|
|
7
7
|
if (!pluginName) {
|
|
8
8
|
return pluginName;
|
|
9
9
|
}
|
|
10
|
-
return pluginName.
|
|
10
|
+
return pluginName.replaceAll(
|
|
11
11
|
/(\^+)0/g,
|
|
12
12
|
(n0, esc) => {
|
|
13
13
|
return esc.length % 2
|
|
14
14
|
? esc.slice(1) + '-'
|
|
15
15
|
: n0;
|
|
16
16
|
}
|
|
17
|
-
).
|
|
17
|
+
).replaceAll('^^', '^');
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
export const escapePlugin = ({pluginName, applicableField, targetLanguage}) => {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* globals console, location, URL */
|
|
2
1
|
// import {escapeHTML} from './sanitize.js';
|
|
3
2
|
import {dialogs} from './dialogs.js';
|
|
4
3
|
|
|
@@ -36,7 +35,8 @@ export const setServiceWorkerDefaults = (target, source) => {
|
|
|
36
35
|
// some tabs open)
|
|
37
36
|
|
|
38
37
|
export const listenForWorkerUpdate = ({
|
|
39
|
-
r
|
|
38
|
+
r
|
|
39
|
+
// logger
|
|
40
40
|
}) => {
|
|
41
41
|
r.addEventListener('updatefound', (e) => {
|
|
42
42
|
// New service worker has appeared
|
|
@@ -64,8 +64,7 @@ this dialog now and continue working with the old version.
|
|
|
64
64
|
However, when you are finished, you should close this tab
|
|
65
65
|
and any other old tabs for this site in order to be able to
|
|
66
66
|
begin using the new version.
|
|
67
|
-
`
|
|
68
|
-
);
|
|
67
|
+
`);
|
|
69
68
|
break;
|
|
70
69
|
case 'redundant': // discarded. Either failed install, or it's been
|
|
71
70
|
// replaced by a newer version
|
|
@@ -82,8 +81,7 @@ this dialog now and continue working with the old version.
|
|
|
82
81
|
However, when you are finished, you may wish to close this tab
|
|
83
82
|
and any other old tabs for this site in order to try again
|
|
84
83
|
for offline installation.
|
|
85
|
-
`
|
|
86
|
-
);
|
|
84
|
+
`);
|
|
87
85
|
break;
|
|
88
86
|
// These shouldn't occur as we are not skipping waiting (?)
|
|
89
87
|
case 'activating':
|
|
@@ -105,7 +103,7 @@ export const respondToState = async ({
|
|
|
105
103
|
// We use this promise for rejecting (inside a listener)
|
|
106
104
|
// to a common catch and to prevent continuation by
|
|
107
105
|
// failing to return
|
|
108
|
-
return new Promise(async (
|
|
106
|
+
return new Promise(async () => { // eslint-disable-line no-async-promise-executor
|
|
109
107
|
navigator.serviceWorker.addEventListener('message', ({data}) => {
|
|
110
108
|
const {message, type, name, errorType} = data;
|
|
111
109
|
console.log('msg1', message, r);
|
|
@@ -186,8 +184,7 @@ export const respondToState = async ({
|
|
|
186
184
|
await dialogs.alert(`
|
|
187
185
|
There was likely an error installing. Click "ok" to try again.
|
|
188
186
|
(Error code: Service worker is redundant)
|
|
189
|
-
`
|
|
190
|
-
);
|
|
187
|
+
`);
|
|
191
188
|
location.reload();
|
|
192
189
|
// listenForWorkerUpdate({r, logger});
|
|
193
190
|
} else if (r.installing) {
|
|
@@ -203,8 +200,7 @@ you have in them, please close this and any other existing tabs
|
|
|
203
200
|
running this web application and then open the site again.
|
|
204
201
|
Please note it may take some time to install and may not show
|
|
205
202
|
any indication it is installing.
|
|
206
|
-
`, {ok: false}
|
|
207
|
-
);
|
|
203
|
+
`, {ok: false});
|
|
208
204
|
// We might just let the user go on without a reload, but
|
|
209
205
|
// as fetch operations would apparently wait to execute,
|
|
210
206
|
// it wouldn't be much use, so just reload (to get same
|
|
@@ -67,9 +67,9 @@ export const getWorkData = async function ({
|
|
|
67
67
|
|
|
68
68
|
let fileData;
|
|
69
69
|
const fileGroup = filesObj.groups.find((fg) => {
|
|
70
|
-
fileData = fg.files.find((file) =>
|
|
71
|
-
work === workI18n(['workNames', fg.id, file.name])
|
|
72
|
-
);
|
|
70
|
+
fileData = fg.files.find((file) => {
|
|
71
|
+
return work === workI18n(['workNames', fg.id, file.name]);
|
|
72
|
+
});
|
|
73
73
|
return Boolean(fileData);
|
|
74
74
|
});
|
|
75
75
|
// This is not specific to the work, but we export it anyways
|
|
@@ -178,7 +178,7 @@ export const getWorkData = async function ({
|
|
|
178
178
|
console.log('pluginsForWork', pluginsForWork);
|
|
179
179
|
const {lang, namespace} = this; // array with first item as preferred
|
|
180
180
|
pluginsForWork.iterateMappings(({
|
|
181
|
-
plugin,
|
|
181
|
+
// plugin,
|
|
182
182
|
pluginName, pluginLang,
|
|
183
183
|
onByDefaultDefault,
|
|
184
184
|
placement, applicableFields, meta
|
|
@@ -63,6 +63,7 @@ class Dialog {
|
|
|
63
63
|
return dialog;
|
|
64
64
|
}
|
|
65
65
|
makeCancelDialog ({
|
|
66
|
+
// eslint-disable-next-line no-unused-vars -- Discarding
|
|
66
67
|
submit, // Don't pass this on to `args` if present
|
|
67
68
|
cancel,
|
|
68
69
|
cancelClass = 'cancel', submitClass = 'submit',
|
|
@@ -94,7 +95,7 @@ class Dialog {
|
|
|
94
95
|
message: msg,
|
|
95
96
|
submitClass = 'submit'
|
|
96
97
|
} = message;
|
|
97
|
-
return new Promise((resolve
|
|
98
|
+
return new Promise((resolve) => {
|
|
98
99
|
const dialog = /** @type {HTMLDialogElement} */ (jml('dialog', [
|
|
99
100
|
msg,
|
|
100
101
|
...(includeOk
|
|
@@ -17,9 +17,9 @@ export default async function getLocaleFallbackResults ({
|
|
|
17
17
|
// `$ref` (as with <https://github.com/whitlockjc/json-refs>) and
|
|
18
18
|
// replace `loadLocales` behavior with our own now resolved
|
|
19
19
|
// locales; see https://github.com/jdorn/json-editor/issues/132
|
|
20
|
-
return basePath + (langData.localeFileBasePath) + langs.find((l) =>
|
|
21
|
-
l.code === code
|
|
22
|
-
).locale.$ref;
|
|
20
|
+
return basePath + (langData.localeFileBasePath) + langs.find((l) => {
|
|
21
|
+
return l.code === code;
|
|
22
|
+
}).locale.$ref;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
if (!$p.l10n) {
|