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

Commit 818773d

Browse files
committed
Fixed PR #22 for adding support for adding to the setup callback
1 parent 9e40867 commit 818773d

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/tinymce.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,16 @@ angular.module('ui.tinymce', [])
1414
if (!attrs.id) {
1515
attrs.$set('id', 'uiTinymce' + generatedIds++);
1616
}
17+
18+
if (attrs.uiTinymce) {
19+
expression = scope.$eval(attrs.uiTinymce);
20+
} else {
21+
expression = {};
22+
}
1723
options = {
1824
// Update model when calling setContent (such as from the source editor popup)
1925
setup: function (ed) {
26+
var args;
2027
ed.on('init', function(args) {
2128
ngModel.$render();
2229
});
@@ -36,15 +43,15 @@ angular.module('ui.tinymce', [])
3643
scope.$apply();
3744
}
3845
});
46+
if (expression.setup) {
47+
scope.$eval(expression.setup);
48+
delete expression.setup;
49+
}
3950
},
4051
mode: 'exact',
4152
elements: attrs.id
4253
};
43-
if (attrs.uiTinymce) {
44-
expression = scope.$eval(attrs.uiTinymce);
45-
} else {
46-
expression = {};
47-
}
54+
// extend options with initial uiTinymceConfig and options from directive attribute value
4855
angular.extend(options, uiTinymceConfig, expression);
4956
setTimeout(function () {
5057
tinymce.init(options);

0 commit comments

Comments
 (0)