@cou.sh/nuxt 1.0.1
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/README.md +84 -0
- package/dist/module.d.mts +49 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +126 -0
- package/dist/runtime/components/ActivityTimeline.d.vue.ts +17 -0
- package/dist/runtime/components/ActivityTimeline.vue +108 -0
- package/dist/runtime/components/ActivityTimeline.vue.d.ts +17 -0
- package/dist/runtime/components/AuthForm.d.vue.ts +20 -0
- package/dist/runtime/components/AuthForm.vue +78 -0
- package/dist/runtime/components/AuthForm.vue.d.ts +20 -0
- package/dist/runtime/components/CommentThread.d.vue.ts +10 -0
- package/dist/runtime/components/CommentThread.vue +149 -0
- package/dist/runtime/components/CommentThread.vue.d.ts +10 -0
- package/dist/runtime/components/ConnectionStatus.d.vue.ts +13 -0
- package/dist/runtime/components/ConnectionStatus.vue +27 -0
- package/dist/runtime/components/ConnectionStatus.vue.d.ts +13 -0
- package/dist/runtime/components/DocumentBreadcrumb.d.vue.ts +13 -0
- package/dist/runtime/components/DocumentBreadcrumb.vue +38 -0
- package/dist/runtime/components/DocumentBreadcrumb.vue.d.ts +13 -0
- package/dist/runtime/components/DocumentCard.d.vue.ts +30 -0
- package/dist/runtime/components/DocumentCard.vue +88 -0
- package/dist/runtime/components/DocumentCard.vue.d.ts +30 -0
- package/dist/runtime/components/DocumentSearchPalette.d.vue.ts +22 -0
- package/dist/runtime/components/DocumentSearchPalette.vue +99 -0
- package/dist/runtime/components/DocumentSearchPalette.vue.d.ts +22 -0
- package/dist/runtime/components/DocumentTree.d.vue.ts +32 -0
- package/dist/runtime/components/DocumentTree.vue +497 -0
- package/dist/runtime/components/DocumentTree.vue.d.ts +32 -0
- package/dist/runtime/components/Editor.d.vue.ts +11 -0
- package/dist/runtime/components/Editor.vue +328 -0
- package/dist/runtime/components/Editor.vue.d.ts +11 -0
- package/dist/runtime/components/ExportMenu.d.vue.ts +9 -0
- package/dist/runtime/components/ExportMenu.vue +55 -0
- package/dist/runtime/components/ExportMenu.vue.d.ts +9 -0
- package/dist/runtime/components/FileUploader.d.vue.ts +22 -0
- package/dist/runtime/components/FileUploader.vue +148 -0
- package/dist/runtime/components/FileUploader.vue.d.ts +22 -0
- package/dist/runtime/components/MemberManager.d.vue.ts +9 -0
- package/dist/runtime/components/MemberManager.vue +153 -0
- package/dist/runtime/components/MemberManager.vue.d.ts +9 -0
- package/dist/runtime/components/OfflineIndicator.d.vue.ts +9 -0
- package/dist/runtime/components/OfflineIndicator.vue +44 -0
- package/dist/runtime/components/OfflineIndicator.vue.d.ts +9 -0
- package/dist/runtime/components/PermissionGuard.d.vue.ts +25 -0
- package/dist/runtime/components/PermissionGuard.vue +16 -0
- package/dist/runtime/components/PermissionGuard.vue.d.ts +25 -0
- package/dist/runtime/components/RoleBadge.d.vue.ts +11 -0
- package/dist/runtime/components/RoleBadge.vue +30 -0
- package/dist/runtime/components/RoleBadge.vue.d.ts +11 -0
- package/dist/runtime/components/ShareDialog.d.vue.ts +15 -0
- package/dist/runtime/components/ShareDialog.vue +119 -0
- package/dist/runtime/components/ShareDialog.vue.d.ts +15 -0
- package/dist/runtime/components/SnapshotTimeline.d.vue.ts +15 -0
- package/dist/runtime/components/SnapshotTimeline.vue +118 -0
- package/dist/runtime/components/SnapshotTimeline.vue.d.ts +15 -0
- package/dist/runtime/components/SpaceSettings.d.vue.ts +7 -0
- package/dist/runtime/components/SpaceSettings.vue +105 -0
- package/dist/runtime/components/SpaceSettings.vue.d.ts +7 -0
- package/dist/runtime/components/SpaceSwitcher.d.vue.ts +18 -0
- package/dist/runtime/components/SpaceSwitcher.vue +104 -0
- package/dist/runtime/components/SpaceSwitcher.vue.d.ts +18 -0
- package/dist/runtime/components/TrashBin.d.vue.ts +7 -0
- package/dist/runtime/components/TrashBin.vue +159 -0
- package/dist/runtime/components/TrashBin.vue.d.ts +7 -0
- package/dist/runtime/components/UserMenu.d.vue.ts +13 -0
- package/dist/runtime/components/UserMenu.vue +50 -0
- package/dist/runtime/components/UserMenu.vue.d.ts +13 -0
- package/dist/runtime/components/UserPresence.d.vue.ts +13 -0
- package/dist/runtime/components/UserPresence.vue +34 -0
- package/dist/runtime/components/UserPresence.vue.d.ts +13 -0
- package/dist/runtime/components/editor/CollaborationUsers.d.vue.ts +7 -0
- package/dist/runtime/components/editor/CollaborationUsers.vue +31 -0
- package/dist/runtime/components/editor/CollaborationUsers.vue.d.ts +7 -0
- package/dist/runtime/components/editor/CompletionExtension.d.ts +43 -0
- package/dist/runtime/components/editor/CompletionExtension.js +133 -0
- package/dist/runtime/components/editor/ImageUploadExtension.d.ts +10 -0
- package/dist/runtime/components/editor/ImageUploadExtension.js +31 -0
- package/dist/runtime/components/editor/ImageUploadNode.d.vue.ts +4 -0
- package/dist/runtime/components/editor/ImageUploadNode.vue +59 -0
- package/dist/runtime/components/editor/ImageUploadNode.vue.d.ts +4 -0
- package/dist/runtime/components/editor/LinkPopover.d.vue.ts +8 -0
- package/dist/runtime/components/editor/LinkPopover.vue +131 -0
- package/dist/runtime/components/editor/LinkPopover.vue.d.ts +8 -0
- package/dist/runtime/components/widgets/ButtonWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/ButtonWidget.vue +32 -0
- package/dist/runtime/components/widgets/ButtonWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/CalendarWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/CalendarWidget.vue +36 -0
- package/dist/runtime/components/widgets/CalendarWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/CheckboxWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/CheckboxWidget.vue +32 -0
- package/dist/runtime/components/widgets/CheckboxWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/ColorPickerWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/ColorPickerWidget.vue +30 -0
- package/dist/runtime/components/widgets/ColorPickerWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/IconWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/IconWidget.vue +102 -0
- package/dist/runtime/components/widgets/IconWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/InputDateWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/InputDateWidget.vue +38 -0
- package/dist/runtime/components/widgets/InputDateWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/ScrollAreaWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/ScrollAreaWidget.vue +41 -0
- package/dist/runtime/components/widgets/ScrollAreaWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/SliderWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/SliderWidget.vue +42 -0
- package/dist/runtime/components/widgets/SliderWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/SwitchWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/SwitchWidget.vue +35 -0
- package/dist/runtime/components/widgets/SwitchWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/TabPanelWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/TabPanelWidget.vue +22 -0
- package/dist/runtime/components/widgets/TabPanelWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/TabsWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/TabsWidget.vue +109 -0
- package/dist/runtime/components/widgets/TabsWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/index.d.ts +13 -0
- package/dist/runtime/components/widgets/index.js +278 -0
- package/dist/runtime/composables/index.d.ts +14 -0
- package/dist/runtime/composables/index.js +13 -0
- package/dist/runtime/composables/useCollabStatus.d.ts +10 -0
- package/dist/runtime/composables/useCollabStatus.js +23 -0
- package/dist/runtime/composables/useDocumentPermissions.d.ts +11 -0
- package/dist/runtime/composables/useDocumentPermissions.js +44 -0
- package/dist/runtime/composables/useEditorCollaboration.d.ts +25 -0
- package/dist/runtime/composables/useEditorCollaboration.js +141 -0
- package/dist/runtime/composables/useEditorCompletion.d.ts +60 -0
- package/dist/runtime/composables/useEditorCompletion.js +42 -0
- package/dist/runtime/composables/useEditorDragHandle.d.ts +10 -0
- package/dist/runtime/composables/useEditorDragHandle.js +130 -0
- package/dist/runtime/composables/useEditorEmojis.d.ts +4 -0
- package/dist/runtime/composables/useEditorEmojis.js +9 -0
- package/dist/runtime/composables/useEditorMentions.d.ts +4 -0
- package/dist/runtime/composables/useEditorMentions.js +27 -0
- package/dist/runtime/composables/useEditorSuggestions.d.ts +149 -0
- package/dist/runtime/composables/useEditorSuggestions.js +114 -0
- package/dist/runtime/composables/useEditorToolbar.d.ts +12 -0
- package/dist/runtime/composables/useEditorToolbar.js +194 -0
- package/dist/runtime/composables/useLucideIcons.d.ts +4 -0
- package/dist/runtime/composables/useLucideIcons.js +16 -0
- package/dist/runtime/composables/useOnlineStatus.d.ts +6 -0
- package/dist/runtime/composables/useOnlineStatus.js +44 -0
- package/dist/runtime/composables/useSpaces.d.ts +36 -0
- package/dist/runtime/composables/useSpaces.js +29 -0
- package/dist/runtime/middleware/collab-auth.d.ts +2 -0
- package/dist/runtime/middleware/collab-auth.js +18 -0
- package/dist/runtime/plugin.d.ts +7 -0
- package/dist/runtime/plugin.js +39 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/types.d.mts +3 -0
- package/package.json +66 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { upperFirst } from "scule";
|
|
2
|
+
import { mapEditorItems } from "@nuxt/ui/utils/editor";
|
|
3
|
+
const CONVERTIBLE_TYPES = ["paragraph", "heading", "bulletList", "orderedList", "taskList", "blockquote", "codeBlock", "listItem", "taskItem"];
|
|
4
|
+
export function useEditorDragHandle(customHandlers) {
|
|
5
|
+
const selectedNode = ref();
|
|
6
|
+
const getTypeSpecificItems = (editor, nodeType) => {
|
|
7
|
+
const pos = selectedNode.value?.pos;
|
|
8
|
+
if (CONVERTIBLE_TYPES.includes(nodeType)) {
|
|
9
|
+
return [{
|
|
10
|
+
label: "Turn into",
|
|
11
|
+
icon: "i-lucide-repeat-2",
|
|
12
|
+
children: [
|
|
13
|
+
{ kind: "paragraph", label: "Paragraph", icon: "i-lucide-type" },
|
|
14
|
+
{ kind: "heading", level: 1, label: "Heading 1", icon: "i-lucide-heading-1" },
|
|
15
|
+
{ kind: "heading", level: 2, label: "Heading 2", icon: "i-lucide-heading-2" },
|
|
16
|
+
{ kind: "heading", level: 3, label: "Heading 3", icon: "i-lucide-heading-3" },
|
|
17
|
+
{ kind: "heading", level: 4, label: "Heading 4", icon: "i-lucide-heading-4" },
|
|
18
|
+
{ kind: "bulletList", label: "Bullet List", icon: "i-lucide-list" },
|
|
19
|
+
{ kind: "orderedList", label: "Ordered List", icon: "i-lucide-list-ordered" },
|
|
20
|
+
{ kind: "taskList", label: "Task List", icon: "i-lucide-list-check" },
|
|
21
|
+
{ kind: "blockquote", label: "Blockquote", icon: "i-lucide-text-quote" },
|
|
22
|
+
{ kind: "codeBlock", label: "Code Block", icon: "i-lucide-square-code" }
|
|
23
|
+
]
|
|
24
|
+
}, {
|
|
25
|
+
kind: "clearFormatting",
|
|
26
|
+
pos,
|
|
27
|
+
label: "Reset formatting",
|
|
28
|
+
icon: "i-lucide-rotate-ccw"
|
|
29
|
+
}];
|
|
30
|
+
}
|
|
31
|
+
if (nodeType === "image") {
|
|
32
|
+
const node = pos !== void 0 ? editor.state.doc.nodeAt(pos) : null;
|
|
33
|
+
return [{
|
|
34
|
+
label: "Download image",
|
|
35
|
+
icon: "i-lucide-download",
|
|
36
|
+
to: node?.attrs?.src,
|
|
37
|
+
download: true
|
|
38
|
+
}];
|
|
39
|
+
}
|
|
40
|
+
if (nodeType === "table") {
|
|
41
|
+
return [{
|
|
42
|
+
label: "Clear all contents",
|
|
43
|
+
icon: "i-lucide-square-x",
|
|
44
|
+
onSelect: () => {
|
|
45
|
+
if (pos === void 0) return;
|
|
46
|
+
const tableNode = editor.state.doc.nodeAt(pos);
|
|
47
|
+
if (!tableNode) return;
|
|
48
|
+
const cellRanges = [];
|
|
49
|
+
tableNode.descendants((node, nodePos) => {
|
|
50
|
+
if (node.type.name === "tableCell" || node.type.name === "tableHeader") {
|
|
51
|
+
const cellStart = pos + 1 + nodePos + 1;
|
|
52
|
+
const cellEnd = cellStart + node.content.size;
|
|
53
|
+
if (node.content.size > 0) {
|
|
54
|
+
cellRanges.push({ from: cellStart, to: cellEnd });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
});
|
|
59
|
+
const { tr } = editor.state;
|
|
60
|
+
cellRanges.reverse().forEach(({ from, to }) => {
|
|
61
|
+
tr.delete(from, to);
|
|
62
|
+
});
|
|
63
|
+
editor.view.dispatch(tr);
|
|
64
|
+
}
|
|
65
|
+
}];
|
|
66
|
+
}
|
|
67
|
+
return [];
|
|
68
|
+
};
|
|
69
|
+
const getItems = (editor) => {
|
|
70
|
+
if (!selectedNode.value?.node?.type) {
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
const nodeType = selectedNode.value.node.type;
|
|
74
|
+
const typeSpecificItems = getTypeSpecificItems(editor, nodeType);
|
|
75
|
+
return mapEditorItems(editor, [[
|
|
76
|
+
{
|
|
77
|
+
type: "label",
|
|
78
|
+
label: upperFirst(nodeType)
|
|
79
|
+
},
|
|
80
|
+
...typeSpecificItems
|
|
81
|
+
], [
|
|
82
|
+
{
|
|
83
|
+
kind: "duplicate",
|
|
84
|
+
pos: selectedNode.value?.pos,
|
|
85
|
+
label: "Duplicate",
|
|
86
|
+
icon: "i-lucide-copy"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
label: "Copy to clipboard",
|
|
90
|
+
icon: "i-lucide-clipboard",
|
|
91
|
+
onSelect: async () => {
|
|
92
|
+
if (!selectedNode.value) return;
|
|
93
|
+
const pos = selectedNode.value.pos;
|
|
94
|
+
const node = editor.state.doc.nodeAt(pos);
|
|
95
|
+
if (node) {
|
|
96
|
+
await navigator.clipboard.writeText(node.textContent);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
], [
|
|
101
|
+
{
|
|
102
|
+
kind: "moveUp",
|
|
103
|
+
pos: selectedNode.value?.pos,
|
|
104
|
+
label: "Move up",
|
|
105
|
+
icon: "i-lucide-arrow-up"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
kind: "moveDown",
|
|
109
|
+
pos: selectedNode.value?.pos,
|
|
110
|
+
label: "Move down",
|
|
111
|
+
icon: "i-lucide-arrow-down"
|
|
112
|
+
}
|
|
113
|
+
], [
|
|
114
|
+
{
|
|
115
|
+
kind: "delete",
|
|
116
|
+
pos: selectedNode.value?.pos,
|
|
117
|
+
label: "Delete",
|
|
118
|
+
icon: "i-lucide-trash"
|
|
119
|
+
}
|
|
120
|
+
]], customHandlers);
|
|
121
|
+
};
|
|
122
|
+
const onNodeChange = (event) => {
|
|
123
|
+
selectedNode.value = event;
|
|
124
|
+
};
|
|
125
|
+
return {
|
|
126
|
+
selectedNode,
|
|
127
|
+
getItems,
|
|
128
|
+
onNodeChange
|
|
129
|
+
};
|
|
130
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const FALLBACK_USERS = [{
|
|
2
|
+
label: "benjamincanac",
|
|
3
|
+
avatar: { src: "https://avatars.githubusercontent.com/u/739984?v=4" }
|
|
4
|
+
}, {
|
|
5
|
+
label: "atinux",
|
|
6
|
+
avatar: { src: "https://avatars.githubusercontent.com/u/904724?v=4" }
|
|
7
|
+
}, {
|
|
8
|
+
label: "HugoRCD",
|
|
9
|
+
avatar: { src: "https://avatars.githubusercontent.com/u/71938701?v=4" }
|
|
10
|
+
}];
|
|
11
|
+
export function useEditorMentions(collaborationUsers) {
|
|
12
|
+
const items = computed(() => {
|
|
13
|
+
if (!collaborationUsers?.value?.length) {
|
|
14
|
+
return FALLBACK_USERS;
|
|
15
|
+
}
|
|
16
|
+
return collaborationUsers.value.map((user) => ({
|
|
17
|
+
label: user.name,
|
|
18
|
+
avatar: {
|
|
19
|
+
alt: user.name,
|
|
20
|
+
style: { color: user.color }
|
|
21
|
+
}
|
|
22
|
+
}));
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
items
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import type { EditorCustomHandlers } from '@nuxt/ui';
|
|
2
|
+
export declare function useEditorSuggestions<T extends EditorCustomHandlers>(_customHandlers?: T): {
|
|
3
|
+
items: (({
|
|
4
|
+
type: "label";
|
|
5
|
+
label: string;
|
|
6
|
+
kind?: undefined;
|
|
7
|
+
icon?: undefined;
|
|
8
|
+
level?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
kind: "paragraph";
|
|
11
|
+
label: string;
|
|
12
|
+
icon: string;
|
|
13
|
+
type?: undefined;
|
|
14
|
+
level?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
kind: "heading";
|
|
17
|
+
level: 1;
|
|
18
|
+
label: string;
|
|
19
|
+
icon: string;
|
|
20
|
+
type?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "heading";
|
|
23
|
+
level: 2;
|
|
24
|
+
label: string;
|
|
25
|
+
icon: string;
|
|
26
|
+
type?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
kind: "heading";
|
|
29
|
+
level: 3;
|
|
30
|
+
label: string;
|
|
31
|
+
icon: string;
|
|
32
|
+
type?: undefined;
|
|
33
|
+
} | {
|
|
34
|
+
kind: "bulletList";
|
|
35
|
+
label: string;
|
|
36
|
+
icon: string;
|
|
37
|
+
type?: undefined;
|
|
38
|
+
level?: undefined;
|
|
39
|
+
} | {
|
|
40
|
+
kind: "orderedList";
|
|
41
|
+
label: string;
|
|
42
|
+
icon: string;
|
|
43
|
+
type?: undefined;
|
|
44
|
+
level?: undefined;
|
|
45
|
+
} | {
|
|
46
|
+
kind: "taskList";
|
|
47
|
+
label: string;
|
|
48
|
+
icon: string;
|
|
49
|
+
type?: undefined;
|
|
50
|
+
level?: undefined;
|
|
51
|
+
} | {
|
|
52
|
+
kind: "blockquote";
|
|
53
|
+
label: string;
|
|
54
|
+
icon: string;
|
|
55
|
+
type?: undefined;
|
|
56
|
+
level?: undefined;
|
|
57
|
+
} | {
|
|
58
|
+
kind: "codeBlock";
|
|
59
|
+
label: string;
|
|
60
|
+
icon: string;
|
|
61
|
+
type?: undefined;
|
|
62
|
+
level?: undefined;
|
|
63
|
+
})[] | ({
|
|
64
|
+
type: "label";
|
|
65
|
+
label: string;
|
|
66
|
+
kind?: undefined;
|
|
67
|
+
icon?: undefined;
|
|
68
|
+
} | {
|
|
69
|
+
kind: "mention";
|
|
70
|
+
label: string;
|
|
71
|
+
icon: string;
|
|
72
|
+
type?: undefined;
|
|
73
|
+
} | {
|
|
74
|
+
kind: "emoji";
|
|
75
|
+
label: string;
|
|
76
|
+
icon: string;
|
|
77
|
+
type?: undefined;
|
|
78
|
+
} | {
|
|
79
|
+
kind: "imageUpload";
|
|
80
|
+
label: string;
|
|
81
|
+
icon: string;
|
|
82
|
+
type?: undefined;
|
|
83
|
+
} | {
|
|
84
|
+
kind: "table";
|
|
85
|
+
label: string;
|
|
86
|
+
icon: string;
|
|
87
|
+
type?: undefined;
|
|
88
|
+
} | {
|
|
89
|
+
kind: "horizontalRule";
|
|
90
|
+
label: string;
|
|
91
|
+
icon: string;
|
|
92
|
+
type?: undefined;
|
|
93
|
+
})[] | ({
|
|
94
|
+
type: "label";
|
|
95
|
+
label: string;
|
|
96
|
+
kind?: undefined;
|
|
97
|
+
icon?: undefined;
|
|
98
|
+
} | {
|
|
99
|
+
kind: "switchWidget";
|
|
100
|
+
label: string;
|
|
101
|
+
icon: string;
|
|
102
|
+
type?: undefined;
|
|
103
|
+
} | {
|
|
104
|
+
kind: "checkboxWidget";
|
|
105
|
+
label: string;
|
|
106
|
+
icon: string;
|
|
107
|
+
type?: undefined;
|
|
108
|
+
} | {
|
|
109
|
+
kind: "buttonWidget";
|
|
110
|
+
label: string;
|
|
111
|
+
icon: string;
|
|
112
|
+
type?: undefined;
|
|
113
|
+
} | {
|
|
114
|
+
kind: "sliderWidget";
|
|
115
|
+
label: string;
|
|
116
|
+
icon: string;
|
|
117
|
+
type?: undefined;
|
|
118
|
+
} | {
|
|
119
|
+
kind: "colorPickerWidget";
|
|
120
|
+
label: string;
|
|
121
|
+
icon: string;
|
|
122
|
+
type?: undefined;
|
|
123
|
+
} | {
|
|
124
|
+
kind: "calendarWidget";
|
|
125
|
+
label: string;
|
|
126
|
+
icon: string;
|
|
127
|
+
type?: undefined;
|
|
128
|
+
} | {
|
|
129
|
+
kind: "inputDateWidget";
|
|
130
|
+
label: string;
|
|
131
|
+
icon: string;
|
|
132
|
+
type?: undefined;
|
|
133
|
+
} | {
|
|
134
|
+
kind: "scrollAreaWidget";
|
|
135
|
+
label: string;
|
|
136
|
+
icon: string;
|
|
137
|
+
type?: undefined;
|
|
138
|
+
} | {
|
|
139
|
+
kind: "iconWidget";
|
|
140
|
+
label: string;
|
|
141
|
+
icon: string;
|
|
142
|
+
type?: undefined;
|
|
143
|
+
} | {
|
|
144
|
+
kind: "tabsWidget";
|
|
145
|
+
label: string;
|
|
146
|
+
icon: string;
|
|
147
|
+
type?: undefined;
|
|
148
|
+
})[])[];
|
|
149
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export function useEditorSuggestions(_customHandlers) {
|
|
2
|
+
const items = [[{
|
|
3
|
+
type: "label",
|
|
4
|
+
label: "Style"
|
|
5
|
+
}, {
|
|
6
|
+
kind: "paragraph",
|
|
7
|
+
label: "Paragraph",
|
|
8
|
+
icon: "i-lucide-type"
|
|
9
|
+
}, {
|
|
10
|
+
kind: "heading",
|
|
11
|
+
level: 1,
|
|
12
|
+
label: "Heading 1",
|
|
13
|
+
icon: "i-lucide-heading-1"
|
|
14
|
+
}, {
|
|
15
|
+
kind: "heading",
|
|
16
|
+
level: 2,
|
|
17
|
+
label: "Heading 2",
|
|
18
|
+
icon: "i-lucide-heading-2"
|
|
19
|
+
}, {
|
|
20
|
+
kind: "heading",
|
|
21
|
+
level: 3,
|
|
22
|
+
label: "Heading 3",
|
|
23
|
+
icon: "i-lucide-heading-3"
|
|
24
|
+
}, {
|
|
25
|
+
kind: "bulletList",
|
|
26
|
+
label: "Bullet List",
|
|
27
|
+
icon: "i-lucide-list"
|
|
28
|
+
}, {
|
|
29
|
+
kind: "orderedList",
|
|
30
|
+
label: "Numbered List",
|
|
31
|
+
icon: "i-lucide-list-ordered"
|
|
32
|
+
}, {
|
|
33
|
+
kind: "taskList",
|
|
34
|
+
label: "Task List",
|
|
35
|
+
icon: "i-lucide-list-check"
|
|
36
|
+
}, {
|
|
37
|
+
kind: "blockquote",
|
|
38
|
+
label: "Blockquote",
|
|
39
|
+
icon: "i-lucide-text-quote"
|
|
40
|
+
}, {
|
|
41
|
+
kind: "codeBlock",
|
|
42
|
+
label: "Code Block",
|
|
43
|
+
icon: "i-lucide-square-code"
|
|
44
|
+
}], [{
|
|
45
|
+
type: "label",
|
|
46
|
+
label: "Insert"
|
|
47
|
+
}, {
|
|
48
|
+
kind: "mention",
|
|
49
|
+
label: "Mention",
|
|
50
|
+
icon: "i-lucide-at-sign"
|
|
51
|
+
}, {
|
|
52
|
+
kind: "emoji",
|
|
53
|
+
label: "Emoji",
|
|
54
|
+
icon: "i-lucide-smile-plus"
|
|
55
|
+
}, {
|
|
56
|
+
kind: "imageUpload",
|
|
57
|
+
label: "Image",
|
|
58
|
+
icon: "i-lucide-image"
|
|
59
|
+
}, {
|
|
60
|
+
kind: "table",
|
|
61
|
+
label: "Table",
|
|
62
|
+
icon: "i-lucide-table"
|
|
63
|
+
}, {
|
|
64
|
+
kind: "horizontalRule",
|
|
65
|
+
label: "Horizontal Rule",
|
|
66
|
+
icon: "i-lucide-separator-horizontal"
|
|
67
|
+
}], [{
|
|
68
|
+
type: "label",
|
|
69
|
+
label: "Widgets"
|
|
70
|
+
}, {
|
|
71
|
+
kind: "switchWidget",
|
|
72
|
+
label: "Toggle Switch",
|
|
73
|
+
icon: "i-lucide-toggle-right"
|
|
74
|
+
}, {
|
|
75
|
+
kind: "checkboxWidget",
|
|
76
|
+
label: "Checkbox",
|
|
77
|
+
icon: "i-lucide-square-check"
|
|
78
|
+
}, {
|
|
79
|
+
kind: "buttonWidget",
|
|
80
|
+
label: "Button",
|
|
81
|
+
icon: "i-lucide-mouse-pointer-click"
|
|
82
|
+
}, {
|
|
83
|
+
kind: "sliderWidget",
|
|
84
|
+
label: "Slider",
|
|
85
|
+
icon: "i-lucide-sliders-horizontal"
|
|
86
|
+
}, {
|
|
87
|
+
kind: "colorPickerWidget",
|
|
88
|
+
label: "Color Picker",
|
|
89
|
+
icon: "i-lucide-palette"
|
|
90
|
+
}, {
|
|
91
|
+
kind: "calendarWidget",
|
|
92
|
+
label: "Calendar",
|
|
93
|
+
icon: "i-lucide-calendar"
|
|
94
|
+
}, {
|
|
95
|
+
kind: "inputDateWidget",
|
|
96
|
+
label: "Date Input",
|
|
97
|
+
icon: "i-lucide-calendar-days"
|
|
98
|
+
}, {
|
|
99
|
+
kind: "scrollAreaWidget",
|
|
100
|
+
label: "Scroll Area",
|
|
101
|
+
icon: "i-lucide-scroll"
|
|
102
|
+
}, {
|
|
103
|
+
kind: "iconWidget",
|
|
104
|
+
label: "Icon",
|
|
105
|
+
icon: "i-lucide-star"
|
|
106
|
+
}, {
|
|
107
|
+
kind: "tabsWidget",
|
|
108
|
+
label: "Tabs",
|
|
109
|
+
icon: "i-lucide-panel-top"
|
|
110
|
+
}]];
|
|
111
|
+
return {
|
|
112
|
+
items
|
|
113
|
+
};
|
|
114
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EditorToolbarItem, EditorCustomHandlers } from '@nuxt/ui';
|
|
2
|
+
import type { Editor } from '@tiptap/vue-3';
|
|
3
|
+
interface UseEditorToolbarOptions {
|
|
4
|
+
aiLoading?: Ref<boolean | undefined>;
|
|
5
|
+
}
|
|
6
|
+
export declare function useEditorToolbar<T extends EditorCustomHandlers>(_customHandlers?: T, options?: UseEditorToolbarOptions): {
|
|
7
|
+
toolbarItems: EditorToolbarItem<T>[][];
|
|
8
|
+
bubbleToolbarItems: any;
|
|
9
|
+
getImageToolbarItems: (editor: Editor) => EditorToolbarItem<T>[][];
|
|
10
|
+
getTableToolbarItems: (editor: Editor) => EditorToolbarItem<T>[][];
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
export function useEditorToolbar(_customHandlers, options = {}) {
|
|
2
|
+
const { aiLoading } = options;
|
|
3
|
+
const toolbarItems = [[{
|
|
4
|
+
kind: "undo",
|
|
5
|
+
icon: "i-lucide-undo",
|
|
6
|
+
tooltip: { text: "Undo" }
|
|
7
|
+
}, {
|
|
8
|
+
kind: "redo",
|
|
9
|
+
icon: "i-lucide-redo",
|
|
10
|
+
tooltip: { text: "Redo" }
|
|
11
|
+
}], [{
|
|
12
|
+
kind: "imageUpload",
|
|
13
|
+
label: "Add",
|
|
14
|
+
icon: "i-lucide-image",
|
|
15
|
+
tooltip: { text: "Add image" }
|
|
16
|
+
}]];
|
|
17
|
+
const bubbleToolbarItems = computed(() => [[{
|
|
18
|
+
label: "Turn into",
|
|
19
|
+
trailingIcon: "i-lucide-chevron-down",
|
|
20
|
+
activeColor: "neutral",
|
|
21
|
+
activeVariant: "ghost",
|
|
22
|
+
tooltip: { text: "Turn into" },
|
|
23
|
+
content: {
|
|
24
|
+
align: "start"
|
|
25
|
+
},
|
|
26
|
+
ui: {
|
|
27
|
+
label: "text-xs"
|
|
28
|
+
},
|
|
29
|
+
items: [{
|
|
30
|
+
type: "label",
|
|
31
|
+
label: "Turn into"
|
|
32
|
+
}, {
|
|
33
|
+
kind: "paragraph",
|
|
34
|
+
label: "Paragraph",
|
|
35
|
+
icon: "i-lucide-type"
|
|
36
|
+
}, {
|
|
37
|
+
kind: "heading",
|
|
38
|
+
level: 1,
|
|
39
|
+
label: "Heading 1",
|
|
40
|
+
icon: "i-lucide-heading-1"
|
|
41
|
+
}, {
|
|
42
|
+
kind: "heading",
|
|
43
|
+
level: 2,
|
|
44
|
+
label: "Heading 2",
|
|
45
|
+
icon: "i-lucide-heading-2"
|
|
46
|
+
}, {
|
|
47
|
+
kind: "heading",
|
|
48
|
+
level: 3,
|
|
49
|
+
label: "Heading 3",
|
|
50
|
+
icon: "i-lucide-heading-3"
|
|
51
|
+
}, {
|
|
52
|
+
kind: "heading",
|
|
53
|
+
level: 4,
|
|
54
|
+
label: "Heading 4",
|
|
55
|
+
icon: "i-lucide-heading-4"
|
|
56
|
+
}, {
|
|
57
|
+
kind: "bulletList",
|
|
58
|
+
label: "Bullet List",
|
|
59
|
+
icon: "i-lucide-list"
|
|
60
|
+
}, {
|
|
61
|
+
kind: "orderedList",
|
|
62
|
+
label: "Ordered List",
|
|
63
|
+
icon: "i-lucide-list-ordered"
|
|
64
|
+
}, {
|
|
65
|
+
kind: "taskList",
|
|
66
|
+
label: "Task List",
|
|
67
|
+
icon: "i-lucide-list-check"
|
|
68
|
+
}, {
|
|
69
|
+
kind: "blockquote",
|
|
70
|
+
label: "Blockquote",
|
|
71
|
+
icon: "i-lucide-text-quote"
|
|
72
|
+
}, {
|
|
73
|
+
kind: "codeBlock",
|
|
74
|
+
label: "Code Block",
|
|
75
|
+
icon: "i-lucide-square-code"
|
|
76
|
+
}]
|
|
77
|
+
}], [{
|
|
78
|
+
kind: "mark",
|
|
79
|
+
mark: "bold",
|
|
80
|
+
icon: "i-lucide-bold",
|
|
81
|
+
tooltip: { text: "Bold" }
|
|
82
|
+
}, {
|
|
83
|
+
kind: "mark",
|
|
84
|
+
mark: "italic",
|
|
85
|
+
icon: "i-lucide-italic",
|
|
86
|
+
tooltip: { text: "Italic" }
|
|
87
|
+
}, {
|
|
88
|
+
kind: "mark",
|
|
89
|
+
mark: "underline",
|
|
90
|
+
icon: "i-lucide-underline",
|
|
91
|
+
tooltip: { text: "Underline" }
|
|
92
|
+
}, {
|
|
93
|
+
kind: "mark",
|
|
94
|
+
mark: "strike",
|
|
95
|
+
icon: "i-lucide-strikethrough",
|
|
96
|
+
tooltip: { text: "Strikethrough" }
|
|
97
|
+
}, {
|
|
98
|
+
kind: "mark",
|
|
99
|
+
mark: "code",
|
|
100
|
+
icon: "i-lucide-code",
|
|
101
|
+
tooltip: { text: "Code" }
|
|
102
|
+
}], [{
|
|
103
|
+
slot: "link",
|
|
104
|
+
icon: "i-lucide-link"
|
|
105
|
+
}, {
|
|
106
|
+
kind: "imageUpload",
|
|
107
|
+
icon: "i-lucide-image",
|
|
108
|
+
tooltip: { text: "Image" }
|
|
109
|
+
}]]);
|
|
110
|
+
const getImageToolbarItems = (editor) => {
|
|
111
|
+
const node = editor.state.doc.nodeAt(editor.state.selection.from);
|
|
112
|
+
return [[{
|
|
113
|
+
icon: "i-lucide-download",
|
|
114
|
+
to: node?.attrs?.src,
|
|
115
|
+
download: true,
|
|
116
|
+
tooltip: { text: "Download" }
|
|
117
|
+
}, {
|
|
118
|
+
icon: "i-lucide-refresh-cw",
|
|
119
|
+
tooltip: { text: "Replace" },
|
|
120
|
+
onClick: () => {
|
|
121
|
+
const { state } = editor;
|
|
122
|
+
const { selection } = state;
|
|
123
|
+
const pos = selection.from;
|
|
124
|
+
const node2 = state.doc.nodeAt(pos);
|
|
125
|
+
if (node2 && node2.type.name === "image") {
|
|
126
|
+
editor.chain().focus().deleteRange({ from: pos, to: pos + node2.nodeSize }).insertContentAt(pos, { type: "imageUpload" }).run();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}], [{
|
|
130
|
+
icon: "i-lucide-trash",
|
|
131
|
+
tooltip: { text: "Delete" },
|
|
132
|
+
onClick: () => {
|
|
133
|
+
const { state } = editor;
|
|
134
|
+
const { selection } = state;
|
|
135
|
+
const pos = selection.from;
|
|
136
|
+
const node2 = state.doc.nodeAt(pos);
|
|
137
|
+
if (node2 && node2.type.name === "image") {
|
|
138
|
+
editor.chain().focus().deleteRange({ from: pos, to: pos + node2.nodeSize }).run();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}]];
|
|
142
|
+
};
|
|
143
|
+
const getTableToolbarItems = (editor) => {
|
|
144
|
+
return [[{
|
|
145
|
+
icon: "i-lucide-between-vertical-start",
|
|
146
|
+
tooltip: { text: "Add row above" },
|
|
147
|
+
onClick: () => {
|
|
148
|
+
editor.chain().focus().addRowBefore().run();
|
|
149
|
+
}
|
|
150
|
+
}, {
|
|
151
|
+
icon: "i-lucide-between-vertical-end",
|
|
152
|
+
tooltip: { text: "Add row below" },
|
|
153
|
+
onClick: () => {
|
|
154
|
+
editor.chain().focus().addRowAfter().run();
|
|
155
|
+
}
|
|
156
|
+
}, {
|
|
157
|
+
icon: "i-lucide-between-horizontal-start",
|
|
158
|
+
tooltip: { text: "Add column before" },
|
|
159
|
+
onClick: () => {
|
|
160
|
+
editor.chain().focus().addColumnBefore().run();
|
|
161
|
+
}
|
|
162
|
+
}, {
|
|
163
|
+
icon: "i-lucide-between-horizontal-end",
|
|
164
|
+
tooltip: { text: "Add column after" },
|
|
165
|
+
onClick: () => {
|
|
166
|
+
editor.chain().focus().addColumnAfter().run();
|
|
167
|
+
}
|
|
168
|
+
}], [{
|
|
169
|
+
icon: "i-lucide-rows-3",
|
|
170
|
+
tooltip: { text: "Delete row" },
|
|
171
|
+
onClick: () => {
|
|
172
|
+
editor.chain().focus().deleteRow().run();
|
|
173
|
+
}
|
|
174
|
+
}, {
|
|
175
|
+
icon: "i-lucide-columns-3",
|
|
176
|
+
tooltip: { text: "Delete column" },
|
|
177
|
+
onClick: () => {
|
|
178
|
+
editor.chain().focus().deleteColumn().run();
|
|
179
|
+
}
|
|
180
|
+
}], [{
|
|
181
|
+
icon: "i-lucide-trash",
|
|
182
|
+
tooltip: { text: "Delete table" },
|
|
183
|
+
onClick: () => {
|
|
184
|
+
editor.chain().focus().deleteTable().run();
|
|
185
|
+
}
|
|
186
|
+
}]];
|
|
187
|
+
};
|
|
188
|
+
return {
|
|
189
|
+
toolbarItems,
|
|
190
|
+
bubbleToolbarItems,
|
|
191
|
+
getImageToolbarItems,
|
|
192
|
+
getTableToolbarItems
|
|
193
|
+
};
|
|
194
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as lucideIcons from "lucide-vue-next";
|
|
2
|
+
function toKebab(str) {
|
|
3
|
+
return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").toLowerCase();
|
|
4
|
+
}
|
|
5
|
+
const allIcons = Object.keys(lucideIcons).filter((key) => /^[A-Z]/.test(key) && !key.endsWith("Icon") && key !== "default").map((key) => `i-lucide-${toKebab(key)}`).sort();
|
|
6
|
+
export function useLucideIcons() {
|
|
7
|
+
function search(query, limit = 60) {
|
|
8
|
+
if (!query) return allIcons.slice(0, limit);
|
|
9
|
+
const q = query.toLowerCase().replace(/\s+/g, "-");
|
|
10
|
+
return allIcons.filter((name) => name.includes(q)).slice(0, limit);
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
icons: allIcons,
|
|
14
|
+
search
|
|
15
|
+
};
|
|
16
|
+
}
|