Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul McCarthy 39 posts 160 karma points
    Jul 20, 2023 @ 14:24
    Paul McCarthy
    0

    Backoffice editorService options

    We are currently updating a plugin from v7 to v10 and have run into some difficulty with changing from dialogService to editorService.

    We can't seem to find in the documentation a full scope of the parameters that editorService can take, just some examples of how it can be used.

    Our code is thus:

     editorService.open({
     view: '/App_Plugins/MyPlugin/' + html + '.html',
     show: true,
     modalClass: 'umb-modal s-services',
     dialogData: $scope.dialogData,
     callback: function (dialogData) {
      // do stuff
         console.log("scope: " + $scope);
    
     },
     error: function (error) {
         console.log(error);
     }, 
     close: function () {
         editorService.close();
     } });
    

    We think that the modalClass option is invalid, for example but cannot find a definitive spec to tell us all the optional parameters.

    Anyone got such a thing?

  • Nick Hoang 51 posts 180 karma points
    Aug 24, 2023 @ 09:32
    Nick Hoang
    0

    You need to look at some examples, here's one of them: https://github.com/leekelleher/umbraco-contentment/blob/develop/src/Umbraco.Community.Contentment/DataEditors//dev-mode.js

    editorService.open({
    title: "Edit raw value",
    value: Utilities.toJson(model.value, true),
    ace: {
        showGutter: true,
        useWrapMode: true,
        useSoftTabs: true,
        theme: "chrome",
        mode: "javascript",
        advanced: {
            fontSize: "14px",
            wrap: true
        },
        onLoad: function (_editor) {
            $timeout(() => _editor.focus());
        },
    },
    view: "/App_Plugins/Contentment/editors/_json-editor.html",
    size: "medium",
    submit: function (value) {
    
        model.value = Utilities.fromJson(value);
    
        if (callback) {
            callback();
        }
    
        editorService.close();
    },
    close: function () {
        editorService.close();
    }});
    

    Hope it helps.

Please Sign in or register to post replies

Write your reply to:

Draft