@bpmn-io/feel-editor 1.4.0 → 1.5.0

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.es.js CHANGED
@@ -3,7 +3,7 @@ import { defaultKeymap } from '@codemirror/commands';
3
3
  import { syntaxTree, LanguageSupport, syntaxHighlighting, HighlightStyle, bracketMatching, indentOnInput } from '@codemirror/language';
4
4
  import { linter as linter$1, setDiagnosticsEffect } from '@codemirror/lint';
5
5
  import { Facet, Compartment, EditorState } from '@codemirror/state';
6
- import { EditorView, tooltips, keymap } from '@codemirror/view';
6
+ import { EditorView, tooltips, keymap, placeholder } from '@codemirror/view';
7
7
  import { snippets, keywordCompletions, feelLanguage } from 'lang-feel';
8
8
  import { domify } from 'min-dom';
9
9
  import { cmFeelLinter } from '@bpmn-io/feel-lint';
@@ -867,6 +867,8 @@ var theme = [ baseTheme, highlightTheme, syntaxClasses ];
867
867
  */
868
868
 
869
869
  const autocompletionConf = new Compartment();
870
+ const placeholderConf = new Compartment();
871
+
870
872
 
871
873
  /**
872
874
  * Creates a FEEL editor in the supplied container
@@ -892,6 +894,7 @@ function FeelEditor({
892
894
  onChange = () => {},
893
895
  onKeyDown = () => {},
894
896
  onLint = () => {},
897
+ placeholder: placeholder$1 = '',
895
898
  readOnly = false,
896
899
  value = '',
897
900
  variables = []
@@ -948,6 +951,7 @@ function FeelEditor({
948
951
  language(),
949
952
  linter,
950
953
  lintHandler,
954
+ placeholderConf.of(placeholder(placeholder$1)),
951
955
  tooltipLayout,
952
956
  theme,
953
957
  ...editorExtensions
@@ -1022,4 +1026,15 @@ FeelEditor.prototype.setVariables = function(variables) {
1022
1026
  });
1023
1027
  };
1024
1028
 
1029
+ /**
1030
+ * Update placeholder text.
1031
+ * @param {string} placeholder
1032
+ * @returns {void}
1033
+ */
1034
+ FeelEditor.prototype.setPlaceholder = function(placeholder$1) {
1035
+ this._cmEditor.dispatch({
1036
+ effects: placeholderConf.reconfigure(placeholder(placeholder$1))
1037
+ });
1038
+ };
1039
+
1025
1040
  export { FeelEditor as default };
package/dist/index.js CHANGED
@@ -869,6 +869,8 @@ var theme = [ baseTheme, highlightTheme, syntaxClasses ];
869
869
  */
870
870
 
871
871
  const autocompletionConf = new state.Compartment();
872
+ const placeholderConf = new state.Compartment();
873
+
872
874
 
873
875
  /**
874
876
  * Creates a FEEL editor in the supplied container
@@ -894,6 +896,7 @@ function FeelEditor({
894
896
  onChange = () => {},
895
897
  onKeyDown = () => {},
896
898
  onLint = () => {},
899
+ placeholder = '',
897
900
  readOnly = false,
898
901
  value = '',
899
902
  variables = []
@@ -950,6 +953,7 @@ function FeelEditor({
950
953
  language(),
951
954
  linter,
952
955
  lintHandler,
956
+ placeholderConf.of(view.placeholder(placeholder)),
953
957
  tooltipLayout,
954
958
  theme,
955
959
  ...editorExtensions
@@ -1024,4 +1028,15 @@ FeelEditor.prototype.setVariables = function(variables) {
1024
1028
  });
1025
1029
  };
1026
1030
 
1031
+ /**
1032
+ * Update placeholder text.
1033
+ * @param {string} placeholder
1034
+ * @returns {void}
1035
+ */
1036
+ FeelEditor.prototype.setPlaceholder = function(placeholder) {
1037
+ this._cmEditor.dispatch({
1038
+ effects: placeholderConf.reconfigure(view.placeholder(placeholder))
1039
+ });
1040
+ };
1041
+
1027
1042
  module.exports = FeelEditor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpmn-io/feel-editor",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Editor for FEEL expressions.",
5
5
  "files": [
6
6
  "dist"