更新
This commit is contained in:
@@ -17,6 +17,7 @@ const props = withDefaults(
|
||||
|
||||
const emit = defineEmits<{
|
||||
"update:modelValue": [value: string];
|
||||
"save-shortcut": [];
|
||||
}>();
|
||||
|
||||
const editor = useEditor({
|
||||
@@ -34,6 +35,14 @@ const editor = useEditor({
|
||||
class:
|
||||
"min-h-[320px] px-6 py-4 outline-none focus:outline-none",
|
||||
},
|
||||
handleKeyDown: (_view, event) => {
|
||||
if ((event.ctrlKey || event.metaKey) && event.key === "s") {
|
||||
event.preventDefault();
|
||||
emit("save-shortcut");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
},
|
||||
onUpdate: ({ editor }) => {
|
||||
emit("update:modelValue", editor.getHTML());
|
||||
@@ -53,7 +62,7 @@ watch(
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="flex flex-col rounded-xl border border-gray-700 bg-gray-900 shadow-2xl overflow-hidden"
|
||||
class="flex flex-col flex-1 w-full border border-gray-700 bg-gray-900 shadow-2xl overflow-hidden"
|
||||
>
|
||||
<!-- Toolbar -->
|
||||
<div
|
||||
@@ -205,7 +214,7 @@ watch(
|
||||
</div>
|
||||
|
||||
<!-- Editor content -->
|
||||
<EditorContent :editor="editor" class="tiptap-editor" />
|
||||
<EditorContent :editor="editor" class="tiptap-editor flex-1 flex flex-col" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -214,6 +223,7 @@ watch(
|
||||
.tiptap-editor .ProseMirror {
|
||||
color: #f3f4f6;
|
||||
min-height: 320px;
|
||||
flex: 1;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user