From 80d3f2ca341a48e051ad9f8a05a44fa6692c6c90 Mon Sep 17 00:00:00 2001 From: yanmao <55792257+yanmao-cc@users.noreply.github.com> Date: Sat, 22 Jan 2022 18:06:13 +0800 Subject: [PATCH] =?UTF-8?q?update:=20block=20=E6=8F=92=E4=BB=B6markdown=20?= =?UTF-8?q?=E4=BC=9A=E6=9C=89=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/react/components/editor/config.tsx | 9 +++++++-- examples/react/components/editor/index.less | 2 +- packages/engine/src/block/index.ts | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/examples/react/components/editor/config.tsx b/examples/react/components/editor/config.tsx index 4551e19fa..3884c9546 100644 --- a/examples/react/components/editor/config.tsx +++ b/examples/react/components/editor/config.tsx @@ -1,4 +1,4 @@ -import { $, removeUnit } from '@aomao/engine'; +import { $, isMobile, removeUnit } from '@aomao/engine'; import type { PluginEntry, CardEntry, @@ -35,7 +35,7 @@ import Unorderedlist from '@aomao/plugin-unorderedlist'; import Indent from '@aomao/plugin-indent'; // import type { IndentOptions } from '@aomao/plugin-indent'; import Heading from '@aomao/plugin-heading'; -// import type { HeadingOptions } from '@aomao/plugin-heading'; +import type { HeadingOptions } from '@aomao/plugin-heading'; import Strikethrough from '@aomao/plugin-strikethrough'; // import type { StrikethroughOptions } from '@aomao/plugin-strikethrough'; import Sub from '@aomao/plugin-sub'; @@ -389,7 +389,12 @@ export const toolbarOptions: ToolbarOptions = { }, }; +const headingOptions: HeadingOptions = { + showAnchor: isMobile ? false : true, +}; + export const pluginConfig: Record = { + [Heading.pluginName]: headingOptions, [ToolbarPlugin.pluginName]: toolbarOptions, [Table.pluginName]: tableOptions, [MarkRange.pluginName]: markRangeOptions, diff --git a/examples/react/components/editor/index.less b/examples/react/components/editor/index.less index 2ae58ff65..44ecc78b7 100644 --- a/examples/react/components/editor/index.less +++ b/examples/react/components/editor/index.less @@ -107,7 +107,7 @@ @media @mobile { padding: 0; height: auto; - overflow: hidden; + overflow: inherit; } } diff --git a/packages/engine/src/block/index.ts b/packages/engine/src/block/index.ts index a9ccbfb5a..e782c2e8f 100644 --- a/packages/engine/src/block/index.ts +++ b/packages/engine/src/block/index.ts @@ -45,7 +45,7 @@ class Block implements BlockModelInterface { .getHandleListener('backspace', 'keydown') ?.on((event) => backspace.trigger(event)); - event.on('keydown:space', (event) => this.triggerMarkdown(event)); + event.on('keyup:space', (event) => this.triggerMarkdown(event)); } }