@knime/kds-rich-text-editor 11.0.0 → 11.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @knime/kds-rich-text-editor
2
2
 
3
+ ## 11.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 7dbad9a: Ensure editor is always 100% height of its available container
8
+ - Updated dependencies [7dbad9a, 2c0897f]
9
+ - @knime/kds-components@11.1.1
10
+ - @knime/kds-styles@11.1.1
11
+
12
+ ## 11.1.0
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [1cbcad8]
17
+ - @knime/kds-styles@11.1.0
18
+ - @knime/kds-components@11.1.0
19
+
3
20
  ## 11.0.0
4
21
 
5
22
  ### Patch Changes
package/README.md CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  This is part of the [KNIME Design System](../../README.md).
4
4
 
5
- This package contains the `KdsRichTextEditor` component and its toolbar, a WYSIWYG editor that follows the KNIME Design System. It is based on the [Vue] JavaScript framework, built on the KNIME Design System tokens, and powered by [Tiptap]/[ProseMirror].
5
+ This package contains the `KdsRichTextEditor` component (a WYSIWYG editor with toolbar) and the `KdsRichTextInput` form field built on it, following the KNIME Design System. They are based on the [Vue] JavaScript framework, built on the KNIME Design System tokens, and powered by [Tiptap]/[ProseMirror].
6
6
 
7
7
  It's published as npm package: [@knime/kds-rich-text-editor]
8
8
 
9
9
  ## Why a separate package?
10
10
 
11
- Tiptap and ProseMirror add a large, DOM-parsing dependency subtree (~50 packages) that is irrelevant to most consumers of `@knime/kds-components`. Keeping the editor in its own package keeps that dependency, bundle, and security-audit/SBOM surface **opt-in** — only apps that install this package pull it in. See the [root README](../../README.md) for the package overview.
11
+ Tiptap and ProseMirror add a large, DOM-parsing dependency subtree that is irrelevant to most consumers of `@knime/kds-components`. Keeping the editor in its own package keeps that dependency, bundle, and security-audit/SBOM surface **opt-in** — only apps that install this package pull it in. See the [root README](../../README.md) for the package overview.
12
12
 
13
13
  The Tiptap/ProseMirror packages are declared as regular `dependencies` but are **externalized** in the build (see [`vite.config.js`](vite.config.js)). They are resolved at consume time rather than bundled, so consumers dedupe a single ProseMirror instance and can pull CVE-patched transitive versions via their own lockfile without waiting on a republish.
14
14
 
@@ -33,18 +33,13 @@ pnpm run test:unit # Run all unit tests (packages/*)
33
33
  pnpm run coverage # Generate coverage reports
34
34
  ```
35
35
 
36
- ### Logging
37
-
38
- You can log using the global `consola` variable (which the embedding application needs to provide).
39
-
40
- See https://github.com/nuxt/consola for details.
41
-
42
36
  ## Building
43
37
 
44
38
  To build the editor as a [Vue library]:
45
39
 
46
40
  ```sh
47
- pnpm run build # Build only this package
41
+ pnpm run build # From this package: build only the editor
42
+ pnpm run build:rich-text-editor # From the monorepo root: build only the editor
48
43
  ```
49
44
 
50
45
  Results are saved to `dist/`.
@@ -57,10 +52,16 @@ All `@knime/kds-*` packages (including this one) are versioned together via Chan
57
52
 
58
53
  ## Using the editor in a Vue application
59
54
 
60
- Install the [@knime/kds-rich-text-editor] npm package as a dependency. It requires `@knime/kds-components` and `vue` as peer dependencies:
55
+ Install the [@knime/kds-rich-text-editor] npm package together with `@knime/kds-styles`. It declares `vue` as peer dependency (`@knime/kds-components` comes along as a regular dependency):
61
56
 
62
57
  ```sh
63
- pnpm add @knime/kds-rich-text-editor @knime/kds-components @knime/kds-styles
58
+ pnpm add @knime/kds-rich-text-editor @knime/kds-styles vue
59
+ ```
60
+
61
+ The editor uses the KDS CSS variables but does not load them. Import them once in your app (e.g. in `main.ts`):
62
+
63
+ ```ts
64
+ import "@knime/kds-styles/kds-variables.css";
64
65
  ```
65
66
 
66
67
  ```vue
@@ -82,16 +83,23 @@ const value = ref("<p>Hello world</p>");
82
83
 
83
84
  ### Public exports
84
85
 
85
- All public symbols follow the KDS `Kds` prefix convention:
86
+ Public symbols follow the KDS `Kds` prefix convention, except `EditorTools`:
86
87
 
87
88
  | Export | Kind | Description |
88
89
  | --------------------------- | --------- | --------------------------------------------------- |
89
90
  | `KdsRichTextEditor` | component | The editor (with built-in toolbar) |
91
+ | `KdsRichTextInput` | component | The editor as form field with label and description |
90
92
  | `KdsCreateLinkModal` | component | Modal used by the link tool |
91
93
  | `kdsDefaultLinkToolOptions` | const | Default URL validator / sanitizer for the link tool |
94
+ | `kdsCharacterCountDisplay` | const | When to show the character counter |
95
+ | `kdsCharacterCountDisplays` | const | Array of all character counter display values |
92
96
  | `KdsLinkToolOptions` | type | Options for the link tool |
93
97
  | `KdsRichTextEditorProps` | type | Props of `KdsRichTextEditor` |
98
+ | `KdsRichTextInputProps` | type | Props of `KdsRichTextInput` |
94
99
  | `KdsBaseExtensionsConfig` | type | Opt-in map of built-in Tiptap extensions |
100
+ | `KdsCharacterLimit` | type | Character limit and counter display settings |
101
+ | `KdsCharacterCountDisplay` | type | Union of the character counter display values |
102
+ | `EditorTools` | type | Toolbar tool definitions (not `Kds`-prefixed) |
95
103
 
96
104
  ### Using with Vitest, Nuxt, or Vite SSR
97
105
 
@@ -124,8 +132,8 @@ export default defineNuxtConfig({ build: { transpile: [/@knime\//] } });
124
132
 
125
133
  The editor expects that the embedding app provides the following:
126
134
 
127
- - Vue and Consola compatible to the versions defined in [`package.json`](package.json)
128
- - `@knime/kds-components` and the `@knime/kds-styles` CSS variables imported once in the app entry
135
+ - `vue` matching the peer dependency range in [`package.json`](package.json)
136
+ - the `@knime/kds-styles` CSS variables imported once in the app entry
129
137
 
130
138
  [Vue]: https://vuejs.org/
131
139
  [Tiptap]: https://tiptap.dev/
package/dist/index.css CHANGED
@@ -27,7 +27,7 @@
27
27
  }
28
28
 
29
29
  .editor-wrapper {
30
- &[data-v-a230bf6c] {
30
+ &[data-v-f0330e9f] {
31
31
  /* Fixed 44px toolbar height per the design (28px content + 8px padding on
32
32
  * each side); the small toolbar buttons (24px) center within the content
33
33
  * area. */
@@ -37,34 +37,35 @@
37
37
  );
38
38
 
39
39
  position: relative;
40
+ height: 100%;
40
41
  isolation: isolate;
41
42
  }
42
- &.disabled[data-v-a230bf6c] {
43
+ &.disabled[data-v-f0330e9f] {
43
44
  color: var(--kds-color-text-and-icon-disabled);
44
45
  }
45
46
  }
46
47
 
47
48
  /* stylelint-disable selector-class-pattern */
48
49
  .rich-text-editor {
49
- &[data-v-a230bf6c] {
50
+ &[data-v-f0330e9f] {
50
51
  height: 100%;
51
- max-height: var(--v3c79e33b);
52
+ max-height: var(--v2a0392e8);
52
53
  overflow-y: auto;
53
54
 
54
55
  /* stylelint-disable knime/no-deep-nesting */
55
56
  /* stylelint-enable selector-class-pattern */
56
57
  }
57
58
  &.editable {
58
- &[data-v-a230bf6c] {
59
+ &[data-v-f0330e9f] {
59
60
  padding: var(--kds-spacing-container-0-5x);
60
61
  cursor: text;
61
62
  background: var(--kds-color-background-input-initial);
62
63
  }
63
- &[data-v-a230bf6c] .ProseMirror {
64
- min-height: var(--v63a1a18d);
64
+ &[data-v-f0330e9f] .ProseMirror {
65
+ min-height: var(--v512b513a);
65
66
  }
66
67
  }
67
- &[data-v-a230bf6c] .ProseMirror {
68
+ &[data-v-f0330e9f] .ProseMirror {
68
69
  height: 100%;
69
70
  font: var(--kds-font-base-body-small);
70
71
 
@@ -214,7 +215,7 @@ a {
214
215
  margin-left: var(--kds-spacing-container-0-12x);
215
216
  content: "";
216
217
  background-color: var(--link-color);
217
- mask-image: var(--f8ef0ace);
218
+ mask-image: var(--v69243186);
218
219
  mask-repeat: no-repeat;
219
220
  mask-size: contain;
220
221
  }
@@ -263,34 +264,34 @@ td {
263
264
  }
264
265
  }
265
266
  }
266
- &[data-v-a230bf6c] .ProseMirror:focus-visible,
267
- &[data-v-a230bf6c] .ProseMirror:focus {
267
+ &[data-v-f0330e9f] .ProseMirror:focus-visible,
268
+ &[data-v-f0330e9f] .ProseMirror:focus {
268
269
  outline: transparent;
269
270
  }
270
271
  }
271
272
  .editor-wrapper.with-border {
272
- &[data-v-a230bf6c] {
273
+ &[data-v-f0330e9f] {
273
274
  border: var(--kds-border-action-input);
274
275
  border-radius: var(--kds-border-radius-container-0-37x);
275
276
  }
276
- &.disabled[data-v-a230bf6c] {
277
+ &.disabled[data-v-f0330e9f] {
277
278
  border: var(--kds-border-action-disabled);
278
279
  }
279
- & .toolbar-wrapper[data-v-a230bf6c] {
280
+ & .toolbar-wrapper[data-v-f0330e9f] {
280
281
  border-top-left-radius: var(--kds-border-radius-container-0-37x);
281
282
  border-top-right-radius: var(--kds-border-radius-container-0-37x);
282
283
  }
283
- & .rich-text-editor[data-v-a230bf6c] {
284
+ & .rich-text-editor[data-v-f0330e9f] {
284
285
  border-bottom-right-radius: var(--kds-border-radius-container-0-37x);
285
286
  border-bottom-left-radius: var(--kds-border-radius-container-0-37x);
286
287
  }
287
288
  }
288
- .editor-wrapper.show-focus-ring[data-v-a230bf6c] {
289
+ .editor-wrapper.show-focus-ring[data-v-f0330e9f] {
289
290
  outline: var(--kds-border-action-focused);
290
291
  outline-offset: var(--kds-spacing-offset-focus);
291
292
  }
292
293
  .embedded-toolbar {
293
- &[data-v-a230bf6c] {
294
+ &[data-v-f0330e9f] {
294
295
  height: var(--toolbar-height);
295
296
  padding: var(--kds-spacing-container-0-5x);
296
297
  overflow-x: auto;
@@ -301,7 +302,7 @@ td {
301
302
  border-bottom: var(--kds-border-base-muted);
302
303
  -ms-overflow-style: none; /* needed to hide scroll bar in edge */
303
304
  }
304
- &[data-v-a230bf6c]::-webkit-scrollbar {
305
+ &[data-v-f0330e9f]::-webkit-scrollbar {
305
306
  display: none;
306
307
  }
307
308
  }
package/dist/index.js CHANGED
@@ -3436,9 +3436,9 @@ var KdsRichTextEditor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(
3436
3436
  emits: /*@__PURE__*/ mergeModels(["blur"], ["update:modelValue"]),
3437
3437
  setup(__props, { expose: __expose, emit: __emit }) {
3438
3438
  useCssVars((_ctx) => ({
3439
- "v3c79e33b": maxHeightStyle.value,
3440
- "v63a1a18d": minHeightStyle.value,
3441
- "f8ef0ace": externalIcon
3439
+ "v2a0392e8": maxHeightStyle.value,
3440
+ "v512b513a": minHeightStyle.value,
3441
+ "v69243186": externalIcon
3442
3442
  }));
3443
3443
  const hardCharacterLimit = __props.editable ? Math.max(__props.characterLimit.maxCharacters ?? 1e3, MIN_CHARACTER_LIMIT) : Infinity;
3444
3444
  const characterCountDisplay = __props.characterLimit.display ?? kdsCharacterCountDisplay.NEVER;
@@ -3608,7 +3608,7 @@ var KdsRichTextEditor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(
3608
3608
  ])]);
3609
3609
  };
3610
3610
  }
3611
- }), [["__scopeId", "data-v-a230bf6c"]]);
3611
+ }), [["__scopeId", "data-v-f0330e9f"]]);
3612
3612
  //#endregion
3613
3613
  //#region src/KdsRichTextInput.vue
3614
3614
  var KdsRichTextInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({