Skip to content

Instantly share code, notes, and snippets.

@FND
Created March 18, 2009 08:50
Show Gist options
  • Save FND/81007 to your computer and use it in GitHub Desktop.
Save FND/81007 to your computer and use it in GitHub Desktop.
//{{{
config.macros.toggleReadOnly = {
label: "toggle",
tooltip: "toggle read-only mode",
handler: function(place, macroName, params, wikifier, paramString, tiddler) {
createTiddlyButton(place, this.label, this.tooltip, this.toggle);
},
toggle: function() {
if(readOnly) {
config.macros.toggleReadOnly.disable();
} else {
config.macros.toggleReadOnly.enable();
}
},
enable: function() {
readOnly = true;
backstage.hide();
refreshDisplay();
},
disable: function() {
readOnly = false;
if(!backstage.button) {
backstage.init();
}
backstage.show();
refreshDisplay();
}
};
//}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment