mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +02:00
This commit is contained in:
parent
eda2c69334
commit
948ca605b0
@ -232,4 +232,19 @@ describe('markdownCommands.toggleList', () => {
|
||||
);
|
||||
expect(editor.state.selection.main.from).toBe(preSubListText.length);
|
||||
});
|
||||
|
||||
it('should not treat a list of IP addresses as a numbered list', async () => {
|
||||
const initialDocText = '192.168.1.1. This\n127.0.0.1. is\n0.0.0.0. a list';
|
||||
|
||||
const editor = await createTestEditor(
|
||||
initialDocText,
|
||||
EditorSelection.range(0, initialDocText.length),
|
||||
[],
|
||||
);
|
||||
|
||||
toggleList(ListType.UnorderedList)(editor);
|
||||
expect(editor.state.doc.toString()).toBe(
|
||||
'- 192.168.1.1. This\n- 127.0.0.1. is\n- 0.0.0.0. a list',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -132,9 +132,9 @@ export const toggleList = (listType: ListType): Command => {
|
||||
// RegExps for different list types. The regular expressions MUST
|
||||
// be mutually exclusive.
|
||||
// `(?!\[[ xX]+\])` means "not followed by [x] or [ ]".
|
||||
const bulletedRegex = /^\s*([-*])\s(?!\[[ xX]+\])/;
|
||||
const checklistRegex = /^\s*[-*]\s\[[ xX]+\]\s?/;
|
||||
const numberedRegex = /^\s*\d+\.\s?/;
|
||||
const bulletedRegex = /^\s*([-*])\s(?!\[[ xX]+\]\s)/;
|
||||
const checklistRegex = /^\s*[-*]\s\[[ xX]+\]\s/;
|
||||
const numberedRegex = /^\s*\d+\.\s/;
|
||||
|
||||
const listRegexes: Record<ListType, RegExp> = {
|
||||
[ListType.OrderedList]: numberedRegex,
|
||||
|
Loading…
Reference in New Issue
Block a user