Copied to clipboard

Flag this post as spam?

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


  • Ben Palmer 180 posts 866 karma points c-trib
    May 11, 2015 @ 17:16
    Ben Palmer
    0

    Using the RTE in a Custom Property Editor

    I'm trying to create a custom property editor for use in the grid and I've *almost* got it working nicely but the styles seem completely broken.

    So, I'm basically creating a grid editor with a space for an input and a piece of rich text.

    I've found the following post: http://www.enkelmedia.se/blogg/2013/12/4/umbraco-7-use-the-rich-text-editor-tinymce-in-a-custom-section.aspx

    This has got me a working (in terms of functionality) rich text editor in the grid but as you can see from the following screengrab, it's not quite styled as planned:

    My package.manifest:

    {
        propertyEditors: [
            {
                alias: "Accordion",
                name: "Accordion",
                editor: {
                    view: "~/App_Plugins/Accordion/Accordion.html"
                }
            }
        ],
        javascript: [
            '~/App_Plugins/Accordion/Accordion.Controller.js'
        ]
    }

    My view:

    <div ng-controller="Accordion"> <div class="usky-editor-placeholder"> <div class="umb-el-wrap"> <div> <label class="control-label"> Title </label> <input type="text" name="title" ng-model="control.value.title" class="umb-editor umb-textstring textstring"> </div> </div> <div class="umb-el-wrap"> <div> <ng-form> <umb-property property="property"> <umb-editor model="property"></umb-editor> </umb-property> <pre> Value from the RTE {{property.value}} </pre> </ng-form> </div> </div> </div> </div>

    And finally, my controller:

    angular.module("umbraco")
        .controller("Accordion",
            function ($scope) {
                if (typeof $scope.control.value == "undefined") {
                    $scope.control.value = {
                        title: "",
                        text: ""
                    }
                }
    
                $scope.property = {
                    label: 'bodyText',
                    description: 'Load some stuff here',
                    view: 'rte',
                    config: {
                        editor: {
                            toolbar: ["code", "undo", "redo", "cut", "styleselect", "bold", "italic", "alignleft", "aligncenter", "alignright", "bullist", "numlist", "link", "umbmediapicker", "umbmacro", "table", "umbembeddialog"],
                            stylesheets: [],
                            dimensions: { height: 400, width: 250 }
                        }
                    },
                    value: "test"
                };
            }
        );

    Any ideas what I'm doing wrong here?

    Thanks!

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    May 11, 2015 @ 18:08
    Jan Skovgaard
    0

    Hi 0Neji

    What should it look like? You can add a stylesheet to your manifest so you can control what it looks like - And you might learn a trick or two by reading the angularjs workbook here https://github.com/umbraco/AngularWorkbook

    There is also some documentation regarding property editors here, which is probably also useful http://umbraco.github.io/Belle/#/api

    Hope this helps.

    /Jan

  • Ben Palmer 180 posts 866 karma points c-trib
    May 11, 2015 @ 18:20
    Ben Palmer
    0

    I'm aiming for it to look like the normal RTE editor in the grid so I don't really want to try and work around the issues with custom code. It should look like this:

    Thanks for the links, I'll have a look through and see if there's anything relevant.

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    May 11, 2015 @ 19:42
    Dennis Aaen
    0

    Hi 0Neji,

    If you have full access to the Umbraco TV, there is a whole chapter on how to build a property editor  http://umbraco.tv/videos/umbraco-v7/developer/extending/property-editors

    Hope this can help too.

    /Dennis

     

  • Søren Kottal 711 posts 4549 karma points MVP 6x c-trib
    May 12, 2015 @ 07:45
Please Sign in or register to post replies

Write your reply to:

Draft