@@ -8,6 +8,7 @@ import { useTransformer } from './generator/transformer'
88import { useToast } from 'vue-toastification'
99import { useI18n } from 'vue-i18n'
1010import { useStorage } from './storage/storage'
11+ import { useEntity } from './entity'
1112
1213export const useCharacters = ( ) => {
1314 const CONTEXT = useContextStore ( )
@@ -19,6 +20,7 @@ export const useCharacters = () => {
1920 const toast = useToast ( )
2021 const { t } = useI18n ( )
2122 const storage = useStorage ( )
23+ const ent = useEntity ( )
2224
2325 const handler = ( index ?: ID < number > , inner ?: string ) => {
2426 const getEntities = ( index ?: ID < number > ) : Entities => {
@@ -32,7 +34,12 @@ export const useCharacters = () => {
3234 str : string ,
3335 c : ProjectStateCharacter
3436 ) => {
35- const text = utils . text ( ) . defaultWhitespace ( str )
37+ if ( ! ent . utils ( ) . isTextBlock ( entity . type ) ) return
38+
39+ const text = ASTUtils . normalize ( str , { type : 'all' , whitespace : true } )
40+
41+ if ( ! text ) return
42+
3643 const color = utils . convert ( ) . hexToRgbA ( c . color , c . colorAlpha )
3744
3845 const isValidImportant =
@@ -64,17 +71,12 @@ export const useCharacters = () => {
6471 default :
6572 break
6673 }
67-
68- /*
69- if (!text.toLowerCase().includes(c.name.toLowerCase()))
70- entity.visual.custom = undefined
71- */
7274 }
7375
74- entities . forEach ( ( e ) => {
76+ entities . forEach ( ( e , i ) => {
7577 e . visual . custom = undefined
7678
77- PROJECT . characters ?. list ?. forEach ( ( character , i ) => {
79+ PROJECT . characters ?. list ?. forEach ( ( character ) => {
7880 onSetter ( e , i === 0 && inner ? inner : e . raw , character )
7981 } )
8082 } )
0 commit comments