diff --git a/src/editor/index.ts b/src/editor/index.ts index 12909b0..2e44eba 100644 --- a/src/editor/index.ts +++ b/src/editor/index.ts @@ -68,6 +68,7 @@ import { IPageBreak } from './interface/PageBreak' import { LETTER_CLASS } from './dataset/constant/Common' import { INTERNAL_CONTEXT_MENU_KEY } from './dataset/constant/ContextMenu' import { IRange } from './interface/Range' +import { splitText } from './utils' export default class Editor { public command: Command @@ -248,11 +249,14 @@ export default class Editor { } } -// 对外对象 +// 对外方法 +export { splitText } + +// 对外常量 +export { EDITOR_COMPONENT, LETTER_CLASS, INTERNAL_CONTEXT_MENU_KEY } + +// 对外枚举 export { - EDITOR_COMPONENT, - LETTER_CLASS, - INTERNAL_CONTEXT_MENU_KEY, Editor, RowFlex, VerticalAlign, diff --git a/src/main.ts b/src/main.ts index 5c6128f..f5e786d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -17,7 +17,8 @@ import Editor, { PageMode, PaperDirection, RowFlex, - TitleLevel + TitleLevel, + splitText } from './editor' import { Dialog } from './components/dialog/Dialog' import { formatPrismToken } from './utils/prism' @@ -442,7 +443,7 @@ window.onload = function () { type: ElementType.HYPERLINK, value: '', url, - valueList: name.split('').map(n => ({ + valueList: splitText(name).map(n => ({ value: n, size: 16 })) @@ -563,7 +564,7 @@ window.onload = function () { const elementList: IElement[] = [] for (let i = 0; i < formatTokenList.length; i++) { const formatToken = formatTokenList[i] - const tokenStringList = formatToken.content.split('') + const tokenStringList = splitText(formatToken.content) for (let j = 0; j < tokenStringList.length; j++) { const value = tokenStringList[j] const element: IElement = {