Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 8679913

Browse files
jbaumbachwesleycho
authored andcommitted
Implemented functionality to handle onChange events from TinyMCE
Closes #63
1 parent 8150dba commit 8679913

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,27 +53,31 @@ Apply the directive to your form elements:
5353

5454
```html
5555
<form method="post">
56-
<textarea ui-tinymce ng-model="tinymceModel"></textarea>
56+
<textarea ui-tinymce ng-model="tinymceModel"></textarea>
5757
</form>
5858
```
5959
## Options
6060

61-
All the TinyMCE options can be passed through the directive.
61+
All the TinyMCE options can be passed through the directive, as well as some helpers.
6262

6363
```javascript
6464
myAppModule.controller('MyController', function($scope) {
65-
$scope.tinymceOptions = {
66-
handle_event_callback: function (e) {
67-
// put logic here for keypress
68-
}
69-
};
65+
$scope.tinymceOptions = {
66+
onChange: function(e) {
67+
// put logic here for keypress and cut/paste changes
68+
},
69+
inline: false,
70+
plugins : 'advlist autolink link image lists charmap print preview',
71+
skin: 'lightgray',
72+
theme : 'modern'
73+
};
7074
});
7175
```
7276
```html
7377
<form method="post">
74-
<textarea ui-tinymce="tinymceOptions" ng-model="tinymceModel"></textarea>
78+
<textarea ui-tinymce="tinymceOptions" ng-model="tinymceModel"></textarea>
7579
</form>
76-
```
80+
```documentation
7781

7882
## Working with ng-model
7983

src/tinymce.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ angular.module('ui.tinymce', [])
2323
if (!$rootScope.$$phase) {
2424
scope.$apply();
2525
}
26+
if (angular.isFunction(options.onChange)) {
27+
options.onChange();
28+
}
2629
};
2730

2831
// generate an ID if not present

0 commit comments

Comments
 (0)