|
@@ -523,7 +523,15 @@ export default {
|
|
|
header: [], // 页眉配置
|
|
|
main: [], // 主要编辑内容
|
|
|
footer: [], // 页脚信息
|
|
|
- options: IEditorOption,
|
|
|
+ options:{
|
|
|
+ width: 794, // A4 纸张宽度
|
|
|
+ height: 1123, // A4 纸张高度
|
|
|
+ defaultSize:Number(this.editorOptions.size) ,
|
|
|
+ defaultFont: this.editorOptions.font,
|
|
|
+ // defaultSize: 14,//Number(this.editorOptions.size),
|
|
|
+ defaultBold: this.editorOptions.bold,
|
|
|
+ defaultAlign: this.editorOptions.align
|
|
|
+ },// IEditorOption,
|
|
|
// 批注 TODO
|
|
|
commentList: [],
|
|
|
};
|
|
@@ -541,6 +549,15 @@ export default {
|
|
|
docJson: {
|
|
|
type: String,
|
|
|
},
|
|
|
+ editorOptions: {
|
|
|
+ type: Object,
|
|
|
+ default: () => ({
|
|
|
+ defaultFont: 'Arial',
|
|
|
+ //defaultSize: 14,
|
|
|
+ defaultBold: false,
|
|
|
+ defaultAlign: 'left'
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
watch: {
|
|
|
// 监听父组件传过来的编辑模式,设置模式
|
|
@@ -582,6 +599,7 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|
|
|
+ console.log(this.editorOptions);
|
|
|
const isApple =
|
|
|
typeof navigator !== "undefined" && /Mac OS X/.test(navigator.userAgent);
|
|
|
const instance = new Editor(
|
|
@@ -590,7 +608,10 @@ export default {
|
|
|
header: this.header,
|
|
|
main: this.main,
|
|
|
footer: this.footer,
|
|
|
- defaultFont: 'Arial', // 添加默认字体配置
|
|
|
+ defaultFont: this.editorOptions.font,
|
|
|
+ // defaultSize: 14,//Number(this.editorOptions.size),
|
|
|
+ defaultBold: this.editorOptions.bold,
|
|
|
+ defaultAlign: this.editorOptions.align
|
|
|
},
|
|
|
this.options
|
|
|
);
|
|
@@ -2206,6 +2227,20 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
]);
|
|
|
+
|
|
|
+ /* // 设置初始样式
|
|
|
+ this.$nextTick(() => {
|
|
|
+ // 设置字体
|
|
|
+ instance.command.executeFont(this.editorOptions.defaultFont)
|
|
|
+ // 设置字号
|
|
|
+ instance.command.executeSize(this.editorOptions.defaultSize)
|
|
|
+ // 设置加粗
|
|
|
+ if (this.editorOptions.defaultBold) {
|
|
|
+ instance.command.executeBold()
|
|
|
+ }
|
|
|
+ // 设置对齐方式
|
|
|
+ instance.command.executeAlign(this.editorOptions.defaultAlign)
|
|
|
+ }) */
|
|
|
},
|
|
|
};
|
|
|
</script>
|