添加对齐菜单

This commit is contained in:
麦香缘
2025-02-18 11:33:01 +08:00
parent 44f33b05fe
commit 0d9468c659
12 changed files with 777 additions and 3 deletions
+45
View File
@@ -20,6 +20,12 @@ import { Superscript } from "../common/Superscript.ts";
import { FontColor } from "../common/FontColor.ts";
import { Highlight } from "../common/Highlight.ts";
import { AlignLeft } from "../common/AlignLeft.ts";
import { AlignCenter } from "../common/AlignCenter.ts";
import { AlignRight } from "../common/AlignRight.ts";
import { AlignJustify } from "../common/AlignJustify.ts";
import { AlignDistributed } from "../common/AlignDistributed.ts";
import { Redo } from "./base/Redo.ts";
import { Undo } from "./base/Undo.ts";
@@ -36,6 +42,9 @@ import { Indent } from "./base/Indent.ts";
import { Outdent } from "./base/Outdent.ts";
import { LineHeight } from "./base/LineHeight.ts";
import { BlockQuote } from "./base/BlockQuote.ts";
import { CodeBlock } from "./base/CodeBlock.ts";
/**
* 传统菜单栏
*/
@@ -78,6 +87,14 @@ export class Classic extends HTMLElement implements UAIEditorEventListener {
baseMenuOutdent!: Outdent;
baseMenuLineHeight!: LineHeight;
baseMenuAlignLeft!: AlignLeft;
baseMenuAlignCenter!: AlignCenter;
baseMenuAlignRight!: AlignRight;
baseMenuAlignJustify!: AlignJustify;
baseMenuAlignDistributed!: AlignDistributed;
baseMenuBlockQuote!: BlockQuote;
baseMenuCodeBlock!: CodeBlock;
constructor(defaultToolbarMenus: Record<string, any>[]) {
super();
this.defaultToolbarMenus = defaultToolbarMenus;
@@ -217,6 +234,27 @@ export class Classic extends HTMLElement implements UAIEditorEventListener {
this.baseMenuLineHeight = new LineHeight({ menuType: "popup", enable: true });
this.eventComponents.push(this.baseMenuLineHeight);
this.baseMenuAlignLeft = new AlignLeft({ menuType: "button", enable: true });
this.eventComponents.push(this.baseMenuAlignLeft);
this.baseMenuAlignCenter = new AlignCenter({ menuType: "button", enable: true });
this.eventComponents.push(this.baseMenuAlignCenter);
this.baseMenuAlignRight = new AlignRight({ menuType: "button", enable: true });
this.eventComponents.push(this.baseMenuAlignRight);
this.baseMenuAlignJustify = new AlignJustify({ menuType: "button", enable: true });
this.eventComponents.push(this.baseMenuAlignJustify);
this.baseMenuAlignDistributed = new AlignDistributed({ menuType: "button", enable: true });
this.eventComponents.push(this.baseMenuAlignDistributed);
this.baseMenuBlockQuote = new BlockQuote({ menuType: "button", enable: true });
this.eventComponents.push(this.baseMenuBlockQuote);
this.baseMenuCodeBlock = new CodeBlock({ menuType: "button", enable: true });
this.eventComponents.push(this.baseMenuCodeBlock);
}
/**
* 创建基础菜单
@@ -264,5 +302,12 @@ export class Classic extends HTMLElement implements UAIEditorEventListener {
group3.appendChild(this.baseMenuIndent);
group3.appendChild(this.baseMenuOutdent);
group3.appendChild(this.baseMenuLineHeight);
group3.appendChild(this.baseMenuAlignLeft);
group3.appendChild(this.baseMenuAlignCenter);
group3.appendChild(this.baseMenuAlignRight);
group3.appendChild(this.baseMenuAlignJustify);
group3.appendChild(this.baseMenuAlignDistributed);
group3.appendChild(this.baseMenuBlockQuote);
group3.appendChild(this.baseMenuCodeBlock);
}
}