remove code for content mini editor

This commit is contained in:
Mads Rasmussen
2018-07-03 16:06:37 +02:00
parent 14365e3894
commit afd8e7d404
5 changed files with 1 additions and 299 deletions

View File

@@ -1,25 +0,0 @@
/**
* @ngdoc directive
* @name umbraco.directives.directive:umbLaunchMiniEditor
* @restrict E
* @function
* @description
* Used on a button to launch a mini content editor editor dialog
**/
angular.module("umbraco.directives")
.directive('umbLaunchMiniEditor', function (miniEditorHelper) {
return {
restrict: 'A',
replace: false,
scope: {
node: '=umbLaunchMiniEditor',
},
link: function(scope, element, attrs) {
element.click(function() {
miniEditorHelper.launchMiniEditor(scope.node);
});
}
};
});

View File

@@ -1,89 +0,0 @@
(function () {
'use strict';
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
// is a singleton and is shared globally. The mini dialog will also be referencing the fileManager
// and we don't want it to be sharing the same files as the main editor. So we'll store the current files locally here,
// clear them out and then launch the dialog. When the dialog closes, we'll reset the fileManager to it's previous state.
var currFiles = _.groupBy(fileManager.getFiles(), "alias");
fileManager.clearFiles();
//We need to store the original editorState entity because it will need to change when the mini editor is loaded so that
// any property editors that are working with editorState get given the correct entity, otherwise strange things will
// start happening.
var currEditorState = editorState.getCurrent();
dialogService.open({
template: "views/common/dialogs/content/edit.html",
id: node.id,
closeOnSave: true,
tabFilter: ["Generic properties"],
callback: function (data) {
//set the node name back
node.name = data.name;
//reset the fileManager to what it was
fileManager.clearFiles();
_.each(currFiles, function (val, key) {
fileManager.setFiles(key, _.map(currFiles['upload'], function (i) { return i.file; }));
});
//reset the editor state
editorState.set(currEditorState);
//Now we need to check if the content item that was edited was actually the same content item
// as the main content editor and if so, update all property data
if (data.id === currEditorState.id) {
var changed = contentEditingHelper.reBindChangedProperties(currEditorState, data);
}
launched = false;
deferred.resolve(data);
},
closeCallback: function () {
//reset the fileManager to what it was
fileManager.clearFiles();
_.each(currFiles, function (val, key) {
fileManager.setFiles(key, _.map(currFiles['upload'], function (i) { return i.file; }));
});
//reset the editor state
editorState.set(currEditorState);
launched = false;
deferred.reject();
}
});
return deferred.promise;
}
var service = {
launchMiniEditor: launchMiniEditor
};
return service;
}
angular.module('umbraco.services').factory('miniEditorHelper', miniEditorHelper);
})();

View File

@@ -1,103 +0,0 @@
function ContentEditDialogController($scope, editorState, $routeParams, $q, $timeout, $window, appState, contentResource, entityResource, navigationService, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, treeService, fileManager, formHelper, umbRequestHelper, umbModelMapper, $http) {
$scope.defaultButton = null;
$scope.subButtons = [];
var dialogOptions = $scope.$parent.dialogOptions;
// This is a helper method to reduce the amount of code repitition for actions: Save, Publish, SendToPublish
function performSave(args) {
contentEditingHelper.contentEditorPerformSave({
saveMethod: args.saveMethod,
scope: $scope,
content: $scope.content
}).then(function (content) {
//success
if (dialogOptions.closeOnSave) {
$scope.submit(content);
}
}, function(err) {
//error
});
}
function filterTabs(entity, blackList) {
if (blackList) {
_.each(entity.tabs, function (tab) {
tab.hide = _.contains(blackList, tab.alias);
});
}
return entity;
};
function init(content) {
var buttons = contentEditingHelper.configureContentEditorButtons({
create: $routeParams.create,
content: content,
methods: {
saveAndPublish: $scope.saveAndPublish,
sendToPublish: $scope.sendToPublish,
save: $scope.save,
unPublish: angular.noop
}
});
$scope.defaultButton = buttons.defaultButton;
$scope.subButtons = buttons.subButtons;
//This is a total hack but we have really no other way of sharing data to the property editors of this
// content item, so we'll just set the property on the content item directly
$scope.content.isDialogEditor = true;
editorState.set($scope.content);
}
//check if the entity is being passed in, otherwise load it from the server
if (angular.isObject(dialogOptions.entity)) {
$scope.loaded = true;
$scope.content = filterTabs(dialogOptions.entity, dialogOptions.tabFilter);
init($scope.content);
}
else {
contentResource.getById(dialogOptions.id)
.then(function(data) {
$scope.loaded = true;
$scope.content = filterTabs(data, dialogOptions.tabFilter);
init($scope.content);
//in one particular special case, after we've created a new item we redirect back to the edit
// route but there might be server validation errors in the collection which we need to display
// after the redirect, so we will bind all subscriptions which will show the server validation errors
// if there are any and then clear them so the collection no longer persists them.
serverValidationManager.executeAndClearAllSubscriptions();
});
}
$scope.sendToPublish = function () {
performSave({ saveMethod: contentResource.sendToPublish });
};
$scope.saveAndPublish = function () {
performSave({ saveMethod: contentResource.publish });
};
$scope.save = function () {
performSave({ saveMethod: contentResource.save });
};
// this method is called for all action buttons and then we proxy based on the btn definition
$scope.performAction = function (btn) {
if (!btn || !angular.isFunction(btn.handler)) {
throw "btn.handler must be a function reference";
}
if (!$scope.busy) {
btn.handler.apply(this);
}
};
}
angular.module("umbraco")
.controller("Umbraco.Dialogs.Content.EditController", ContentEditDialogController);

View File

@@ -1,80 +0,0 @@
<form novalidate name="contentForm"
ng-controller="Umbraco.Dialogs.Content.EditController"
ng-show="loaded"
ng-submit="save()"
val-form-manager
class="umb-mini-editor">
<div class="umb-panel">
<div class="umb-panel-header">
<umb-content-name
placeholder="@placeholders_entername"
ng-model="content.name"/>
</div>
<div class="umb-panel-body with-footer">
<div class="umb-pane" ng-if="content">
<umb-tabs-nav
model="content.tabs"
id-suffix="-mini-editor">
</umb-tabs-nav>
<umb-tabs-content>
<umb-tab
id="tab{{tab.id}}-mini-editor"
ng-repeat="tab in content.tabs"
rel="{{tab.id}}-mini-editor">
<umb-property
property="property"
ng-repeat="property in tab.properties">
<umb-property-editor model="property"></umb-property-editor>
</umb-property>
</umb-tab>
</umb-tabs-content>
</div>
</div>
<div class="umb-panel-footer" >
<div class="umb-el-wrap umb-panel-buttons">
<div class="btn-toolbar umb-btn-toolbar pull-right">
<a href ng-click="close()" class="btn btn-link">
<localize key="general_close">Close</localize>
</a>
<div class="btn-group dropup" ng-if="defaultButton">
<!-- primary button -->
<a class="btn btn-success" href="#" ng-click="performAction(defaultButton)" prevent-default>
<localize key="{{defaultButton.labelKey}}">{{defaultButton.labelKey}}</localize>
</a>
<a class="btn btn-success dropdown-toggle" data-toggle="dropdown" ng-if="subButtons.length > 0">
<span class="caret"></span>
</a>
<!-- sub buttons -->
<ul class="dropdown-menu bottom-up" role="menu" aria-labelledby="dLabel" ng-if="subButtons.length > 0">
<li ng-repeat="btn in subButtons">
<a href="#" ng-click="performAction(btn)" prevent-default>
<localize key="{{btn.labelKey}}">{{btn.labelKey}}</localize>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</form>

View File

@@ -10,10 +10,9 @@
* @param {any} angularHelper
* @param {any} navigationService
* @param {any} $location
* @param {any} miniEditorHelper
* @param {any} localizationService
*/
function contentPickerController($scope, entityResource, editorState, iconHelper, $routeParams, angularHelper, navigationService, $location, miniEditorHelper, localizationService, editorService) {
function contentPickerController($scope, entityResource, editorState, iconHelper, $routeParams, angularHelper, navigationService, $location, localizationService, editorService) {
var unsubscribe;