@abraca/nuxt 0.1.0
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 +201 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +170 -0
- package/dist/runtime/components/ACollaborationUsers.d.vue.ts +11 -0
- package/dist/runtime/components/ACollaborationUsers.vue +48 -0
- package/dist/runtime/components/ACollaborationUsers.vue.d.ts +11 -0
- package/dist/runtime/components/AColorPicker.d.vue.ts +13 -0
- package/dist/runtime/components/AColorPicker.vue +71 -0
- package/dist/runtime/components/AColorPicker.vue.d.ts +13 -0
- package/dist/runtime/components/ACommandPalette.d.vue.ts +13 -0
- package/dist/runtime/components/ACommandPalette.vue +31 -0
- package/dist/runtime/components/ACommandPalette.vue.d.ts +13 -0
- package/dist/runtime/components/AConnectionStatus.d.vue.ts +13 -0
- package/dist/runtime/components/AConnectionStatus.vue +50 -0
- package/dist/runtime/components/AConnectionStatus.vue.d.ts +13 -0
- package/dist/runtime/components/ADocTypeSelect.d.vue.ts +10 -0
- package/dist/runtime/components/ADocTypeSelect.vue +34 -0
- package/dist/runtime/components/ADocTypeSelect.vue.d.ts +10 -0
- package/dist/runtime/components/ADocumentTree.d.vue.ts +53 -0
- package/dist/runtime/components/ADocumentTree.vue +350 -0
- package/dist/runtime/components/ADocumentTree.vue.d.ts +53 -0
- package/dist/runtime/components/AEditor.d.vue.ts +60 -0
- package/dist/runtime/components/AEditor.vue +174 -0
- package/dist/runtime/components/AEditor.vue.d.ts +60 -0
- package/dist/runtime/components/AFloatingWindow.d.vue.ts +24 -0
- package/dist/runtime/components/AFloatingWindow.vue +232 -0
- package/dist/runtime/components/AFloatingWindow.vue.d.ts +24 -0
- package/dist/runtime/components/AIconPicker.d.vue.ts +13 -0
- package/dist/runtime/components/AIconPicker.vue +257 -0
- package/dist/runtime/components/AIconPicker.vue.d.ts +13 -0
- package/dist/runtime/components/ANodePanel.d.vue.ts +15 -0
- package/dist/runtime/components/ANodePanel.vue +541 -0
- package/dist/runtime/components/ANodePanel.vue.d.ts +15 -0
- package/dist/runtime/components/ANotifications.d.vue.ts +7 -0
- package/dist/runtime/components/ANotifications.vue +75 -0
- package/dist/runtime/components/ANotifications.vue.d.ts +7 -0
- package/dist/runtime/components/APermissionGuard.d.vue.ts +21 -0
- package/dist/runtime/components/APermissionGuard.vue +22 -0
- package/dist/runtime/components/APermissionGuard.vue.d.ts +21 -0
- package/dist/runtime/components/APresence.d.vue.ts +43 -0
- package/dist/runtime/components/APresence.vue +36 -0
- package/dist/runtime/components/APresence.vue.d.ts +43 -0
- package/dist/runtime/components/AProvider.d.vue.ts +27 -0
- package/dist/runtime/components/AProvider.vue +42 -0
- package/dist/runtime/components/AProvider.vue.d.ts +27 -0
- package/dist/runtime/components/ARoleBadge.d.vue.ts +11 -0
- package/dist/runtime/components/ARoleBadge.vue +29 -0
- package/dist/runtime/components/ARoleBadge.vue.d.ts +11 -0
- package/dist/runtime/components/AVoiceBar.d.vue.ts +13 -0
- package/dist/runtime/components/AVoiceBar.vue +379 -0
- package/dist/runtime/components/AVoiceBar.vue.d.ts +13 -0
- package/dist/runtime/components/AVoiceTile.d.vue.ts +10 -0
- package/dist/runtime/components/AVoiceTile.vue +48 -0
- package/dist/runtime/components/AVoiceTile.vue.d.ts +10 -0
- package/dist/runtime/components/AWindowLayer.d.vue.ts +3 -0
- package/dist/runtime/components/AWindowLayer.vue +17 -0
- package/dist/runtime/components/AWindowLayer.vue.d.ts +3 -0
- package/dist/runtime/components/aware/AArea.d.vue.ts +42 -0
- package/dist/runtime/components/aware/AArea.vue +45 -0
- package/dist/runtime/components/aware/AArea.vue.d.ts +42 -0
- package/dist/runtime/components/aware/AAvatar.d.vue.ts +25 -0
- package/dist/runtime/components/aware/AAvatar.vue +86 -0
- package/dist/runtime/components/aware/AAvatar.vue.d.ts +25 -0
- package/dist/runtime/components/aware/AButton.d.vue.ts +7 -0
- package/dist/runtime/components/aware/AButton.vue +39 -0
- package/dist/runtime/components/aware/AButton.vue.d.ts +7 -0
- package/dist/runtime/components/aware/ACursorLabel.d.vue.ts +12 -0
- package/dist/runtime/components/aware/ACursorLabel.vue +44 -0
- package/dist/runtime/components/aware/ACursorLabel.vue.d.ts +12 -0
- package/dist/runtime/components/aware/ADocBadge.d.vue.ts +11 -0
- package/dist/runtime/components/aware/ADocBadge.vue +27 -0
- package/dist/runtime/components/aware/ADocBadge.vue.d.ts +11 -0
- package/dist/runtime/components/aware/AFacepile.d.vue.ts +20 -0
- package/dist/runtime/components/aware/AFacepile.vue +92 -0
- package/dist/runtime/components/aware/AFacepile.vue.d.ts +20 -0
- package/dist/runtime/components/aware/AInput.d.vue.ts +7 -0
- package/dist/runtime/components/aware/AInput.vue +44 -0
- package/dist/runtime/components/aware/AInput.vue.d.ts +7 -0
- package/dist/runtime/components/aware/ASelect.d.vue.ts +7 -0
- package/dist/runtime/components/aware/ASelect.vue +51 -0
- package/dist/runtime/components/aware/ASelect.vue.d.ts +7 -0
- package/dist/runtime/components/aware/ATextarea.d.vue.ts +7 -0
- package/dist/runtime/components/aware/ATextarea.vue +44 -0
- package/dist/runtime/components/aware/ATextarea.vue.d.ts +7 -0
- package/dist/runtime/components/aware/AUserList.d.vue.ts +17 -0
- package/dist/runtime/components/aware/AUserList.vue +72 -0
- package/dist/runtime/components/aware/AUserList.vue.d.ts +17 -0
- package/dist/runtime/components/renderers/ACalendarRenderer.d.vue.ts +8 -0
- package/dist/runtime/components/renderers/ACalendarRenderer.vue +154 -0
- package/dist/runtime/components/renderers/ACalendarRenderer.vue.d.ts +8 -0
- package/dist/runtime/components/renderers/AGalleryRenderer.d.vue.ts +8 -0
- package/dist/runtime/components/renderers/AGalleryRenderer.vue +88 -0
- package/dist/runtime/components/renderers/AGalleryRenderer.vue.d.ts +8 -0
- package/dist/runtime/components/renderers/AKanbanRenderer.d.vue.ts +8 -0
- package/dist/runtime/components/renderers/AKanbanRenderer.vue +179 -0
- package/dist/runtime/components/renderers/AKanbanRenderer.vue.d.ts +8 -0
- package/dist/runtime/components/renderers/AOutlineRenderer.d.vue.ts +8 -0
- package/dist/runtime/components/renderers/AOutlineRenderer.vue +180 -0
- package/dist/runtime/components/renderers/AOutlineRenderer.vue.d.ts +8 -0
- package/dist/runtime/components/renderers/ATableRenderer.d.vue.ts +8 -0
- package/dist/runtime/components/renderers/ATableRenderer.vue +191 -0
- package/dist/runtime/components/renderers/ATableRenderer.vue.d.ts +8 -0
- package/dist/runtime/composables/useAAField.d.ts +42 -0
- package/dist/runtime/composables/useAAField.js +62 -0
- package/dist/runtime/composables/useAbraLocale.d.ts +14 -0
- package/dist/runtime/composables/useAbraLocale.js +11 -0
- package/dist/runtime/composables/useAbracadabra.d.ts +11 -0
- package/dist/runtime/composables/useAbracadabra.js +3 -0
- package/dist/runtime/composables/useAbracadabraAuth.d.ts +23 -0
- package/dist/runtime/composables/useAbracadabraAuth.js +22 -0
- package/dist/runtime/composables/useAwareness.d.ts +22 -0
- package/dist/runtime/composables/useAwareness.js +48 -0
- package/dist/runtime/composables/useAwarenessPeers.d.ts +34 -0
- package/dist/runtime/composables/useAwarenessPeers.js +33 -0
- package/dist/runtime/composables/useBackgroundSync.d.ts +37 -0
- package/dist/runtime/composables/useBackgroundSync.js +73 -0
- package/dist/runtime/composables/useChat.d.ts +65 -0
- package/dist/runtime/composables/useChat.js +210 -0
- package/dist/runtime/composables/useChatUsers.d.ts +21 -0
- package/dist/runtime/composables/useChatUsers.js +39 -0
- package/dist/runtime/composables/useChildTree.d.ts +119 -0
- package/dist/runtime/composables/useChildTree.js +100 -0
- package/dist/runtime/composables/useCommandPalette.d.ts +58 -0
- package/dist/runtime/composables/useCommandPalette.js +94 -0
- package/dist/runtime/composables/useConnectionStatus.d.ts +17 -0
- package/dist/runtime/composables/useConnectionStatus.js +37 -0
- package/dist/runtime/composables/useDashboard.d.ts +3 -0
- package/dist/runtime/composables/useDashboard.js +23 -0
- package/dist/runtime/composables/useDocExport.d.ts +5 -0
- package/dist/runtime/composables/useDocExport.js +256 -0
- package/dist/runtime/composables/useDocImport.d.ts +10 -0
- package/dist/runtime/composables/useDocImport.js +227 -0
- package/dist/runtime/composables/useDocJump.d.ts +29 -0
- package/dist/runtime/composables/useDocJump.js +17 -0
- package/dist/runtime/composables/useDocumentPermissions.d.ts +20 -0
- package/dist/runtime/composables/useDocumentPermissions.js +33 -0
- package/dist/runtime/composables/useEditor.d.ts +45 -0
- package/dist/runtime/composables/useEditor.js +121 -0
- package/dist/runtime/composables/useEditorDragHandle.d.ts +26 -0
- package/dist/runtime/composables/useEditorDragHandle.js +219 -0
- package/dist/runtime/composables/useEditorMentions.d.ts +28 -0
- package/dist/runtime/composables/useEditorMentions.js +40 -0
- package/dist/runtime/composables/useEditorSuggestions.d.ts +18 -0
- package/dist/runtime/composables/useEditorSuggestions.js +45 -0
- package/dist/runtime/composables/useEditorToolbar.d.ts +22 -0
- package/dist/runtime/composables/useEditorToolbar.js +60 -0
- package/dist/runtime/composables/useFileBlobStore.d.ts +15 -0
- package/dist/runtime/composables/useFileBlobStore.js +22 -0
- package/dist/runtime/composables/useFileIndex.d.ts +20 -0
- package/dist/runtime/composables/useFileIndex.js +69 -0
- package/dist/runtime/composables/useFollowUser.d.ts +5 -0
- package/dist/runtime/composables/useFollowUser.js +40 -0
- package/dist/runtime/composables/useNotifications.d.ts +82 -0
- package/dist/runtime/composables/useNotifications.js +171 -0
- package/dist/runtime/composables/useOfflineUploadQueue.d.ts +90 -0
- package/dist/runtime/composables/useOfflineUploadQueue.js +33 -0
- package/dist/runtime/composables/usePasskeyAccounts.d.ts +32 -0
- package/dist/runtime/composables/usePasskeyAccounts.js +46 -0
- package/dist/runtime/composables/usePluginRegistry.d.ts +6 -0
- package/dist/runtime/composables/usePluginRegistry.js +3 -0
- package/dist/runtime/composables/useRendererBase.d.ts +186 -0
- package/dist/runtime/composables/useRendererBase.js +46 -0
- package/dist/runtime/composables/useSearchIndex.d.ts +20 -0
- package/dist/runtime/composables/useSearchIndex.js +104 -0
- package/dist/runtime/composables/useTrash.d.ts +50 -0
- package/dist/runtime/composables/useTrash.js +127 -0
- package/dist/runtime/composables/useVoice.d.ts +51 -0
- package/dist/runtime/composables/useVoice.js +220 -0
- package/dist/runtime/composables/useWindowManager.d.ts +122 -0
- package/dist/runtime/composables/useWindowManager.js +141 -0
- package/dist/runtime/composables/useYDoc.d.ts +142 -0
- package/dist/runtime/composables/useYDoc.js +172 -0
- package/dist/runtime/extensions/accordion.d.ts +3 -0
- package/dist/runtime/extensions/accordion.js +49 -0
- package/dist/runtime/extensions/badge.d.ts +2 -0
- package/dist/runtime/extensions/badge.js +39 -0
- package/dist/runtime/extensions/callout.d.ts +2 -0
- package/dist/runtime/extensions/callout.js +28 -0
- package/dist/runtime/extensions/card.d.ts +3 -0
- package/dist/runtime/extensions/card.js +53 -0
- package/dist/runtime/extensions/code-collapse.d.ts +2 -0
- package/dist/runtime/extensions/code-collapse.js +32 -0
- package/dist/runtime/extensions/code-group.d.ts +2 -0
- package/dist/runtime/extensions/code-group.js +17 -0
- package/dist/runtime/extensions/collapsible.d.ts +2 -0
- package/dist/runtime/extensions/collapsible.js +35 -0
- package/dist/runtime/extensions/document-header.d.ts +11 -0
- package/dist/runtime/extensions/document-header.js +82 -0
- package/dist/runtime/extensions/document-meta.d.ts +20 -0
- package/dist/runtime/extensions/document-meta.js +121 -0
- package/dist/runtime/extensions/document.d.ts +6 -0
- package/dist/runtime/extensions/document.js +6 -0
- package/dist/runtime/extensions/file-block.d.ts +15 -0
- package/dist/runtime/extensions/file-block.js +34 -0
- package/dist/runtime/extensions/file-drop.d.ts +6 -0
- package/dist/runtime/extensions/file-drop.js +65 -0
- package/dist/runtime/extensions/kbd.d.ts +2 -0
- package/dist/runtime/extensions/kbd.js +33 -0
- package/dist/runtime/extensions/prose-icon.d.ts +2 -0
- package/dist/runtime/extensions/prose-icon.js +33 -0
- package/dist/runtime/extensions/search-highlight.d.ts +10 -0
- package/dist/runtime/extensions/search-highlight.js +129 -0
- package/dist/runtime/extensions/steps.d.ts +2 -0
- package/dist/runtime/extensions/steps.js +32 -0
- package/dist/runtime/extensions/tabs.d.ts +3 -0
- package/dist/runtime/extensions/tabs.js +49 -0
- package/dist/runtime/extensions/views/AccordionItemView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/AccordionItemView.vue +41 -0
- package/dist/runtime/extensions/views/AccordionItemView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/AccordionView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/AccordionView.vue +22 -0
- package/dist/runtime/extensions/views/AccordionView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/BadgeView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/BadgeView.vue +23 -0
- package/dist/runtime/extensions/views/BadgeView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/CalloutView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/CalloutView.vue +43 -0
- package/dist/runtime/extensions/views/CalloutView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/CardGroupView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/CardGroupView.vue +22 -0
- package/dist/runtime/extensions/views/CardGroupView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/CardView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/CardView.vue +28 -0
- package/dist/runtime/extensions/views/CardView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/CodeCollapseView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/CodeCollapseView.vue +45 -0
- package/dist/runtime/extensions/views/CodeCollapseView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/CodeGroupView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/CodeGroupView.vue +53 -0
- package/dist/runtime/extensions/views/CodeGroupView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/CollapsibleView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/CollapsibleView.vue +42 -0
- package/dist/runtime/extensions/views/CollapsibleView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/FileNodeView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/FileNodeView.vue +140 -0
- package/dist/runtime/extensions/views/FileNodeView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/KbdView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/KbdView.vue +23 -0
- package/dist/runtime/extensions/views/KbdView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/ProseIconView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/ProseIconView.vue +23 -0
- package/dist/runtime/extensions/views/ProseIconView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/StepsView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/StepsView.vue +32 -0
- package/dist/runtime/extensions/views/StepsView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/TabsItemView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/TabsItemView.vue +22 -0
- package/dist/runtime/extensions/views/TabsItemView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/TabsView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/TabsView.vue +56 -0
- package/dist/runtime/extensions/views/TabsView.vue.d.ts +4 -0
- package/dist/runtime/locale.d.ts +134 -0
- package/dist/runtime/locale.js +119 -0
- package/dist/runtime/middleware/abracadabra-auth.d.ts +11 -0
- package/dist/runtime/middleware/abracadabra-auth.js +9 -0
- package/dist/runtime/plugin-abracadabra.client.d.ts +7 -0
- package/dist/runtime/plugin-abracadabra.client.js +898 -0
- package/dist/runtime/plugin-abracadabra.server.d.ts +2 -0
- package/dist/runtime/plugin-abracadabra.server.js +71 -0
- package/dist/runtime/plugin-registry.d.ts +34 -0
- package/dist/runtime/plugin-registry.js +83 -0
- package/dist/runtime/plugin-shared-globals.client.d.ts +2 -0
- package/dist/runtime/plugin-shared-globals.client.js +20 -0
- package/dist/runtime/plugins/core.plugin.d.ts +12 -0
- package/dist/runtime/plugins/core.plugin.js +179 -0
- package/dist/runtime/server/api/_abracadabra/render/[docId].get.d.ts +18 -0
- package/dist/runtime/server/api/_abracadabra/render/[docId].get.js +51 -0
- package/dist/runtime/server/api/_abracadabra/spaces.get.d.ts +11 -0
- package/dist/runtime/server/api/_abracadabra/spaces.get.js +16 -0
- package/dist/runtime/server/plugins/abracadabra-service.d.ts +2 -0
- package/dist/runtime/server/plugins/abracadabra-service.js +116 -0
- package/dist/runtime/server/runners/doc-tree-cache.d.ts +11 -0
- package/dist/runtime/server/runners/doc-tree-cache.js +65 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/server/utils/docCache.d.ts +25 -0
- package/dist/runtime/server/utils/docCache.js +131 -0
- package/dist/runtime/server/utils/serverRunner.d.ts +28 -0
- package/dist/runtime/server/utils/serverRunner.js +58 -0
- package/dist/runtime/types.d.ts +444 -0
- package/dist/runtime/types.js +93 -0
- package/dist/runtime/utils/VoiceClient.d.ts +94 -0
- package/dist/runtime/utils/VoiceClient.js +599 -0
- package/dist/runtime/utils/avatarStyle.d.ts +15 -0
- package/dist/runtime/utils/avatarStyle.js +20 -0
- package/dist/runtime/utils/colorPalettes.d.ts +13 -0
- package/dist/runtime/utils/colorPalettes.js +49 -0
- package/dist/runtime/utils/docTypes.d.ts +129 -0
- package/dist/runtime/utils/docTypes.js +116 -0
- package/dist/runtime/utils/markdownToYjs.d.ts +23 -0
- package/dist/runtime/utils/markdownToYjs.js +440 -0
- package/dist/runtime/utils/metaFieldDefinitions.d.ts +7 -0
- package/dist/runtime/utils/metaFieldDefinitions.js +182 -0
- package/dist/runtime/utils/voiceErrors.d.ts +33 -0
- package/dist/runtime/utils/voiceErrors.js +54 -0
- package/dist/runtime/utils/yjsConvert.d.ts +14 -0
- package/dist/runtime/utils/yjsConvert.js +331 -0
- package/dist/types.d.mts +13 -0
- package/package.json +100 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { Extension } from "@tiptap/core";
|
|
2
|
+
import { Plugin, PluginKey } from "@tiptap/pm/state";
|
|
3
|
+
import { Decoration, DecorationSet } from "@tiptap/pm/view";
|
|
4
|
+
const searchHighlightKey = new PluginKey("searchHighlight");
|
|
5
|
+
const docHighlightKey = new PluginKey("docHighlight");
|
|
6
|
+
function buildDecorations(doc, term) {
|
|
7
|
+
if (!term || term.length < 2) return DecorationSet.empty;
|
|
8
|
+
const lower = term.toLowerCase();
|
|
9
|
+
const decorations = [];
|
|
10
|
+
doc.descendants((node, pos) => {
|
|
11
|
+
if (!node.isText || !node.text) return;
|
|
12
|
+
const text = node.text.toLowerCase();
|
|
13
|
+
let idx = text.indexOf(lower);
|
|
14
|
+
while (idx !== -1) {
|
|
15
|
+
decorations.push(
|
|
16
|
+
Decoration.inline(pos + idx, pos + idx + lower.length, {
|
|
17
|
+
class: "search-highlight"
|
|
18
|
+
})
|
|
19
|
+
);
|
|
20
|
+
idx = text.indexOf(lower, idx + 1);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return DecorationSet.create(doc, decorations);
|
|
24
|
+
}
|
|
25
|
+
export function findAllMatches(doc, term) {
|
|
26
|
+
if (!term || term.length < 2) return [];
|
|
27
|
+
const lower = term.toLowerCase();
|
|
28
|
+
const results = [];
|
|
29
|
+
doc.descendants((node, pos) => {
|
|
30
|
+
if (!node.isText || !node.text) return;
|
|
31
|
+
const text = node.text;
|
|
32
|
+
const textLower = text.toLowerCase();
|
|
33
|
+
let idx = textLower.indexOf(lower);
|
|
34
|
+
while (idx !== -1) {
|
|
35
|
+
const contextBefore = text.slice(Math.max(0, idx - 30), idx);
|
|
36
|
+
const contextAfter = text.slice(idx + lower.length, idx + lower.length + 30);
|
|
37
|
+
results.push({
|
|
38
|
+
from: pos + idx,
|
|
39
|
+
to: pos + idx + lower.length,
|
|
40
|
+
contextBefore,
|
|
41
|
+
contextAfter
|
|
42
|
+
});
|
|
43
|
+
idx = textLower.indexOf(lower, idx + 1);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return results;
|
|
47
|
+
}
|
|
48
|
+
export const SearchHighlight = Extension.create({
|
|
49
|
+
name: "searchHighlight",
|
|
50
|
+
addProseMirrorPlugins() {
|
|
51
|
+
return [
|
|
52
|
+
new Plugin({
|
|
53
|
+
key: docHighlightKey,
|
|
54
|
+
state: {
|
|
55
|
+
init() {
|
|
56
|
+
return DecorationSet.empty;
|
|
57
|
+
},
|
|
58
|
+
apply(tr, old) {
|
|
59
|
+
const meta = tr.getMeta(docHighlightKey);
|
|
60
|
+
if (meta === null) return DecorationSet.empty;
|
|
61
|
+
if (meta) {
|
|
62
|
+
return DecorationSet.create(tr.doc, [
|
|
63
|
+
Decoration.inline(meta.from, meta.to, { class: "doc-passage-highlight" })
|
|
64
|
+
]);
|
|
65
|
+
}
|
|
66
|
+
return old.map(tr.mapping, tr.doc);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
props: {
|
|
70
|
+
decorations(state) {
|
|
71
|
+
return docHighlightKey.getState(state);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}),
|
|
75
|
+
new Plugin({
|
|
76
|
+
key: searchHighlightKey,
|
|
77
|
+
state: {
|
|
78
|
+
init() {
|
|
79
|
+
return DecorationSet.empty;
|
|
80
|
+
},
|
|
81
|
+
apply(tr, old) {
|
|
82
|
+
const meta = tr.getMeta(searchHighlightKey);
|
|
83
|
+
if (meta !== void 0) {
|
|
84
|
+
return buildDecorations(tr.doc, meta);
|
|
85
|
+
}
|
|
86
|
+
return old.map(tr.mapping, tr.doc);
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
props: {
|
|
90
|
+
decorations(state) {
|
|
91
|
+
return searchHighlightKey.getState(state);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
];
|
|
96
|
+
},
|
|
97
|
+
addCommands() {
|
|
98
|
+
return {
|
|
99
|
+
setSearchHighlight: (term) => ({ tr, dispatch }) => {
|
|
100
|
+
if (dispatch) {
|
|
101
|
+
tr.setMeta(searchHighlightKey, term);
|
|
102
|
+
dispatch(tr);
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
105
|
+
},
|
|
106
|
+
clearSearchHighlight: () => ({ tr, dispatch }) => {
|
|
107
|
+
if (dispatch) {
|
|
108
|
+
tr.setMeta(searchHighlightKey, "");
|
|
109
|
+
dispatch(tr);
|
|
110
|
+
}
|
|
111
|
+
return true;
|
|
112
|
+
},
|
|
113
|
+
setDocHighlight: ({ from, to }) => ({ tr, dispatch }) => {
|
|
114
|
+
if (dispatch) {
|
|
115
|
+
tr.setMeta(docHighlightKey, { from, to });
|
|
116
|
+
dispatch(tr);
|
|
117
|
+
}
|
|
118
|
+
return true;
|
|
119
|
+
},
|
|
120
|
+
clearDocHighlight: () => ({ tr, dispatch }) => {
|
|
121
|
+
if (dispatch) {
|
|
122
|
+
tr.setMeta(docHighlightKey, null);
|
|
123
|
+
dispatch(tr);
|
|
124
|
+
}
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Node, mergeAttributes } from "@tiptap/core";
|
|
2
|
+
import { VueNodeViewRenderer } from "@tiptap/vue-3";
|
|
3
|
+
import StepsView from "./views/StepsView.vue";
|
|
4
|
+
export const Steps = Node.create({
|
|
5
|
+
name: "steps",
|
|
6
|
+
group: "block",
|
|
7
|
+
content: "block+",
|
|
8
|
+
addAttributes() {
|
|
9
|
+
return {
|
|
10
|
+
level: { default: 1 }
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
parseHTML() {
|
|
14
|
+
return [
|
|
15
|
+
{
|
|
16
|
+
tag: "div[data-steps]",
|
|
17
|
+
getAttrs: (el) => ({
|
|
18
|
+
level: parseInt(el.getAttribute("data-level") || "1", 10)
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
];
|
|
22
|
+
},
|
|
23
|
+
renderHTML({ HTMLAttributes }) {
|
|
24
|
+
return ["div", mergeAttributes({
|
|
25
|
+
"data-steps": "",
|
|
26
|
+
"data-level": HTMLAttributes.level
|
|
27
|
+
}), 0];
|
|
28
|
+
},
|
|
29
|
+
addNodeView() {
|
|
30
|
+
return VueNodeViewRenderer(StepsView);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Node, mergeAttributes } from "@tiptap/core";
|
|
2
|
+
import { VueNodeViewRenderer } from "@tiptap/vue-3";
|
|
3
|
+
import TabsView from "./views/TabsView.vue";
|
|
4
|
+
import TabsItemView from "./views/TabsItemView.vue";
|
|
5
|
+
export const TabsItem = Node.create({
|
|
6
|
+
name: "tabsItem",
|
|
7
|
+
content: "block+",
|
|
8
|
+
addAttributes() {
|
|
9
|
+
return {
|
|
10
|
+
label: { default: "Tab" },
|
|
11
|
+
icon: { default: "" }
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
parseHTML() {
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
tag: "div[data-tabs-item]",
|
|
18
|
+
getAttrs: (el) => ({
|
|
19
|
+
label: el.getAttribute("data-label"),
|
|
20
|
+
icon: el.getAttribute("data-icon")
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
];
|
|
24
|
+
},
|
|
25
|
+
renderHTML({ HTMLAttributes }) {
|
|
26
|
+
return ["div", mergeAttributes({
|
|
27
|
+
"data-tabs-item": "",
|
|
28
|
+
"data-label": HTMLAttributes.label,
|
|
29
|
+
"data-icon": HTMLAttributes.icon
|
|
30
|
+
}), 0];
|
|
31
|
+
},
|
|
32
|
+
addNodeView() {
|
|
33
|
+
return VueNodeViewRenderer(TabsItemView);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
export const Tabs = Node.create({
|
|
37
|
+
name: "tabs",
|
|
38
|
+
group: "block",
|
|
39
|
+
content: "tabsItem+",
|
|
40
|
+
parseHTML() {
|
|
41
|
+
return [{ tag: "div[data-tabs]" }];
|
|
42
|
+
},
|
|
43
|
+
renderHTML() {
|
|
44
|
+
return ["div", { "data-tabs": "" }, 0];
|
|
45
|
+
},
|
|
46
|
+
addNodeView() {
|
|
47
|
+
return VueNodeViewRenderer(TabsView);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
@@ -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,41 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { NodeViewWrapper, NodeViewContent } 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 open = ref(false);
|
|
17
|
+
const label = computed(() => props.node.attrs.label || "Item");
|
|
18
|
+
const icon = computed(() => props.node.attrs.icon || "");
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<NodeViewWrapper as="div" class="border-b border-(--ui-border) last:border-b-0">
|
|
23
|
+
<button
|
|
24
|
+
contenteditable="false"
|
|
25
|
+
class="group w-full flex-1 flex items-center gap-1.5 font-medium text-sm py-3.5 px-4 text-left text-(--ui-text-highlighted) focus-visible:outline-(--ui-primary) focus:outline-none min-w-0"
|
|
26
|
+
:data-state="open ? 'open' : 'closed'"
|
|
27
|
+
@click="open = !open"
|
|
28
|
+
>
|
|
29
|
+
<UIcon v-if="icon" :name="icon" class="shrink-0 size-5" />
|
|
30
|
+
<span class="text-start break-words flex-1">{{ label }}</span>
|
|
31
|
+
<UIcon
|
|
32
|
+
name="i-lucide-chevron-down"
|
|
33
|
+
class="shrink-0 size-5 ms-auto transition-transform duration-200"
|
|
34
|
+
:class="{ 'rotate-180': open }"
|
|
35
|
+
/>
|
|
36
|
+
</button>
|
|
37
|
+
<div v-show="open" class="text-sm pb-3.5 px-4">
|
|
38
|
+
<NodeViewContent class="text-(--ui-text-muted) [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 [&>*]:my-1.5" />
|
|
39
|
+
</div>
|
|
40
|
+
</NodeViewWrapper>
|
|
41
|
+
</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,22 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { NodeViewWrapper, NodeViewContent } from "@tiptap/vue-3";
|
|
3
|
+
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
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<NodeViewWrapper as="div" class="my-5 w-full">
|
|
20
|
+
<NodeViewContent />
|
|
21
|
+
</NodeViewWrapper>
|
|
22
|
+
</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,23 @@
|
|
|
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 || "Badge");
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<NodeViewWrapper as="span" class="inline">
|
|
21
|
+
<UBadge color="primary" variant="subtle" class="rounded-full">{{ label }}</UBadge>
|
|
22
|
+
</NodeViewWrapper>
|
|
23
|
+
</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,43 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { NodeViewWrapper, NodeViewContent } from "@tiptap/vue-3";
|
|
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 CONFIG = {
|
|
18
|
+
tip: { icon: "i-lucide-lightbulb", color: "success" },
|
|
19
|
+
note: { icon: "i-lucide-info", color: "info" },
|
|
20
|
+
info: { icon: "i-lucide-info", color: "info" },
|
|
21
|
+
callout: { icon: "i-lucide-info", color: "info" },
|
|
22
|
+
alert: { icon: "i-lucide-info", color: "info" },
|
|
23
|
+
warning: { icon: "i-lucide-triangle-alert", color: "warning" },
|
|
24
|
+
caution: { icon: "i-lucide-triangle-alert", color: "warning" },
|
|
25
|
+
danger: { icon: "i-lucide-circle-x", color: "error" }
|
|
26
|
+
};
|
|
27
|
+
const cfg = computed(() => CONFIG[props.node.attrs.type] ?? CONFIG["note"]);
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<NodeViewWrapper as="div" class="my-3">
|
|
32
|
+
<UAlert
|
|
33
|
+
:color="cfg.color"
|
|
34
|
+
:icon="cfg.icon"
|
|
35
|
+
variant="soft"
|
|
36
|
+
:ui="{ description: '[&>*:first-child]:mt-0 [&>*:last-child]:mb-0' }"
|
|
37
|
+
>
|
|
38
|
+
<template #description>
|
|
39
|
+
<NodeViewContent />
|
|
40
|
+
</template>
|
|
41
|
+
</UAlert>
|
|
42
|
+
</NodeViewWrapper>
|
|
43
|
+
</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,22 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { NodeViewWrapper, NodeViewContent } from "@tiptap/vue-3";
|
|
3
|
+
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
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<NodeViewWrapper as="div" class="grid grid-cols-1 sm:grid-cols-2 gap-5 my-5 [&>*]:my-0">
|
|
20
|
+
<NodeViewContent />
|
|
21
|
+
</NodeViewWrapper>
|
|
22
|
+
</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,28 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { NodeViewWrapper, NodeViewContent } 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 title = computed(() => props.node.attrs.title || "");
|
|
17
|
+
const icon = computed(() => props.node.attrs.icon || "");
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<NodeViewWrapper as="div" class="group relative block my-5 p-4 sm:p-6 border border-(--ui-border) rounded-md bg-(--ui-bg) transition-colors">
|
|
22
|
+
<UIcon v-if="icon" :name="icon" class="size-6 mb-2 block text-(--ui-text-highlighted)" contenteditable="false" />
|
|
23
|
+
<p v-if="title" class="text-(--ui-text-highlighted) font-semibold" contenteditable="false">{{ title }}</p>
|
|
24
|
+
<div :class="['text-[15px] text-(--ui-text-muted) [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 [&>*]:my-1', title ? 'mt-1' : '']">
|
|
25
|
+
<NodeViewContent />
|
|
26
|
+
</div>
|
|
27
|
+
</NodeViewWrapper>
|
|
28
|
+
</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,45 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { NodeViewWrapper, NodeViewContent } 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 open = ref(props.node.attrs.open ?? false);
|
|
17
|
+
function toggleOpen() {
|
|
18
|
+
open.value = !open.value;
|
|
19
|
+
props.updateAttributes({ open: open.value });
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<NodeViewWrapper
|
|
25
|
+
as="div"
|
|
26
|
+
class="relative my-5"
|
|
27
|
+
:class="open ? '[&_pre]:h-auto [&_pre]:min-h-[200px] [&_pre]:max-h-[80vh] [&_pre]:pb-12' : '[&_pre]:h-[200px] [&_pre]:overflow-hidden'"
|
|
28
|
+
>
|
|
29
|
+
<NodeViewContent class="[&>*]:my-0" />
|
|
30
|
+
<div
|
|
31
|
+
class="h-16 absolute inset-x-px bottom-px rounded-b-md flex items-center justify-center"
|
|
32
|
+
:class="!open ? 'bg-gradient-to-t from-(--ui-bg-muted)' : ''"
|
|
33
|
+
contenteditable="false"
|
|
34
|
+
>
|
|
35
|
+
<UButton
|
|
36
|
+
color="neutral"
|
|
37
|
+
variant="outline"
|
|
38
|
+
:icon="open ? 'i-lucide-chevron-up' : 'i-lucide-chevron-down'"
|
|
39
|
+
:data-state="open ? 'open' : 'closed'"
|
|
40
|
+
:label="open ? 'Collapse code' : 'Expand code'"
|
|
41
|
+
@click="toggleOpen"
|
|
42
|
+
/>
|
|
43
|
+
</div>
|
|
44
|
+
</NodeViewWrapper>
|
|
45
|
+
</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,53 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { NodeViewWrapper, NodeViewContent } 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 activeIndex = ref(0);
|
|
17
|
+
const tabs = computed(() => {
|
|
18
|
+
const result = [];
|
|
19
|
+
props.node.forEach((child, _offset, index) => {
|
|
20
|
+
const lang = child.attrs?.language || `Tab ${index + 1}`;
|
|
21
|
+
result.push(lang);
|
|
22
|
+
});
|
|
23
|
+
return result;
|
|
24
|
+
});
|
|
25
|
+
watch(() => props.node.childCount, () => {
|
|
26
|
+
if (activeIndex.value >= props.node.childCount) {
|
|
27
|
+
activeIndex.value = Math.max(0, props.node.childCount - 1);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<NodeViewWrapper as="div" class="relative my-5 [&>*:not(:first-child)]:!my-0 [&>*:not(:first-child)]:!static">
|
|
34
|
+
<div
|
|
35
|
+
class="relative flex items-center gap-1 border border-(--ui-border-muted) bg-(--ui-bg) border-b-0 rounded-t-md overflow-x-auto p-2"
|
|
36
|
+
contenteditable="false"
|
|
37
|
+
>
|
|
38
|
+
<button
|
|
39
|
+
v-for="(tab, i) in tabs"
|
|
40
|
+
:key="i"
|
|
41
|
+
class="relative inline-flex items-center gap-1.5 px-2 py-1.5 text-sm rounded-md transition-colors"
|
|
42
|
+
:class="activeIndex === i ? 'text-(--ui-text-highlighted) bg-(--ui-bg-elevated) shadow-xs' : 'text-(--ui-text) hover:bg-(--ui-bg-elevated)/50'"
|
|
43
|
+
@click="activeIndex = i"
|
|
44
|
+
>
|
|
45
|
+
<span class="truncate">{{ tab }}</span>
|
|
46
|
+
</button>
|
|
47
|
+
</div>
|
|
48
|
+
<NodeViewContent
|
|
49
|
+
class="[&>*]:hidden [&>*]:!my-0 [&>*:first-child_pre]:rounded-t-none"
|
|
50
|
+
:class="`[&>*:nth-child(${activeIndex + 1})]:block`"
|
|
51
|
+
/>
|
|
52
|
+
</NodeViewWrapper>
|
|
53
|
+
</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;
|