@bpmn-io/properties-panel 3.41.0 → 3.41.1

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/dist/index.esm.js CHANGED
@@ -10,7 +10,7 @@ import { Annotation, EditorState } from '@codemirror/state';
10
10
  import { syntaxHighlighting, foldGutter, bracketMatching, defaultHighlightStyle, foldKeymap } from '@codemirror/language';
11
11
  import { closeBrackets, closeBracketsKeymap } from '@codemirror/autocomplete';
12
12
  import { history, defaultKeymap, historyKeymap } from '@codemirror/commands';
13
- import { json, jsonParseLinter } from '@codemirror/lang-json';
13
+ import { jsonParseLinter, json } from '@codemirror/lang-json';
14
14
  import { linter } from '@codemirror/lint';
15
15
  import { FeelersEditor } from 'feelers';
16
16
  import Editor from '@bpmn-io/feel-editor';
@@ -1823,6 +1823,7 @@ function CheckboxGroup(props) {
1823
1823
  }
1824
1824
 
1825
1825
  const ExternalChange = Annotation.define();
1826
+ const parseJsonLinter = jsonParseLinter();
1826
1827
 
1827
1828
  /**
1828
1829
  * A CodeMirror based JSON editor for the properties panel.
@@ -1867,7 +1868,11 @@ function JsonEditor(props) {
1867
1868
  if (update.docChanged && !isExternal) {
1868
1869
  handleChange(update.state.doc.toString());
1869
1870
  }
1870
- }), json(), linter(jsonParseLinter(), {
1871
+ }), json(), linter(view => {
1872
+ const content = view.state.doc.toString();
1873
+ if (!content.trim()) return [];
1874
+ return parseJsonLinter(view);
1875
+ }, {
1871
1876
  delay: 300
1872
1877
  })]
1873
1878
  }),
@@ -2003,7 +2008,7 @@ function isEdited$8(node) {
2003
2008
  // helpers /////////////////
2004
2009
 
2005
2010
  function validateJson(value) {
2006
- if (!value) return null;
2011
+ if (!value || !value.trim()) return null;
2007
2012
  try {
2008
2013
  return isObject(JSON.parse(value)) ? null : 'JSON contains errors';
2009
2014
  } catch (e) {