From a52c8a07aedb01096b7492a9a31d77645dd55429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=9B?= <1501034130@qq.com> Date: Fri, 27 Sep 2024 20:49:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=95=E7=94=A8=E6=A0=BC=E5=BC=8F=E5=8F=AF?= =?UTF-8?q?=E5=8C=85=E6=8B=AC=E5=A4=9A=E4=B8=AA=E6=AE=B5=E8=90=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/editor/schema.ts | 2 +- src/components/editor/toolbar.ts | 2 +- src/components/editor/tools.ts | 4 ++-- src/styles/Default.css | 3 +-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/components/editor/schema.ts b/src/components/editor/schema.ts index f812f6d..8c3f695 100644 --- a/src/components/editor/schema.ts +++ b/src/components/editor/schema.ts @@ -73,7 +73,7 @@ export const schema = new Schema({ }, }, blockquote: { - content: "inline*", + content: "paragraph+", group: "block", defining: true, parseDOM: [{ tag: "blockquote" }], diff --git a/src/components/editor/toolbar.ts b/src/components/editor/toolbar.ts index dbae2a9..90497b2 100644 --- a/src/components/editor/toolbar.ts +++ b/src/components/editor/toolbar.ts @@ -75,7 +75,7 @@ class ToolbarView { } const activeNode = getActiveNodeName(view); - if (activeNode) { + if (activeNode && activeNode in this.buttons.lineFormat) { setActive(this.buttons.lineFormat[activeNode], true); this.lastActiveLineFormat = activeNode; } diff --git a/src/components/editor/tools.ts b/src/components/editor/tools.ts index c3cc8a2..21c0f88 100644 --- a/src/components/editor/tools.ts +++ b/src/components/editor/tools.ts @@ -121,11 +121,11 @@ export const toolsRaw = [ type: "lineFormat", }, { - command: setBlockType(schema.nodes.blockquote), + command: wrapIn(schema.nodes.blockquote), name: "blockquote", key: "Mod-q", icon: "i-quote", - type: "lineFormat", + type: "node", }, { command: insertImage(), name: "image", icon: "i-image", type: "node" }, { diff --git a/src/styles/Default.css b/src/styles/Default.css index 5b9a7ad..6c6a159 100644 --- a/src/styles/Default.css +++ b/src/styles/Default.css @@ -424,10 +424,9 @@ code { blockquote { margin: 1rem 0px; - color: var(--p-text-muted-color); border-left: 4px solid var(--p-primary-color); background-color: var(--p-content-background); - padding: 8px 16px; + padding: 1px 16px; } figure {