@websline/system-components 1.3.28 → 1.4.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.
|
@@ -61,19 +61,62 @@
|
|
|
61
61
|
const Highlight = (await import("@tiptap/extension-highlight")).default;
|
|
62
62
|
const Placeholder = (await import("@tiptap/extension-placeholder")).default;
|
|
63
63
|
const DOMPurify = (await import("dompurify")).default;
|
|
64
|
+
const Link = (await import("@tiptap/extension-link")).default;
|
|
65
|
+
|
|
66
|
+
const CustomLink = Link.extend({
|
|
67
|
+
addAttributes() {
|
|
68
|
+
return {
|
|
69
|
+
href: {
|
|
70
|
+
default: null,
|
|
71
|
+
},
|
|
72
|
+
pageId: {
|
|
73
|
+
default: null,
|
|
74
|
+
parseHTML: (el) => el.getAttribute("data-page-id"),
|
|
75
|
+
renderHTML: (attrs) => {
|
|
76
|
+
if (!attrs.pageId) return {};
|
|
77
|
+
return { "data-page-id": attrs.pageId };
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
anchor: {
|
|
81
|
+
default: null,
|
|
82
|
+
parseHTML: (el) => el.getAttribute("data-anchor"),
|
|
83
|
+
renderHTML: (attrs) => {
|
|
84
|
+
if (!attrs.anchor) return {};
|
|
85
|
+
return { "data-anchor": attrs.anchor };
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
target: {
|
|
89
|
+
default: null,
|
|
90
|
+
parseHTML: (el) => el.getAttribute("target"),
|
|
91
|
+
renderHTML: (attrs) => {
|
|
92
|
+
if (attrs.target === "_blank") {
|
|
93
|
+
return { target: "_blank" };
|
|
94
|
+
}
|
|
95
|
+
return {};
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
renderHTML({ HTMLAttributes }) {
|
|
102
|
+
const attrs = { ...HTMLAttributes };
|
|
103
|
+
|
|
104
|
+
if (attrs.target === "_blank") {
|
|
105
|
+
attrs.rel = "noopener noreferrer";
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return ["a", attrs, 0];
|
|
109
|
+
},
|
|
110
|
+
});
|
|
64
111
|
|
|
65
112
|
editor = new Editor({
|
|
66
113
|
element: element,
|
|
67
114
|
extensions: [
|
|
68
115
|
StarterKit.configure({
|
|
69
|
-
link:
|
|
70
|
-
openOnClick: false,
|
|
71
|
-
HTMLAttributes: {
|
|
72
|
-
rel: "noopener noreferrer",
|
|
73
|
-
},
|
|
74
|
-
},
|
|
116
|
+
link: false,
|
|
75
117
|
}),
|
|
76
118
|
Color,
|
|
119
|
+
CustomLink,
|
|
77
120
|
Highlight.configure({
|
|
78
121
|
multicolor: true,
|
|
79
122
|
}),
|
|
@@ -12,19 +12,14 @@
|
|
|
12
12
|
return editor.on("transaction", () => (active = editor.isActive("link")));
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
-
const setLink = () => {
|
|
16
|
-
const focus = () => editor.chain().focus();
|
|
17
|
-
|
|
18
|
-
const previousUrl = editor.getAttributes("link").href;
|
|
19
|
-
const url = prompt("Link eingeben:", previousUrl || "https://");
|
|
20
|
-
|
|
21
|
-
if (url === null) return;
|
|
22
|
-
url === "" ? focus().unsetLink().run() : focus().setLink({ href: url }).run();
|
|
23
|
-
};
|
|
24
|
-
|
|
25
15
|
const handleOpenLinkModal = () => {
|
|
26
16
|
if (onOpenLink) {
|
|
27
|
-
onOpenLink({
|
|
17
|
+
onOpenLink({
|
|
18
|
+
editor,
|
|
19
|
+
getCurrentLink: () => editor.getAttributes("link"),
|
|
20
|
+
applyLink: (attrs) => editor.chain().focus().setLink(attrs).run(),
|
|
21
|
+
removeLink: () => editor.chain().focus().unsetLink().run(),
|
|
22
|
+
});
|
|
28
23
|
return;
|
|
29
24
|
}
|
|
30
25
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@websline/system-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -33,15 +33,16 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@tiptap/core": "^3.
|
|
37
|
-
"@tiptap/extension-color": "^3.
|
|
38
|
-
"@tiptap/extension-highlight": "^3.
|
|
39
|
-
"@tiptap/extension-
|
|
40
|
-
"@tiptap/extension-
|
|
41
|
-
"@tiptap/extension-text-
|
|
42
|
-
"@tiptap/
|
|
43
|
-
"@tiptap/
|
|
44
|
-
"
|
|
36
|
+
"@tiptap/core": "^3.21.0",
|
|
37
|
+
"@tiptap/extension-color": "^3.21.0",
|
|
38
|
+
"@tiptap/extension-highlight": "^3.21.0",
|
|
39
|
+
"@tiptap/extension-link": "^3.21.0",
|
|
40
|
+
"@tiptap/extension-placeholder": "^3.21.0",
|
|
41
|
+
"@tiptap/extension-text-align": "^3.21.0",
|
|
42
|
+
"@tiptap/extension-text-style": "^3.21.0",
|
|
43
|
+
"@tiptap/pm": "^3.21.0",
|
|
44
|
+
"@tiptap/starter-kit": "^3.21.0",
|
|
45
|
+
"bits-ui": "^2.16.5",
|
|
45
46
|
"dompurify": "^3.3.3",
|
|
46
47
|
"tailwind-variants": "^3.2.2"
|
|
47
48
|
},
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
"@eslint/js": "^10.0.1",
|
|
54
55
|
"@storybook/addon-a11y": "^10.3.3",
|
|
55
56
|
"@storybook/addon-docs": "^10.3.3",
|
|
56
|
-
"@storybook/addon-svelte-csf": "^5.1.
|
|
57
|
+
"@storybook/addon-svelte-csf": "^5.1.2",
|
|
57
58
|
"@storybook/sveltekit": "^10.3.3",
|
|
58
59
|
"@sveltejs/adapter-auto": "^7.0.1",
|
|
59
60
|
"@sveltejs/kit": "^2.55.0",
|
|
@@ -63,7 +64,7 @@
|
|
|
63
64
|
"@tailwindcss/typography": "^0.5.19",
|
|
64
65
|
"@tailwindcss/vite": "^4.2.2",
|
|
65
66
|
"@types/node": "^25.5.0",
|
|
66
|
-
"@vitest/browser": "^4.1.
|
|
67
|
+
"@vitest/browser": "^4.1.2",
|
|
67
68
|
"eslint": "^10.1.0",
|
|
68
69
|
"eslint-config-prettier": "^10.1.8",
|
|
69
70
|
"eslint-plugin-storybook": "^10.3.3",
|
|
@@ -76,11 +77,11 @@
|
|
|
76
77
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
77
78
|
"publint": "^0.3.18",
|
|
78
79
|
"storybook": "^10.3.3",
|
|
79
|
-
"svelte": "^5.55.
|
|
80
|
+
"svelte": "^5.55.1",
|
|
80
81
|
"tailwindcss": "^4.2.2",
|
|
81
82
|
"typescript": "^5.9.3",
|
|
82
|
-
"vite": "^8.0.
|
|
83
|
-
"vitest": "^4.1.
|
|
83
|
+
"vite": "^8.0.3",
|
|
84
|
+
"vitest": "^4.1.2",
|
|
84
85
|
"vitest-browser-svelte": "^2.1.0"
|
|
85
86
|
},
|
|
86
87
|
"keywords": [
|