Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2021-10-25 13:59:52 +0300
committerMax <max@nextcloud.com>2022-01-24 14:29:09 +0300
commit4221a8243aa5a64abe8782dff838a0d4c4bafdad (patch)
tree5ce62f2f18b40e7689924c6854f9a6bd168a14e2 /src/marks/index.js
parent02bb65ad2b22c9bf2905940a46690662f79a1b5a (diff)
Support underline - use `____` in markdown
Fixes: #75. Signed-off-by: Azul <azul@riseup.net>
Diffstat (limited to 'src/marks/index.js')
-rw-r--r--src/marks/index.js35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/marks/index.js b/src/marks/index.js
index 0275bae57..88c9ad995 100644
--- a/src/marks/index.js
+++ b/src/marks/index.js
@@ -20,7 +20,13 @@
*
*/
-import { Bold, Italic as TipTapItalic, Strike as TipTapStrike, Link as TipTapLink } from 'tiptap-extensions'
+import {
+ Bold,
+ Italic as TipTapItalic,
+ Strike as TipTapStrike,
+ Link as TipTapLink,
+ Underline as TipTapUnderline,
+} from 'tiptap-extensions'
import { Plugin } from 'tiptap'
import { getMarkAttrs } from 'tiptap-utils'
import { markInputRule, markPasteRule } from 'tiptap-commands'
@@ -201,11 +207,36 @@ class Link extends TipTapLink {
}
-/** Strike is currently unsupported by prosemirror-markdown */
+class Underline extends TipTapUnderline {
+
+ get schema() {
+ return {
+ parseDOM: [
+ {
+ tag: 'u',
+ },
+ {
+ style: 'text-decoration',
+ getAttrs: value => value === 'underline',
+ },
+ ],
+ toDOM: () => ['u', 0],
+ toMarkdown: {
+ open: '____',
+ close: '____',
+ mixable: true,
+ expelEnclosingWhitespace: true,
+ },
+ }
+ }
+}
+
+/** Strike is currently unsupported by prosemirror-markdown */
export {
Strong,
Italic,
Strike,
Link,
+ Underline,
}