diff --git a/src/canvas/index.js b/src/canvas/index.js index 935224289..7397b3c4a 100644 --- a/src/canvas/index.js +++ b/src/canvas/index.js @@ -84,6 +84,10 @@ export default () => { return this; }, + getModel() { + return canvas; + }, + /** * Get the configuration object * @return {Object} diff --git a/src/commands/view/SwitchVisibility.js b/src/commands/view/SwitchVisibility.js index 80a30a790..8dba5761d 100644 --- a/src/commands/view/SwitchVisibility.js +++ b/src/commands/view/SwitchVisibility.js @@ -15,9 +15,12 @@ export default { toggleVis(ed, active = 1) { if (!ed.Commands.isActive('preview')) { - const cvModel = ed.Canvas.getCanvasView().model; - ed.Canvas.getFrames().forEach(frame => this._upFrame(frame, active)); - cvModel[active ? 'on' : 'off']('change:frames', this._onFramesChange); + const cv = ed.Canvas; + cv.getFrames().forEach(frame => this._upFrame(frame, active)); + cv.getModel()[active ? 'on' : 'off']( + 'change:frames', + this._onFramesChange + ); } },