优化代码功能
This commit is contained in:
|
Before Width: | Height: | Size: 327 B After Width: | Height: | Size: 327 B |
@@ -14,7 +14,7 @@ import expandDownIcon from "../assets/icons/expand-down.svg";
|
|||||||
import toolbarRibbon from "../assets/icons/toolbar-ribbon.svg";
|
import toolbarRibbon from "../assets/icons/toolbar-ribbon.svg";
|
||||||
import toolbarClassic from "../assets/icons/toolbar-classic.svg";
|
import toolbarClassic from "../assets/icons/toolbar-classic.svg";
|
||||||
import toolbarSource from "../assets/icons/toolbar-source.svg";
|
import toolbarSource from "../assets/icons/toolbar-source.svg";
|
||||||
import codeblock from "../assets/icons/codeblock.svg";
|
import code from "../assets/icons/code.svg";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文档顶部菜单栏
|
* 文档顶部菜单栏
|
||||||
@@ -59,7 +59,7 @@ export class Header extends HTMLElement implements UAIEditorEventListener {
|
|||||||
// 创建源码编辑器
|
// 创建源码编辑器
|
||||||
this.sourceMenu = document.createElement("div");
|
this.sourceMenu = document.createElement("div");
|
||||||
this.sourceMenu.classList.add("uai-source-menu");
|
this.sourceMenu.classList.add("uai-source-menu");
|
||||||
this.sourceMenu.innerHTML = `<img src="${codeblock}" width="20" /> ${t('toolbar.source')}`;
|
this.sourceMenu.innerHTML = `<img src="${code}" width="20" /> ${t('toolbar.source')}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ import { Outdent } from "./menus/toolbar/base/Outdent.ts";
|
|||||||
import { LineHeight } from "./menus/toolbar/base/LineHeight.ts";
|
import { LineHeight } from "./menus/toolbar/base/LineHeight.ts";
|
||||||
|
|
||||||
import { BlockQuote } from "./menus/toolbar/base/BlockQuote.ts";
|
import { BlockQuote } from "./menus/toolbar/base/BlockQuote.ts";
|
||||||
import { CodeBlock } from "./menus/toolbar/base/CodeBlock.ts";
|
import { Code } from "./menus/toolbar/base/Code.ts";
|
||||||
|
|
||||||
import { Print } from "./menus/toolbar/base/Print.ts";
|
import { Print } from "./menus/toolbar/base/Print.ts";
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ defineCustomElement('uai-editor-base-menu-outdent', Outdent);
|
|||||||
defineCustomElement('uai-editor-base-menu-lineheight', LineHeight);
|
defineCustomElement('uai-editor-base-menu-lineheight', LineHeight);
|
||||||
|
|
||||||
defineCustomElement('uai-editor-base-menu-blockquote', BlockQuote);
|
defineCustomElement('uai-editor-base-menu-blockquote', BlockQuote);
|
||||||
defineCustomElement('uai-editor-base-menu-codeblock', CodeBlock);
|
defineCustomElement('uai-editor-base-menu-code', Code);
|
||||||
|
|
||||||
defineCustomElement('uai-editor-base-menu-print', Print);
|
defineCustomElement('uai-editor-base-menu-print', Print);
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import { Outdent } from "./base/Outdent.ts";
|
|||||||
import { LineHeight } from "./base/LineHeight.ts";
|
import { LineHeight } from "./base/LineHeight.ts";
|
||||||
|
|
||||||
import { BlockQuote } from "./base/BlockQuote.ts";
|
import { BlockQuote } from "./base/BlockQuote.ts";
|
||||||
import { CodeBlock } from "./base/CodeBlock.ts";
|
import { Code } from "./base/Code.ts";
|
||||||
import { Print } from "./base/Print.ts";
|
import { Print } from "./base/Print.ts";
|
||||||
|
|
||||||
import { Link } from "./insert/Link.ts";
|
import { Link } from "./insert/Link.ts";
|
||||||
@@ -157,7 +157,7 @@ export class Classic extends HTMLElement implements UAIEditorEventListener {
|
|||||||
baseMenuAlignJustify!: AlignJustify;
|
baseMenuAlignJustify!: AlignJustify;
|
||||||
baseMenuAlignDistributed!: AlignDistributed;
|
baseMenuAlignDistributed!: AlignDistributed;
|
||||||
baseMenuBlockQuote!: BlockQuote;
|
baseMenuBlockQuote!: BlockQuote;
|
||||||
baseMenuCodeBlock!: CodeBlock;
|
baseMenuCode!: Code;
|
||||||
baseMenuPrint!: Print;
|
baseMenuPrint!: Print;
|
||||||
|
|
||||||
// 插入菜单
|
// 插入菜单
|
||||||
@@ -389,8 +389,8 @@ export class Classic extends HTMLElement implements UAIEditorEventListener {
|
|||||||
this.baseMenuBlockQuote = new BlockQuote({ menuType: "button", enable: true });
|
this.baseMenuBlockQuote = new BlockQuote({ menuType: "button", enable: true });
|
||||||
this.eventComponents.push(this.baseMenuBlockQuote);
|
this.eventComponents.push(this.baseMenuBlockQuote);
|
||||||
|
|
||||||
this.baseMenuCodeBlock = new CodeBlock({ menuType: "button", enable: true });
|
this.baseMenuCode = new Code({ menuType: "button", enable: true });
|
||||||
this.eventComponents.push(this.baseMenuCodeBlock);
|
this.eventComponents.push(this.baseMenuCode);
|
||||||
|
|
||||||
this.baseMenuPrint = new Print({ menuType: "button", enable: true, header: "classic", hideText: false });
|
this.baseMenuPrint = new Print({ menuType: "button", enable: true, header: "classic", hideText: false });
|
||||||
this.eventComponents.push(this.baseMenuPrint);
|
this.eventComponents.push(this.baseMenuPrint);
|
||||||
@@ -537,7 +537,7 @@ export class Classic extends HTMLElement implements UAIEditorEventListener {
|
|||||||
group3.appendChild(this.baseMenuAlignJustify);
|
group3.appendChild(this.baseMenuAlignJustify);
|
||||||
group3.appendChild(this.baseMenuAlignDistributed);
|
group3.appendChild(this.baseMenuAlignDistributed);
|
||||||
group3.appendChild(this.baseMenuBlockQuote);
|
group3.appendChild(this.baseMenuBlockQuote);
|
||||||
group3.appendChild(this.baseMenuCodeBlock);
|
group3.appendChild(this.baseMenuCode);
|
||||||
|
|
||||||
const group4 = document.createElement("div");
|
const group4 = document.createElement("div");
|
||||||
group4.classList.add("uai-classic-virtual-group");
|
group4.classList.add("uai-classic-virtual-group");
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ import { Outdent } from "./base/Outdent.ts";
|
|||||||
import { LineHeight } from "./base/LineHeight.ts";
|
import { LineHeight } from "./base/LineHeight.ts";
|
||||||
|
|
||||||
import { BlockQuote } from "./base/BlockQuote.ts";
|
import { BlockQuote } from "./base/BlockQuote.ts";
|
||||||
import { CodeBlock } from "./base/CodeBlock.ts";
|
import { Code } from "./base/Code.ts";
|
||||||
|
|
||||||
import { Print } from "./base/Print.ts";
|
import { Print } from "./base/Print.ts";
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ export class Ribbon extends HTMLElement implements UAIEditorEventListener {
|
|||||||
baseMenuAlignJustify!: AlignJustify;
|
baseMenuAlignJustify!: AlignJustify;
|
||||||
baseMenuAlignDistributed!: AlignDistributed;
|
baseMenuAlignDistributed!: AlignDistributed;
|
||||||
baseMenuBlockQuote!: BlockQuote;
|
baseMenuBlockQuote!: BlockQuote;
|
||||||
baseMenuCodeBlock!: CodeBlock;
|
baseMenuCode!: Code;
|
||||||
baseMenuPrint!: Print;
|
baseMenuPrint!: Print;
|
||||||
|
|
||||||
// 插入菜单
|
// 插入菜单
|
||||||
@@ -410,8 +410,8 @@ export class Ribbon extends HTMLElement implements UAIEditorEventListener {
|
|||||||
this.baseMenuBlockQuote = new BlockQuote({ menuType: "button", enable: true });
|
this.baseMenuBlockQuote = new BlockQuote({ menuType: "button", enable: true });
|
||||||
this.eventComponents.push(this.baseMenuBlockQuote);
|
this.eventComponents.push(this.baseMenuBlockQuote);
|
||||||
|
|
||||||
this.baseMenuCodeBlock = new CodeBlock({ menuType: "button", enable: true });
|
this.baseMenuCode = new Code({ menuType: "button", enable: true });
|
||||||
this.eventComponents.push(this.baseMenuCodeBlock);
|
this.eventComponents.push(this.baseMenuCode);
|
||||||
|
|
||||||
this.baseMenuPrint = new Print({ menuType: "button", enable: true, huge: true, hideText: false });
|
this.baseMenuPrint = new Print({ menuType: "button", enable: true, huge: true, hideText: false });
|
||||||
this.eventComponents.push(this.baseMenuPrint);
|
this.eventComponents.push(this.baseMenuPrint);
|
||||||
@@ -584,7 +584,7 @@ export class Ribbon extends HTMLElement implements UAIEditorEventListener {
|
|||||||
group3row2.appendChild(this.baseMenuAlignJustify);
|
group3row2.appendChild(this.baseMenuAlignJustify);
|
||||||
group3row2.appendChild(this.baseMenuAlignDistributed);
|
group3row2.appendChild(this.baseMenuAlignDistributed);
|
||||||
group3row2.appendChild(this.baseMenuBlockQuote);
|
group3row2.appendChild(this.baseMenuBlockQuote);
|
||||||
group3row2.appendChild(this.baseMenuCodeBlock);
|
group3row2.appendChild(this.baseMenuCode);
|
||||||
|
|
||||||
const group4 = document.createElement("div");
|
const group4 = document.createElement("div");
|
||||||
group4.classList.add("uai-ribbon-virtual-group");
|
group4.classList.add("uai-ribbon-virtual-group");
|
||||||
|
|||||||
+5
-5
@@ -8,20 +8,20 @@ import { t } from "i18next";
|
|||||||
import { UAIEditorEventListener, UAIEditorOptions } from "../../../../core/UAIEditor.ts";
|
import { UAIEditorEventListener, UAIEditorOptions } from "../../../../core/UAIEditor.ts";
|
||||||
import { MenuButton, MenuButtonOptions } from "../../MenuButton.ts";
|
import { MenuButton, MenuButtonOptions } from "../../MenuButton.ts";
|
||||||
|
|
||||||
import icon from "../../../../assets/icons/codeblock.svg";
|
import icon from "../../../../assets/icons/code.svg";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 基础菜单:设置代码块
|
* 基础菜单:设置代码
|
||||||
*/
|
*/
|
||||||
export class CodeBlock extends HTMLElement implements UAIEditorEventListener {
|
export class Code extends HTMLElement implements UAIEditorEventListener {
|
||||||
// 按钮选项
|
// 按钮选项
|
||||||
menuButtonOptions: MenuButtonOptions = {
|
menuButtonOptions: MenuButtonOptions = {
|
||||||
menuType: "button",
|
menuType: "button",
|
||||||
enable: true,
|
enable: true,
|
||||||
icon: icon,
|
icon: icon,
|
||||||
hideText: true,
|
hideText: true,
|
||||||
text: t('base.codeblock'),
|
text: t('base.code'),
|
||||||
tooltip: t('base.codeblock'),
|
tooltip: t('base.code'),
|
||||||
shortcut: "Ctrl+E",
|
shortcut: "Ctrl+E",
|
||||||
}
|
}
|
||||||
|
|
||||||
+1
-1
@@ -28,7 +28,7 @@ export const zh = {
|
|||||||
"bgColor": "字体背景颜色",
|
"bgColor": "字体背景颜色",
|
||||||
"bold": "粗体",
|
"bold": "粗体",
|
||||||
"clearFormat": "清除文本格式",
|
"clearFormat": "清除文本格式",
|
||||||
"codeblock": "代码",
|
"code": "代码",
|
||||||
"color": "字体颜色",
|
"color": "字体颜色",
|
||||||
"fontFamily": {
|
"fontFamily": {
|
||||||
"text": "选择字体",
|
"text": "选择字体",
|
||||||
|
|||||||
Reference in New Issue
Block a user