зеркало из https://github.com/mozilla/pjs.git
Bug 353006: Disable editing of styles on resource:stylesheets in domi, patch by Jason Barnabe (np) <jason_barnabe@fastmail.fm>, r=timeless, sr=neil
This commit is contained in:
Родитель
4cae155943
Коммит
b97840afcf
|
@ -140,15 +140,26 @@ StyleRulesViewer.prototype =
|
|||
|
||||
isCommandEnabled: function isCommandEnabled(aCommand)
|
||||
{
|
||||
var declaration = this.getSelectedDec();
|
||||
// if no declaration is selected, nothing is enabled
|
||||
if (!declaration)
|
||||
return false;
|
||||
|
||||
//XXX can't edit resource: stylesheets because of bug 343508
|
||||
var rule = declaration.parentRule;
|
||||
var isEditable = !(rule && rule.parentStyleSheet &&
|
||||
/^resource:/.test(rule.parentStyleSheet.href));
|
||||
|
||||
switch (aCommand) {
|
||||
case "cmdEditCopy":
|
||||
return this.mPropsTree.view.selection.count > 0;
|
||||
case "cmdEditDelete":
|
||||
case "cmdTogglePriority":
|
||||
return this.mPropsTree.view.selection.count > 0;
|
||||
return isEditable && this.mPropsTree.view.selection.count > 0;
|
||||
case "cmdEditInsert":
|
||||
return this.mRuleTree.view.selection.count == 1;
|
||||
return isEditable && this.mRuleTree.view.selection.count == 1;
|
||||
case "cmdEditEdit":
|
||||
return this.mPropsTree.view.selection.count == 1;
|
||||
return isEditable && this.mPropsTree.view.selection.count == 1;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче