diff options
author | Julius Härtl <jus@bitgrid.net> | 2019-06-11 21:44:29 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2019-06-11 21:44:29 +0300 |
commit | 711c0287683554b8077d3486f198dcd952ac8ff5 (patch) | |
tree | 020642ddbdc4cd76e860c6512cc849d1c9c2f9c4 /src/marks | |
parent | b43fe0693b1f35bb94cc58124687f658ccbea80f (diff) |
Implement strike support by extending the default markdown parser
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src/marks')
-rw-r--r-- | src/marks/index.js | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/src/marks/index.js b/src/marks/index.js index 0768b83ba..4e9f9776b 100644 --- a/src/marks/index.js +++ b/src/marks/index.js @@ -20,7 +20,7 @@ * */ -import { Bold, Italic as TipTapItalic } from 'tiptap-extensions' +import { Bold, Italic as TipTapItalic, Strike as TipTapStrike } from 'tiptap-extensions' /** * This file maps prosemirror mark names to tiptap classes, @@ -43,9 +43,41 @@ class Italic extends TipTapItalic { } +class Strike extends TipTapStrike { + + get schema() { + return { + parseDOM: [ + { + tag: 's' + }, + { + tag: 'del' + }, + { + tag: 'strike' + }, + { + style: 'text-decoration', + getAttrs: value => value === 'line-through' + } + ], + toDOM: () => ['s', 0], + toMarkdown: { + open: '~~', + close: '~~', + mixable: true, + expelEnclosingWhitespace: true + } + } + } + +} + /** Strike is currently unsupported by prosemirror-markdown */ export { Strong, - Italic + Italic, + Strike } |