Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on Android — attempts to run an editor command when no editor is available #1

Closed
personalizedrefrigerator opened this issue Jul 19, 2024 · 0 comments

Comments

@personalizedrefrigerator
Copy link
Owner

personalizedrefrigerator commented Jul 19, 2024

See https://discourse.joplinapp.org/t/2024-07-19-diff-view-0-1-0-error-on-android/39230.

Notes

This seems to be happening because the plugin tries to send a "showDiffWith" command to the editor on note selection change, regardless of whether the editor is open:

await joplin.commands.execute('editor.execCommand', {
name: 'cm6-show-diff-with',
args: [await getContentToDiffWith(selectedNoteId)],

On mobile, when the note editor isn't visible, editor.execCommand fails.

Possible solutions:

  • Detect whether the editor is open before attempting to diff with another note.
    • While it's possible to determine that the editor has opened with a .postMessage call, it's difficult to determine when the editor closes.
  • Catch the error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant