0

There is an issue with angular-ui-tinymce version 0.0.18 when using the autosave plugin. The plugin does not work with angular-ui-tinymce.

This has been logged as an issue by someone else on Oct 20, 2016 to the angular-ui github account with no resolution. https://github.com/angular-ui/ui-tinymce/issues/300

Below is the code used :

<!DOCTYPE html>
<head>
  <script type="text/javascript" src="bower_components/tinymce/tinymce.js"></script>
  <script type="text/javascript" src="bower_components/angular/angular.js"></script>
  <script type="text/javascript" src="bower_components/angular-ui-tinymce/src/tinymce.js"></script>
  </head>
<body ng-app="myApp">
  <form method="post" ng-controller="TinyMceController">
    <textarea ui-tinymce="tinymceOptions" ng-model="tinymceModel"></textarea>
    <button ng-click="getContent()">Get content</button>
    <button ng-click="setContent()">Set content</button>
  </form>
</body>
<script>
    var myAppModule = angular.module('myApp', ['ui.tinymce']);

    myAppModule.controller('TinyMceController', function($scope) {
    $scope.tinymceModel = '';

    $scope.getContent = function() {
        console.log('Editor content:', $scope.tinymceModel);
    };

    $scope.setContent = function() {
        $scope.tinymceModel = 'Time: ' + (new Date());
    };

    $scope.tinymceOptions = {
        inline: false,
        plugins: 'autosave',
        skin: 'lightgray',
        theme: 'modern',
        menubar: false,
        toolbar1: 'restoredraft storedraft bold italic underline alignleft aligncenter alignright justify bullist numlist outdent indent',
        toolbar2: 'fontselect fontsizeselect',
        autosave_interval: "5s",
        autosave_ask_before_unload: true,
        autosave_retention: "60m"
    };
    });
</script>
Andy
  • 351
  • 1
  • 2
  • 12
  • Here is a plunkr from another user showing same issue http://plnkr.co/edit/ojQQyWBR3UNiDzuLSZ9K?p=preview – Andy Jun 27 '17 at 13:02
  • I think the issue is around the dirty flag. The autosave plugin checks the dirty flag to determine if it should save to local storage. There is another user who had a lot of views who complain that the dirty flag is not being set. https://stackoverflow.com/questions/40790328/tinymce-dirty-flag-is-not-set-or-is-reset-automatically-after-editor-leaving?rq=1 – Andy Jun 27 '17 at 13:10

0 Answers0