A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.umbraco.com/umbraco-cms/13.latest/reference/angular/services/editorservice below:

Editor Service | Umbraco CMS

Editor Service | Umbraco CMS
  1. Reference
  2. AngularJS
  3. Services
Editor Service

The Angular editorService service is the primary resource used for opening overlays and handling infinite editing. Besides the open and close functions, the service also contains functions for opening specialized overlays/editors - eg. contentPicker or mediaPicker.

The contentPicker function opens a Content Picker in infinite editing. Depending on the options, it may be used for picking a single content item or a set of content items. Options for the function is as following:

Indicates a boolean value for whether the editor should work as a single Content Picker (false) or a Multi Content Picker (true).

Is a callback function when the user selects and submits one or more content items.

Is a callback function when the close button is clicked.

The Content Picker could be opened as:

editorService.contentPicker({
    multiPicker: true,
    submit: function(model) {
        model.selection.forEach(item, function() {
            console.log(item.name);
        });
        editorService.close();
    },
    close: function() {
        editorService.close();
    }
});

This example snippet will open a new Multi Content Picker. If the user submits one or more content items, the name of each content item will be printed to the console. The user may also close the Content Picker without selecting any content items, in which case the close callback function is invoked.

The documentTypeEditor function of the editor service can be used for opening a new overlay for creating a new Document Type. It can also be used for editing an existing Document Type.

The function supports the following options:

Indicates the numeric ID of the Document Type which should be opened for editing.

A boolean value indicating whether the overlay should be used for creating a new Document Type (opposed to editing an existing Document Type).

When part of a create-overlay, this option specifies whether the Document Type should be created without a corresponding Template.

A callback function for when the user submits/saves the Document Type.

A callback function for when the close button is clicked.

An overlay for creating a new Document Type may be opened as:

editorService.documentTypeEditor({
    id: -1,
    create: true,
    submit: function (model) {
        console.log(model.documentTypeAlias);
     editorService.close();
    },
    close: function () {
        editorService.close();
    }
});

Notice that both the id and create options must be specified. When the overlay submits, you'll be able to get the alias of the created Document Type through model.documentTypeAlias.

Opening an overlay for editing an existing Document Type can be opened as:

editorService.documentTypeEditor({
    id: 1103,
    submit: function (model) {
        console.log(model.documentTypeAlias);
        editorService.close();
    },
    close: function () {
        editorService.close();
    }
});

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4