Skip to content

Commit fc8ffc4

Browse files
committed
fix: #155
#!zh: 文字组件 h1 的样式 编辑模式和预览模式不一致 #!en: text component appears differently inedit mode and preview mode
1 parent be68bae commit fc8ffc4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

front-end/h5/src/components/plugins/lbp-text.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @Author: ly525
33
* @Date: 2019-11-24 18:51:58
44
* @LastEditors: ly525
5-
* @LastEditTime: 2019-11-30 23:01:55
5+
* @LastEditTime: 2020-04-25 11:14:38
66
* @FilePath: /luban-h5/front-end/h5/src/components/plugins/lbp-text.js
77
* @Github: https://github.com/ly525/luban-h5
88
* @Description: luban-h5 text component/plugin
@@ -27,7 +27,13 @@ export default {
2727
border: `${this.borderWidth}px solid ${this.borderColor}`,
2828
borderRadius: `${this.borderRadius}px`
2929
}
30-
const pureText = <div domPropsInnerHTML={this.text} class="ql-editor ql-container"></div>
30+
/**
31+
* https://github.com/ly525/luban-h5/issues/155
32+
* 需要给预览模式的文字添加 ql-snow 样式原因:文字样式和文字编辑器(ql-editor)的 theme 有关系
33+
* 比如编辑模式 h1 样式为:.ql-snow .ql-editor h1 {font-size: 2em;}
34+
* 因此预览模式的文字内容也需要加上 div.ql-snow > div.ql-editor 作为wrapper
35+
*/
36+
const previewText = <div class="ql-snow"><div domPropsInnerHTML={this.text} class="ql-editor ql-container"></div></div>
3137
return (
3238
<div
3339
onDblclick={e => {
@@ -68,7 +74,7 @@ export default {
6874
})
6975
}}>
7076
</quillEditor>
71-
: pureText
77+
: previewText
7278
}
7379
</div>
7480
)

0 commit comments

Comments
 (0)