@knime/kds-rich-text-editor 0.30.4

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +710 -0
  3. package/README.md +116 -0
  4. package/dist/index.css +282 -0
  5. package/dist/index.js +917 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/src/KdsRichTextEditor.vue.d.ts +35 -0
  8. package/dist/src/KdsRichTextEditor.vue.d.ts.map +1 -0
  9. package/dist/src/index.d.ts +6 -0
  10. package/dist/src/index.d.ts.map +1 -0
  11. package/dist/src/toolbar/KdsCreateLinkModal.vue.d.ts +459 -0
  12. package/dist/src/toolbar/KdsCreateLinkModal.vue.d.ts.map +1 -0
  13. package/dist/src/toolbar/RichTextEditorBaseToolbar.vue.d.ts +48 -0
  14. package/dist/src/toolbar/RichTextEditorBaseToolbar.vue.d.ts.map +1 -0
  15. package/dist/src/toolbar/RichTextEditorToolbar.vue.d.ts +10 -0
  16. package/dist/src/toolbar/RichTextEditorToolbar.vue.d.ts.map +1 -0
  17. package/dist/src/toolbar/types.d.ts +29 -0
  18. package/dist/src/toolbar/types.d.ts.map +1 -0
  19. package/dist/src/toolbar/useLinkTool.d.ts +22 -0
  20. package/dist/src/toolbar/useLinkTool.d.ts.map +1 -0
  21. package/dist/src/types.d.ts +112 -0
  22. package/dist/src/types.d.ts.map +1 -0
  23. package/dist/src/utils/custom-escape.d.ts +15 -0
  24. package/dist/src/utils/custom-escape.d.ts.map +1 -0
  25. package/dist/src/utils/custom-hard-break.d.ts +2 -0
  26. package/dist/src/utils/custom-hard-break.d.ts.map +1 -0
  27. package/dist/src/utils/custom-link.d.ts +16 -0
  28. package/dist/src/utils/custom-link.d.ts.map +1 -0
  29. package/dist/src/utils/custom-text-align.d.ts +2 -0
  30. package/dist/src/utils/custom-text-align.d.ts.map +1 -0
  31. package/dist/src/utils/paragraphTextStyle/extension.d.ts +17 -0
  32. package/dist/src/utils/paragraphTextStyle/extension.d.ts.map +1 -0
  33. package/dist/src/utils/paragraphTextStyle/index.d.ts +4 -0
  34. package/dist/src/utils/paragraphTextStyle/index.d.ts.map +1 -0
  35. package/package.json +76 -0
@@ -0,0 +1,112 @@
1
+ import { AnyExtension } from '@tiptap/core';
2
+ import { KdsLinkToolOptions } from './utils/custom-link';
3
+ export type KdsBaseExtensionsConfig = {
4
+ bold?: true;
5
+ italic?: true;
6
+ underline?: true;
7
+ textAlign?: true;
8
+ bulletList?: true;
9
+ orderedList?: true;
10
+ heading?: true;
11
+ paragraphTextStyle?: true;
12
+ blockquote?: true;
13
+ code?: true;
14
+ codeBlock?: true;
15
+ horizontalRule?: true;
16
+ strike?: true;
17
+ link?: true;
18
+ };
19
+ type BaseExtensions = KdsBaseExtensionsConfig | ({
20
+ [key in keyof KdsBaseExtensionsConfig]: never;
21
+ } & {
22
+ all: boolean;
23
+ });
24
+ export type KdsRichTextEditorProps = {
25
+ editable?: boolean;
26
+ /**
27
+ * Min height the editor should have. By default this is unset, so
28
+ * the editor will fir the min content
29
+ */
30
+ minHeight?: number | null;
31
+ /**
32
+ * Max height the editor can have. The editor container will grow up to this
33
+ * value before it starts to overflow the content. By default this is unset, so
34
+ * the editor will grow with the content
35
+ */
36
+ maxHeight?: number | null;
37
+ /**
38
+ * Extensions that should be enabled. By default all are disabled and you
39
+ * have to opt-in to use them
40
+ */
41
+ baseExtensions?: BaseExtensions;
42
+ /**
43
+ * Function to format the display value of each tool's hotkeys as a title when hovered.
44
+ * Receives as parameter the key combinations of each tool and should return
45
+ * the string to be displayed in the title
46
+ * @param hotkey
47
+ */
48
+ hotkeyFormatter?: (hotkey: Array<string>) => string;
49
+ /**
50
+ * Custom extensions that you want to use for the editor
51
+ */
52
+ customExtensions?: Array<AnyExtension>;
53
+ /**
54
+ * Whether to automatically focus the editor on mount. Also applies when the
55
+ * editable prop changes. False by default
56
+ */
57
+ autofocus?: boolean;
58
+ /**
59
+ * Whether the editor renders with a border or not. e.g Workflow Annotations use a borderless editor
60
+ */
61
+ withBorder?: boolean;
62
+ /**
63
+ * Whether the editor is in a disabled state. This state changes its style, sets the
64
+ * editor to non-editable and hides the toolbar. In the disabled state, the editor won't
65
+ * react to changes of the editable prop.
66
+ */
67
+ disabled?: boolean;
68
+ /**
69
+ * Only used if the link tool is enabled. If not set, the url will not be checked.
70
+ * @param url
71
+ */
72
+ linkToolOptions?: KdsLinkToolOptions;
73
+ /**
74
+ * Max number of allowed characters in the editor. When the user has 100 characters
75
+ * or less left, then a visual counter will be displayed to the user.
76
+ *
77
+ * Notes:
78
+ * - Defaults to 1000 and cannot be under 200
79
+ * - When a number less than 200 is supplied, the editor will fallback to 200
80
+ * - This prop is *intentionally* **not** reactive. This is because this acts
81
+ * as a configuration that is given to the editor upon usage rather than a
82
+ * dynamic value. Having an increasingly changing value defeats
83
+ * the purpose of having a limit
84
+ */
85
+ characterLimit?: number;
86
+ /**
87
+ * Whether the character counter (`x / limit characters`) is shown below the
88
+ * editor. The `characterLimit` is still enforced when hidden — this only
89
+ * controls the visibility of the counter, e.g. when the limit is high enough
90
+ * that surfacing it would only add noise.
91
+ *
92
+ * Defaults to `false`.
93
+ */
94
+ showCharacterCount?: boolean;
95
+ /**
96
+ * Custom handler when pressing `Esc` in the keyboard.
97
+ * @returns whether the shortcut command is handled or not
98
+ */
99
+ customEscapeHandler?: () => boolean;
100
+ /**
101
+ * Accessible label for the editor (for aria-label). Provide this when the
102
+ * editor has no visible label. Prefer `ariaLabelledby` when a visible label
103
+ * element exists.
104
+ */
105
+ ariaLabel?: string;
106
+ /**
107
+ * ID of the element that labels this editor (for aria-labelledby).
108
+ */
109
+ ariaLabelledby?: string;
110
+ };
111
+ export {};
112
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CA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;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,eAAe,CAAC,EAAE,kBAAkB,CAAC;IACrC;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,OAAO,CAAC;IACpC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { Extension } from '@tiptap/vue-3';
2
+ /**
3
+ * TODO UIEXT-1461 Remove and resolve properly with https://knime-com.atlassian.net/browse/UIEXT-1461-
4
+ */
5
+ type CustomEscapeExtensionOptions = {
6
+ handler: () => boolean;
7
+ };
8
+ declare module "@tiptap/core" {
9
+ interface ExtensionOptions {
10
+ customEscape: CustomEscapeExtensionOptions;
11
+ }
12
+ }
13
+ export declare const CustomEscape: Extension<CustomEscapeExtensionOptions, any>;
14
+ export {};
15
+ //# sourceMappingURL=custom-escape.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-escape.d.ts","sourceRoot":"","sources":["../../../src/utils/custom-escape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;GAEG;AACH,KAAK,4BAA4B,GAAG;IAClC,OAAO,EAAE,MAAM,OAAO,CAAC;CACxB,CAAC;AAEF,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,gBAAgB;QACxB,YAAY,EAAE,4BAA4B,CAAC;KAC5C;CACF;AAED,eAAO,MAAM,YAAY,8CAcvB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const CustomHardBreak: import('@tiptap/core').Node<import('@tiptap/extension-hard-break').HardBreakOptions, any>;
2
+ //# sourceMappingURL=custom-hard-break.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-hard-break.d.ts","sourceRoot":"","sources":["../../../src/utils/custom-hard-break.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,2FAM1B,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare const validateURL: (href: string) => boolean;
2
+ export type KdsLinkToolOptions = {
3
+ /**
4
+ * Custom function that can be supplied to validate urls added with the link tool
5
+ * @param url The url of the link to be added
6
+ */
7
+ urlValidator: (url: string) => boolean;
8
+ /**
9
+ * Custom function that can, e.g., be used to append a protocol like https:// to a url if not present
10
+ * @param url The url of the link to be added
11
+ */
12
+ sanitizeUrlText: (url: string) => string;
13
+ };
14
+ export declare const kdsDefaultLinkToolOptions: KdsLinkToolOptions;
15
+ export declare const CustomLink: import('@tiptap/core').Mark<import('@tiptap/extension-link').LinkOptions, any>;
16
+ //# sourceMappingURL=custom-link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-link.d.ts","sourceRoot":"","sources":["../../../src/utils/custom-link.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,YAAyB,CAAC;AAElE,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACvC;;;OAGG;IACH,eAAe,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,kBAQvC,CAAC;AAEF,eAAO,MAAM,UAAU,gFA+CrB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const CustomTextAlign: import('@tiptap/core').Extension<import('@tiptap/extension-text-align').TextAlignOptions, any>;
2
+ //# sourceMappingURL=custom-text-align.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-text-align.d.ts","sourceRoot":"","sources":["../../../src/utils/custom-text-align.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,gGAkB1B,CAAC"}
@@ -0,0 +1,17 @@
1
+ declare module "@tiptap/core" {
2
+ interface Commands<ReturnType> {
3
+ fontSize: {
4
+ /**
5
+ * Sets a custom class on the paragraph which is used to set a small font size
6
+ */
7
+ setSmallText: () => ReturnType;
8
+ /**
9
+ * Reverts setSmallText
10
+ */
11
+ unsetSmallText: () => ReturnType;
12
+ };
13
+ }
14
+ }
15
+ declare const SmallText: import('@tiptap/core').Node<import('@tiptap/extension-paragraph').ParagraphOptions, any>;
16
+ export { SmallText };
17
+ //# sourceMappingURL=extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../../src/utils/paragraphTextStyle/extension.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,QAAQ,EAAE;YACR;;eAEG;YACH,YAAY,EAAE,MAAM,UAAU,CAAC;YAC/B;;eAEG;YACH,cAAc,EAAE,MAAM,UAAU,CAAC;SAClC,CAAC;KACH;CACF;AAED,QAAA,MAAM,SAAS,0FA6Cb,CAAC;AAEH,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Editor } from '@tiptap/vue-3';
2
+ import { EditorToolSecondaryItem } from '../../toolbar/types';
3
+ export declare const getParagraphTextStyleTool: (getEditor: () => Editor) => EditorToolSecondaryItem;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/paragraphTextStyle/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,KAAK,EACV,uBAAuB,EAExB,MAAM,qBAAqB,CAAC;AA4B7B,eAAO,MAAM,yBAAyB,GACpC,WAAW,MAAM,MAAM,KACtB,uBAiCF,CAAC"}
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "@knime/kds-rich-text-editor",
3
+ "version": "0.30.4",
4
+ "description": "Package containing the RichTextEditor component which follows the KNIME Design System",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/knime/knime-designsystem.git",
8
+ "directory": "packages/rich-text-editor"
9
+ },
10
+ "license": "GPL 3 and Additional Permissions according to Sec. 7 (SEE the file LICENSE)",
11
+ "author": "KNIME AG, Zurich, Switzerland",
12
+ "keywords": [
13
+ "knime",
14
+ "design system",
15
+ "documentation",
16
+ "storybook",
17
+ "rich-text",
18
+ "editor"
19
+ ],
20
+ "type": "module",
21
+ "main": "./dist/index.js",
22
+ "module": "./dist/index.js",
23
+ "types": "./dist/src/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/src/index.d.ts",
27
+ "import": "./dist/index.js"
28
+ }
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "CHANGELOG.md"
33
+ ],
34
+ "peerDependencies": {
35
+ "vue": "~3.5.0",
36
+ "@knime/kds-components": "^0.30.4"
37
+ },
38
+ "dependencies": {
39
+ "@knime/utils": "^1.11.0",
40
+ "consola": "^3.4.2",
41
+ "@tiptap/core": "^3.25.0",
42
+ "@tiptap/extension-character-count": "^3.25.0",
43
+ "@tiptap/extension-hard-break": "^3.25.0",
44
+ "@tiptap/extension-heading": "^3.25.0",
45
+ "@tiptap/extension-link": "^3.25.0",
46
+ "@tiptap/extension-paragraph": "^3.25.0",
47
+ "@tiptap/extension-text-align": "^3.25.0",
48
+ "@tiptap/pm": "^3.25.0",
49
+ "@tiptap/starter-kit": "^3.25.0",
50
+ "@tiptap/vue-3": "^3.25.0",
51
+ "@knime/kds-styles": "^0.30.4"
52
+ },
53
+ "devDependencies": {
54
+ "@storybook/vue3-vite": "^10.4.3",
55
+ "@vitejs/plugin-vue": "^6.0.5",
56
+ "@vue/test-utils": "^2.4.6",
57
+ "@vue/tsconfig": "^0.9.1",
58
+ "storybook": "^10.4.3",
59
+ "ts-morph": "^28.0.0",
60
+ "vite": "^7.3.2",
61
+ "vite-plugin-dts": "^4.5.4",
62
+ "vite-plugin-lib-inject-css": "^2.2.2",
63
+ "vite-svg-loader": "^5.1.1",
64
+ "vue": "3.5.32",
65
+ "vue-tsc": "^3.3.4",
66
+ "@knime/kds-components": "^0.30.4"
67
+ },
68
+ "engines": {
69
+ "node": "24.10.0",
70
+ "npm": "please-use-pnpm"
71
+ },
72
+ "scripts": {
73
+ "build": "vite build",
74
+ "type-check": "vue-tsc --build"
75
+ }
76
+ }