added "edit" button into ribbon button container

This commit is contained in:
zadam
2021-06-15 22:59:13 +02:00
parent 2220c4491b
commit 02da5b598c
7 changed files with 65 additions and 43 deletions

View File

@@ -40,8 +40,8 @@ class NoteContext extends Component {
this.notePath = resolvedNotePath;
this.noteId = treeService.getNoteIdFromNotePath(resolvedNotePath);
this.textPreviewDisabled = false;
this.codePreviewDisabled = false;
this.readOnlyTemporarilyDisabled = false;
this.readOnlyTemporarilyDisabled = false;
this.saveToRecentNotes(resolvedNotePath);
@@ -177,6 +177,28 @@ class NoteContext extends Component {
});
}
async isReadOnly() {
if (this.readOnlyTemporarilyDisabled) {
return false;
}
if (this.note.type !== 'text' && this.note.type !== 'code') {
return false;
}
if (this.note.hasLabel('readOnly')) {
return true;
}
const noteComplement = await this.getNoteComplement();
const SIZE_LIMIT = this.note.type === 'text' ? 10000 : 30000;
return noteComplement.content
&& noteComplement.content.length > SIZE_LIMIT
&& !this.note.hasLabel('autoReadOnlyDisabled');
}
async entitiesReloadedEvent({loadResults}) {
if (loadResults.isNoteReloaded(this.noteId)) {
const note = await froca.getNote(this.noteId);