mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
imported internal links crash ckeditor, #1979
This commit is contained in:
parent
3c7232f427
commit
b9639bffce
2
libraries/ckeditor/ckeditor.js
vendored
2
libraries/ckeditor/ckeditor.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -11,7 +11,7 @@ function sanitize(dirtyHtml) {
|
||||
'figure', 'span', 'label', 'input'
|
||||
],
|
||||
allowedAttributes: {
|
||||
'a': [ 'href', 'class' ],
|
||||
'a': [ 'href', 'class', 'data-note-path' ],
|
||||
'img': [ 'src' ],
|
||||
'section': [ 'class', 'data-note-id' ],
|
||||
'figure': [ 'class' ],
|
||||
|
@ -307,6 +307,14 @@ async function importZip(taskContext, fileBuffer, importRootNote) {
|
||||
return `href="#root/${targetNoteId}"`;
|
||||
});
|
||||
|
||||
content = content.replace(/data-note-path="([^"]*)"/g, (match, notePath) => {
|
||||
const noteId = notePath.split("/").pop();
|
||||
|
||||
const targetNoteId = noteIdMap[noteId];
|
||||
|
||||
return `data-note-path="root/${targetNoteId}"`;
|
||||
});
|
||||
|
||||
if (noteMeta) {
|
||||
const includeNoteLinks = (noteMeta.attributes || [])
|
||||
.filter(attr => attr.type === 'relation' && attr.name === 'includeNoteLink');
|
||||
|
Loading…
x
Reference in New Issue
Block a user