TinyMCE and Angular Ui TinyMCE with autosave plugin

ⅰ亾dé卋堺 提交于 2020-01-07 03:51:51

问题


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>

来源:https://stackoverflow.com/questions/44780101/tinymce-and-angular-ui-tinymce-with-autosave-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!