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

Beta editor: Opening, then closing settings, can break some legacy plugins #10023

Closed
personalizedrefrigerator opened this issue Feb 29, 2024 · 0 comments · Fixed by #10024
Closed
Labels
bug It's a bug

Comments

@personalizedrefrigerator
Copy link
Collaborator

Operating system

Linux

Joplin version

2.14.16

Desktop version info

No response

Current behaviour

  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 no longer works.

Expected behaviour

Currently, CodeMirror5Emulation.defineExtension only works if the extension is not already present. This is different from the behavior of .defineExtension in CodeMirror 5, which overrides previous extension values.

Note: This is breaking a downstream pull request in some cases.

Logs

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It's a bug
Projects
None yet
1 participant