diff --git a/js/main.js b/js/main.js index 88ae00a..f054582 100644 --- a/js/main.js +++ b/js/main.js @@ -83,20 +83,14 @@ Extension.prototype.onSelectedElementChange = function(){ var self = this; - this.ensureDifferentElementSelected() - .then(function(){ - if (self.activeEditor){ - self.removeEditor(self.activeEditor); - } - - self.getSelectedElementStyles().then(function(data){ - self.controller.setModel(new app.Model(data)); - self.controller.setView(); - }); - }) - .catch(function(err){ - console.info("reselecting prev element; stop") - }) + if (this.activeEditor){ + this.removeEditor(this.activeEditor); + } + + self.getSelectedElementStyles().then(function(data){ + self.controller.setModel(new app.Model(data)); + self.controller.setView(); + }); }; Extension.prototype.onEditorStateChange = function(editor){ @@ -107,38 +101,6 @@ } }; - /* - Workaround for Chrome 40+ regression in DevTools API where `onSelectionChanged` triggers twice. - @see https://code.google.com/p/chromium/issues/detail?id=438267 - - Check if the selection change happens consecutively on the same element. - Return a promise which resolves if the selection change occurs on different elements as expected, - and rejects if the selection change occurs consecutively on the same element which is caused by the regression. - */ - Extension.prototype.ensureDifferentElementSelected = function(){ - return new Promise(function(resolve, reject){ - - function check(role){ - var marker = 'editor-target'; - - // data-role matches, same element is selected - if (role == marker){ - reject(); - } - - // data-role is undefined, element is not the previously selected one - // mark currently selected element ($0), unmark previously selected element ($1) - if (role == undefined){ - chrome.devtools.inspectedWindow.eval('$0.dataset.role="'+ marker.toString() +'"; delete $1.dataset.role', function(){ - resolve(); - }); - } - } - - chrome.devtools.inspectedWindow.eval('$0.dataset.role', check); - }) - } - Extension.prototype.setupEditor = function(editor){ chrome.devtools.inspectedWindow.eval('setup($0, "'+ editor.property.toString() +'", "'+ editor.value.toString() +'")', { useContentScriptContext: true }); this.activeEditor = editor; diff --git a/manifest.json b/manifest.json index 2acd2b3..928d09e 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "CSS Shapes Editor", - "version": "1.2.1", + "version": "1.2.2", "author": "Razvan Caliman ", "minimum_chrome_version": "37.0.0", "description": "Interactive editor for CSS Shapes.", diff --git a/package.json b/package.json index de310c4..3f52970 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chrome-css-shapes-editor", - "version": "1.2.1", + "version": "1.2.2", "description": "Interactive editor for CSS Shapes", "main": "background.js", "scripts": {