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

Desktop: Fixes #10023: Beta editor plugins: Fix opening and closing settings can break some plugins with legacy code #10024

Conversation

personalizedrefrigerator
Copy link
Collaborator

Summary

This fixes an issue where opening and closing settings could break some legacy plugins. A similar change was also made as a part of #9928.

Fixes #10023.

Testing

Follow reproduction steps in #10023:

  1. Apply the following diff:
diff --git a/packages/app-cli/tests/support/plugins/codemirror6/src/contentScript.ts b/packages/app-cli/tests/support/plugins/codemirror6/src/contentScript.ts
index af0532dcf..3a816a16c 100644
--- a/packages/app-cli/tests/support/plugins/codemirror6/src/contentScript.ts
+++ b/packages/app-cli/tests/support/plugins/codemirror6/src/contentScript.ts
@@ -47,7 +47,7 @@ export default (_context: ContentScriptContext): CodeMirrorContentScriptModule =
 
 			// We can also register editor commands. These commands can be later executed with:
 			//   joplin.commands.execute('editor.execCommand', { name: 'name-here', args: [] })
-			codeMirrorWrapper.registerCommand('wrap-selection-with-tag', (tagName: string) => {
+			(codeMirrorWrapper as any).defineExtension('wrap-selection-with-tag', (tagName: string) => {
 				const editor: EditorView = codeMirrorWrapper.editor;
 
 				// See https://codemirror.net/examples/change/
  1. Build and add the CodeMirror 6 demo plugin (packages/app-cli/tests/support/plugins/codemirror6/) as a development plugin.
  2. Verify that running :underline from the command palette works.
  3. Open settings
  4. Close settings
  5. Verify that running :underline from the command palette still works.

This has been tested successfully on Ubuntu 23.10.

@personalizedrefrigerator personalizedrefrigerator changed the title Desktop: Fixes #10023: Beta editor plugins: Fix opening and closing settings can break some legacy plugins Desktop: Fixes #10023: Beta editor plugins: Fix opening and closing settings can break some plugins with legacy code Feb 29, 2024
@laurent22 laurent22 merged commit 9a10cd4 into laurent22:dev Mar 4, 2024
10 checks passed
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

Successfully merging this pull request may close these issues.

Beta editor: Opening, then closing settings, can break some legacy plugins
2 participants