@websline/system-components 1.3.14 → 1.3.16

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.
@@ -42,7 +42,6 @@
42
42
  ...rest
43
43
  } = $props();
44
44
 
45
- let DOMPurify;
46
45
  let element = $state();
47
46
  /** @type {import("@tiptap/core").Editor} */
48
47
  let editor = $state.raw();
@@ -61,7 +60,7 @@
61
60
  const { TextStyle } = await import("@tiptap/extension-text-style");
62
61
  const Highlight = (await import("@tiptap/extension-highlight")).default;
63
62
  const Placeholder = (await import("@tiptap/extension-placeholder")).default;
64
- DOMPurify = (await import("dompurify")).default;
63
+ const DOMPurify = (await import("dompurify")).default;
65
64
 
66
65
  editor = new Editor({
67
66
  element: element,
@@ -89,11 +88,21 @@
89
88
  editorProps: {
90
89
  handlePaste(view, event) {
91
90
  const html = event.clipboardData.getData("text/html");
92
- const sanitized = sanitizeContent(html);
93
- if (!sanitized) return false;
94
91
 
95
- editor.commands.insertContent(sanitized);
96
- return true;
92
+ if (html) {
93
+ const cleaned = DOMPurify.sanitize(html, {
94
+ ALLOWED_TAGS: ["b", "strong", "i", "em", "u", "s", "strike", "p", "br"],
95
+ ALLOWED_ATTR: [],
96
+ });
97
+
98
+ const normalized = cleanHTMLWhitespace(cleaned);
99
+
100
+ editor.commands.insertContent(normalized);
101
+
102
+ return true;
103
+ }
104
+
105
+ return false;
97
106
  },
98
107
  },
99
108
  onUpdate: () => {
@@ -123,11 +132,9 @@
123
132
  });
124
133
 
125
134
  $effect(() => {
126
- content;
127
135
  if (editor) {
128
- const sanitized = untrack(() => sanitizeContent(content));
129
136
  isContentPropUpdate = true;
130
- editor.commands.setContent(sanitized ?? "");
137
+ editor.commands.setContent(content ?? "");
131
138
  }
132
139
  });
133
140
 
@@ -153,17 +160,6 @@
153
160
 
154
161
  return dom.innerHTML.trim();
155
162
  };
156
-
157
- const sanitizeContent = (html) => {
158
- if (typeof html !== "string" || !DOMPurify) return;
159
-
160
- const cleaned = DOMPurify.sanitize(html, {
161
- ALLOWED_TAGS: ["b", "strong", "i", "em", "u", "s", "strike", "p", "br"],
162
- ALLOWED_ATTR: [],
163
- });
164
-
165
- return cleanHTMLWhitespace(cleaned);
166
- };
167
163
  </script>
168
164
 
169
165
  <div class={styles.base({ class: classes.base })} {...rest}>
@@ -173,7 +169,7 @@
173
169
  </div>
174
170
  {/if}
175
171
  {#if fieldName}
176
- <input type="hidden" name={fieldName} value={htmlInputValue} />
172
+ <input name={fieldName} bind:value={content} />
177
173
  {/if}
178
174
  <div
179
175
  class={styles.field({ class: classes.field })}
@@ -32,6 +32,7 @@
32
32
  class: className = "",
33
33
  disabled = false,
34
34
  name,
35
+ onChange,
35
36
  size = "medium",
36
37
  value = $bindable(),
37
38
  variant = "default",
@@ -47,6 +48,10 @@
47
48
  receive,
48
49
  size,
49
50
  update: (newValue) => {
51
+ if (onChange) {
52
+ onChange(newValue);
53
+ }
54
+
50
55
  value = newValue;
51
56
  },
52
57
  value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websline/system-components",
3
- "version": "1.3.14",
3
+ "version": "1.3.16",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -26,16 +26,16 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "@tiptap/core": "^3.20.0",
30
- "@tiptap/extension-color": "^3.20.0",
31
- "@tiptap/extension-highlight": "^3.20.0",
32
- "@tiptap/extension-placeholder": "^3.20.0",
33
- "@tiptap/extension-text-align": "^3.20.0",
34
- "@tiptap/extension-text-style": "^3.20.0",
35
- "@tiptap/pm": "^3.20.0",
36
- "@tiptap/starter-kit": "^3.20.0",
29
+ "@tiptap/core": "^3.20.1",
30
+ "@tiptap/extension-color": "^3.20.1",
31
+ "@tiptap/extension-highlight": "^3.20.1",
32
+ "@tiptap/extension-placeholder": "^3.20.1",
33
+ "@tiptap/extension-text-align": "^3.20.1",
34
+ "@tiptap/extension-text-style": "^3.20.1",
35
+ "@tiptap/pm": "^3.20.1",
36
+ "@tiptap/starter-kit": "^3.20.1",
37
37
  "bits-ui": "^2.16.3",
38
- "dompurify": "^3.3.1",
38
+ "dompurify": "^3.3.2",
39
39
  "tailwind-variants": "^3.2.2",
40
40
  "uuid": "^13.0.0"
41
41
  },
@@ -43,12 +43,12 @@
43
43
  "svelte": "^5.38.7"
44
44
  },
45
45
  "devDependencies": {
46
- "@eslint/compat": "^2.0.2",
47
- "@eslint/js": "^9.39.3",
48
- "@storybook/addon-a11y": "^10.2.15",
49
- "@storybook/addon-docs": "^10.2.15",
46
+ "@eslint/compat": "^2.0.3",
47
+ "@eslint/js": "^9.39.4",
48
+ "@storybook/addon-a11y": "^10.2.17",
49
+ "@storybook/addon-docs": "^10.2.17",
50
50
  "@storybook/addon-svelte-csf": "^5.0.11",
51
- "@storybook/sveltekit": "^10.2.15",
51
+ "@storybook/sveltekit": "^10.2.17",
52
52
  "@sveltejs/adapter-auto": "^7.0.1",
53
53
  "@sveltejs/kit": "^2.53.4",
54
54
  "@sveltejs/package": "^2.5.7",
@@ -56,12 +56,12 @@
56
56
  "@tailwindcss/forms": "^0.5.11",
57
57
  "@tailwindcss/typography": "^0.5.19",
58
58
  "@tailwindcss/vite": "^4.2.1",
59
- "@types/node": "^25.3.3",
59
+ "@types/node": "^25.4.0",
60
60
  "@vitest/browser": "^4.0.18",
61
- "eslint": "^9.39.3",
61
+ "eslint": "^9.39.4",
62
62
  "eslint-config-prettier": "^10.1.8",
63
- "eslint-plugin-storybook": "^10.2.15",
64
- "eslint-plugin-svelte": "^3.15.0",
63
+ "eslint-plugin-storybook": "^10.2.17",
64
+ "eslint-plugin-svelte": "^3.15.2",
65
65
  "globals": "^17.4.0",
66
66
  "playwright": "^1.58.2",
67
67
  "postcss-url": "^10.1.3",
@@ -69,8 +69,8 @@
69
69
  "prettier-plugin-svelte": "^3.5.1",
70
70
  "prettier-plugin-tailwindcss": "^0.7.2",
71
71
  "publint": "^0.3.18",
72
- "storybook": "^10.2.15",
73
- "svelte": "^5.53.7",
72
+ "storybook": "^10.2.17",
73
+ "svelte": "^5.53.9",
74
74
  "tailwindcss": "^4.2.1",
75
75
  "typescript": "^5.9.3",
76
76
  "vite": "^7.3.1",