diff --git a/src/components/editor/keymap.ts b/src/components/editor/keymap.ts index 74da91e..7c696e0 100644 --- a/src/components/editor/keymap.ts +++ b/src/components/editor/keymap.ts @@ -28,6 +28,7 @@ export const extraKeymap = { "Mod-y": redo, "Mod-b": toggleMark(schema.marks.bold), "Mod-i": toggleMark(schema.marks.italic), + "Mod-u": toggleMark(schema.marks.underline), "Mod-`": toggleMark(schema.marks.code), "Mod-1": setBlockType(schema.nodes.heading, { level: 1 }), "Mod-2": setBlockType(schema.nodes.heading, { level: 2 }), diff --git a/src/components/editor/schema.ts b/src/components/editor/schema.ts index 65feece..7d13d45 100644 --- a/src/components/editor/schema.ts +++ b/src/components/editor/schema.ts @@ -104,6 +104,12 @@ export const schema = new Schema({ return ["i", 0]; }, }, + underline: { + parseDOM: [{ tag: "u" }], + toDOM() { + return ["u", 0]; + }, + }, del: { parseDOM: [{ tag: "del" }], toDOM() { diff --git a/src/styles/Icons.css b/src/styles/Icons.css index e80c877..7a06cf5 100644 --- a/src/styles/Icons.css +++ b/src/styles/Icons.css @@ -46,6 +46,10 @@ content: "\e23f"; } +.i-underline::before { + content: "\e249"; +} + .i-strikethrough::before { content: "\e257"; } diff --git a/src/views/NoteView.vue b/src/views/NoteView.vue index 78e1f10..5964e66 100644 --- a/src/views/NoteView.vue +++ b/src/views/NoteView.vue @@ -151,6 +151,12 @@ const editorTools = [ active: () => editor.value!.isMarkActive("italic"), enable: () => true, }, + { + icon: "i i-m i-underline", + command: () => editor.value!.toggleMark("underline"), + active: () => editor.value!.isMarkActive("underline"), + enable: () => true, + }, { icon: "i i-m i-strikethrough", command: () => editor.value!.toggleMark("del"),