Update index.ts

This commit is contained in:
yanmao 2022-01-05 00:46:29 +08:00
parent 6a87ef0e30
commit 7cfac41029
1 changed files with 4 additions and 4 deletions

View File

@ -319,7 +319,7 @@ class TableComponent<V extends TableValue = TableValue>
if (this.colorTool) return; if (this.colorTool) return;
this.colorTool = new ColorTool(this.editor, this.id, { this.colorTool = new ColorTool(this.editor, this.id, {
colors: TableComponent.colors, colors: TableComponent.colors,
defaultColor: this.getValue()?.color, defaultColor: super.getValue()?.color,
onChange: (color: string) => { onChange: (color: string) => {
this.setValue({ this.setValue({
color, color,
@ -356,14 +356,14 @@ class TableComponent<V extends TableValue = TableValue>
title: language['noBorder'], title: language['noBorder'],
content: '<span class="data-icon data-icon-no-border"></span>', content: '<span class="data-icon data-icon-no-border"></span>',
didMount: (node) => { didMount: (node) => {
const value = this.getValue(); const value = super.getValue();
if (value?.noBorder === true) { if (value?.noBorder === true) {
node.addClass('active'); node.addClass('active');
} }
this.noBorderToolButton = node; this.noBorderToolButton = node;
}, },
onClick: (_, node) => { onClick: (_, node) => {
const value = this.getValue(); const value = super.getValue();
this.setValue({ this.setValue({
noBorder: !value?.noBorder, noBorder: !value?.noBorder,
} as V); } as V);
@ -802,7 +802,6 @@ class TableComponent<V extends TableValue = TableValue>
render() { render() {
Template.isReadonly = !isEngine(this.editor) || this.editor.readonly; Template.isReadonly = !isEngine(this.editor) || this.editor.readonly;
const value = this.getValue();
// 重新渲染 // 重新渲染
if ( if (
this.wrapper && this.wrapper &&
@ -875,6 +874,7 @@ class TableComponent<V extends TableValue = TableValue>
}, 10); }, 10);
return; return;
} }
const value = this.getValue();
// 第一次渲染 // 第一次渲染
if (!value) return 'Error value'; if (!value) return 'Error value';
if (value.html) { if (value.html) {