@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,133 @@
|
|
|
1
|
+
import { Extension } from "@tiptap/core";
|
|
2
|
+
import { Decoration, DecorationSet } from "@tiptap/pm/view";
|
|
3
|
+
import { Plugin, PluginKey } from "@tiptap/pm/state";
|
|
4
|
+
import { useDebounceFn } from "@vueuse/core";
|
|
5
|
+
export const completionPluginKey = new PluginKey("completion");
|
|
6
|
+
export const Completion = Extension.create({
|
|
7
|
+
name: "completion",
|
|
8
|
+
addOptions() {
|
|
9
|
+
return {
|
|
10
|
+
autoTrigger: false,
|
|
11
|
+
debounce: 250,
|
|
12
|
+
triggerCharacters: ["/", ":", "@"],
|
|
13
|
+
onTrigger: void 0,
|
|
14
|
+
onAccept: void 0,
|
|
15
|
+
onDismiss: void 0
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
addStorage() {
|
|
19
|
+
return {
|
|
20
|
+
suggestion: "",
|
|
21
|
+
position: void 0,
|
|
22
|
+
visible: false,
|
|
23
|
+
debouncedTrigger: null,
|
|
24
|
+
setSuggestion(text) {
|
|
25
|
+
this.suggestion = text;
|
|
26
|
+
},
|
|
27
|
+
clearSuggestion() {
|
|
28
|
+
this.suggestion = "";
|
|
29
|
+
this.position = void 0;
|
|
30
|
+
this.visible = false;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
addProseMirrorPlugins() {
|
|
35
|
+
const storage = this.storage;
|
|
36
|
+
return [
|
|
37
|
+
new Plugin({
|
|
38
|
+
key: completionPluginKey,
|
|
39
|
+
props: {
|
|
40
|
+
decorations(state) {
|
|
41
|
+
if (!storage.visible || !storage.suggestion || storage.position === void 0) {
|
|
42
|
+
return DecorationSet.empty;
|
|
43
|
+
}
|
|
44
|
+
const widget = Decoration.widget(storage.position, () => {
|
|
45
|
+
const span = document.createElement("span");
|
|
46
|
+
span.className = "completion-suggestion";
|
|
47
|
+
span.textContent = storage.suggestion;
|
|
48
|
+
span.style.cssText = "color: var(--ui-text-muted); opacity: 0.6; pointer-events: none;";
|
|
49
|
+
return span;
|
|
50
|
+
}, { side: 1 });
|
|
51
|
+
return DecorationSet.create(state.doc, [widget]);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
];
|
|
56
|
+
},
|
|
57
|
+
addKeyboardShortcuts() {
|
|
58
|
+
return {
|
|
59
|
+
"Mod-j": ({ editor }) => {
|
|
60
|
+
if (this.storage.visible) {
|
|
61
|
+
this.storage.clearSuggestion();
|
|
62
|
+
this.options.onDismiss?.();
|
|
63
|
+
}
|
|
64
|
+
this.storage.debouncedTrigger?.(editor);
|
|
65
|
+
return true;
|
|
66
|
+
},
|
|
67
|
+
"Tab": ({ editor }) => {
|
|
68
|
+
if (!this.storage.visible || !this.storage.suggestion || this.storage.position === void 0) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
const suggestion = this.storage.suggestion;
|
|
72
|
+
const position = this.storage.position;
|
|
73
|
+
this.storage.clearSuggestion();
|
|
74
|
+
editor.view.dispatch(editor.state.tr.setMeta("completionUpdate", true));
|
|
75
|
+
editor.chain().focus().insertContentAt(position, suggestion).run();
|
|
76
|
+
this.options.onAccept?.();
|
|
77
|
+
return true;
|
|
78
|
+
},
|
|
79
|
+
"Escape": ({ editor }) => {
|
|
80
|
+
if (this.storage.visible) {
|
|
81
|
+
this.storage.clearSuggestion();
|
|
82
|
+
editor.view.dispatch(editor.state.tr.setMeta("completionUpdate", true));
|
|
83
|
+
this.options.onDismiss?.();
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
onUpdate({ editor }) {
|
|
91
|
+
if (this.storage.visible) {
|
|
92
|
+
this.storage.clearSuggestion();
|
|
93
|
+
editor.view.dispatch(editor.state.tr.setMeta("completionUpdate", true));
|
|
94
|
+
this.options.onDismiss?.();
|
|
95
|
+
}
|
|
96
|
+
if (this.options.autoTrigger) {
|
|
97
|
+
this.storage.debouncedTrigger?.(editor);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
onSelectionUpdate({ editor }) {
|
|
101
|
+
if (this.storage.visible) {
|
|
102
|
+
this.storage.clearSuggestion();
|
|
103
|
+
editor.view.dispatch(editor.state.tr.setMeta("completionUpdate", true));
|
|
104
|
+
this.options.onDismiss?.();
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
onCreate() {
|
|
108
|
+
const storage = this.storage;
|
|
109
|
+
const options = this.options;
|
|
110
|
+
this.storage.debouncedTrigger = useDebounceFn((editor) => {
|
|
111
|
+
if (!options.onTrigger) return;
|
|
112
|
+
const { state } = editor;
|
|
113
|
+
const { selection } = state;
|
|
114
|
+
const { $from } = selection;
|
|
115
|
+
const isAtEndOfBlock = $from.parentOffset === $from.parent.content.size;
|
|
116
|
+
const hasContent = $from.parent.textContent.trim().length > 0;
|
|
117
|
+
const textContent = $from.parent.textContent;
|
|
118
|
+
const endsWithPunctuation = /[.!?]\s*$/.test(textContent);
|
|
119
|
+
const triggerChars = options.triggerCharacters || [];
|
|
120
|
+
const endsWithTrigger = triggerChars.some((char) => textContent.endsWith(char));
|
|
121
|
+
if (!isAtEndOfBlock || !hasContent || endsWithPunctuation || endsWithTrigger) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
storage.position = selection.from;
|
|
125
|
+
storage.visible = true;
|
|
126
|
+
options.onTrigger(editor);
|
|
127
|
+
}, options.debounce || 250);
|
|
128
|
+
},
|
|
129
|
+
onDestroy() {
|
|
130
|
+
this.storage.debouncedTrigger = null;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
export default Completion;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Node, mergeAttributes } from "@tiptap/core";
|
|
2
|
+
import { VueNodeViewRenderer } from "@tiptap/vue-3";
|
|
3
|
+
import ImageUploadNodeComponent from "./ImageUploadNode.vue";
|
|
4
|
+
export const ImageUpload = Node.create({
|
|
5
|
+
name: "imageUpload",
|
|
6
|
+
group: "block",
|
|
7
|
+
atom: true,
|
|
8
|
+
draggable: true,
|
|
9
|
+
addAttributes() {
|
|
10
|
+
return {};
|
|
11
|
+
},
|
|
12
|
+
parseHTML() {
|
|
13
|
+
return [{
|
|
14
|
+
tag: 'div[data-type="image-upload"]'
|
|
15
|
+
}];
|
|
16
|
+
},
|
|
17
|
+
renderHTML({ HTMLAttributes }) {
|
|
18
|
+
return ["div", mergeAttributes(HTMLAttributes, { "data-type": "image-upload" })];
|
|
19
|
+
},
|
|
20
|
+
addNodeView() {
|
|
21
|
+
return VueNodeViewRenderer(ImageUploadNodeComponent);
|
|
22
|
+
},
|
|
23
|
+
addCommands() {
|
|
24
|
+
return {
|
|
25
|
+
insertImageUpload: () => ({ commands }) => {
|
|
26
|
+
return commands.insertContent({ type: this.name });
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
export default ImageUpload;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeViewProps } from '@tiptap/vue-3';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<NodeViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NodeViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { NodeViewWrapper } from "@tiptap/vue-3";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
decorations: { type: Array, required: true },
|
|
5
|
+
selected: { type: Boolean, required: true },
|
|
6
|
+
updateAttributes: { type: Function, required: true },
|
|
7
|
+
deleteNode: { type: Function, required: true },
|
|
8
|
+
node: { type: null, required: true },
|
|
9
|
+
view: { type: null, required: true },
|
|
10
|
+
getPos: { type: null, required: true },
|
|
11
|
+
innerDecorations: { type: null, required: true },
|
|
12
|
+
editor: { type: Object, required: true },
|
|
13
|
+
extension: { type: Object, required: true },
|
|
14
|
+
HTMLAttributes: { type: Object, required: true }
|
|
15
|
+
});
|
|
16
|
+
const file = ref(null);
|
|
17
|
+
const loading = ref(false);
|
|
18
|
+
watch(file, async (newFile) => {
|
|
19
|
+
if (!newFile) return;
|
|
20
|
+
loading.value = true;
|
|
21
|
+
const reader = new FileReader();
|
|
22
|
+
reader.onload = async (e) => {
|
|
23
|
+
const dataUrl = e.target?.result;
|
|
24
|
+
if (!dataUrl) {
|
|
25
|
+
loading.value = false;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const pos = props.getPos();
|
|
29
|
+
if (typeof pos !== "number") {
|
|
30
|
+
loading.value = false;
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
props.editor.chain().focus().deleteRange({ from: pos, to: pos + 1 }).setImage({ src: dataUrl }).run();
|
|
34
|
+
loading.value = false;
|
|
35
|
+
};
|
|
36
|
+
reader.readAsDataURL(newFile);
|
|
37
|
+
});
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<NodeViewWrapper>
|
|
42
|
+
<UFileUpload
|
|
43
|
+
v-model="file"
|
|
44
|
+
accept="image/*"
|
|
45
|
+
label="Upload an image"
|
|
46
|
+
description="SVG, PNG, JPG or GIF (max. 2MB)"
|
|
47
|
+
:preview="false"
|
|
48
|
+
class="min-h-48"
|
|
49
|
+
>
|
|
50
|
+
<template #leading>
|
|
51
|
+
<UAvatar
|
|
52
|
+
:icon="loading ? 'i-lucide-loader-circle' : 'i-lucide-image'"
|
|
53
|
+
size="xl"
|
|
54
|
+
:ui="{ icon: [loading && 'animate-spin'] }"
|
|
55
|
+
/>
|
|
56
|
+
</template>
|
|
57
|
+
</UFileUpload>
|
|
58
|
+
</NodeViewWrapper>
|
|
59
|
+
</template>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeViewProps } from '@tiptap/vue-3';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<NodeViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NodeViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/vue-3';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
editor: Editor;
|
|
4
|
+
autoOpen?: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const props = defineProps({
|
|
3
|
+
editor: { type: Object, required: true },
|
|
4
|
+
autoOpen: { type: Boolean, required: false }
|
|
5
|
+
});
|
|
6
|
+
const open = ref(false);
|
|
7
|
+
const url = ref("");
|
|
8
|
+
const active = computed(() => props.editor.isActive("link"));
|
|
9
|
+
const disabled = computed(() => {
|
|
10
|
+
if (!props.editor.isEditable) return true;
|
|
11
|
+
const { selection } = props.editor.state;
|
|
12
|
+
return selection.empty && !props.editor.isActive("link");
|
|
13
|
+
});
|
|
14
|
+
watch(() => props.editor, (editor, _, onCleanup) => {
|
|
15
|
+
if (!editor) return;
|
|
16
|
+
const updateUrl = () => {
|
|
17
|
+
const { href } = editor.getAttributes("link");
|
|
18
|
+
url.value = href || "";
|
|
19
|
+
};
|
|
20
|
+
updateUrl();
|
|
21
|
+
editor.on("selectionUpdate", updateUrl);
|
|
22
|
+
onCleanup(() => {
|
|
23
|
+
editor.off("selectionUpdate", updateUrl);
|
|
24
|
+
});
|
|
25
|
+
}, { immediate: true });
|
|
26
|
+
watch(active, (isActive) => {
|
|
27
|
+
if (isActive && props.autoOpen) {
|
|
28
|
+
open.value = true;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
function setLink() {
|
|
32
|
+
if (!url.value) return;
|
|
33
|
+
const { selection } = props.editor.state;
|
|
34
|
+
const isEmpty = selection.empty;
|
|
35
|
+
const hasCode = props.editor.isActive("code");
|
|
36
|
+
let chain = props.editor.chain().focus();
|
|
37
|
+
if (hasCode && !isEmpty) {
|
|
38
|
+
chain = chain.extendMarkRange("code").setLink({ href: url.value });
|
|
39
|
+
} else {
|
|
40
|
+
chain = chain.extendMarkRange("link").setLink({ href: url.value });
|
|
41
|
+
if (isEmpty) {
|
|
42
|
+
chain = chain.insertContent({ type: "text", text: url.value });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
chain.run();
|
|
46
|
+
open.value = false;
|
|
47
|
+
}
|
|
48
|
+
function removeLink() {
|
|
49
|
+
props.editor.chain().focus().extendMarkRange("link").unsetLink().setMeta("preventAutolink", true).run();
|
|
50
|
+
url.value = "";
|
|
51
|
+
open.value = false;
|
|
52
|
+
}
|
|
53
|
+
function openLink() {
|
|
54
|
+
if (!url.value) return;
|
|
55
|
+
window.open(url.value, "_blank", "noopener,noreferrer");
|
|
56
|
+
}
|
|
57
|
+
function handleKeyDown(event) {
|
|
58
|
+
if (event.key === "Enter") {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
setLink();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<template>
|
|
66
|
+
<UPopover
|
|
67
|
+
v-model:open="open"
|
|
68
|
+
:ui="{ content: 'p-0.5' }"
|
|
69
|
+
>
|
|
70
|
+
<UTooltip text="Link">
|
|
71
|
+
<UButton
|
|
72
|
+
icon="i-lucide-link"
|
|
73
|
+
color="neutral"
|
|
74
|
+
active-color="primary"
|
|
75
|
+
variant="ghost"
|
|
76
|
+
active-variant="soft"
|
|
77
|
+
size="sm"
|
|
78
|
+
:active="active"
|
|
79
|
+
:disabled="disabled"
|
|
80
|
+
/>
|
|
81
|
+
</UTooltip>
|
|
82
|
+
|
|
83
|
+
<template #content>
|
|
84
|
+
<UInput
|
|
85
|
+
v-model="url"
|
|
86
|
+
autofocus
|
|
87
|
+
name="url"
|
|
88
|
+
type="url"
|
|
89
|
+
variant="none"
|
|
90
|
+
placeholder="Paste a link..."
|
|
91
|
+
@keydown="handleKeyDown"
|
|
92
|
+
>
|
|
93
|
+
<div class="flex items-center mr-0.5">
|
|
94
|
+
<UButton
|
|
95
|
+
icon="i-lucide-corner-down-left"
|
|
96
|
+
variant="ghost"
|
|
97
|
+
size="sm"
|
|
98
|
+
:disabled="!url && !active"
|
|
99
|
+
title="Apply link"
|
|
100
|
+
@click="setLink"
|
|
101
|
+
/>
|
|
102
|
+
|
|
103
|
+
<USeparator
|
|
104
|
+
orientation="vertical"
|
|
105
|
+
class="h-6 mx-1"
|
|
106
|
+
/>
|
|
107
|
+
|
|
108
|
+
<UButton
|
|
109
|
+
icon="i-lucide-external-link"
|
|
110
|
+
color="neutral"
|
|
111
|
+
variant="ghost"
|
|
112
|
+
size="sm"
|
|
113
|
+
:disabled="!url && !active"
|
|
114
|
+
title="Open in new window"
|
|
115
|
+
@click="openLink"
|
|
116
|
+
/>
|
|
117
|
+
|
|
118
|
+
<UButton
|
|
119
|
+
icon="i-lucide-trash"
|
|
120
|
+
color="neutral"
|
|
121
|
+
variant="ghost"
|
|
122
|
+
size="sm"
|
|
123
|
+
:disabled="!url && !active"
|
|
124
|
+
title="Remove link"
|
|
125
|
+
@click="removeLink"
|
|
126
|
+
/>
|
|
127
|
+
</div>
|
|
128
|
+
</UInput>
|
|
129
|
+
</template>
|
|
130
|
+
</UPopover>
|
|
131
|
+
</template>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/vue-3';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
editor: Editor;
|
|
4
|
+
autoOpen?: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeViewProps } from '@tiptap/vue-3';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<NodeViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NodeViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { NodeViewWrapper } from "@tiptap/vue-3";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
decorations: { type: Array, required: true },
|
|
5
|
+
selected: { type: Boolean, required: true },
|
|
6
|
+
updateAttributes: { type: Function, required: true },
|
|
7
|
+
deleteNode: { type: Function, required: true },
|
|
8
|
+
node: { type: null, required: true },
|
|
9
|
+
view: { type: null, required: true },
|
|
10
|
+
getPos: { type: null, required: true },
|
|
11
|
+
innerDecorations: { type: null, required: true },
|
|
12
|
+
editor: { type: Object, required: true },
|
|
13
|
+
extension: { type: Object, required: true },
|
|
14
|
+
HTMLAttributes: { type: Object, required: true }
|
|
15
|
+
});
|
|
16
|
+
const label = computed(() => props.node.attrs.label || "Button");
|
|
17
|
+
const variant = computed(() => props.node.attrs.variant || "solid");
|
|
18
|
+
const color = computed(() => props.node.attrs.color || "primary");
|
|
19
|
+
const icon = computed(() => props.node.attrs.icon || void 0);
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<NodeViewWrapper as="span" class="inline-flex align-middle mx-0.5">
|
|
24
|
+
<UButton
|
|
25
|
+
:label="label"
|
|
26
|
+
:variant="variant"
|
|
27
|
+
:color="color"
|
|
28
|
+
:icon="icon"
|
|
29
|
+
size="xs"
|
|
30
|
+
/>
|
|
31
|
+
</NodeViewWrapper>
|
|
32
|
+
</template>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeViewProps } from '@tiptap/vue-3';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<NodeViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NodeViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeViewProps } from '@tiptap/vue-3';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<NodeViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NodeViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { NodeViewWrapper } from "@tiptap/vue-3";
|
|
3
|
+
import { CalendarDate } from "@internationalized/date";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
decorations: { type: Array, required: true },
|
|
6
|
+
selected: { type: Boolean, required: true },
|
|
7
|
+
updateAttributes: { type: Function, required: true },
|
|
8
|
+
deleteNode: { type: Function, required: true },
|
|
9
|
+
node: { type: null, required: true },
|
|
10
|
+
view: { type: null, required: true },
|
|
11
|
+
getPos: { type: null, required: true },
|
|
12
|
+
innerDecorations: { type: null, required: true },
|
|
13
|
+
editor: { type: Object, required: true },
|
|
14
|
+
extension: { type: Object, required: true },
|
|
15
|
+
HTMLAttributes: { type: Object, required: true }
|
|
16
|
+
});
|
|
17
|
+
const value = computed({
|
|
18
|
+
get: () => {
|
|
19
|
+
const raw = props.node.attrs.date;
|
|
20
|
+
if (!raw) return void 0;
|
|
21
|
+
const [y, m, d] = raw.split("-").map(Number);
|
|
22
|
+
return new CalendarDate(y, m, d);
|
|
23
|
+
},
|
|
24
|
+
set: (val) => {
|
|
25
|
+
props.updateAttributes({
|
|
26
|
+
date: val ? `${val.year}-${String(val.month).padStart(2, "0")}-${String(val.day).padStart(2, "0")}` : null
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<NodeViewWrapper class="my-2 flex" data-drag-handle>
|
|
34
|
+
<UCalendar v-model="value" />
|
|
35
|
+
</NodeViewWrapper>
|
|
36
|
+
</template>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeViewProps } from '@tiptap/vue-3';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<NodeViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NodeViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeViewProps } from '@tiptap/vue-3';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<NodeViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NodeViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { NodeViewWrapper } from "@tiptap/vue-3";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
decorations: { type: Array, required: true },
|
|
5
|
+
selected: { type: Boolean, required: true },
|
|
6
|
+
updateAttributes: { type: Function, required: true },
|
|
7
|
+
deleteNode: { type: Function, required: true },
|
|
8
|
+
node: { type: null, required: true },
|
|
9
|
+
view: { type: null, required: true },
|
|
10
|
+
getPos: { type: null, required: true },
|
|
11
|
+
innerDecorations: { type: null, required: true },
|
|
12
|
+
editor: { type: Object, required: true },
|
|
13
|
+
extension: { type: Object, required: true },
|
|
14
|
+
HTMLAttributes: { type: Object, required: true }
|
|
15
|
+
});
|
|
16
|
+
const checked = computed({
|
|
17
|
+
get: () => props.node.attrs.checked,
|
|
18
|
+
set: (value) => {
|
|
19
|
+
props.updateAttributes({ checked: value });
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const label = computed(() => props.node.attrs.label || "");
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<NodeViewWrapper as="span" class="inline-flex items-center align-middle mx-0.5">
|
|
27
|
+
<UCheckbox
|
|
28
|
+
v-model="checked"
|
|
29
|
+
:label="label"
|
|
30
|
+
/>
|
|
31
|
+
</NodeViewWrapper>
|
|
32
|
+
</template>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeViewProps } from '@tiptap/vue-3';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<NodeViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NodeViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeViewProps } from '@tiptap/vue-3';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<NodeViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NodeViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { NodeViewWrapper } from "@tiptap/vue-3";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
decorations: { type: Array, required: true },
|
|
5
|
+
selected: { type: Boolean, required: true },
|
|
6
|
+
updateAttributes: { type: Function, required: true },
|
|
7
|
+
deleteNode: { type: Function, required: true },
|
|
8
|
+
node: { type: null, required: true },
|
|
9
|
+
view: { type: null, required: true },
|
|
10
|
+
getPos: { type: null, required: true },
|
|
11
|
+
innerDecorations: { type: null, required: true },
|
|
12
|
+
editor: { type: Object, required: true },
|
|
13
|
+
extension: { type: Object, required: true },
|
|
14
|
+
HTMLAttributes: { type: Object, required: true }
|
|
15
|
+
});
|
|
16
|
+
const color = computed({
|
|
17
|
+
get: () => props.node.attrs.color,
|
|
18
|
+
set: (value) => {
|
|
19
|
+
props.updateAttributes({ color: value });
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const label = computed(() => props.node.attrs.label || "");
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<NodeViewWrapper as="span" class="inline-flex items-center align-middle mx-0.5 gap-1.5">
|
|
27
|
+
<span v-if="label" class="text-sm text-[var(--ui-text-muted)]">{{ label }}</span>
|
|
28
|
+
<UColorPicker v-model="color" size="xs" />
|
|
29
|
+
</NodeViewWrapper>
|
|
30
|
+
</template>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeViewProps } from '@tiptap/vue-3';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<NodeViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NodeViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeViewProps } from '@tiptap/vue-3';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<NodeViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NodeViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|