Update package version to 1.1.0 and enhance link insertion logic in EditPagesComponent for improved safety and usability

This commit is contained in:
Torsten Schulz (local)
2025-08-13 11:32:54 +02:00
parent 967080bdbd
commit 8b77bdc048
2 changed files with 15 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "miriamgemeinde", "name": "miriamgemeinde",
"version": "0.1.0", "version": "1.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",

View File

@@ -322,10 +322,20 @@ export default {
addLinkDialog.value.openAddLinkDialog(); addLinkDialog.value.openAddLinkDialog();
}; };
const insertLink = ({ url, text }) => { const insertLink = (url, text) => {
if (url && text && editor.value) { if (!editor.value) return;
editor.value.chain().focus().extendMarkRange('link').setLink({ href: url }).insertContent(text).run(); if (!url) return;
} const selectionText = editor.value.state.doc.textBetween(
editor.value.state.selection.from,
editor.value.state.selection.to
);
const linkText = (text && text.trim()) || selectionText || url;
// Einfaches Escaping für Text
const escapeHtml = (s) => s.replace(/[&<>"']/g, c => ({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;','\'':'&#39;'}[c]));
const safeText = escapeHtml(linkText);
const safeUrl = url.trim();
// Direkter HTML Insert, damit der Link garantiert entsteht
editor.value.chain().focus().insertContent(`<a href="${safeUrl}" target="_blank" rel="noopener noreferrer">${safeText}</a>`).run();
}; };
const openAddDownloadDialog = () => { const openAddDownloadDialog = () => {