make launch mini editor service return a promise so we can update a node when it is saved
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function miniEditorHelper(dialogService, editorState, fileManager, contentEditingHelper) {
|
||||
function miniEditorHelper(dialogService, editorState, fileManager, contentEditingHelper, $q) {
|
||||
|
||||
var launched = false;
|
||||
|
||||
function launchMiniEditor(node) {
|
||||
|
||||
var deferred = $q.defer();
|
||||
|
||||
launched = true;
|
||||
|
||||
//We need to store the current files selected in the file manager locally because the fileManager
|
||||
@@ -47,6 +49,9 @@
|
||||
}
|
||||
|
||||
launched = false;
|
||||
|
||||
deferred.resolve(data);
|
||||
|
||||
},
|
||||
closeCallback: function () {
|
||||
//reset the fileManager to what it was
|
||||
@@ -59,9 +64,14 @@
|
||||
editorState.set(currEditorState);
|
||||
|
||||
launched = false;
|
||||
|
||||
deferred.reject();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
|
||||
}
|
||||
|
||||
var service = {
|
||||
|
||||
@@ -213,7 +213,16 @@ function contentPickerController($scope, entityResource, editorState, iconHelper
|
||||
};
|
||||
|
||||
$scope.openMiniEditor = function(node) {
|
||||
miniEditorHelper.launchMiniEditor(node);
|
||||
miniEditorHelper.launchMiniEditor(node).then(function(updatedNode){
|
||||
// update the node
|
||||
node.name = updatedNode.name;
|
||||
node.published = updatedNode.hasPublishedVersion;
|
||||
if(entityType !== "Member") {
|
||||
entityResource.getUrl(updatedNode.id, entityType).then(function(data){
|
||||
node.url = data;
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var unsubscribe = $scope.$on("formSubmitting", function (ev, args) {
|
||||
|
||||
Reference in New Issue
Block a user