mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-02 12:47:41 +02:00
Chore: Fixes #9001: Fix error logged to console when a partial link is partially selected in Beta Editor (#9002)
This commit is contained in:
parent
feb95451fd
commit
992807eb8f
@ -505,6 +505,7 @@ packages/editor/CodeMirror/editorCommands/editorCommands.js
|
||||
packages/editor/CodeMirror/editorCommands/supportsCommand.js
|
||||
packages/editor/CodeMirror/editorCommands/swapLine.js
|
||||
packages/editor/CodeMirror/getScrollFraction.js
|
||||
packages/editor/CodeMirror/markdown/computeSelectionFormatting.test.js
|
||||
packages/editor/CodeMirror/markdown/computeSelectionFormatting.js
|
||||
packages/editor/CodeMirror/markdown/decoratorExtension.js
|
||||
packages/editor/CodeMirror/markdown/markdownCommands.bulletedVsChecklist.test.js
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -491,6 +491,7 @@ packages/editor/CodeMirror/editorCommands/editorCommands.js
|
||||
packages/editor/CodeMirror/editorCommands/supportsCommand.js
|
||||
packages/editor/CodeMirror/editorCommands/swapLine.js
|
||||
packages/editor/CodeMirror/getScrollFraction.js
|
||||
packages/editor/CodeMirror/markdown/computeSelectionFormatting.test.js
|
||||
packages/editor/CodeMirror/markdown/computeSelectionFormatting.js
|
||||
packages/editor/CodeMirror/markdown/decoratorExtension.js
|
||||
packages/editor/CodeMirror/markdown/markdownCommands.bulletedVsChecklist.test.js
|
||||
|
@ -0,0 +1,21 @@
|
||||
import { EditorSelection } from '@codemirror/state';
|
||||
import createTestEditor from '../testUtil/createTestEditor';
|
||||
import computeSelectionFormatting from './computeSelectionFormatting';
|
||||
|
||||
|
||||
describe('computeSelectionFormatting', () => {
|
||||
// The below tests rely on CodeMirror to correctly parse the document, which
|
||||
// can be buggy (and fail very rarely).
|
||||
jest.retryTimes(2);
|
||||
|
||||
it('should correctly compute formatting for partial links', async () => {
|
||||
// Start with the selection midway through the link
|
||||
const editor = await createTestEditor('A [partial link]', EditorSelection.cursor(4), ['Link']);
|
||||
|
||||
const formatting = computeSelectionFormatting(editor.state, false);
|
||||
expect(formatting.linkData).toMatchObject({
|
||||
linkText: null,
|
||||
linkURL: null,
|
||||
});
|
||||
});
|
||||
});
|
@ -20,7 +20,10 @@ const computeSelectionFormatting = (state: EditorState, globalSpellcheck: boolea
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
return {
|
||||
linkText: null,
|
||||
linkURL: null,
|
||||
};
|
||||
};
|
||||
|
||||
// Find nodes that overlap/are within the selected region
|
||||
|
Loading…
Reference in New Issue
Block a user