chore: export splitText function

This commit is contained in:
Hufe921
2023-12-06 20:30:55 +08:00
parent 3f1babec68
commit bcbd879e0f
2 changed files with 12 additions and 7 deletions
+8 -4
View File
@@ -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,
+4 -3
View File
@@ -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 = {