添加字体颜色设置菜单

This commit is contained in:
麦香缘
2025-02-18 11:28:33 +08:00
parent c4d637c943
commit 7ebb20813c
9 changed files with 556 additions and 1 deletions
+13
View File
@@ -17,6 +17,9 @@ import { Strike } from "../common/Strike.ts";
import { Subscript } from "../common/Subscript.ts";
import { Superscript } from "../common/Superscript.ts";
import { FontColor } from "../common/FontColor.ts";
import { Highlight } from "../common/Highlight.ts";
import { Redo } from "./base/Redo";
import { Undo } from "./base/Undo";
import { FormatPainter } from "./base/FormatPainter";
@@ -57,6 +60,8 @@ export class Classic extends HTMLElement implements UAIEditorEventListener {
baseMenuStrike!: Strike;
baseMenuSubscript!: Subscript;
baseMenuSuperscript!: Superscript;
baseMenuFontColor!: FontColor;
baseMenuHighlight!: Highlight;
constructor(defaultToolbarMenus: Record<string, any>[]) {
super();
@@ -173,6 +178,12 @@ export class Classic extends HTMLElement implements UAIEditorEventListener {
this.baseMenuSuperscript = new Superscript({ menuType: "button", enable: true });
this.eventComponents.push(this.baseMenuSuperscript);
this.baseMenuFontColor = new FontColor({ menuType: "color", enable: true });
this.eventComponents.push(this.baseMenuFontColor);
this.baseMenuHighlight = new Highlight({ menuType: "color", enable: true });
this.eventComponents.push(this.baseMenuHighlight);
}
/**
* 创建基础菜单
@@ -208,5 +219,7 @@ export class Classic extends HTMLElement implements UAIEditorEventListener {
group2.appendChild(this.baseMenuStrike);
group2.appendChild(this.baseMenuSubscript);
group2.appendChild(this.baseMenuSuperscript);
group2.appendChild(this.baseMenuFontColor);
group2.appendChild(this.baseMenuHighlight);
}
}
+13
View File
@@ -17,6 +17,9 @@ import { Strike } from "../common/Strike.ts";
import { Subscript } from "../common/Subscript.ts";
import { Superscript } from "../common/Superscript.ts";
import { FontColor } from "../common/FontColor.ts";
import { Highlight } from "../common/Highlight.ts";
import { Redo } from "./base/Redo";
import { Undo } from "./base/Undo";
@@ -59,6 +62,8 @@ export class Ribbon extends HTMLElement implements UAIEditorEventListener {
baseMenuStrike!: Strike;
baseMenuSubscript!: Subscript;
baseMenuSuperscript!: Superscript;
baseMenuFontColor!: FontColor;
baseMenuHighlight!: Highlight;
constructor(defaultToolbarMenus: Record<string, any>[]) {
super();
@@ -195,6 +200,12 @@ export class Ribbon extends HTMLElement implements UAIEditorEventListener {
this.baseMenuSuperscript = new Superscript({ menuType: "button", enable: true });
this.eventComponents.push(this.baseMenuSuperscript);
this.baseMenuFontColor = new FontColor({ menuType: "color", enable: true });
this.eventComponents.push(this.baseMenuFontColor);
this.baseMenuHighlight = new Highlight({ menuType: "color", enable: true });
this.eventComponents.push(this.baseMenuHighlight);
}
/**
@@ -247,5 +258,7 @@ export class Ribbon extends HTMLElement implements UAIEditorEventListener {
group2row2.appendChild(this.baseMenuStrike);
group2row2.appendChild(this.baseMenuSubscript);
group2row2.appendChild(this.baseMenuSuperscript);
group2row2.appendChild(this.baseMenuFontColor);
group2row2.appendChild(this.baseMenuHighlight);
}
}