From 73014dc87be5360ab8f09e211a12b06dfcbb77e2 Mon Sep 17 00:00:00 2001 From: Hufe921 Date: Fri, 28 Jul 2023 17:52:14 +0800 Subject: [PATCH] fix: limit word break element type --- src/editor/core/draw/particle/TextParticle.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/editor/core/draw/particle/TextParticle.ts b/src/editor/core/draw/particle/TextParticle.ts index 3df406d..25c85db 100644 --- a/src/editor/core/draw/particle/TextParticle.ts +++ b/src/editor/core/draw/particle/TextParticle.ts @@ -1,4 +1,4 @@ -import { IElement } from '../../..' +import { ElementType, IElement } from '../../..' import { PUNCTUATION_LIST } from '../../../dataset/constant/Common' import { LETTER_REG } from '../../../dataset/constant/Regular' import { IRowElement } from '../../../interface/Row' @@ -37,7 +37,10 @@ export class TextParticle { let i = curIndex while (i < elementList.length) { const element = elementList[i] - if (!LETTER_REG.test(element.value)) { + if ( + (element.type && element.type !== ElementType.TEXT) || + !LETTER_REG.test(element.value) + ) { endElement = element break }