This commit is contained in:
zadam 2022-12-07 23:37:40 +01:00
parent 2a68bdb690
commit 653f80f7d8
3 changed files with 32 additions and 14 deletions

View File

@ -85,6 +85,6 @@ export default class RootCommandExecutor extends Component {
}
async showOptionsCommand() {
await appContext.tabManager.openContextWithNote('options', true, null, 'opt_root')
await appContext.tabManager.openContextWithNote('options', true, null, 'options')
}
}

View File

@ -183,17 +183,17 @@ const HIDDEN_SUBTREE_DEFINITION = {
title: 'Options',
type: 'book',
children: [
{ id: 'optionsAppearance', title: 'Appearance', type: 'contentWidget' },
{ id: 'optionsShortcuts', title: 'Shortcuts', type: 'contentWidget' },
{ id: 'optionsTextNotes', title: 'Text Notes', type: 'contentWidget' },
{ id: 'optionsCodeNotes', title: 'Code Notes', type: 'contentWidget' },
{ id: 'optionsImages', title: 'Images', type: 'contentWidget' },
{ id: 'optionsSpellcheck', title: 'Spellcheck', type: 'contentWidget' },
{ id: 'optionsPassword', title: 'Password', type: 'contentWidget' },
{ id: 'optionsEtapi', title: 'ETAPI', type: 'contentWidget' },
{ id: 'optionsBackup', title: 'Backup', type: 'contentWidget' },
{ id: 'optionsSync', title: 'Sync', type: 'contentWidget' },
{ id: 'optionsOther', title: 'Other', type: 'contentWidget' },
{ id: 'optionsAppearance', title: 'Appearance', type: 'contentWidget', icon: 'bx-layout' },
{ id: 'optionsShortcuts', title: 'Shortcuts', type: 'contentWidget', icon: 'bxs-keyboard' },
{ id: 'optionsTextNotes', title: 'Text Notes', type: 'contentWidget', icon: 'bx-text' },
{ id: 'optionsCodeNotes', title: 'Code Notes', type: 'contentWidget', icon: 'bx-code' },
{ id: 'optionsImages', title: 'Images', type: 'contentWidget', icon: 'bx-image' },
{ id: 'optionsSpellcheck', title: 'Spellcheck', type: 'contentWidget', icon: 'bx-check-double' },
{ id: 'optionsPassword', title: 'Password', type: 'contentWidget', icon: 'bx-lock' },
{ id: 'optionsEtapi', title: 'ETAPI', type: 'contentWidget', icon: 'bx-extension' },
{ id: 'optionsBackup', title: 'Backup', type: 'contentWidget', icon: 'bx-data' },
{ id: 'optionsSync', title: 'Sync', type: 'contentWidget', icon: 'bx-wifi' },
{ id: 'optionsOther', title: 'Other', type: 'contentWidget', icon: 'bx-dots-horizontal' },
{ id: 'optionsAdvanced', title: 'Advanced', type: 'contentWidget' }
]
}

View File

@ -187,7 +187,7 @@ async function importZip(taskContext, fileBuffer, importRootNote) {
title: noteTitle,
content: '',
noteId: noteId,
type: noteMeta ? noteMeta.type : 'text',
type: resolveNoteType(noteMeta.type),
mime: noteMeta ? noteMeta.mime : 'text/html',
prefix: noteMeta ? noteMeta.prefix : '',
isExpanded: noteMeta ? noteMeta.isExpanded : false,
@ -258,12 +258,14 @@ async function importZip(taskContext, fileBuffer, importRootNote) {
return;
}
const {type, mime} = noteMeta ? noteMeta : detectFileTypeAndMime(taskContext, filePath);
let {type, mime} = noteMeta ? noteMeta : detectFileTypeAndMime(taskContext, filePath);
if (type !== 'file' && type !== 'image') {
content = content.toString("UTF-8");
}
type = resolveNoteType(type);
if ((noteMeta && noteMeta.format === 'markdown')
|| (!noteMeta && taskContext.data.textImportedAsText && ['text/markdown', 'text/x-markdown'].includes(mime))) {
const parsed = mdReader.parse(content);
@ -531,6 +533,22 @@ async function importZip(taskContext, fileBuffer, importRootNote) {
return firstNote;
}
function resolveNoteType(type) {
type = type || 'text';
// BC for ZIPs created in Triliun 0.57 and older
if (type === 'relation-map') {
type = 'relationMap';
} else if (type === 'note-map') {
type = 'noteMap';
} else if (type === 'web-view') {
type = 'webView';
}
return type;
}
module.exports = {
importZip
};