添加字体设置菜单
This commit is contained in:
@@ -9,7 +9,7 @@ import tippy, { Instance, Props } from "tippy.js";
|
||||
* 菜单按钮选项
|
||||
*/
|
||||
export type MenuButtonOptions = {
|
||||
menuType: "button",
|
||||
menuType: "button" | "select",
|
||||
enable: boolean,
|
||||
className?: string,
|
||||
header?: "ribbon" | "classic",
|
||||
@@ -55,6 +55,10 @@ export class MenuButton extends HTMLElement implements UAIEditorEventListener {
|
||||
// 按钮
|
||||
this.createMenuButton()
|
||||
}
|
||||
if (this.menuButtonOptions.menuType === "select") {
|
||||
// 下拉选择
|
||||
this.createMenuSelect()
|
||||
}
|
||||
|
||||
// 提示信息
|
||||
var tipsContent = this.menuButtonOptions.tooltip;
|
||||
@@ -129,4 +133,17 @@ export class MenuButton extends HTMLElement implements UAIEditorEventListener {
|
||||
this.menuButtonContent.appendChild(menuButtonText);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建下拉选择框
|
||||
*/
|
||||
createMenuSelect() {
|
||||
this.menuButton = document.createElement("div");
|
||||
this.menuButton.classList.add("uai-menu-button");
|
||||
this.container.appendChild(this.menuButton);
|
||||
|
||||
this.menuButtonContent = document.createElement("select");
|
||||
this.menuButtonContent.classList.add("uai-button-content");
|
||||
this.menuButton.appendChild(this.menuButtonContent);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user