chore: export splitText function

pr675
Hufe921 2 years ago
parent 3f1babec68
commit bcbd879e0f

@ -68,6 +68,7 @@ import { IPageBreak } from './interface/PageBreak'
import { LETTER_CLASS } from './dataset/constant/Common' import { LETTER_CLASS } from './dataset/constant/Common'
import { INTERNAL_CONTEXT_MENU_KEY } from './dataset/constant/ContextMenu' import { INTERNAL_CONTEXT_MENU_KEY } from './dataset/constant/ContextMenu'
import { IRange } from './interface/Range' import { IRange } from './interface/Range'
import { splitText } from './utils'
export default class Editor { export default class Editor {
public command: Command public command: Command
@ -248,11 +249,14 @@ export default class Editor {
} }
} }
// 对外对象 // 对外方法
export { splitText }
// 对外常量
export { EDITOR_COMPONENT, LETTER_CLASS, INTERNAL_CONTEXT_MENU_KEY }
// 对外枚举
export { export {
EDITOR_COMPONENT,
LETTER_CLASS,
INTERNAL_CONTEXT_MENU_KEY,
Editor, Editor,
RowFlex, RowFlex,
VerticalAlign, VerticalAlign,

@ -17,7 +17,8 @@ import Editor, {
PageMode, PageMode,
PaperDirection, PaperDirection,
RowFlex, RowFlex,
TitleLevel TitleLevel,
splitText
} from './editor' } from './editor'
import { Dialog } from './components/dialog/Dialog' import { Dialog } from './components/dialog/Dialog'
import { formatPrismToken } from './utils/prism' import { formatPrismToken } from './utils/prism'
@ -442,7 +443,7 @@ window.onload = function () {
type: ElementType.HYPERLINK, type: ElementType.HYPERLINK,
value: '', value: '',
url, url,
valueList: name.split('').map(n => ({ valueList: splitText(name).map(n => ({
value: n, value: n,
size: 16 size: 16
})) }))
@ -563,7 +564,7 @@ window.onload = function () {
const elementList: IElement[] = [] const elementList: IElement[] = []
for (let i = 0; i < formatTokenList.length; i++) { for (let i = 0; i < formatTokenList.length; i++) {
const formatToken = formatTokenList[i] const formatToken = formatTokenList[i]
const tokenStringList = formatToken.content.split('') const tokenStringList = splitText(formatToken.content)
for (let j = 0; j < tokenStringList.length; j++) { for (let j = 0; j < tokenStringList.length; j++) {
const value = tokenStringList[j] const value = tokenStringList[j]
const element: IElement = { const element: IElement = {

Loading…
Cancel
Save