mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 11:56:01 +01:00
split out note's content into separate entity, WIP
This commit is contained in:
@@ -8,15 +8,15 @@ class NoteFull extends NoteShort {
|
||||
super(treeCache, row);
|
||||
|
||||
/** @param {string} */
|
||||
this.content = row.content;
|
||||
this.noteContent = row.noteContent;
|
||||
|
||||
if (this.content !== "" && this.isJson()) {
|
||||
try {
|
||||
/** @param {object} */
|
||||
this.jsonContent = JSON.parse(this.content);
|
||||
}
|
||||
catch(e) {}
|
||||
}
|
||||
// if (this.content !== "" && this.isJson()) {
|
||||
// try {
|
||||
// /** @param {object} */
|
||||
// this.jsonContent = JSON.parse(this.content);
|
||||
// }
|
||||
// catch(e) {}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -357,6 +357,7 @@ export default {
|
||||
updateNoteView,
|
||||
loadNote,
|
||||
getCurrentNote,
|
||||
getCurrentNoteContent,
|
||||
getCurrentNoteType,
|
||||
getCurrentNoteId,
|
||||
focusOnTitle,
|
||||
@@ -364,7 +365,6 @@ export default {
|
||||
saveNote,
|
||||
saveNoteIfChanged,
|
||||
noteChanged,
|
||||
getCurrentNoteContent,
|
||||
onNoteChange,
|
||||
addDetailLoadedListener
|
||||
};
|
||||
@@ -49,7 +49,7 @@ async function show() {
|
||||
// this needs to happen after the element is shown, otherwise the editor won't be refreshed
|
||||
// CodeMirror breaks pretty badly on null so even though it shouldn't happen (guarded by consistency check)
|
||||
// we provide fallback
|
||||
codeEditor.setValue(currentNote.content || "");
|
||||
codeEditor.setValue(currentNote.noteContent.content || "");
|
||||
|
||||
const info = CodeMirror.findModeByMIME(currentNote.mime);
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ async function show() {
|
||||
$fileSize.text((attributeMap.fileSize || "?") + " bytes");
|
||||
$fileType.text(currentNote.mime);
|
||||
|
||||
$previewRow.toggle(!!currentNote.content);
|
||||
$previewContent.text(currentNote.content);
|
||||
$previewRow.toggle(!!currentNote.noteContent.content);
|
||||
$previewContent.text(currentNote.noteContent.content);
|
||||
}
|
||||
|
||||
$downloadButton.click(() => utils.download(getFileUrl()));
|
||||
|
||||
@@ -93,9 +93,9 @@ function loadMapData() {
|
||||
}
|
||||
};
|
||||
|
||||
if (currentNote.content) {
|
||||
if (currentNote.noteContent.content) {
|
||||
try {
|
||||
mapData = JSON.parse(currentNote.content);
|
||||
mapData = JSON.parse(currentNote.noteContent.content);
|
||||
} catch (e) {
|
||||
console.log("Could not parse content: ", e);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ function show() {
|
||||
$component.show();
|
||||
|
||||
try {
|
||||
const json = JSON.parse(noteDetailService.getCurrentNote().content);
|
||||
const json = JSON.parse(noteDetailService.getCurrentNote().noteContent.content);
|
||||
|
||||
$searchString.val(json.searchString);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ async function show() {
|
||||
|
||||
textEditor.isReadOnly = await isReadOnly();
|
||||
|
||||
textEditor.setData(noteDetailService.getCurrentNote().content);
|
||||
textEditor.setData(noteDetailService.getCurrentNote().noteContent.content);
|
||||
|
||||
$component.show();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user