@bpmn-io/properties-panel 3.41.0 → 3.41.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.
@@ -569,42 +569,6 @@ textarea.bio-properties-panel-input {
569
569
  resize: vertical;
570
570
  }
571
571
 
572
- /**
573
- * JSON Editor (CodeMirror)
574
- */
575
-
576
- .bio-properties-panel-json-editor .cm-editor {
577
- border: 1px solid var(--input-border-color);
578
- border-radius: 2px;
579
- background-color: var(--input-background-color);
580
- font-size: var(--text-size-base);
581
- font-family: var(--font-family-monospace);
582
- }
583
-
584
- .bio-properties-panel-json-editor .cm-editor.cm-focused {
585
- outline: none;
586
- background-color: var(--input-focus-background-color);
587
- border-color: var(--input-focus-border-color);
588
- }
589
-
590
- .bio-properties-panel-json-editor .cm-scroller {
591
- overflow: auto;
592
- max-height: 215px;
593
- }
594
-
595
- .bio-properties-panel-json-editor .cm-content {
596
- padding-right: 18px;
597
- }
598
-
599
- .bio-properties-panel-entry.has-error .bio-properties-panel-json-editor .cm-editor {
600
- border-color: var(--input-error-border-color);
601
- background-color: var(--input-error-background-color);
602
- }
603
-
604
- .bio-properties-panel-entry.has-error .bio-properties-panel-json-editor .cm-editor.cm-focused {
605
- border-color: var(--input-error-focus-border-color);
606
- }
607
-
608
572
  .bio-properties-panel-entry.has-error .bio-properties-panel-input,
609
573
  .bio-properties-panel-entry.has-error .bio-properties-panel-feel-editor__open-popup-placeholder {
610
574
  border-color: var(--input-error-border-color);
@@ -635,6 +599,27 @@ textarea.bio-properties-panel-input {
635
599
  margin: auto;
636
600
  }
637
601
 
602
+ /**
603
+ * JSON Editor (CodeMirror)
604
+ */
605
+
606
+ .bio-properties-panel-json-editor .bio-properties-panel-input {
607
+ padding: 0;
608
+ }
609
+
610
+ .bio-properties-panel-json-editor .cm-editor {
611
+ font-family: var(--font-family-monospace);
612
+ }
613
+
614
+ .bio-properties-panel-json-editor .cm-editor.cm-focused {
615
+ outline: none;
616
+ }
617
+
618
+ .bio-properties-panel-json-editor .cm-scroller {
619
+ overflow: auto;
620
+ max-height: 215px;
621
+ }
622
+
638
623
  /**
639
624
  * Toggle Switch
640
625
  */
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
  }),
@@ -1918,6 +1923,7 @@ function JsonEditor(props) {
1918
1923
  children: label
1919
1924
  })
1920
1925
  }), jsx("div", {
1926
+ class: classnames('bio-properties-panel-input', value && 'edited'),
1921
1927
  ref: containerRef
1922
1928
  })]
1923
1929
  });
@@ -1996,14 +2002,13 @@ function JsonEditorEntry(props) {
1996
2002
  * Check if the JSON editor entry has been edited.
1997
2003
  */
1998
2004
  function isEdited$8(node) {
1999
- const cmContent = node && node.querySelector('.cm-content');
2000
- return cmContent ? cmContent.textContent.trim().length > 0 : false;
2005
+ return node && node.classList.contains('edited');
2001
2006
  }
2002
2007
 
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) {