Add contentTypeEditor to editorService (#15034)
This commit is contained in:
committed by
GitHub
parent
7e26d09f77
commit
ee8339d563
@@ -509,6 +509,7 @@
|
||||
scope.openContentType = (contentTypeId) => {
|
||||
const editor = {
|
||||
id: contentTypeId,
|
||||
entityType: scope.contentType,
|
||||
submit: () => {
|
||||
const args = { node: scope.model };
|
||||
eventsService.emit("editors.documentType.reload", args);
|
||||
@@ -519,17 +520,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
switch (scope.contentType) {
|
||||
case "documentType":
|
||||
editorService.documentTypeEditor(editor);
|
||||
break;
|
||||
case "mediaType":
|
||||
editorService.mediaTypeEditor(editor);
|
||||
break;
|
||||
case "memberType":
|
||||
editorService.memberTypeEditor(editor);
|
||||
break;
|
||||
}
|
||||
editorService.contentTypeEditor(editor);
|
||||
};
|
||||
|
||||
/* ---------- TABS ---------- */
|
||||
|
||||
@@ -635,6 +635,39 @@ When building a custom infinite editor view you can use the same components as a
|
||||
open(editor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.services.editorService#contentTypeEditor
|
||||
* @methodOf umbraco.services.editorService
|
||||
*
|
||||
* @description
|
||||
* Opens the content type editor in infinite editing, the submit callback returns the alias of the saved content type.
|
||||
*
|
||||
* @param {object} editor rendering options.
|
||||
* @param {string} editor.entityType Entity type to open - default document type.
|
||||
* @param {number} editor.id Indicates the ID of the content type to be edited. Alternatively the ID may be set to `-1` in combination with `create` being set to `true` to open the content type editor for creating a new content type.
|
||||
* @param {boolean} editor.create Set to `true` to open the content type editor for creating a new content type.
|
||||
* @param {function} editor.submit Callback function when the submit button is clicked. Returns the editor model object.
|
||||
* @param {function} editor.close Callback function when the close button is clicked.
|
||||
* @returns {object} editor object.
|
||||
*/
|
||||
function contentTypeEditor(editor) {
|
||||
|
||||
if (!editor.entityType) editor.entityType = "documentType";
|
||||
|
||||
switch (editor.entityType) {
|
||||
case "documentType":
|
||||
documentTypeEditor(editor);
|
||||
break;
|
||||
case "mediaType":
|
||||
mediaTypeEditor(editor);
|
||||
break;
|
||||
case "memberType":
|
||||
memberTypeEditor(editor);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.services.editorService#documentTypeEditor
|
||||
@@ -1158,6 +1191,7 @@ When building a custom infinite editor view you can use the same components as a
|
||||
linkPicker: linkPicker,
|
||||
mediaPicker: mediaPicker,
|
||||
iconPicker: iconPicker,
|
||||
contentTypeEditor: contentTypeEditor,
|
||||
documentTypeEditor: documentTypeEditor,
|
||||
mediaTypeEditor: mediaTypeEditor,
|
||||
memberTypeEditor: memberTypeEditor,
|
||||
|
||||
@@ -60,6 +60,7 @@ function DataTypeInfoController($scope, $routeParams, dataTypeResource, $timeout
|
||||
|
||||
const editor = {
|
||||
id: id,
|
||||
entityType: type,
|
||||
submit: function (model) {
|
||||
editorService.close();
|
||||
vm.view.loading = true;
|
||||
@@ -71,17 +72,7 @@ function DataTypeInfoController($scope, $routeParams, dataTypeResource, $timeout
|
||||
}
|
||||
};
|
||||
|
||||
switch (type) {
|
||||
case "documentType":
|
||||
editorService.documentTypeEditor(editor);
|
||||
break;
|
||||
case "mediaType":
|
||||
editorService.mediaTypeEditor(editor);
|
||||
break;
|
||||
case "memberType":
|
||||
editorService.memberTypeEditor(editor);
|
||||
break;
|
||||
}
|
||||
editorService.contentTypeEditor(editor);
|
||||
}
|
||||
|
||||
loadRelations();
|
||||
|
||||
Reference in New Issue
Block a user