优化 除了英文字符换行问题

This commit is contained in:
yf 2025-01-06 12:35:50 +08:00
parent f5083ca420
commit dfe4c43765
2 changed files with 54 additions and 4 deletions

View File

@ -12,8 +12,8 @@
<span
:id="textElId"
:style="cellInfo.style.text"
style="word-break: keep-all; white-space: normal; overflow-wrap: break-word;"
v-html="safeHtml(cellInfo.label)">
style="word-break: keep-all; white-space: normal; overflow-wrap: break-word;hyphens: auto;"
v-html="safeHtml(textShowLabel)">
</span>
<el-dialog
v-model="cellInfo.showInput"
@ -99,7 +99,32 @@ export default defineComponent({
targetElement: null
}
},
computed: {
textShowLabel() {
// ,&#8203;
if(this.cellInfo.label){
let text = this.cellInfo.label;
text = text.replaceAll('"', "“");
text = text.replaceAll(',', ",&#8203;");
text = text.replaceAll('.', ".&#8203;");
text = text.replaceAll(':', ":&#8203;");
text = text.replaceAll('!', "!&#8203;");
text = text.replaceAll('?', "?&#8203;");
text = text.replaceAll("'", "'&#8203;");
text = text.replaceAll('-', "-&#8203;");
text = text.replaceAll('—', "—&#8203;");
text = text.replaceAll('/', "/&#8203;");
text = text.replaceAll('(', "(&#8203;");
text = text.replaceAll(')', ")&#8203;");
text = text.replaceAll('+', "+&#8203;");
text = text.replaceAll('=', "=&#8203;");
return text;
}
return this.cellInfo.label
}
},
mounted() {
const node = (this as any).getNode()
this.nodeInfo = node

View File

@ -12,8 +12,8 @@
<span
:id="textElId"
:style="cellInfo.style.text"
style="word-break: keep-all; white-space: normal; overflow-wrap: break-word;"
v-html="safeHtml(cellInfo.label)">
style="word-break: keep-all; white-space: normal; overflow-wrap: break-word;hyphens: auto;"
v-html="safeHtml(textShowLabel)">
</span>
<el-dialog
v-model="cellInfo.showInput"
@ -99,7 +99,32 @@ export default defineComponent({
targetElement: null
}
},
computed: {
textShowLabel() {
// ,&#8203;
if(this.cellInfo.label){
let text = this.cellInfo.label;
text = text.replaceAll('"', "“");
text = text.replaceAll(',', ",&#8203;");
text = text.replaceAll('.', ".&#8203;");
text = text.replaceAll(':', ":&#8203;");
text = text.replaceAll('!', "!&#8203;");
text = text.replaceAll('?', "?&#8203;");
text = text.replaceAll("'", "'&#8203;");
text = text.replaceAll('-', "-&#8203;");
text = text.replaceAll('—', "—&#8203;");
text = text.replaceAll('/', "/&#8203;");
text = text.replaceAll('(', "(&#8203;");
text = text.replaceAll(')', ")&#8203;");
text = text.replaceAll('+', "+&#8203;");
text = text.replaceAll('=', "=&#8203;");
return text;
}
return this.cellInfo.label
}
},
mounted() {
const node = (this as any).getNode()
this.nodeInfo = node