问题
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