mirror of
https://github.com/zadam/trilium.git
synced 2025-11-17 18:50:41 +01:00
Merge remote-tracking branch 'origin/master' into next60
# Conflicts: # src/routes/api/options.js # src/services/import/zip.js # src/services/options_init.js
This commit is contained in:
@@ -314,6 +314,8 @@ async function importZip(taskContext, fileBuffer, importRootNote) {
|
||||
return /^(?:[a-z]+:)?\/\//i.test(url);
|
||||
}
|
||||
|
||||
content = removeTrilumTags(content);
|
||||
|
||||
content = content.replace(/<h1>([^<]*)<\/h1>/gi, (match, text) => {
|
||||
if (noteTitle.trim() === text.trim()) {
|
||||
return ""; // remove whole H1 tag
|
||||
@@ -403,6 +405,18 @@ async function importZip(taskContext, fileBuffer, importRootNote) {
|
||||
return content;
|
||||
}
|
||||
|
||||
function removeTrilumTags(content) {
|
||||
const tagsToRemove = [
|
||||
'<h1 data-trilium-h1>([^<]*)<\/h1>',
|
||||
'<title data-trilium-title>([^<]*)<\/title>'
|
||||
]
|
||||
for (const tag of tagsToRemove) {
|
||||
let re = new RegExp(tag, "gi");
|
||||
content = content.replace(re, '');
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {NoteMeta} noteMeta
|
||||
* @param {string} type
|
||||
|
||||
Reference in New Issue
Block a user