Skip to content

Commit

Permalink
update: block 插件markdown 会有空格
Browse files Browse the repository at this point in the history
  • Loading branch information
big-camel committed Jan 22, 2022
1 parent 4626ad9 commit 80d3f2c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions examples/react/components/editor/config.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { $, removeUnit } from '@aomao/engine';
import { $, isMobile, removeUnit } from '@aomao/engine';
import type {
PluginEntry,
CardEntry,
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -389,7 +389,12 @@ export const toolbarOptions: ToolbarOptions = {
},
};

const headingOptions: HeadingOptions = {
showAnchor: isMobile ? false : true,
};

export const pluginConfig: Record<string, PluginOptions> = {
[Heading.pluginName]: headingOptions,
[ToolbarPlugin.pluginName]: toolbarOptions,
[Table.pluginName]: tableOptions,
[MarkRange.pluginName]: markRangeOptions,
Expand Down
2 changes: 1 addition & 1 deletion examples/react/components/editor/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
@media @mobile {
padding: 0;
height: auto;
overflow: hidden;
overflow: inherit;
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/engine/src/block/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

Expand Down

0 comments on commit 80d3f2c

Please sign in to comment.