Infinite editing editorService.contentEditor unable to create new content item
See original GitHub issueI am currently working on a back office extension to allow users to create new content items without leaving the context of the current item using the infinite editing features.
The documentation for the contentEditor hints that this should be possible by setting the create flag on the editor options to true. Although the docs mention Media and not Content?
create | Boolean | Create new content item |
---|
See: https://our.umbraco.com/apidocs/v8/ui/#/api/umbraco.services.editorService
However there is nowhere to set the alias of the type of content you would like to create, or where in the tree it should create the new item.
Reproduction
If I run the following:
function create() {
var options = {
create: true,
submit: function (model) {
editorService.close();
},
close: function () {
editorService.close();
}
}
editorService.contentEditor(options);
}
you end up with the following error.
GET http://localhost:2427/umbraco/backoffice/UmbracoApi/Content/GetEmpty?contentTypeAlias=undefined&parentId=1068 404 (Not Found)
1068 is the ID of the page I am currently on.
Bug summary
There should be a way to create a new piece of content using the editorService.contentEditor I would expect the editor object to have attributes for:
- documentTypeAlias
- parentId
Specifics
- Umbraco 8.0.2
Steps to reproduce
As mentioned above
Expected result
To be able to initiate the creation of new content from the editorService.contentEditor with a call like the following
function create() {
var options = {
create: true,
parentId: 1069,
documentTypeAlias: 'contentPage',
submit: function (model) {
editorService.close();
},
close: function () {
editorService.close();
}
}
editorService.contentEditor(options);
}
Actual result
you can’t. And when you set the create flag I get the following error:
GET http://localhost:2427/umbraco/backoffice/UmbracoApi/Content/GetEmpty?contentTypeAlias=undefined&parentId=1068 404 (Not Found)
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (6 by maintainers)
Hey Umbraco team. I have put through a pull request to resolve this issue.
https://github.com/umbraco/Umbraco-CMS/pull/6031
Sweet, @nielslyngsoe also seems to think it makes a lot of sense, so my fears have been removed.
Should be pretty easy to make sure those variables get passed along.