Created
January 11, 2016 10:22
-
-
Save jamiepollock/3702572a46aaa0210210 to your computer and use it in GitHub Desktop.
Simple reusable rte editor - wrapping umb-editor rte with a reusable config for use in a custom Umbraco backoffice ui
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| angular.module("umbraco.directives").directive('simplerichtexteditor', function (assetsService) { | |
| return { | |
| restrict: 'E', | |
| scope: { | |
| field: '=' | |
| }, | |
| controller: function ($scope, $element) { | |
| $scope.model = { | |
| alias: 'simpleRichtextEditor', | |
| view: 'rte', | |
| config: { | |
| editor: { | |
| toolbar: [ 'preview', '|', 'undo', 'redo', '|', 'copy', 'cut', 'paste', '|', 'bold', 'italic', '|', 'link', 'unlink'], | |
| stylesheets: [], | |
| dimensions: { height: 400, width: '100%' } | |
| } | |
| }, | |
| value: $scope.field | |
| }; | |
| $scope.$watch('model', function () { | |
| if ($scope.model != undefined) { | |
| $scope.field = $scope.model.value; | |
| } | |
| }, true); | |
| }, | |
| templateUrl: '/App_Plugins/SimpleDirectives/views/simplerichtexteditor.html' | |
| }; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="richtexteditor--simple"> | |
| <umb-editor model="model"></umb-editor> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <simplerichtexteditor field="model.myRteValue" ng-if="model" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment