fix: 修复快捷键会重复执行
This commit is contained in:
parent
5be63c7a4c
commit
ba207da75d
|
@ -160,11 +160,7 @@ class ChangeEvent implements ChangeEventInterface {
|
|||
.substring(type.length)
|
||||
.toLowerCase();
|
||||
if (this.engine.command.queryEnabled(commandName)) {
|
||||
this.engine.hotkey.disable();
|
||||
this.engine.command.execute(commandName);
|
||||
setTimeout(() => {
|
||||
this.engine.hotkey.enable();
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -9,7 +9,6 @@ import { HotkeyInterface } from './types/hotkey';
|
|||
class Hotkey implements HotkeyInterface {
|
||||
private engine: EngineInterface;
|
||||
private disabled: boolean = false;
|
||||
#matchTimeout?: NodeJS.Timeout;
|
||||
constructor(engine: EngineInterface) {
|
||||
this.engine = engine;
|
||||
//绑定事件
|
||||
|
@ -83,10 +82,7 @@ class Hotkey implements HotkeyInterface {
|
|||
if (this.disabled) {
|
||||
return;
|
||||
}
|
||||
if (this.#matchTimeout) {
|
||||
clearTimeout(this.#matchTimeout);
|
||||
}
|
||||
this.#matchTimeout = setTimeout(() => this.match(e), 50);
|
||||
this.match(e);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,6 +17,7 @@ export const getToolbarDefaultConfig = (
|
|||
): Array<ButtonProps | DropdownProps | ColorProps | CollapseProps> => {
|
||||
const language = engine.language.get('toolbar');
|
||||
const headingLanguage = language['heading'];
|
||||
const fontSizeInContainer = engine.container.css('font-size');
|
||||
return [
|
||||
{
|
||||
type: 'collapse',
|
||||
|
@ -538,7 +539,7 @@ export const getToolbarDefaultConfig = (
|
|||
{ key: '40px', content: '40px', hotkey: false },
|
||||
{ key: '48px', content: '48px', hotkey: false },
|
||||
].map((item) =>
|
||||
item.key === engine.container.css('font-size')
|
||||
item.key === fontSizeInContainer
|
||||
? { ...item, isDefault: true }
|
||||
: item,
|
||||
),
|
||||
|
|
|
@ -208,7 +208,7 @@ class EmbedComponent extends Card<EmbedValue> {
|
|||
)}</a></span>
|
||||
<a target="_blank" class="data-icon data-icon-preview" href="${url}"></a>
|
||||
</div>
|
||||
<div class="data-embed-body" height="${height}${
|
||||
<div class="data-embed-body" style="height:${height}${
|
||||
height === 'auto' ? '' : 'px'
|
||||
}">
|
||||
<div class="data-embed-content-bg">
|
||||
|
|
|
@ -123,7 +123,7 @@ export default class extends Plugin {
|
|||
|
||||
pasteSchema(schema: SchemaInterface) {
|
||||
schema.add({
|
||||
type: 'mark',
|
||||
type: 'inline',
|
||||
name: 'a',
|
||||
attributes: {
|
||||
'data-type': {
|
||||
|
|
|
@ -228,7 +228,7 @@ export default class Math extends Plugin<Options> {
|
|||
|
||||
pasteSchema(schema: SchemaInterface) {
|
||||
schema.add({
|
||||
type: 'mark',
|
||||
type: 'inline',
|
||||
name: 'span',
|
||||
attributes: {
|
||||
'data-type': {
|
||||
|
|
|
@ -216,7 +216,7 @@ class MentionPlugin extends Plugin<Options> {
|
|||
|
||||
pasteSchema(schema: SchemaInterface) {
|
||||
schema.add({
|
||||
type: 'mark',
|
||||
type: 'inline',
|
||||
name: 'span',
|
||||
attributes: {
|
||||
'data-type': {
|
||||
|
|
|
@ -47,7 +47,7 @@ export default class extends Plugin<Options> {
|
|||
|
||||
pasteSchema(schema: SchemaInterface) {
|
||||
schema.add({
|
||||
type: 'mark',
|
||||
type: 'inline',
|
||||
name: 'span',
|
||||
attributes: {
|
||||
'data-type': {
|
||||
|
|
Loading…
Reference in New Issue