@openmrs/esm-implementer-tools-app 8.0.1-pre.3370 → 8.0.1-pre.3376
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/.turbo/turbo-build.log +12 -12
- package/dist/1915.js +1 -1
- package/dist/1915.js.map +1 -1
- package/dist/5839.js +2 -0
- package/dist/5839.js.LICENSE.txt +13 -0
- package/dist/5839.js.map +1 -0
- package/dist/6132.js +1 -1
- package/dist/8e7b152564424838.js +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-implementer-tools-app.js +1 -1
- package/dist/openmrs-esm-implementer-tools-app.js.buildmanifest.json +39 -37
- package/dist/openmrs-esm-implementer-tools-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +5 -5
- package/src/configuration/json-editor/json-editor.component.tsx +16 -7
- package/dist/7687.js +0 -2
- package/dist/7687.js.LICENSE.txt +0 -44
- package/dist/7687.js.map +0 -1
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
-
import { Button } from '@carbon/react';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
2
|
import classNames from 'classnames';
|
|
5
3
|
import AceEditor from 'react-ace';
|
|
6
|
-
import '
|
|
7
|
-
import '
|
|
4
|
+
import { Button } from '@carbon/react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
8
6
|
import { clearConfigErrors, temporaryConfigStore, useStore } from '@openmrs/esm-framework/src/internal';
|
|
9
7
|
import styles from './json-editor.scss';
|
|
10
8
|
|
|
9
|
+
import 'ace-builds/src-noconflict/mode-json';
|
|
10
|
+
import 'ace-builds/src-noconflict/theme-dracula';
|
|
11
|
+
import ace from 'ace-builds/src-noconflict/ace';
|
|
12
|
+
|
|
13
|
+
// Configure ace to bundle workers locally (webpack 5 asset modules)
|
|
14
|
+
// Using new URL() syntax instead of deprecated file-loader or CDN for offline compatibility
|
|
15
|
+
ace.config.setModuleUrl(
|
|
16
|
+
'ace/mode/json_worker',
|
|
17
|
+
new URL('ace-builds/src-noconflict/worker-json.js', import.meta.url).href,
|
|
18
|
+
);
|
|
19
|
+
|
|
11
20
|
export interface JsonEditorProps {
|
|
12
21
|
/** A CSS value */
|
|
13
22
|
height: string;
|
|
@@ -25,17 +34,17 @@ export default function JsonEditor({ height }: JsonEditorProps) {
|
|
|
25
34
|
try {
|
|
26
35
|
config = JSON.parse(editorValue);
|
|
27
36
|
} catch (e) {
|
|
28
|
-
setError(e.message);
|
|
37
|
+
setError(e instanceof Error ? e.message : 'Invalid JSON');
|
|
29
38
|
return;
|
|
30
39
|
}
|
|
31
40
|
setError('');
|
|
32
41
|
clearConfigErrors();
|
|
33
42
|
temporaryConfigStore.setState({ config });
|
|
34
|
-
}, [editorValue,
|
|
43
|
+
}, [editorValue, temporaryConfig.config]);
|
|
35
44
|
|
|
36
45
|
useEffect(() => {
|
|
37
46
|
if (editorValue != JSON.stringify(temporaryConfig.config, null, 2)) {
|
|
38
|
-
setKey((k) => `${k}+`); // just keep
|
|
47
|
+
setKey((k) => `${k}+`); // just keep appending plus signs
|
|
39
48
|
}
|
|
40
49
|
}, [temporaryConfig.config]);
|
|
41
50
|
|