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