Desktop: Fixes #13574: Fix crash when opening the legacy Markdown editor#13576
Merged
laurent22 merged 2 commits intolaurent22:devfrom Nov 3, 2025
Merged
Conversation
| const addCodeMirrorExtension = (CodeMirror: CodeMirror5Emulation) => { | ||
| CodeMirror.defineOption('joplin.search-highlight-state', null, ()=>{}); | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied | ||
| CodeMirror?.defineExtension('setMarkers', function(keywords: any, options: any) { |
Collaborator
Author
There was a problem hiding this comment.
This pull request converts setMarkers from a CodeMirror 5 legacy extension to a regular function. One of the issues that b3bd4e0 tried to address was that legacy CodeMirror 5 extensions are defined for all editor instances. As a result, clearMarkers/setMarkers would often use state associated with the wrong editor. This issue is easier to to address if the setMarkers function is a standard function that accepts an editor as input.
The legacy editor crash was caused by differences in the CodeMirror 6 compatibility layer and CodeMirror 5. In particular, the way that the current editor state was passed to the searchMarkers extension worked with the CodeMirror 6 compatibility layer, but not CodeMirror 5.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request fixes a regression that caused the editor to crash when opening the legacy Markdown editor.
Fixes #13574.
Details
The regression was caused by b3bd4e0, which was mistakenly included in #13551. b3bd4e0. b3bd4e0 was intended to fix a multi-window support bug, but 1) was not fully tested and 2) was only a partial fix.
b3bd4e0 should have been pushed to a separate branch and had its own pull request with its own manual testing plan.
Testing plan
Automated testing
This pull request adds a new automated test that verifies that the legacy Markdown editor can load successfully.
Manual testing
Screen recording
Screencast.from.2025-10-30.09-05-46.webm