-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9256af3
commit 11e1c83
Showing
2 changed files
with
14 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -522,13 +522,23 @@ function addCommands( | |
isEnabled: () => { | ||
const iterator = shell.widgets('main'); | ||
let widget = iterator.next(); | ||
let anyWritable = false; | ||
while (widget) { | ||
if (docManager.contextForWidget(widget)) { | ||
return true; | ||
let context = docManager.contextForWidget(widget); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
if ( | ||
context && | ||
context.contentsModel && | ||
context.contentsModel.writable | ||
) { | ||
anyWritable = true; | ||
This comment has been minimized.
Sorry, something went wrong.
ivanov
Member
|
||
} | ||
} | ||
widget = iterator.next(); | ||
} | ||
return false; | ||
// disable saveAll if all of the widgets models | ||
// have writable === false | ||
return anyWritable; | ||
This comment has been minimized.
Sorry, something went wrong.
ivanov
Member
|
||
}, | ||
execute: () => { | ||
const iterator = shell.widgets('main'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Perhaps we could set the context variable first, then check to see if context is writable, so we don't have two calls to contextForWidget: