Copied to clipboard

Flag this post as spam?

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


  • Herman 20 posts 141 karma points
    Apr 20, 2015 @ 16:58
    Herman
    0

    Adding text to Richtext editor - Customproperty, Angularjs

    Hi, Im trying to add some text to a richtext in a customsection

    Controller:

    angular.module("umbraco").controller("TextController", function ($scope, notificationsService) {
    
        $scope.textEditor = {
            label: 'bodyText',
            view: 'rte',
            value: $scope.testvalue,
            config: {
                editor: {
                    toolbar: ["code", "undo", "redo", "cut", "styleselect", "bold", "italic", "alignleft", "aligncenter", "alignright", "bullist", "numlist", "link", "umbmediapicker", "table"],
                    stylesheets: [],
                    dimensions: { height: 400, width: "90%" }
                }
            }
        };
    
    
    
        $scope.addField = function () {
            $scope.textEditor = "new value";
            $scope.testvalue = "new value";
        };
    });
    

    Html

                        <ng-form>
                            <umb-editor model="textEditor"></umb-editor>      
                        </ng-form>
    

    When I run the addField function the value in the richtext updates but the textarea value does not change. No errors in the log. Any ideas?

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Apr 21, 2015 @ 08:31
    Dave Woestenborghs
    0

    Hi,

    I tried several ways of reusing existing property editors. A way that works I explain in this article :

    http://24days.in/umbraco/2014/umbraco-angular-tips/

    Read the section about Reusing existing datatypes. There are some links to source code as well.

    Dave

  • Herman 20 posts 141 karma points
    Apr 21, 2015 @ 09:47
    Herman
    0

    Hi Dave, I have no trouble reusing the rte datatype, my only problem is that i cant add text to the editor dynamically.

    //H

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Apr 21, 2015 @ 09:49
    Dave Woestenborghs
    0

    I know I tried your approach as well and had some issues with it. The way I describe is the only way I found it fully functioning.

    Dave

  • Herman 20 posts 141 karma points
    Apr 22, 2015 @ 08:32
    Herman
    0

    Hi Dave, I was not able to get your code to work. Is the Datatypecacheprovider required? Isnt there a workaround?

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Apr 22, 2015 @ 09:20
    Dave Woestenborghs
    0

    The datatype cacheprovider caches the retreival of datatype information. So it's a performance improvement.

    Dave

  • ariel.jugesh 9 posts 80 karma points
    Apr 19, 2017 @ 11:19
    ariel.jugesh
    0

    Did you get the solution of it ? I am having the same issue. Text is not changing.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies