diff --git a/src/config/menus.ts b/src/config/menus.ts index e7cb224..e19e417 100644 --- a/src/config/menus.ts +++ b/src/config/menus.ts @@ -4,7 +4,7 @@ */ export default { - menus: ['bold', 'head', 'link', 'underline', 'strikethrough', 'fontStyle'], + menus: ['bold', 'head', 'link', 'underline', 'strikeThrough', 'fontStyle'], fontNames: ['宋体', '微软雅黑', 'Arial', 'Tahoma', 'Verdana'], diff --git a/src/menus/font-style/FontStyleList.ts b/src/menus/font-style/FontStyleList.ts index d461173..2776381 100644 --- a/src/menus/font-style/FontStyleList.ts +++ b/src/menus/font-style/FontStyleList.ts @@ -2,12 +2,8 @@ * @description 字体 class * @author dyl */ -import $, { DomElement } from '../../utils/dom-core' - -export type DroListItem = { - $elem: DomElement - value: string -} +import $ from '../../utils/dom-core' +import { DropListItem } from '../menu-constructors/DropList' /** * 封装的一个字体菜单列表数据的组装对象, @@ -16,7 +12,7 @@ export type DroListItem = { * 因此,想着顺便研究实践下ts,遍创建了这样一个类 */ class FontStyleList { - private itemList: DroListItem[] + private itemList: DropListItem[] constructor(list: string[]) { this.itemList = [] @@ -28,7 +24,7 @@ class FontStyleList { }) } - public getItemList(): DroListItem[] { + public getItemList(): DropListItem[] { return this.itemList } } diff --git a/src/menus/menu-constructors/DropList.ts b/src/menus/menu-constructors/DropList.ts index 5cae9d8..1ace0d0 100644 --- a/src/menus/menu-constructors/DropList.ts +++ b/src/menus/menu-constructors/DropList.ts @@ -6,7 +6,7 @@ import $, { DomElement } from '../../utils/dom-core' import DropListMenu from './DropListMenu' import { EMPTY_FN } from '../../utils/const' -export type DroListItem = { +export type DropListItem = { $elem: DomElement value: string } @@ -14,7 +14,7 @@ export type DroListItem = { // droplist 的配置数据 export type DropListConf = { title: string - list: DroListItem[] + list: DropListItem[] type: string // 'list' 列表形式(如“标题”菜单); 'inline-block' 块状形式(如“颜色”菜单) clickHandler: Function width: number | 100 diff --git a/src/menus/menu-list.ts b/src/menus/menu-list.ts index 5bb18e7..dfb9718 100644 --- a/src/menus/menu-list.ts +++ b/src/menus/menu-list.ts @@ -7,7 +7,7 @@ import Bold from './bold/index' import Head from './head/index' import Link from './link/index' import Underline from './underline/index' -import Strikethrough from './strikethrough/index' +import StrikeThrough from './strike-through/index' import FontStyle from './font-style/index' export default { @@ -15,6 +15,6 @@ export default { head: Head, link: Link, underline: Underline, - strikethrough: Strikethrough, + strikeThrough: StrikeThrough, fontStyle: FontStyle, } diff --git a/src/menus/strikethrough/index.ts b/src/menus/strike-through/index.ts similarity index 93% rename from src/menus/strikethrough/index.ts rename to src/menus/strike-through/index.ts index e71cd8c..1f59942 100644 --- a/src/menus/strikethrough/index.ts +++ b/src/menus/strike-through/index.ts @@ -8,7 +8,7 @@ import $ from '../../utils/dom-core' import Editor from '../../editor/index' import { MenuActive } from '../menu-constructors/Menu' -class Strikethrough extends BtnMenu implements MenuActive { +class StrikeThrough extends BtnMenu implements MenuActive { constructor(editor: Editor) { const $elem = $( `