Copied to clipboard

Flag this post as spam?

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


  • Jakob Kristensen 36 posts 169 karma points
    Dec 18, 2017 @ 14:56
    Jakob Kristensen
    0

    RTE Property not updating in custom section

    Hi guys/gals

    Im doing some custom sections and been happy with angular, however some of the buildin property editors for umbraco is really hard to figure out!

    Currently i have an RTE i want to reuse, my code is like so:

    Editor

                     <umb-property property="property"
                                      ng-repeat="property in rteProperties">
                            <umb-editor model="property"></umb-editor>
                        </umb-property>
    

    JS:

     $scope.text = "";
     $scope.rteProperties = [{
                    label: 'label',
                    description: 'desc',
                    view: 'rte',
                    value: $scope.text,
                    config: {
                        editor: {
                            readonly: true,
                            toolbar: [],
                            stylesheets: [],
                            dimensions: { height: 400 }
                        }
                    }
    
                }];
    

    Can you give me some pointers why the text in $scope.text is not updating when updating the tinymce editor ?

  • Markus Johansson 1911 posts 5735 karma points MVP c-trib
    Dec 18, 2017 @ 15:14
    Markus Johansson
    100

    Hi!

    You can't set the value to a variable as it's already a variable.

    Basiclly the value of the RTE in your case will be stored in $scope.rteProperties.value - if you need a initial value you would set that like this:

    $scope.rteProperties.value = 'This is my initial value'

    Then when you want to store it / read the value

    var myRteValue = $scope.rteProperties.value

    I wrote a blog post about this some years ago but it should still be relevant: http://www.enkelmedia.se/blogg/2013/12/4/umbraco-7-use-the-rich-text-editor-tinymce-in-a-custom-section.aspx

    Hope this helps!

  • Jakob Kristensen 36 posts 169 karma points
    Dec 18, 2017 @ 20:07
    Jakob Kristensen
    0

    Hello Markus

    Thank you for the answer, i was using that blog earlier where this was one of the options, really appreciate the effort!

    I was thinking in knockout mode where one would make a binding for an editor and pass in the observable to use.

    The answer ended up being $scope.rteProperties[0].value that returned the correct value.

    Thank you for the help, still new to these custom sections but they are growing on me, angular is very powerful :)

  • Markus Johansson 1911 posts 5735 karma points MVP c-trib
    Dec 19, 2017 @ 11:11
    Markus Johansson
    0

    Great news =D

    Yes, your right! $scope.rteProperties[0].value is the why to go =D Forgot about the array.

    Cheers!

    // m

Please Sign in or register to post replies

Write your reply to:

Draft