mirror of
https://github.com/laurent22/joplin.git
synced 2025-03-11 14:09:55 +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);
|
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
|
// RegExps for different list types. The regular expressions MUST
|
||||||
// be mutually exclusive.
|
// be mutually exclusive.
|
||||||
// `(?!\[[ xX]+\])` means "not followed by [x] or [ ]".
|
// `(?!\[[ xX]+\])` means "not followed by [x] or [ ]".
|
||||||
const bulletedRegex = /^\s*([-*])\s(?!\[[ xX]+\])/;
|
const bulletedRegex = /^\s*([-*])\s(?!\[[ xX]+\]\s)/;
|
||||||
const checklistRegex = /^\s*[-*]\s\[[ xX]+\]\s?/;
|
const checklistRegex = /^\s*[-*]\s\[[ xX]+\]\s/;
|
||||||
const numberedRegex = /^\s*\d+\.\s?/;
|
const numberedRegex = /^\s*\d+\.\s/;
|
||||||
|
|
||||||
const listRegexes: Record<ListType, RegExp> = {
|
const listRegexes: Record<ListType, RegExp> = {
|
||||||
[ListType.OrderedList]: numberedRegex,
|
[ListType.OrderedList]: numberedRegex,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user