[Edit] Utilize EditToolbarSelection

Utilize newer, more general-purpose selector from the
representer responsible for binding selection scope to
toolbar. WTD-929.
This commit is contained in:
Victor Woeltjen 2015-03-03 18:34:03 -08:00
parent 6c97815efb
commit bc69f19012

View File

@ -1,8 +1,8 @@
/*global define*/
define(
['./EditToolbar'],
function (EditToolbar) {
['./EditToolbar', './EditToolbarSelection'],
function (EditToolbar, EditToolbarSelection) {
"use strict";
// No operation
@ -81,8 +81,8 @@ define(
var definition = (representation || {}).toolbar || {};
// Expose the toolbar object to the parent scope
initialize(definition);
// Clear any existing selection
scope.selection = [];
// Create a selection scope
scope.selection = new EditToolbarSelection();
// Initialize toolbar to an empty selection
updateSelection([]);
}
@ -101,7 +101,7 @@ define(
// Detect and handle changes to state from the toolbar
scope.$watchCollection(getState, updateState);
// Watch for changes in the current selection state
scope.$watchCollection("selection", updateSelection);
scope.$watchCollection("selection.all()", updateSelection);
// Expose toolbar state under that name
scope.$parent[attrs.toolbar] = toolbarObject;
}