@omicronenergy/oscd-scl-dialogs 0.0.9 → 0.0.10
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/CHANGELOG.md +13 -0
- package/custom-elements.json +427 -5
- package/dist/OscdTextEditor.d.ts +7 -4
- package/dist/OscdTextEditor.js +33 -29
- package/dist/OscdTextEditor.js.map +1 -1
- package/dist/ace-editor/AceEditor.d.ts +62 -0
- package/dist/ace-editor/AceEditor.js +202 -0
- package/dist/ace-editor/AceEditor.js.map +1 -0
- package/dist/ace-editor/debounce.d.ts +24 -0
- package/dist/ace-editor/debounce.js +41 -0
- package/dist/ace-editor/debounce.js.map +1 -0
- package/dist/ace-editor/property-decorators.d.ts +66 -0
- package/dist/ace-editor/property-decorators.js +171 -0
- package/dist/ace-editor/property-decorators.js.map +1 -0
- package/dist/wizards/ldevice.js +7 -5
- package/dist/wizards/ldevice.js.map +1 -1
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.10](https://github.com/OMICRONEnergyOSS/oscd-scl-dialogs/compare/oscd-scl-dialogs-v0.0.9...oscd-scl-dialogs-v0.0.10) (2026-02-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* copy in ace-custom-element to avoid scoping torture ([5b9b757](https://github.com/OMICRONEnergyOSS/oscd-scl-dialogs/commit/5b9b7575f7b0db00175f52ce8f5b53adc4691329))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* bundling ace-editor should not cause component scope issues ([769def5](https://github.com/OMICRONEnergyOSS/oscd-scl-dialogs/commit/769def5eac0c75956e3f20bcb4fb06a379349db9))
|
|
14
|
+
* ldevice updates should only update ldName when correctly set ([042ef2f](https://github.com/OMICRONEnergyOSS/oscd-scl-dialogs/commit/042ef2f3f1da41f5464e0f1ab26da34faf7550bf))
|
|
15
|
+
|
|
3
16
|
## [0.0.9](https://github.com/OMICRONEnergyOSS/oscd-scl-dialogs/compare/oscd-scl-dialogs-v0.0.8...oscd-scl-dialogs-v0.0.9) (2026-02-16)
|
|
4
17
|
|
|
5
18
|
|
package/custom-elements.json
CHANGED
|
@@ -328,7 +328,7 @@
|
|
|
328
328
|
"text": "object"
|
|
329
329
|
},
|
|
330
330
|
"static": true,
|
|
331
|
-
"default": "{ // Left here for clarity sake. We need to dyn-import this so we have a chance of overriding the customElements.define to prevent // ace-editor from being registered globally and causing issues with other instances of ace-editor in the same document.
|
|
331
|
+
"default": "{ // Left here for clarity sake. We need to dyn-import this so we have a chance of overriding the customElements.define to prevent // ace-editor from being registered globally and causing issues with other instances of ace-editor in the same document. 'ace-editor': AceEditor, }"
|
|
332
332
|
},
|
|
333
333
|
{
|
|
334
334
|
"kind": "field",
|
|
@@ -367,6 +367,29 @@
|
|
|
367
367
|
}
|
|
368
368
|
]
|
|
369
369
|
},
|
|
370
|
+
{
|
|
371
|
+
"kind": "method",
|
|
372
|
+
"name": "firstUpdated",
|
|
373
|
+
"privacy": "protected",
|
|
374
|
+
"return": {
|
|
375
|
+
"type": {
|
|
376
|
+
"text": "void"
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
"parameters": [
|
|
380
|
+
{
|
|
381
|
+
"name": "_changedProperties",
|
|
382
|
+
"type": {
|
|
383
|
+
"text": "PropertyValues"
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
]
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"kind": "method",
|
|
390
|
+
"name": "clearSelection",
|
|
391
|
+
"privacy": "private"
|
|
392
|
+
},
|
|
370
393
|
{
|
|
371
394
|
"kind": "method",
|
|
372
395
|
"name": "updated",
|
|
@@ -394,10 +417,6 @@
|
|
|
394
417
|
"name": "styles",
|
|
395
418
|
"static": true,
|
|
396
419
|
"default": "css` :host { height: 100%; width: 100%; overflow: auto; } ace-editor { height: 100%; width: 100%; } `"
|
|
397
|
-
},
|
|
398
|
-
{
|
|
399
|
-
"kind": "field",
|
|
400
|
-
"name": "define"
|
|
401
420
|
}
|
|
402
421
|
],
|
|
403
422
|
"events": [
|
|
@@ -903,6 +922,403 @@
|
|
|
903
922
|
}
|
|
904
923
|
]
|
|
905
924
|
},
|
|
925
|
+
{
|
|
926
|
+
"kind": "javascript-module",
|
|
927
|
+
"path": "ace-editor/AceEditor.ts",
|
|
928
|
+
"declarations": [
|
|
929
|
+
{
|
|
930
|
+
"kind": "class",
|
|
931
|
+
"description": "Custom element Ace code editor",
|
|
932
|
+
"name": "AceEditor",
|
|
933
|
+
"members": [
|
|
934
|
+
{
|
|
935
|
+
"kind": "field",
|
|
936
|
+
"name": "_observedAttributes",
|
|
937
|
+
"type": {
|
|
938
|
+
"text": "string[]"
|
|
939
|
+
},
|
|
940
|
+
"privacy": "private",
|
|
941
|
+
"static": true,
|
|
942
|
+
"default": "[]"
|
|
943
|
+
},
|
|
944
|
+
{
|
|
945
|
+
"kind": "field",
|
|
946
|
+
"name": "_editor",
|
|
947
|
+
"type": {
|
|
948
|
+
"text": "Ace.Editor | undefined"
|
|
949
|
+
},
|
|
950
|
+
"privacy": "private"
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
"kind": "field",
|
|
954
|
+
"name": "editor",
|
|
955
|
+
"type": {
|
|
956
|
+
"text": "Ace.Editor | undefined"
|
|
957
|
+
},
|
|
958
|
+
"readonly": true
|
|
959
|
+
},
|
|
960
|
+
{
|
|
961
|
+
"kind": "field",
|
|
962
|
+
"name": "version",
|
|
963
|
+
"type": {
|
|
964
|
+
"text": "{ [key: string]: string }"
|
|
965
|
+
},
|
|
966
|
+
"readonly": true
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
"kind": "field",
|
|
970
|
+
"name": "value",
|
|
971
|
+
"type": {
|
|
972
|
+
"text": "string | undefined"
|
|
973
|
+
}
|
|
974
|
+
},
|
|
975
|
+
{
|
|
976
|
+
"kind": "field",
|
|
977
|
+
"name": "mode",
|
|
978
|
+
"type": {
|
|
979
|
+
"text": "string | undefined"
|
|
980
|
+
}
|
|
981
|
+
},
|
|
982
|
+
{
|
|
983
|
+
"kind": "field",
|
|
984
|
+
"name": "theme",
|
|
985
|
+
"type": {
|
|
986
|
+
"text": "string | undefined"
|
|
987
|
+
}
|
|
988
|
+
},
|
|
989
|
+
{
|
|
990
|
+
"kind": "field",
|
|
991
|
+
"name": "tabSize",
|
|
992
|
+
"type": {
|
|
993
|
+
"text": "number | undefined"
|
|
994
|
+
}
|
|
995
|
+
},
|
|
996
|
+
{
|
|
997
|
+
"kind": "field",
|
|
998
|
+
"name": "readonly",
|
|
999
|
+
"type": {
|
|
1000
|
+
"text": "boolean | undefined"
|
|
1001
|
+
}
|
|
1002
|
+
},
|
|
1003
|
+
{
|
|
1004
|
+
"kind": "field",
|
|
1005
|
+
"name": "softTabs",
|
|
1006
|
+
"type": {
|
|
1007
|
+
"text": "boolean | undefined"
|
|
1008
|
+
}
|
|
1009
|
+
},
|
|
1010
|
+
{
|
|
1011
|
+
"kind": "field",
|
|
1012
|
+
"name": "wrap",
|
|
1013
|
+
"type": {
|
|
1014
|
+
"text": "boolean | undefined"
|
|
1015
|
+
}
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
"kind": "field",
|
|
1019
|
+
"name": "valueUpdateMode",
|
|
1020
|
+
"type": {
|
|
1021
|
+
"text": "ValueUpdateMode | undefined"
|
|
1022
|
+
}
|
|
1023
|
+
},
|
|
1024
|
+
{
|
|
1025
|
+
"kind": "field",
|
|
1026
|
+
"name": "hideActiveLineHighlight",
|
|
1027
|
+
"type": {
|
|
1028
|
+
"text": "boolean | undefined"
|
|
1029
|
+
}
|
|
1030
|
+
},
|
|
1031
|
+
{
|
|
1032
|
+
"kind": "field",
|
|
1033
|
+
"name": "hideGutter",
|
|
1034
|
+
"type": {
|
|
1035
|
+
"text": "boolean | undefined"
|
|
1036
|
+
}
|
|
1037
|
+
},
|
|
1038
|
+
{
|
|
1039
|
+
"kind": "field",
|
|
1040
|
+
"name": "hideGutterLineHighlight",
|
|
1041
|
+
"type": {
|
|
1042
|
+
"text": "boolean | undefined"
|
|
1043
|
+
}
|
|
1044
|
+
},
|
|
1045
|
+
{
|
|
1046
|
+
"kind": "field",
|
|
1047
|
+
"name": "hidePrintMargin",
|
|
1048
|
+
"type": {
|
|
1049
|
+
"text": "boolean | undefined"
|
|
1050
|
+
}
|
|
1051
|
+
},
|
|
1052
|
+
{
|
|
1053
|
+
"kind": "field",
|
|
1054
|
+
"name": "basePath",
|
|
1055
|
+
"type": {
|
|
1056
|
+
"text": "string | undefined"
|
|
1057
|
+
}
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
"kind": "method",
|
|
1061
|
+
"name": "dispatch",
|
|
1062
|
+
"privacy": "private",
|
|
1063
|
+
"return": {
|
|
1064
|
+
"type": {
|
|
1065
|
+
"text": "void"
|
|
1066
|
+
}
|
|
1067
|
+
},
|
|
1068
|
+
"parameters": [
|
|
1069
|
+
{
|
|
1070
|
+
"name": "type",
|
|
1071
|
+
"type": {
|
|
1072
|
+
"text": "string"
|
|
1073
|
+
}
|
|
1074
|
+
},
|
|
1075
|
+
{
|
|
1076
|
+
"name": "detail",
|
|
1077
|
+
"type": {
|
|
1078
|
+
"text": "T"
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
]
|
|
1082
|
+
},
|
|
1083
|
+
{
|
|
1084
|
+
"kind": "field",
|
|
1085
|
+
"name": "initializeEditor",
|
|
1086
|
+
"privacy": "private"
|
|
1087
|
+
},
|
|
1088
|
+
{
|
|
1089
|
+
"kind": "method",
|
|
1090
|
+
"name": "appendStyles",
|
|
1091
|
+
"privacy": "private"
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
"kind": "method",
|
|
1095
|
+
"name": "notifyPropertyChanged",
|
|
1096
|
+
"return": {
|
|
1097
|
+
"type": {
|
|
1098
|
+
"text": "void"
|
|
1099
|
+
}
|
|
1100
|
+
},
|
|
1101
|
+
"parameters": [
|
|
1102
|
+
{
|
|
1103
|
+
"name": "name",
|
|
1104
|
+
"type": {
|
|
1105
|
+
"text": "string"
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
]
|
|
1109
|
+
},
|
|
1110
|
+
{
|
|
1111
|
+
"kind": "method",
|
|
1112
|
+
"name": "resize",
|
|
1113
|
+
"return": {
|
|
1114
|
+
"type": {
|
|
1115
|
+
"text": "void"
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
},
|
|
1119
|
+
{
|
|
1120
|
+
"kind": "field",
|
|
1121
|
+
"name": "handleChange",
|
|
1122
|
+
"privacy": "private"
|
|
1123
|
+
},
|
|
1124
|
+
{
|
|
1125
|
+
"kind": "field",
|
|
1126
|
+
"name": "handleBlur",
|
|
1127
|
+
"privacy": "private"
|
|
1128
|
+
}
|
|
1129
|
+
],
|
|
1130
|
+
"events": [
|
|
1131
|
+
{
|
|
1132
|
+
"name": "type",
|
|
1133
|
+
"type": {
|
|
1134
|
+
"text": "CustomEvent"
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
],
|
|
1138
|
+
"superclass": {
|
|
1139
|
+
"name": "HTMLElement"
|
|
1140
|
+
},
|
|
1141
|
+
"customElement": true
|
|
1142
|
+
}
|
|
1143
|
+
],
|
|
1144
|
+
"exports": [
|
|
1145
|
+
{
|
|
1146
|
+
"kind": "js",
|
|
1147
|
+
"name": "default",
|
|
1148
|
+
"declaration": {
|
|
1149
|
+
"name": "AceEditor",
|
|
1150
|
+
"module": "ace-editor/AceEditor.ts"
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
]
|
|
1154
|
+
},
|
|
1155
|
+
{
|
|
1156
|
+
"kind": "javascript-module",
|
|
1157
|
+
"path": "ace-editor/debounce.ts",
|
|
1158
|
+
"declarations": [
|
|
1159
|
+
{
|
|
1160
|
+
"kind": "function",
|
|
1161
|
+
"name": "debounce",
|
|
1162
|
+
"return": {
|
|
1163
|
+
"type": {
|
|
1164
|
+
"text": "() => Promise<T>"
|
|
1165
|
+
}
|
|
1166
|
+
},
|
|
1167
|
+
"parameters": [
|
|
1168
|
+
{
|
|
1169
|
+
"name": "func",
|
|
1170
|
+
"type": {
|
|
1171
|
+
"text": "(...params: any[]) => T"
|
|
1172
|
+
},
|
|
1173
|
+
"description": "The function to invoke."
|
|
1174
|
+
},
|
|
1175
|
+
{
|
|
1176
|
+
"name": "wait",
|
|
1177
|
+
"default": "0",
|
|
1178
|
+
"description": "The time in milliseconds to wait for idle invocations."
|
|
1179
|
+
}
|
|
1180
|
+
],
|
|
1181
|
+
"description": "Returns a new function that delays invocations to the original function\nwithin a specified wait period. The last invocation within this time period\ngets invoked. All earlier invocations are ignore."
|
|
1182
|
+
}
|
|
1183
|
+
],
|
|
1184
|
+
"exports": [
|
|
1185
|
+
{
|
|
1186
|
+
"kind": "js",
|
|
1187
|
+
"name": "debounce",
|
|
1188
|
+
"declaration": {
|
|
1189
|
+
"name": "debounce",
|
|
1190
|
+
"module": "ace-editor/debounce.ts"
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
]
|
|
1194
|
+
},
|
|
1195
|
+
{
|
|
1196
|
+
"kind": "javascript-module",
|
|
1197
|
+
"path": "ace-editor/property-decorators.ts",
|
|
1198
|
+
"declarations": [
|
|
1199
|
+
{
|
|
1200
|
+
"kind": "function",
|
|
1201
|
+
"name": "NotifyAttribute",
|
|
1202
|
+
"parameters": [
|
|
1203
|
+
{
|
|
1204
|
+
"name": "attribute",
|
|
1205
|
+
"optional": true,
|
|
1206
|
+
"type": {
|
|
1207
|
+
"text": "string"
|
|
1208
|
+
},
|
|
1209
|
+
"description": "Override the attribute name to use. If ommitted, the\nproperty name is used (coverted from camelCase, to kebab-case)."
|
|
1210
|
+
}
|
|
1211
|
+
],
|
|
1212
|
+
"description": "Defines that the target property should be exposed as an attribute, and\nthat changes to the attribute should trigger a `notifyPropertyChanged`\ncallback."
|
|
1213
|
+
},
|
|
1214
|
+
{
|
|
1215
|
+
"kind": "function",
|
|
1216
|
+
"name": "NotifyBooleanAttribute",
|
|
1217
|
+
"parameters": [
|
|
1218
|
+
{
|
|
1219
|
+
"name": "attribute",
|
|
1220
|
+
"optional": true,
|
|
1221
|
+
"type": {
|
|
1222
|
+
"text": "string"
|
|
1223
|
+
},
|
|
1224
|
+
"description": "Override the attribute name to use. If ommitted, the\nproperty name is used (coverted from camelCase, to snake-case)."
|
|
1225
|
+
}
|
|
1226
|
+
],
|
|
1227
|
+
"description": "Defines that the target property should be exposed as boolean attribute, and\nthat changes to the attribute should trigger a `notifyPropertyChanged`\ncallback."
|
|
1228
|
+
},
|
|
1229
|
+
{
|
|
1230
|
+
"kind": "function",
|
|
1231
|
+
"name": "NotifyNumericAttribute",
|
|
1232
|
+
"parameters": [
|
|
1233
|
+
{
|
|
1234
|
+
"name": "attribute",
|
|
1235
|
+
"optional": true,
|
|
1236
|
+
"type": {
|
|
1237
|
+
"text": "string"
|
|
1238
|
+
},
|
|
1239
|
+
"description": "Override the attribute name to use. If ommitted, the\nproperty name is used (coverted from camelCase, to snake-case)."
|
|
1240
|
+
}
|
|
1241
|
+
],
|
|
1242
|
+
"description": "Defines that the target property should be exposed as numeric attribute, and\nthat changes to the attribute should trigger a `notifyPropertyChanged`\ncallback."
|
|
1243
|
+
},
|
|
1244
|
+
{
|
|
1245
|
+
"kind": "function",
|
|
1246
|
+
"name": "Notify",
|
|
1247
|
+
"return": {
|
|
1248
|
+
"type": {
|
|
1249
|
+
"text": "(target: NotifyTarget & HTMLElement, key: string) => void"
|
|
1250
|
+
}
|
|
1251
|
+
},
|
|
1252
|
+
"parameters": [
|
|
1253
|
+
{
|
|
1254
|
+
"name": "attribute",
|
|
1255
|
+
"optional": true,
|
|
1256
|
+
"type": {
|
|
1257
|
+
"text": "string"
|
|
1258
|
+
},
|
|
1259
|
+
"description": "Expose the property as an attribute. Note that when\nattribute is specified, this method has the same behavior as\n`NotifyAttribute`."
|
|
1260
|
+
}
|
|
1261
|
+
],
|
|
1262
|
+
"description": "Defines that the target property should trigger a `notifyPropertyChanged`\ncallback when the property changes."
|
|
1263
|
+
},
|
|
1264
|
+
{
|
|
1265
|
+
"kind": "function",
|
|
1266
|
+
"name": "Alias",
|
|
1267
|
+
"parameters": [
|
|
1268
|
+
{
|
|
1269
|
+
"name": "alias",
|
|
1270
|
+
"type": {
|
|
1271
|
+
"text": "string"
|
|
1272
|
+
},
|
|
1273
|
+
"description": "Name of the alias."
|
|
1274
|
+
}
|
|
1275
|
+
],
|
|
1276
|
+
"description": "Creates an alias for the given property with a getter and a setter."
|
|
1277
|
+
}
|
|
1278
|
+
],
|
|
1279
|
+
"exports": [
|
|
1280
|
+
{
|
|
1281
|
+
"kind": "js",
|
|
1282
|
+
"name": "NotifyAttribute",
|
|
1283
|
+
"declaration": {
|
|
1284
|
+
"name": "NotifyAttribute",
|
|
1285
|
+
"module": "ace-editor/property-decorators.ts"
|
|
1286
|
+
}
|
|
1287
|
+
},
|
|
1288
|
+
{
|
|
1289
|
+
"kind": "js",
|
|
1290
|
+
"name": "NotifyBooleanAttribute",
|
|
1291
|
+
"declaration": {
|
|
1292
|
+
"name": "NotifyBooleanAttribute",
|
|
1293
|
+
"module": "ace-editor/property-decorators.ts"
|
|
1294
|
+
}
|
|
1295
|
+
},
|
|
1296
|
+
{
|
|
1297
|
+
"kind": "js",
|
|
1298
|
+
"name": "NotifyNumericAttribute",
|
|
1299
|
+
"declaration": {
|
|
1300
|
+
"name": "NotifyNumericAttribute",
|
|
1301
|
+
"module": "ace-editor/property-decorators.ts"
|
|
1302
|
+
}
|
|
1303
|
+
},
|
|
1304
|
+
{
|
|
1305
|
+
"kind": "js",
|
|
1306
|
+
"name": "Notify",
|
|
1307
|
+
"declaration": {
|
|
1308
|
+
"name": "Notify",
|
|
1309
|
+
"module": "ace-editor/property-decorators.ts"
|
|
1310
|
+
}
|
|
1311
|
+
},
|
|
1312
|
+
{
|
|
1313
|
+
"kind": "js",
|
|
1314
|
+
"name": "Alias",
|
|
1315
|
+
"declaration": {
|
|
1316
|
+
"name": "Alias",
|
|
1317
|
+
"module": "ace-editor/property-decorators.ts"
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
]
|
|
1321
|
+
},
|
|
906
1322
|
{
|
|
907
1323
|
"kind": "javascript-module",
|
|
908
1324
|
"path": "demo/demo-editor-plugin.js",
|
|
@@ -1059,6 +1475,12 @@
|
|
|
1059
1475
|
}
|
|
1060
1476
|
]
|
|
1061
1477
|
},
|
|
1478
|
+
{
|
|
1479
|
+
"kind": "javascript-module",
|
|
1480
|
+
"path": "demo/index.js",
|
|
1481
|
+
"declarations": [],
|
|
1482
|
+
"exports": []
|
|
1483
|
+
},
|
|
1062
1484
|
{
|
|
1063
1485
|
"kind": "javascript-module",
|
|
1064
1486
|
"path": "scripts/update-readme.ts",
|
package/dist/OscdTextEditor.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { LitElement, type PropertyValueMap } from 'lit';
|
|
1
|
+
import { LitElement, type PropertyValueMap, PropertyValues } from 'lit';
|
|
2
2
|
import type * as AceGlobal from 'ace-builds';
|
|
3
3
|
import 'ace-builds/src-noconflict/ace.js';
|
|
4
4
|
import 'ace-builds/src-noconflict/theme-sqlserver.js';
|
|
5
5
|
import 'ace-builds/src-noconflict/mode-xml.js';
|
|
6
6
|
import 'ace-builds/src-noconflict/ext-searchbox.js';
|
|
7
|
-
import
|
|
7
|
+
import AceEditor from './ace-editor/AceEditor.js';
|
|
8
8
|
import { EditV2 } from '@openscd/oscd-api';
|
|
9
9
|
declare global {
|
|
10
10
|
interface Window {
|
|
@@ -25,14 +25,17 @@ declare class BaseElement extends BaseElement_base {
|
|
|
25
25
|
* Intent is to keep this generic so it can be migrated to oscd-ui.
|
|
26
26
|
*/
|
|
27
27
|
export default class OscdTextEditor extends BaseElement {
|
|
28
|
-
static scopedElements: {
|
|
29
|
-
|
|
28
|
+
static scopedElements: {
|
|
29
|
+
'ace-editor': typeof AceEditor;
|
|
30
|
+
};
|
|
30
31
|
value: string | undefined;
|
|
31
32
|
aceEditor: AceEditor;
|
|
32
33
|
format(): void;
|
|
33
34
|
connectedCallback(): void;
|
|
34
35
|
disconnectedCallback(): void;
|
|
35
36
|
private handleAceChange;
|
|
37
|
+
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
38
|
+
private clearSelection;
|
|
36
39
|
protected updated(changedProps: PropertyValueMap<OscdTextEditor>): void;
|
|
37
40
|
render(): import("lit-html").TemplateResult<1>;
|
|
38
41
|
static styles: import("lit").CSSResult;
|
package/dist/OscdTextEditor.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { LitElement, html, css, } from 'lit';
|
|
3
3
|
import { property, query } from 'lit/decorators.js';
|
|
4
4
|
import { ScopedElementsMixin } from '@open-wc/scoped-elements/lit-element.js';
|
|
5
5
|
import 'ace-builds/src-noconflict/ace.js';
|
|
6
6
|
import 'ace-builds/src-noconflict/theme-sqlserver.js';
|
|
7
7
|
import 'ace-builds/src-noconflict/mode-xml.js';
|
|
8
8
|
import 'ace-builds/src-noconflict/ext-searchbox.js';
|
|
9
|
+
import AceEditor from './ace-editor/AceEditor.js';
|
|
9
10
|
const serializer = new XMLSerializer();
|
|
10
11
|
const parser = new DOMParser();
|
|
11
12
|
const ACE_DEFAULT_OPTIONS = {
|
|
@@ -132,24 +133,11 @@ class BaseElement extends ScopedElementsMixin(LitElement) {
|
|
|
132
133
|
* Intent is to keep this generic so it can be migrated to oscd-ui.
|
|
133
134
|
*/
|
|
134
135
|
class OscdTextEditor extends BaseElement {
|
|
135
|
-
constructor() {
|
|
136
|
-
super();
|
|
137
|
-
// Special handling to prevent ace-editor from being registered globally, which would cause issues with multiple instances in the same document.
|
|
138
|
-
// This will all go away once the oscd-ui version is implemented and this project is migrated to oscd-ui
|
|
139
|
-
const customElementsDefineFn = window.customElements.define;
|
|
140
|
-
window.customElements.define = (name, constructor) => {
|
|
141
|
-
if (name !== 'ace-editor') {
|
|
142
|
-
return customElementsDefineFn(name, constructor);
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
import('ace-custom-element').then(AceEditor => {
|
|
146
|
-
if (!this.registry?.get('ace-editor')) {
|
|
147
|
-
this.registry?.define('ace-editor', AceEditor.default);
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
136
|
format() {
|
|
152
|
-
const rawXml = this.aceEditor?.editor?.getSelectedText() ||
|
|
137
|
+
const rawXml = this.aceEditor?.editor?.getSelectedText() ||
|
|
138
|
+
this.aceEditor.editor?.getValue() ||
|
|
139
|
+
this.value ||
|
|
140
|
+
'';
|
|
153
141
|
let initialIndent = '';
|
|
154
142
|
if (this.aceEditor?.editor?.getSelectedText()) {
|
|
155
143
|
const range = this.aceEditor.editor.getSelectionRange();
|
|
@@ -186,16 +174,32 @@ class OscdTextEditor extends BaseElement {
|
|
|
186
174
|
}));
|
|
187
175
|
}
|
|
188
176
|
}
|
|
177
|
+
firstUpdated(_changedProperties) {
|
|
178
|
+
this.clearSelection();
|
|
179
|
+
}
|
|
180
|
+
clearSelection() {
|
|
181
|
+
// Clear selection when content updates
|
|
182
|
+
setTimeout(() => {
|
|
183
|
+
/* For reasons unknown the ace editor initially selects all code, so we need to clear that*/
|
|
184
|
+
const editor = this.aceEditor.editor;
|
|
185
|
+
if (editor) {
|
|
186
|
+
editor.selection.clearSelection();
|
|
187
|
+
editor.moveCursorTo(0, 0);
|
|
188
|
+
}
|
|
189
|
+
}, 100);
|
|
190
|
+
}
|
|
189
191
|
updated(changedProps) {
|
|
190
192
|
if (changedProps.has('value')) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
193
|
+
const editor = this.aceEditor.editor;
|
|
194
|
+
if (!editor) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
// Only update if content actually changed (prevents cursor jump)
|
|
198
|
+
// if (editor.getValue() !== this.value) {
|
|
199
|
+
// editor.setValue(this.value ?? '');
|
|
200
|
+
// }
|
|
201
|
+
editor.selection.clearSelection();
|
|
202
|
+
editor.moveCursorTo(0, 0);
|
|
199
203
|
}
|
|
200
204
|
}
|
|
201
205
|
render() {
|
|
@@ -213,9 +217,9 @@ class OscdTextEditor extends BaseElement {
|
|
|
213
217
|
}
|
|
214
218
|
}
|
|
215
219
|
OscdTextEditor.scopedElements = {
|
|
216
|
-
// Left here for clarity sake. We need to dyn-import this so we have a chance of overriding the customElements.define to prevent
|
|
217
|
-
// ace-editor from being registered globally and causing issues with other instances of ace-editor in the same document.
|
|
218
|
-
|
|
220
|
+
// Left here for clarity sake. We need to dyn-import this so we have a chance of overriding the customElements.define to prevent
|
|
221
|
+
// ace-editor from being registered globally and causing issues with other instances of ace-editor in the same document.
|
|
222
|
+
'ace-editor': AceEditor,
|
|
219
223
|
};
|
|
220
224
|
OscdTextEditor.styles = css `
|
|
221
225
|
:host {
|