@svadmin/editor 0.7.20 → 0.7.21
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/dist/components/BubbleMenu.svelte +2 -2
- package/dist/components/ColorPicker.svelte +2 -2
- package/dist/components/FloatingMenu.svelte +2 -2
- package/dist/components/ImageUpload.svelte +5 -5
- package/dist/components/ImageUpload.svelte.d.ts +2 -2
- package/dist/components/LinkPopover.svelte +4 -4
- package/dist/components/TableMenu.svelte +2 -2
- package/dist/components/Toolbar.svelte +2 -2
- package/dist/components/ToolbarButton.svelte +2 -2
- package/dist/components/ToolbarGroup.svelte +2 -2
- package/dist/components/ToolbarSelect.svelte +2 -2
- package/package.json +28 -28
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
import { ImageIcon, Upload, Link as LinkIcon, RotateCw } from '@lucide/svelte';
|
|
4
4
|
import { t } from '@svadmin/core';
|
|
5
5
|
|
|
6
|
-
let { editor, onUpload, onclose }
|
|
6
|
+
let { editor, onUpload, onclose }: {
|
|
7
7
|
editor: Editor;
|
|
8
|
-
onUpload?: (file: File) => Promise<string
|
|
9
|
-
onclose?: () => void;
|
|
10
|
-
}
|
|
8
|
+
onUpload?: ((file: File) => Promise<string>) | undefined;
|
|
9
|
+
onclose?: (() => void) | undefined;
|
|
10
|
+
} = $props();
|
|
11
11
|
|
|
12
12
|
let mode: 'url' | 'upload' = $state('url');
|
|
13
13
|
let url = $state('');
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
function insertByUrl() {
|
|
62
62
|
if (!url.trim()) return;
|
|
63
63
|
if (disposed || editor.isDestroyed || !editor.isEditable) return;
|
|
64
|
-
editor.chain().focus().setImage({ src: url, alt
|
|
64
|
+
editor.chain().focus().setImage({ src: url, ...(alt ? { alt } : {}) }).run();
|
|
65
65
|
url = '';
|
|
66
66
|
alt = '';
|
|
67
67
|
close();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Editor } from '@tiptap/core';
|
|
2
2
|
type $$ComponentProps = {
|
|
3
3
|
editor: Editor;
|
|
4
|
-
onUpload?: (file: File) => Promise<string
|
|
5
|
-
onclose?: () => void;
|
|
4
|
+
onUpload?: ((file: File) => Promise<string>) | undefined;
|
|
5
|
+
onclose?: (() => void) | undefined;
|
|
6
6
|
};
|
|
7
7
|
declare const ImageUpload: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
8
|
type ImageUpload = ReturnType<typeof ImageUpload>;
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import { ExternalLink, Unlink, Check } from '@lucide/svelte';
|
|
4
4
|
import { t } from '@svadmin/core';
|
|
5
5
|
|
|
6
|
-
let { editor, onclose }
|
|
6
|
+
let { editor, onclose }: {
|
|
7
7
|
editor: Editor;
|
|
8
8
|
onclose?: () => void;
|
|
9
|
-
}
|
|
9
|
+
} = $props();
|
|
10
10
|
|
|
11
11
|
let url = $state('');
|
|
12
12
|
let openInNewTab = $state(true);
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
// Initialize from current link
|
|
15
15
|
$effect(() => {
|
|
16
16
|
const attrs = editor.getAttributes('link');
|
|
17
|
-
url = (attrs
|
|
18
|
-
openInNewTab = attrs
|
|
17
|
+
url = (attrs['href'] as string) ?? '';
|
|
18
|
+
openInNewTab = attrs['target'] === '_blank';
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
function applyLink() {
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
import ToolbarButton from './ToolbarButton.svelte';
|
|
9
9
|
import { t } from '@svadmin/core';
|
|
10
10
|
|
|
11
|
-
let { editor, onclose }
|
|
11
|
+
let { editor, onclose }: {
|
|
12
12
|
editor: Editor;
|
|
13
13
|
onclose?: () => void;
|
|
14
|
-
}
|
|
14
|
+
} = $props();
|
|
15
15
|
|
|
16
16
|
const isInTable = $derived(editor.isActive('table'));
|
|
17
17
|
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
} from '@lucide/svelte';
|
|
20
20
|
import { t } from '@svadmin/core';
|
|
21
21
|
|
|
22
|
-
let { editor, onUpload, preset = 'full' }
|
|
22
|
+
let { editor, onUpload, preset = 'full' }: {
|
|
23
23
|
editor: Editor;
|
|
24
24
|
onUpload?: (file: File) => Promise<string>;
|
|
25
25
|
preset?: 'full' | 'minimal' | 'prose';
|
|
26
|
-
}
|
|
26
|
+
} = $props();
|
|
27
27
|
|
|
28
28
|
// ─── Reactive state: re-read on every transaction ────────────
|
|
29
29
|
let txn = $state(0);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
|
|
4
|
-
let { active = false, disabled = false, title = '', onclick, children }
|
|
4
|
+
let { active = false, disabled = false, title = '', onclick, children }: {
|
|
5
5
|
active?: boolean;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
title?: string;
|
|
8
8
|
onclick?: () => void;
|
|
9
9
|
children: Snippet;
|
|
10
|
-
}
|
|
10
|
+
} = $props();
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<button
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
let { value = '', options = [], title = '', onchange }
|
|
2
|
+
let { value = '', options = [], title = '', onchange }: {
|
|
3
3
|
value?: string;
|
|
4
4
|
options: Array<{ value: string; label: string }>;
|
|
5
5
|
title?: string;
|
|
6
6
|
onchange?: (value: string) => void;
|
|
7
|
-
}
|
|
7
|
+
} = $props();
|
|
8
8
|
</script>
|
|
9
9
|
|
|
10
10
|
<select
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/editor",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.21",
|
|
4
4
|
"description": "Modern Tiptap-based rich text editor for Svelte 5 — headless, modular, production-ready",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -37,35 +37,35 @@
|
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"svelte": "^5.56.10",
|
|
40
|
-
"@svadmin/core": "^0.
|
|
40
|
+
"@svadmin/core": "^0.80.0"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@lucide/svelte": "^1.
|
|
44
|
-
"@tiptap/core": "^3.
|
|
45
|
-
"@tiptap/extension-bubble-menu": "^3.
|
|
46
|
-
"@tiptap/extension-character-count": "^3.
|
|
47
|
-
"@tiptap/extension-code-block-lowlight": "^3.
|
|
48
|
-
"@tiptap/extension-color": "^3.
|
|
49
|
-
"@tiptap/extension-floating-menu": "^3.
|
|
50
|
-
"@tiptap/extension-highlight": "^3.
|
|
51
|
-
"@tiptap/extension-image": "^3.
|
|
52
|
-
"@tiptap/extension-link": "^3.
|
|
53
|
-
"@tiptap/extension-placeholder": "^3.
|
|
54
|
-
"@tiptap/extension-subscript": "^3.
|
|
55
|
-
"@tiptap/extension-superscript": "^3.
|
|
56
|
-
"@tiptap/extension-table": "^3.
|
|
57
|
-
"@tiptap/extension-table-cell": "^3.
|
|
58
|
-
"@tiptap/extension-table-header": "^3.
|
|
59
|
-
"@tiptap/extension-table-row": "^3.
|
|
60
|
-
"@tiptap/extension-task-item": "^3.
|
|
61
|
-
"@tiptap/extension-task-list": "^3.
|
|
62
|
-
"@tiptap/extension-text-align": "^3.
|
|
63
|
-
"@tiptap/extension-text-style": "^3.
|
|
64
|
-
"@tiptap/extension-typography": "^3.
|
|
65
|
-
"@tiptap/extension-underline": "^3.
|
|
66
|
-
"@tiptap/pm": "^3.
|
|
67
|
-
"@tiptap/starter-kit": "^3.
|
|
68
|
-
"@tiptap/suggestion": "^3.
|
|
43
|
+
"@lucide/svelte": "^1.71.0",
|
|
44
|
+
"@tiptap/core": "^3.33.0",
|
|
45
|
+
"@tiptap/extension-bubble-menu": "^3.33.0",
|
|
46
|
+
"@tiptap/extension-character-count": "^3.33.0",
|
|
47
|
+
"@tiptap/extension-code-block-lowlight": "^3.33.0",
|
|
48
|
+
"@tiptap/extension-color": "^3.33.0",
|
|
49
|
+
"@tiptap/extension-floating-menu": "^3.33.0",
|
|
50
|
+
"@tiptap/extension-highlight": "^3.33.0",
|
|
51
|
+
"@tiptap/extension-image": "^3.33.0",
|
|
52
|
+
"@tiptap/extension-link": "^3.33.0",
|
|
53
|
+
"@tiptap/extension-placeholder": "^3.33.0",
|
|
54
|
+
"@tiptap/extension-subscript": "^3.33.0",
|
|
55
|
+
"@tiptap/extension-superscript": "^3.33.0",
|
|
56
|
+
"@tiptap/extension-table": "^3.33.0",
|
|
57
|
+
"@tiptap/extension-table-cell": "^3.33.0",
|
|
58
|
+
"@tiptap/extension-table-header": "^3.33.0",
|
|
59
|
+
"@tiptap/extension-table-row": "^3.33.0",
|
|
60
|
+
"@tiptap/extension-task-item": "^3.33.0",
|
|
61
|
+
"@tiptap/extension-task-list": "^3.33.0",
|
|
62
|
+
"@tiptap/extension-text-align": "^3.33.0",
|
|
63
|
+
"@tiptap/extension-text-style": "^3.33.0",
|
|
64
|
+
"@tiptap/extension-typography": "^3.33.0",
|
|
65
|
+
"@tiptap/extension-underline": "^3.33.0",
|
|
66
|
+
"@tiptap/pm": "^3.33.0",
|
|
67
|
+
"@tiptap/starter-kit": "^3.33.0",
|
|
68
|
+
"@tiptap/suggestion": "^3.33.0",
|
|
69
69
|
"lowlight": "^3.3.0"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|