This commit is contained in:
2026-05-09 20:40:27 +02:00
parent 94e2b8bd47
commit 0b49ac4b48
8 changed files with 175 additions and 141 deletions

View File

@@ -1,12 +1,76 @@
import { ref } from 'vue';
import { useCampaignService } from '~/services/Campaign.js';
import Server from './Server';
const ShowContent = ref(false);
const TotalNotes = ref([]); // Full note data
const CurrentNotes = ref([]); // Current opened note keys
function SetShowContent(value) {
ShowContent.value = value;
}
function PushNote(note){
CurrentNotes.value = CurrentNotes.value.filter((currentNote) => {
return currentNote.key !== note.key;
});
CurrentNotes.value.push(note.key);
}
function DeleteNote(key){
CurrentNotes.value = CurrentNotes.value.filter((k) => {
return k !== key;
});
}
async function FetchCampaignNotes() {
// First we get campaign info
const { Campaign } = useCampaignService();
const campaignId = Campaign.value?._id ?? Campaign.value?.id ?? null;
if (!campaignId) {
TotalNotes.value = [];
return;
}
try {
const response = await Server().get('/note/list', {
params: {
campaign: campaignId
}
});
if (response.data.status !== 'ok') {
// TODO: ERROR
return;
}
TotalNotes.value = response.data.notes.map((note) => {
return {
key: note._id,
title: note.title,
text: note.content ?? '',
date: note.date
};
});
} catch (error) {
// TODO: ERROR
console.error(error);
return;
}
}
function GetNoteByName(name){
return TotalNotes.value.find(note => note.title == name);
}
export {
ShowContent,
SetShowContent
SetShowContent,
CurrentNotes,
FetchCampaignNotes,
TotalNotes,
PushNote,
DeleteNote,
GetNoteByName
}

View File

@@ -5,12 +5,16 @@ const widget_map = {
},
display: {
roll: () => import("~/components/viewer/widgets/display/RollWidgetDisplay.vue"),
}
},
link: {
link: () => import("~/components/viewer/widgets/link/NoteLink.vue")
}
};
const componentCache = {
inline: {},
display: {}
display: {},
link: {}
}
const GetWidget = (type, name) => {
@@ -94,7 +98,7 @@ const linkExtension = {
},
renderer(token) {
return `<span class="vue-link" data-href="${token.link}"></span>`;
return `<span class="vue-component-link" data-component="link" data-content="${token.link}"></span>`;
},
};

View File

@@ -0,0 +1,3 @@
import { ref } from 'vue';
const statusMessage = ref("")