|
|
@@ -51,7 +51,8 @@
|
|
|
}"
|
|
|
>
|
|
|
<div class="cell-wrap">
|
|
|
- <div class="cell-wrap-content" :style="[tdStyle, computedRichStyle(col.content)]">
|
|
|
+ <!-- , computedRichStyle(col.content) -->
|
|
|
+ <div class="cell-wrap-content" :style="[tdStyle(col.content)]">
|
|
|
<template v-if="isEnable(data.property.view_pinyin)">
|
|
|
<template v-if="col.rich_text_list">
|
|
|
<div
|
|
|
@@ -86,7 +87,9 @@
|
|
|
'align-items': getWordAlignItems(word, item),
|
|
|
}"
|
|
|
>
|
|
|
- <span class="pinyin" :style="getPinyinStyle(word)"> {{ word.pinyin }}</span>
|
|
|
+ <span class="pinyin" :style="getPinyinStyle(word)">
|
|
|
+ {{ word.pinyin.trim() ? word.pinyin : ' ' }}</span
|
|
|
+ >
|
|
|
<span class="py-char" :style="getCharStyle(word, item)">{{
|
|
|
convertText(word.text)
|
|
|
}}</span>
|
|
|
@@ -100,7 +103,7 @@
|
|
|
v-model="word.value"
|
|
|
:disabled="disabled"
|
|
|
:class="[...computedAnswerClass(word, i, j)]"
|
|
|
- :style="[{ width: Math.max(40, word.value.length * 21.3) + 'px' }]"
|
|
|
+ :style="getInputStyle(item.styleObj, word)"
|
|
|
/>
|
|
|
</template>
|
|
|
<template v-else-if="data.property.fill_type === fillTypeList[1].value">
|
|
|
@@ -121,7 +124,7 @@
|
|
|
v-model="word.value"
|
|
|
:readonly="true"
|
|
|
:class="[...computedAnswerClass(word, i, j)]"
|
|
|
- :style="[{ width: Math.max(40, word.value.length * 21.3) + 'px' }]"
|
|
|
+ :style="getInputStyle(item.styleObj, word)"
|
|
|
/>
|
|
|
</el-popover>
|
|
|
</template>
|
|
|
@@ -237,7 +240,17 @@
|
|
|
v-model="item.value"
|
|
|
:disabled="disabled"
|
|
|
:class="[...computedAnswerClass(item, i, j)]"
|
|
|
- :style="[{ width: Math.max(40, item.value.length * 21.3) + 'px' }]"
|
|
|
+ :style="[
|
|
|
+ {
|
|
|
+ width: Math.max(40, item.value.length * 21.3) + 'px',
|
|
|
+ fontSize:
|
|
|
+ data.unified_attrib && data.unified_attrib.font_size
|
|
|
+ ? data.unified_attrib.font_size
|
|
|
+ : '',
|
|
|
+ fontFamily:
|
|
|
+ data.unified_attrib && data.unified_attrib.font ? data.unified_attrib.font : '',
|
|
|
+ },
|
|
|
+ ]"
|
|
|
/>
|
|
|
</template>
|
|
|
<template v-else-if="data.property.fill_type === fillTypeList[1].value">
|
|
|
@@ -303,7 +316,8 @@
|
|
|
@click="toggle(col)"
|
|
|
></i>
|
|
|
</div>
|
|
|
- <span v-if="showLang" class="multilingual" :style="[tdStyle, computedRichStyle(col.content)]">
|
|
|
+ <!-- , computedRichStyle(col.content) -->
|
|
|
+ <span v-if="showLang" class="multilingual" :style="[tdStyle(col.content)]">
|
|
|
{{
|
|
|
multilingualTextList[getLang()] &&
|
|
|
multilingualTextList[getLang()][i] &&
|
|
|
@@ -387,7 +401,8 @@
|
|
|
}"
|
|
|
>
|
|
|
<div class="cell-wrap">
|
|
|
- <div class="cell-wrap-content" :style="[tdStyle, computedRichStyle(col.content)]">
|
|
|
+ <!-- , computedRichStyle(col.content) -->
|
|
|
+ <div class="cell-wrap-content" :style="[tdStyle(col.content)]">
|
|
|
<template v-if="isEnable(data.property.view_pinyin)">
|
|
|
<template v-if="col.rich_text_list">
|
|
|
<div
|
|
|
@@ -422,7 +437,9 @@
|
|
|
'align-items': getWordAlignItems(word, item),
|
|
|
}"
|
|
|
>
|
|
|
- <span class="pinyin" :style="getPinyinStyle(word)"> {{ word.pinyin }}</span>
|
|
|
+ <span class="pinyin" :style="getPinyinStyle(word)">{{
|
|
|
+ word.pinyin.trim() ? word.pinyin : ' '
|
|
|
+ }}</span>
|
|
|
<span class="py-char" :style="getCharStyle(word, item)">{{
|
|
|
convertText(word.text)
|
|
|
}}</span>
|
|
|
@@ -586,7 +603,8 @@
|
|
|
style="display: block; width: 18px; height: 18px; border: 1px solid #30a47d"
|
|
|
></i>
|
|
|
</div>
|
|
|
- <span v-if="showLang" class="multilingual" :style="[tdStyle, computedRichStyle(col.content)]">
|
|
|
+ <!-- , computedRichStyle(col.content) -->
|
|
|
+ <span v-if="showLang" class="multilingual" :style="[tdStyle(col.content)]">
|
|
|
{{
|
|
|
multilingualTextList[getLang()] &&
|
|
|
multilingualTextList[getLang()][i] &&
|
|
|
@@ -639,25 +657,51 @@ export default {
|
|
|
},
|
|
|
computed: {
|
|
|
tdStyle() {
|
|
|
- let obj = {};
|
|
|
- // if (this.data.mode === 'short') {
|
|
|
- let styles = this.data.styles;
|
|
|
- obj = {
|
|
|
- fontFamily: styles.fontFamily,
|
|
|
- fontSize: styles.fontSize,
|
|
|
- color: styles.fontColor,
|
|
|
- textDecoration: styles.isUnderline ? 'underline' : styles.isStrikethrough ? 'line-through' : '',
|
|
|
- fontWeight: styles.isBold ? 'bold' : '',
|
|
|
- fontStyle: styles.isItalic ? 'italic' : '',
|
|
|
- justifyContent: styles.textAlign === 'MIDDLE' ? 'center' : styles.textAlign === 'RIGHT' ? 'end' : 'left',
|
|
|
- textAlign: styles.textAlign === 'MIDDLE' ? 'center' : styles.textAlign === 'RIGHT' ? 'end' : 'left',
|
|
|
+ return function (content) {
|
|
|
+ if (!content) return {};
|
|
|
+
|
|
|
+ let styleObject = {};
|
|
|
+ // 提取首个标签的 style 样式属性
|
|
|
+ let styleMatch = content.match(/<\w+\s+[^>]*style=["']([^"']*)["'][^>]*>/i);
|
|
|
+ if (styleMatch && styleMatch[1]) {
|
|
|
+ let styleString = styleMatch[1];
|
|
|
+ let styleArray = styleString.split(';').filter((s) => s.trim() !== '');
|
|
|
+ styleArray.forEach((style) => {
|
|
|
+ let [key, value] = style.split(':');
|
|
|
+ if (key && value) {
|
|
|
+ styleObject[key.trim()] = value.trim();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (styleObject.hasOwnProperty('text-align')) {
|
|
|
+ if (styleObject['text-align'] === 'center') {
|
|
|
+ this.$set(styleObject, 'justify-content', 'center');
|
|
|
+ } else if (styleObject['text-align'] === 'right') {
|
|
|
+ this.$set(styleObject, 'justify-content', 'end');
|
|
|
+ } else {
|
|
|
+ this.$set(styleObject, 'justify-content', 'left');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let obj = {};
|
|
|
+ // if (this.data.mode === 'short') {
|
|
|
+ let styles = this.data.styles;
|
|
|
+ obj = {
|
|
|
+ fontFamily: styles.fontFamily,
|
|
|
+ fontSize: styles.fontSize,
|
|
|
+ color: styles.fontColor,
|
|
|
+ textDecoration: styles.isUnderline ? 'underline' : styles.isStrikethrough ? 'line-through' : '',
|
|
|
+ fontWeight: styles.isBold ? 'bold' : '',
|
|
|
+ fontStyle: styles.isItalic ? 'italic' : '',
|
|
|
+ // justifyContent: styles.textAlign === 'MIDDLE' ? 'center' : styles.textAlign === 'RIGHT' ? 'end' : 'left',
|
|
|
+ // textAlign: styles.textAlign === 'MIDDLE' ? 'center' : styles.textAlign === 'RIGHT' ? 'end' : 'left',
|
|
|
+ };
|
|
|
+ // } else {
|
|
|
+ // obj = {
|
|
|
+ // width: '100%',
|
|
|
+ // };
|
|
|
+ // }
|
|
|
+ return { ...obj, ...styleObject };
|
|
|
};
|
|
|
- // } else {
|
|
|
- // obj = {
|
|
|
- // width: '100%',
|
|
|
- // };
|
|
|
- // }
|
|
|
- return obj;
|
|
|
},
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -848,7 +892,13 @@ export default {
|
|
|
.map((tagItem) => tagItem.style)
|
|
|
.join(';');
|
|
|
|
|
|
- const styleObj = combinedStyle ? this.parseStyleToObject(combinedStyle) : null;
|
|
|
+ const styleObj = combinedStyle
|
|
|
+ ? this.parseStyleToObject(combinedStyle)
|
|
|
+ : {
|
|
|
+ fontSize:
|
|
|
+ this.data.unified_attrib && this.data.unified_attrib.font_size ? this.data.unified_attrib.font_size : '',
|
|
|
+ fontFamily: this.data.unified_attrib && this.data.unified_attrib.font ? this.data.unified_attrib.font : '',
|
|
|
+ };
|
|
|
|
|
|
return {
|
|
|
type: 'text',
|
|
|
@@ -866,7 +916,8 @@ export default {
|
|
|
|
|
|
// 固定使用 League 字体
|
|
|
styles['font-family'] = 'League';
|
|
|
-
|
|
|
+ styles['font-size'] =
|
|
|
+ this.data.unified_attrib && this.data.unified_attrib.pinyin_size ? this.data.unified_attrib.pinyin_size : '';
|
|
|
// 只继承字号和颜色
|
|
|
if (item.activeTextStyle) {
|
|
|
if (item.activeTextStyle.fontSize) {
|
|
|
@@ -918,6 +969,16 @@ export default {
|
|
|
|
|
|
return baseStyle;
|
|
|
},
|
|
|
+ // input的高度
|
|
|
+ getInputStyle(styles, words) {
|
|
|
+ const baseStyle = {};
|
|
|
+ baseStyle['font-size'] = styles ? styles.fontSize : '16px';
|
|
|
+ baseStyle['--input-font-family'] = styles ? styles.fontFamily : '';
|
|
|
+ baseStyle['width'] = Math.max(40, words.value.length * 21.3) + 'px';
|
|
|
+ baseStyle['height'] = styles && styles.fontSize ? styles.fontSize.replace('pt', '') * 1.5 + 'pt' : '24px';
|
|
|
+
|
|
|
+ return baseStyle;
|
|
|
+ },
|
|
|
// 如果汉字有字间距,拼音与汉字左对齐,如果没有则居中对齐
|
|
|
getWordAlignItems(word, block) {
|
|
|
const letterSpacing = block.styleObj?.letterSpacing;
|
|
|
@@ -1411,6 +1472,7 @@ $border-color: #e6e6e6;
|
|
|
|
|
|
:deep input.el-input__inner {
|
|
|
padding: 0;
|
|
|
+ font-family: var(--input-font-family);
|
|
|
|
|
|
// font-size: 16pt;
|
|
|
color: $font-color;
|
|
|
@@ -1484,6 +1546,7 @@ $border-color: #e6e6e6;
|
|
|
|
|
|
span {
|
|
|
display: inline-flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
}
|
|
|
|
|
|
.pinyin-sentence {
|