@prosekit/svelte 0.6.8 → 0.6.10
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.
@@ -5,7 +5,7 @@ import { useEditorContext } from '../contexts/editor-context';
|
|
5
5
|
// on the element manually and only let Svelte set the attributes.
|
6
6
|
export function useComponent(propNames, eventNames) {
|
7
7
|
const hasEditor = propNames.includes('editor');
|
8
|
-
const lowerCaseEventNameMap =
|
8
|
+
const lowerCaseEventNameMap = new Map(eventNames.map((name) => [name.toLowerCase(), name]));
|
9
9
|
const editorContext = useEditorContext();
|
10
10
|
function handleChange(element, $$props) {
|
11
11
|
const properties = {};
|
@@ -21,12 +21,14 @@ export function useComponent(propNames, eventNames) {
|
|
21
21
|
}
|
22
22
|
if (name.startsWith('on')) {
|
23
23
|
const lowerCaseEventName = name.slice(2).toLowerCase();
|
24
|
-
const eventName = lowerCaseEventNameMap
|
24
|
+
const eventName = lowerCaseEventNameMap.get(lowerCaseEventName);
|
25
25
|
if (eventName) {
|
26
26
|
const extractDetail = eventName.endsWith('Change');
|
27
27
|
eventHandlers[eventName] = (event) => {
|
28
28
|
const handler = value;
|
29
|
-
|
29
|
+
if (typeof handler === 'function') {
|
30
|
+
handler(extractDetail ? event.detail : event);
|
31
|
+
}
|
30
32
|
};
|
31
33
|
continue;
|
32
34
|
}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/svelte",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.6.
|
4
|
+
"version": "0.6.10",
|
5
5
|
"private": false,
|
6
6
|
"description": "Svelte components and utilities for ProseKit",
|
7
7
|
"author": {
|
@@ -72,9 +72,9 @@
|
|
72
72
|
"dependencies": {
|
73
73
|
"@prosemirror-adapter/core": "^0.4.0",
|
74
74
|
"@prosemirror-adapter/svelte": "^0.4.1",
|
75
|
-
"@prosekit/core": "^0.8.
|
76
|
-
"@prosekit/
|
77
|
-
"@prosekit/
|
75
|
+
"@prosekit/core": "^0.8.2",
|
76
|
+
"@prosekit/pm": "^0.1.11",
|
77
|
+
"@prosekit/web": "^0.5.10"
|
78
78
|
},
|
79
79
|
"peerDependencies": {
|
80
80
|
"svelte": ">= 5.0.0"
|
@@ -88,11 +88,11 @@
|
|
88
88
|
"@sveltejs/package": "^2.3.11",
|
89
89
|
"@types/node": "^20.17.29",
|
90
90
|
"read-pkg": "^9.0.1",
|
91
|
-
"svelte": "^5.
|
92
|
-
"svelte-check": "^4.1
|
91
|
+
"svelte": "^5.33.18",
|
92
|
+
"svelte-check": "^4.2.1",
|
93
93
|
"tsx": "^4.19.4",
|
94
94
|
"typescript": "~5.8.3",
|
95
|
-
"vitest": "^3.
|
95
|
+
"vitest": "^3.2.3",
|
96
96
|
"@prosekit/config-vitest": "0.0.0"
|
97
97
|
},
|
98
98
|
"publishConfig": {
|