Skip to content

Commit

Permalink
Allows preview while styles disabled, fix #226
Browse files Browse the repository at this point in the history
  • Loading branch information
yfdyh000 committed Nov 23, 2015
1 parent e48ad0d commit 582761f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions components/stylishStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,14 @@ Style.prototype = {
//no-op
return;
//if this style is enabled, then preview doesn't really have an effect atm
if (!this.enabled) {
this.previewOn = on;
if (!this.enabled || !this.stylishOn) {
//if preview is being turned on, register the style
if (on)
this.register();
else
this.unregister();
}
this.previewOn = on;
},

//set the code back to the saved state
Expand Down Expand Up @@ -695,7 +695,7 @@ Style.prototype = {
},

register: function() {
if (!this.stylishOn) {
if (!this.stylishOn && !this.previewOn) { // Allow user to preview
return;
}
var dataUrl = this.dataUrl;
Expand Down
2 changes: 1 addition & 1 deletion content/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function initStyle() {
if (id) {
style = service.find(id, service.CALCULATE_META | service.REGISTER_STYLE_ON_CHANGE);
enableSave(false);
enablePreview(!style.enabled);
enablePreview(!style.enabled || !style.stylishOn);
document.documentElement.setAttribute("windowtype", stylishCommon.getWindowName("stylishEdit", id));
} else {
if (code == null) {
Expand Down

0 comments on commit 582761f

Please sign in to comment.