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 24, 2015
1 parent e48ad0d commit 17fea61
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 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
2 changes: 1 addition & 1 deletion content/install.xul
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
onload="init()"
onunload="callCallback()"
title="&title;"
ondialogaccept="return save(true)"
ondialogaccept="style.setPreview(false);return save(true)"
ondialogextra1="preview();"
ondialogcancel="style.setPreview(false)"
buttonlabelaccept="&install;"
Expand Down

0 comments on commit 17fea61

Please sign in to comment.