1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Mobile: Add support for plugin editor views (#11831)

Co-authored-by: Henry Heino <46334387+personalizedrefrigerator@users.noreply.github.com>
This commit is contained in:
Laurent Cozic
2025-02-17 13:47:56 +00:00
committed by GitHub
parent d2aad1d6c7
commit c6154cfb4e
20 changed files with 337 additions and 164 deletions

View File

@@ -67,6 +67,8 @@ interface Shared {
installResourceHandling?: (refreshResourceHandler: any)=> void;
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
uninstallResourceHandling?: (refreshResourceHandler: any)=> void;
reloadNote?: (comp: BaseNoteScreenComponent)=> Promise<NoteEntity>;
}
const shared: Shared = {};
@@ -268,7 +270,7 @@ shared.isModified = function(comp: BaseNoteScreenComponent) {
return !!Object.getOwnPropertyNames(diff).length;
};
shared.initState = async function(comp: BaseNoteScreenComponent) {
shared.reloadNote = async (comp: BaseNoteScreenComponent) => {
const isProvisionalNote = comp.props.provisionalNoteIds.includes(comp.props.noteId);
const note = await Note.load(comp.props.noteId);
@@ -292,6 +294,7 @@ shared.initState = async function(comp: BaseNoteScreenComponent) {
fromShare: !!comp.props.sharedData,
noteResources: await shared.attachedResources(note ? note.body : ''),
readOnly: itemIsReadOnlySync(ModelType.Note, ItemChange.SOURCE_UNSPECIFIED, note as ItemSlice, Setting.value('sync.userId'), BaseItem.syncShareCache),
noteLastLoadTime: Date.now(),
});
} else {
// Handle the case where a non-existent note is loaded. This can happen briefly after deleting a note.
@@ -304,9 +307,16 @@ shared.initState = async function(comp: BaseNoteScreenComponent) {
fromShare,
noteResources: [],
readOnly: true,
noteLastLoadTime: Date.now(),
});
}
return note;
};
shared.initState = async function(comp: BaseNoteScreenComponent) {
const note = await shared.reloadNote(comp);
if (comp.props.sharedData) {
if (comp.props.sharedData.title) {
this.noteComponent_change(comp, 'title', comp.props.sharedData.title);