stable
Clone or download
Part of story #38627: Choice of a new Rich Text Editor Add an inputRule to support markdown bold The `markInputRule` function is inspired by those in this discussion: https://discuss.prosemirror.net/t/input-rules-for-wrapping-marks/537 Note: // 0 1 2 3 4 5 6 7 8 9 10 // <p> * * b o l d * * </p> // <p> b o l d </p> For the naming I chose the following: `match` is the full match expression: '**bold**' (start: 1, end: 9) `text` is the extracted text: **'bold'** (start: 3, end: 7) `mark` is the text only: 'bold' (start: 1, end: 5) How to test: -- Write **bold** then space -> It should toogle bold and the bold button should be activated. -- Write __bold__ then space -> It should toogle bold and the bold button should be activated. Change-Id: Ibd67cc6254c265f89a4f8baf0aa35d03b79f2594
Modified Files
Name | ||||
---|---|---|---|---|
A | lib/frontend/prose-mirror-editor/src/helpers/MarkInputRule.test.ts | +83 | −0 | Go to diff View file |
A | lib/frontend/prose-mirror-editor/src/helpers/MarkInputRule.ts | +82 | −0 | Go to diff View file |
M | lib/frontend/prose-mirror-editor/src/plugins/toolbar/input-rules.ts | +7 | −1 | Go to diff View file |