@seljs/editor 1.1.0-beta.1 → 1.1.0-beta.3

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.
@@ -54,6 +54,15 @@ const buildExtensions = (config) => {
54
54
  if (config.readOnly) extensions.push(_codemirror_state.EditorState.readOnly.of(true));
55
55
  if (config.placeholder) extensions.push((0, _codemirror_view.placeholder)(config.placeholder));
56
56
  if (resolved.typeDisplay) extensions.push(require_type_display.createTypeDisplay(checker, config.dark ?? false));
57
+ const minLines = config.features?.view?.minLines;
58
+ if (minLines && minLines > 1) {
59
+ const minHeight = `${String(Math.max(1, minLines) * 1.4)}em`;
60
+ extensions.push(_codemirror_view.EditorView.theme({
61
+ "&": { minHeight },
62
+ ".cm-content": { minHeight }
63
+ }));
64
+ }
65
+ if (config.features?.tooltip) extensions.push((0, _codemirror_view.tooltips)(config.features.tooltip));
57
66
  return extensions;
58
67
  };
59
68
  //#endregion
@@ -10,7 +10,7 @@ import { closeBrackets, closeBracketsKeymap } from "@codemirror/autocomplete";
10
10
  import { SELChecker } from "@seljs/checker";
11
11
  import { bracketMatching } from "@codemirror/language";
12
12
  import { EditorState } from "@codemirror/state";
13
- import { EditorView, keymap, placeholder } from "@codemirror/view";
13
+ import { EditorView, keymap, placeholder, tooltips } from "@codemirror/view";
14
14
  import { defaultKeymap, history, historyKeymap } from "@codemirror/commands";
15
15
  import { celLanguageSupport } from "@seljs/cel-lezer";
16
16
  //#region src/editor/editor-config.ts
@@ -54,6 +54,15 @@ const buildExtensions = (config) => {
54
54
  if (config.readOnly) extensions.push(EditorState.readOnly.of(true));
55
55
  if (config.placeholder) extensions.push(placeholder(config.placeholder));
56
56
  if (resolved.typeDisplay) extensions.push(createTypeDisplay(checker, config.dark ?? false));
57
+ const minLines = config.features?.view?.minLines;
58
+ if (minLines && minLines > 1) {
59
+ const minHeight = `${String(Math.max(1, minLines) * 1.4)}em`;
60
+ extensions.push(EditorView.theme({
61
+ "&": { minHeight },
62
+ ".cm-content": { minHeight }
63
+ }));
64
+ }
65
+ if (config.features?.tooltip) extensions.push(tooltips(config.features.tooltip));
57
66
  return extensions;
58
67
  };
59
68
  //#endregion
@@ -27,6 +27,33 @@ interface SELEditorFeatures {
27
27
  * @default false
28
28
  */
29
29
  typeDisplay?: boolean;
30
+ /**
31
+ * Editor view configuration (always enabled)
32
+ */
33
+ view?: {
34
+ /**
35
+ * Minimum number of visible lines
36
+ *
37
+ * @default 1
38
+ */
39
+ minLines?: number;
40
+ };
41
+ /**
42
+ * Tooltip rendering configuration (always enabled)
43
+ */
44
+ tooltip?: {
45
+ /**
46
+ * CSS positioning strategy for tooltips
47
+ *
48
+ * @default "fixed"
49
+ */
50
+ position?: "fixed" | "absolute";
51
+ /**
52
+ * Custom parent element for tooltip rendering.
53
+ * Useful when the editor is inside a modal or overflow container.
54
+ */
55
+ parent?: HTMLElement;
56
+ };
30
57
  }
31
58
  interface SELEditorConfig {
32
59
  /**
@@ -27,6 +27,33 @@ interface SELEditorFeatures {
27
27
  * @default false
28
28
  */
29
29
  typeDisplay?: boolean;
30
+ /**
31
+ * Editor view configuration (always enabled)
32
+ */
33
+ view?: {
34
+ /**
35
+ * Minimum number of visible lines
36
+ *
37
+ * @default 1
38
+ */
39
+ minLines?: number;
40
+ };
41
+ /**
42
+ * Tooltip rendering configuration (always enabled)
43
+ */
44
+ tooltip?: {
45
+ /**
46
+ * CSS positioning strategy for tooltips
47
+ *
48
+ * @default "fixed"
49
+ */
50
+ position?: "fixed" | "absolute";
51
+ /**
52
+ * Custom parent element for tooltip rendering.
53
+ * Useful when the editor is inside a modal or overflow container.
54
+ */
55
+ parent?: HTMLElement;
56
+ };
30
57
  }
31
58
  interface SELEditorConfig {
32
59
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seljs/editor",
3
- "version": "1.1.0-beta.1",
3
+ "version": "1.1.0-beta.3",
4
4
  "repository": {
5
5
  "url": "https://github.com/abinnovision/seljs"
6
6
  },
@@ -56,8 +56,8 @@
56
56
  "@codemirror/view": "^6.40.0",
57
57
  "@lezer/common": "^1.5.1",
58
58
  "@lezer/highlight": "^1.2.3",
59
- "@seljs/cel-lezer": "1.1.0-beta.1",
60
- "@seljs/checker": "1.1.0-beta.1",
59
+ "@seljs/cel-lezer": "1.1.0-beta.3",
60
+ "@seljs/checker": "1.1.0-beta.3",
61
61
  "@seljs/schema": "1.0.1"
62
62
  },
63
63
  "devDependencies": {