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:
gavin%gavinsharp.com 2006-10-10 13:52:04 +00:00
Родитель 4cae155943
Коммит b97840afcf
1 изменённых файлов: 14 добавлений и 3 удалений

Просмотреть файл

@ -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;
},