@abraca/nuxt 2.40.0 → 2.41.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/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=4.0.0"
6
6
  },
7
- "version": "2.40.0",
7
+ "version": "2.41.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -4,6 +4,7 @@ import { useRouter, useRoute, useRuntimeConfig, useToast } from "#imports";
4
4
  import * as Y from "yjs";
5
5
  import { useAbracadabra } from "../composables/useAbracadabra";
6
6
  import { useChildTree } from "../composables/useChildTree";
7
+ import { useDocSlugs } from "../composables/useDocSlugs";
7
8
  import { useNodePanel } from "../composables/useNodePanel";
8
9
  import { useWindowManager } from "../composables/useWindowManager";
9
10
  import { useItemPresence, useViewingBroadcast } from "../composables/useItemPresence";
@@ -71,6 +72,7 @@ const { treeMap } = docTree;
71
72
  const canWrite = computed(() => props.editable !== false);
72
73
  const router = useRouter();
73
74
  const route = useRoute();
75
+ const { getDocUrl } = useDocSlugs();
74
76
  const toast = useToast();
75
77
  const { enqueue: enqueueUpload } = useOfflineUploadQueue();
76
78
  const { isFavorite, toggleFavorite } = useFavorites(rootDoc);
@@ -114,7 +116,7 @@ function pageViewers(pageId) {
114
116
  }
115
117
  function openFull(id, label) {
116
118
  emit("open", id, label);
117
- router.push(`/doc/${id}`);
119
+ router.push(getDocUrl(id));
118
120
  }
119
121
  function onItemActivate(e, id, label) {
120
122
  if (e.metaKey || e.ctrlKey) {
@@ -144,7 +146,7 @@ watch(tiptapDragState, (state, oldState) => {
144
146
  dropIndicator.value = null;
145
147
  const currentDocId = route.params.id;
146
148
  if (currentDocId && currentDocId !== dragOriginDocId) {
147
- router.push(`/doc/${dragOriginDocId}`);
149
+ router.push(getDocUrl(dragOriginDocId));
148
150
  }
149
151
  dragOriginDocId = null;
150
152
  }
@@ -261,7 +263,7 @@ async function onTiptapDrop(targetId) {
261
263
  const fragment = childProv.document.getXmlFragment("default");
262
264
  populateYDocFromHtml(fragment, state.html, label);
263
265
  state.deleteFromSource();
264
- router.push(`/doc/${newId}`);
266
+ router.push(getDocUrl(newId));
265
267
  } else {
266
268
  if (targetId === state.sourceDocId) return;
267
269
  const childProv = await provider.value.loadChild(targetId);
@@ -504,9 +506,9 @@ async function onExternalFileDrop(e, parentId = null) {
504
506
  if (firstId === null && id !== null) firstId = id;
505
507
  }
506
508
  if (parentId) {
507
- router.push(`/doc/${parentId}`);
509
+ router.push(getDocUrl(parentId));
508
510
  } else if (firstId) {
509
- router.push(`/doc/${firstId}`);
511
+ router.push(getDocUrl(firstId));
510
512
  }
511
513
  }
512
514
  const TEXT_EXTENSIONS = ["md", "mdx", "txt", "html", "htm"];
@@ -649,7 +651,7 @@ function createChildPage(parentId) {
649
651
  treeMap.set(id, { label: "", parentId, order: Date.now(), type: "doc" });
650
652
  void client.value?.createChild?.(parentId, { child_id: id, kind: "page" })?.catch?.(() => {
651
653
  });
652
- router.push(`/doc/${id}`);
654
+ router.push(getDocUrl(id));
653
655
  }
654
656
  async function duplicateDoc(id) {
655
657
  if (!provider.value) return;
@@ -3,6 +3,7 @@ import { ref, computed, watch, onBeforeUnmount } from "vue";
3
3
  import { useRouter } from "vue-router";
4
4
  import { useRuntimeConfig, defineShortcuts } from "#imports";
5
5
  import { useRendererBase } from "../../composables/useRendererBase";
6
+ import { useDocSlugs } from "../../composables/useDocSlugs";
6
7
  import { useTouchDrag } from "../../composables/useTouchDrag";
7
8
  import { useNodePanel } from "../../composables/useNodePanel";
8
9
  import { useNodePanelFollow } from "../../composables/useNodePanelFollow";
@@ -30,6 +31,7 @@ const props = defineProps({
30
31
  });
31
32
  const config = useRuntimeConfig();
32
33
  const router = useRouter();
34
+ const { getDocUrl } = useDocSlugs();
33
35
  const locale = computed(() => ({
34
36
  ...DEFAULT_LOCALE.renderers.calendar,
35
37
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -229,7 +231,7 @@ async function openAsWindow(id, label) {
229
231
  function eventMenuItems(eventId, label) {
230
232
  const items = [
231
233
  [
232
- { label: "Open", icon: "i-lucide-external-link", onSelect: () => router.push(`/doc/${eventId}`) },
234
+ { label: "Open", icon: "i-lucide-external-link", onSelect: () => router.push(getDocUrl(eventId)) },
233
235
  { label: "Open as slideover", icon: "i-lucide-panel-right", onSelect: () => openNode(eventId, label) },
234
236
  ...wm.floatWindowsAvailable.value ? [{ label: "Open as window", icon: "i-lucide-picture-in-picture-2", onSelect: () => openAsWindow(eventId, label) }] : [],
235
237
  ...props.editable ? [
@@ -4,6 +4,7 @@ import { useRuntimeConfig, useColorMode, useAppConfig, useToast } from "#imports
4
4
  import { useRouter } from "vue-router";
5
5
  import { avatarBorderStyle } from "../../utils/avatarStyle";
6
6
  import { useAbracadabra } from "../../composables/useAbracadabra";
7
+ import { useDocSlugs } from "../../composables/useDocSlugs";
7
8
  import { useRendererBase } from "../../composables/useRendererBase";
8
9
  import { useNodePanel } from "../../composables/useNodePanel";
9
10
  import { useNodePanelFollow } from "../../composables/useNodePanelFollow";
@@ -25,6 +26,7 @@ const props = defineProps({
25
26
  const emit = defineEmits(["follow"]);
26
27
  const config = useRuntimeConfig();
27
28
  const router = useRouter();
29
+ const { getDocUrl } = useDocSlugs();
28
30
  const toast = useToast();
29
31
  const locale = computed(() => ({
30
32
  ...DEFAULT_LOCALE.renderers.map,
@@ -259,7 +261,7 @@ const contextMenuItems = computed(() => {
259
261
  const w = props.editable;
260
262
  const openItems = (id, entry) => [
261
263
  { label: "Open", icon: "i-lucide-external-link", onSelect: () => {
262
- if (id) router.push(`/doc/${id}`);
264
+ if (id) router.push(getDocUrl(id));
263
265
  } },
264
266
  { label: locale.value.openInPanel ?? "Open as slideover", icon: "i-lucide-panel-right", onSelect: () => {
265
267
  if (id && entry) openNode(id, entry.label);
@@ -4,6 +4,7 @@ import { useRouter, useRuntimeConfig, useAppConfig } from "#imports";
4
4
  import { useVirtualizer } from "@tanstack/vue-virtual";
5
5
  import { DEFAULT_LOCALE } from "../../locale";
6
6
  import { useAbracadabra } from "../../composables/useAbracadabra";
7
+ import { useDocSlugs } from "../../composables/useDocSlugs";
7
8
  import { useRendererBase } from "../../composables/useRendererBase";
8
9
  import { useNodePanel } from "../../composables/useNodePanel";
9
10
  import { useNodePanelFollow } from "../../composables/useNodePanelFollow";
@@ -67,6 +68,7 @@ const { getViewers: getDocViewers } = useItemPresence();
67
68
  const { favorites, isFavorite, toggleFavorite, moveFavorite } = useFavorites(rootDoc);
68
69
  const { voiceRoomId, voiceStatus, peerCount: voicePeerCount, joinRoom: _joinRoom } = useVoice();
69
70
  const router = useRouter();
71
+ const { getDocUrl } = useDocSlugs();
70
72
  const { isOpen: searchOpen, searchTerm } = useCommandPalette();
71
73
  const appConfig = useAppConfig();
72
74
  const neutral = computed(() => appConfig.ui?.colors?.neutral ?? "zinc");
@@ -190,10 +192,10 @@ const virtualPageRows = computed(() => {
190
192
  return rows.map((vRow) => ({ vRow, item: flat[vRow.index] }));
191
193
  });
192
194
  function handleNavigate(entry) {
193
- router.push(`/doc/${entry.id}`);
195
+ router.push(getDocUrl(entry.id));
194
196
  }
195
197
  function handleJoinCall(docId) {
196
- router.push(`/doc/${docId}`);
198
+ router.push(getDocUrl(docId));
197
199
  }
198
200
  function createTypedPage(type) {
199
201
  const label = locale.value.untitled;
@@ -201,7 +203,7 @@ function createTypedPage(type) {
201
203
  if (id) {
202
204
  const entry = tree.treeMap.get(id);
203
205
  if (entry) tree.treeMap.set(id, { ...entry, type });
204
- router.push(`/doc/${id}`);
206
+ router.push(getDocUrl(id));
205
207
  }
206
208
  }
207
209
  async function duplicateDoc(id) {
@@ -272,7 +274,7 @@ function pageMenuItems(page) {
272
274
  const l = locale.value;
273
275
  return [
274
276
  [
275
- { label: l.open, icon: "i-lucide-external-link", onSelect: () => router.push(`/doc/${page.id}`) },
277
+ { label: l.open, icon: "i-lucide-external-link", onSelect: () => router.push(getDocUrl(page.id)) },
276
278
  { label: l.openAsSlideover, icon: "i-lucide-panel-right", onSelect: () => openNode(page.id, page.label) },
277
279
  ...floatWindowsAvailable.value ? [{ label: l.openAsWindow, icon: "i-lucide-picture-in-picture-2", onSelect: () => openAsWindow(page.id, page.label) }] : [],
278
280
  { label: l.rename, icon: "i-lucide-pencil", onSelect: () => startRename(page.id) },
@@ -313,7 +315,7 @@ function readOnlyMenuItems(page) {
313
315
  const l = locale.value;
314
316
  return [
315
317
  [
316
- { label: l.open, icon: "i-lucide-external-link", onSelect: () => router.push(`/doc/${page.id}`) },
318
+ { label: l.open, icon: "i-lucide-external-link", onSelect: () => router.push(getDocUrl(page.id)) },
317
319
  { label: l.openAsSlideover, icon: "i-lucide-panel-right", onSelect: () => openNode(page.id, page.label) },
318
320
  { label: l.openAsWindow, icon: "i-lucide-picture-in-picture-2", onSelect: () => openAsWindow(page.id, page.label) },
319
321
  {
@@ -3,6 +3,7 @@ import { ref, computed, watch, onBeforeUnmount } from "vue";
3
3
  import { useRuntimeConfig } from "#imports";
4
4
  import { useRouter } from "vue-router";
5
5
  import { useRendererBase } from "../../composables/useRendererBase";
6
+ import { useDocSlugs } from "../../composables/useDocSlugs";
6
7
  import { useTouchDrag } from "../../composables/useTouchDrag";
7
8
  import { useNodePanel } from "../../composables/useNodePanel";
8
9
  import { useNodePanelFollow } from "../../composables/useNodePanelFollow";
@@ -26,6 +27,7 @@ const props = defineProps({
26
27
  });
27
28
  const config = useRuntimeConfig();
28
29
  const router = useRouter();
30
+ const { getDocUrl } = useDocSlugs();
29
31
  const locale = computed(() => ({
30
32
  ...DEFAULT_LOCALE.renderers.timeline,
31
33
  ...config.public?.abracadabra?.locale?.renderers?.timeline ?? {},
@@ -392,7 +394,7 @@ const ctxItems = computed(() => {
392
394
  const isEpic = !entry.parentId;
393
395
  const items = [
394
396
  [
395
- { label: locale.value.open, icon: "i-lucide-external-link", onSelect: () => router.push(`/doc/${ctxEntry.value.id}`) },
397
+ { label: locale.value.open, icon: "i-lucide-external-link", onSelect: () => router.push(getDocUrl(ctxEntry.value.id)) },
396
398
  { label: "Open as slideover", icon: "i-lucide-panel-right", onSelect: () => openNode(ctxEntry.value.id, ctxEntry.value.label) },
397
399
  ...wm.floatWindowsAvailable.value ? [{ label: "Open as window", icon: "i-lucide-picture-in-picture-2", onSelect: () => openAsWindow(ctxEntry.value.id, ctxEntry.value.label) }] : [],
398
400
  ...props.editable ? [
@@ -1,6 +1,7 @@
1
1
  import { computed, ref } from "vue";
2
2
  import { useToast, useRouter } from "#imports";
3
3
  import { useAbracadabra } from "./useAbracadabra.js";
4
+ import { useDocSlugs } from "./useDocSlugs.js";
4
5
  import { useAbraLocale } from "./useAbraLocale.js";
5
6
  export const DOC_SNAPSHOTS_KEY = Symbol("doc-snapshots");
6
7
  export function triggerBadgeColor(trigger) {
@@ -41,6 +42,7 @@ export function useDocSnapshots(docId, overrides) {
41
42
  const locale = useAbraLocale("snapshots", overrides);
42
43
  const toast = useToast();
43
44
  const router = useRouter();
45
+ const { getDocUrl } = useDocSlugs();
44
46
  const snapshots = ref([]);
45
47
  const loading = ref(false);
46
48
  const error = ref(null);
@@ -204,7 +206,7 @@ export function useDocSnapshots(docId, overrides) {
204
206
  variant: "outline",
205
207
  onClick: (e) => {
206
208
  e?.stopPropagation();
207
- router.push(`/doc/${res.doc_id}`);
209
+ router.push(getDocUrl(res.doc_id));
208
210
  }
209
211
  }]
210
212
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/nuxt",
3
- "version": "2.40.0",
3
+ "version": "2.41.0",
4
4
  "description": "First-class Nuxt module for the Abracadabra CRDT collaboration platform",
5
5
  "repository": "abracadabra/abracadabra-nuxt",
6
6
  "license": "MIT",