From 31c0def73d68d3e89eabe00290cf7e120e51e777 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Fri, 11 May 2018 18:11:56 +0200 Subject: [PATCH] Move the undo manager stop in getModelToStyle --- src/style_manager/index.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/style_manager/index.js b/src/style_manager/index.js index bd9e2bdc3..76e29d341 100644 --- a/src/style_manager/index.js +++ b/src/style_manager/index.js @@ -270,20 +270,20 @@ module.exports = () => { const opts = { state }; let rule; + // I stop undo manager here as after adding the CSSRule (generally after + // selecting the component) and calling undo() it will remove the rule from + // the collection, therefore updating it in style manager will not affect it + // #268 + um.stop(); + if (hasClasses) { const deviceW = em.getCurrentMedia(); rule = cssC.get(valid, state, deviceW); if (!rule) { - // I stop undo manager here as after adding the CSSRule (generally after - // selecting the component) and calling undo() it will remove the rule from - // the collection, therefore updating it in style manager will not affect it - // #268 - um.stop(); rule = cssC.add(valid, state, deviceW); rule.setStyle(model.getStyle()); model.setStyle({}); - um.start(); } } else if (config.avoidInlineStyle) { rule = cssC.getIdRule(id, opts); @@ -291,6 +291,7 @@ module.exports = () => { } rule && (model = rule); + um.start(); } return model;