Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions src/Umbraco.Web.UI.Client/src/common/services/editor.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,44 @@ When building a custom infinite editor view you can use the same components as a
* Opens a content type picker in infinite editing, the submit callback returns an array of selected items
*
* @param {object} editor rendering options.
* @param {string} editor.entityType Entity type to open - default is document type.
* @param {boolean} editor.multiPicker Pick one or multiple items.
* @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 contentTypePicker(editor) {

if (!editor.entityType) editor.entityType = "documentType";
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to make documentType default as it is the current behaviour.


switch (editor.entityType) {
case "documentType":
documentTypePicker(editor);
break;
case "mediaType":
mediaTypePicker(editor);
break;
case "memberType":
memberTypePicker(editor);
break;
}
}

/**
* @ngdoc method
* @name umbraco.services.editorService#documentTypePicker
* @methodOf umbraco.services.editorService
*
* @description
* Opens a document type picker in infinite editing, the submit callback returns an array of selected items
*
* @param {object} editor rendering options.
* @param {boolean} editor.multiPicker Pick one or multiple items.
* @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 documentTypePicker(editor) {
editor.view = "views/common/infiniteeditors/treepicker/treepicker.html";
if (!editor.size) editor.size = "small";
editor.section = "settings";
Expand Down Expand Up @@ -1143,10 +1175,12 @@ When building a custom infinite editor view you can use the same components as a
open: open,
close: close,
closeAll: closeAll,
mediaEditor: mediaEditor,
contentEditor: contentEditor,
mediaEditor: mediaEditor,
memberEditor: memberEditor,
contentPicker: contentPicker,
contentTypePicker: contentTypePicker,
documentTypePicker: documentTypePicker,
mediaTypePicker: mediaTypePicker,
memberTypePicker: memberTypePicker,
copy: copy,
Expand Down Expand Up @@ -1178,7 +1212,6 @@ When building a custom infinite editor view you can use the same components as a
macroPicker: macroPicker,
memberGroupPicker: memberGroupPicker,
memberPicker: memberPicker,
memberEditor: memberEditor,
mediaCropDetails
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,9 @@

localizationService.localize("blockEditor_headlineCreateBlock").then(function(localizedTitle) {

const contentTypePicker = {
const dialog = {
title: localizedTitle,
section: "settings",
treeAlias: "documentTypes",
entityType: "documentType",
isDialog: true,
filter: function (node) {
if (node.metaData.isElement === true) {
var key = udiService.getKey(node.udi);
Expand Down Expand Up @@ -238,8 +235,8 @@
}
]
};
editorService.treePicker(contentTypePicker);

editorService.contentTypePicker(dialog);
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,9 @@

localizationService.localize("blockEditor_headlineCreateBlock").then(localizedTitle => {

const contentTypePicker = {
const dialog = {
title: localizedTitle,
section: "settings",
treeAlias: "documentTypes",
entityType: "documentType",
isDialog: true,
filter: function (node) {
if (node.metaData.isElement === true) {
var key = udiService.getKey(node.udi);
Expand Down Expand Up @@ -142,7 +139,7 @@
]
};

editorService.treePicker(contentTypePicker);
editorService.contentTypePicker(dialog);
});
};

Expand Down