Copied to clipboard

Flag this post as spam?

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


  • philippe 2 posts 72 karma points
    15 days ago
    philippe
    0

    Data not saved in back office

    Hi all, i've made a custom rte for my back office and I have two problem. The first one is that the data I enter from the back office in that rte is never saved. The other one, is that the content is never showed on the client side. Fisrt thing first, the content is never saved and I don't know why. Here is the code

    the view editor.html

     <div ng-controller="soquijeditor" ng-model="model">
        <ng-form >
            <umb-editor model="Content"></umb-editor>
            <label>
                {{Content.info}}
            </label>
        </ng-form>
    </div>
    

    editor.controller.js

    angular.module("umbraco").controller("soquijeditor",
        function CustomSectionEditController($scope) {
    
            //On ajoute le RTE custom 
            $scope.Content = {
                label: 'texte',
                description: 'contenu soquij',
                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: "100%", width: "100%" }
                    }
                },
                value: ""
    
            };
    
            //on ajoute un espion sur la valeur text du RTE
            $scope.$watch('model.value', function () {
    
                var nbWordsMin = 200;//parseInt($scope.model.config.averageWord);
                var nbWord = $scope.Content.value.split(" ").length;
                var nbChar = $scope.Content.value.length;
                var complexite = nbChar / nbWord;
                var temps = nbWord * complexite / nbWordsMin;
                var min = (temps > 1) ? " minutes " : " minute ";
    
                if (temps > 0.5) { $scope.Content.info = "~ " + temps.toFixed(2) + min; }
                else { $scope.Content.info = ""; }
                $scope.model.value = $scope.Content;
            });
    
        });
    

    the package.manifest

    {
      propertyEditors: [
        {
          alias : "SoquijEditor",
          name : "SOQUIJ editor",
          group : " Rich Content",
          editor : {
            view : "~/App_Plugins/Soquij/editor.html",
            valueType : "JSON"
          }
        }
      ],
      javascript: [
        '~/App_Plugins/Soquij/editor.controller.js'
      ]
    }
    

    If someone know why it's never saved, please tell me!

Please Sign in or register to post replies

Write your reply to:

Draft