Skip to content

Commit

Permalink
feat: delete unnecessary observer to adapt old version browers
Browse files Browse the repository at this point in the history
  • Loading branch information
jiawei686 committed Nov 25, 2022
1 parent 729b404 commit 869963c
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions src/Cherry.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@ export default class Cherry extends CherryStatic {
// 切换模式,有纯预览模式、纯编辑模式、双栏编辑模式
this.switchModel(this.options.editor.defaultModel);

this.cherryDomResize();

Event.on(this.instanceId, Event.Events.toolbarHide, () => {
this.status.toolbar = 'hide';
});
Expand All @@ -184,22 +182,6 @@ export default class Cherry extends CherryStatic {
});
}

/**
* 监听 cherry 高度变化,高度改变触发 codemirror 内容刷新
* @private
*/
cherryDomResize() {
const observer = new ResizeObserver((entries) => {
for (const {} of entries) {
setTimeout(() => this.editor.editor.refresh(), 10);
}
});

observer.observe(this.cherryDom);

this.cherryDomReiszeObserver = observer;
}

/**
* 切换编辑模式
* @param {'edit&preview'|'editOnly'|'previewOnly'} model 模式类型
Expand Down

0 comments on commit 869963c

Please sign in to comment.