ui-tinymce
ui-tinymce copied to clipboard
Cannot read property 'body' of undefined
Hi, I'm having trouble with angular 1.6 integration with the error in title. My usage is nothing special:
<input type="text" class="form-control" placeholder="comment" ui-tinymce="tinymceOptions"
ng-model="model.description">
I use a Service for share tinyMceOptions in various Controllers Controller
...
$scope.tinymceOptions = tinyMceOptions;
....
Service
app.service('tinyMceOptions', ['ListProvider',function (ListProvider) {
return {
menubar:false,
plugins: [
'advlist autolink lists link image charmap print preview anchor',
'searchreplace visualblocks code fullscreen',
'insertdatetime media table contextmenu paste code','paste','autoresize','autolink',
'mention'
],
toolbar: 'undo redo | | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist | link',
valid_elements : "a[href|target=_blank],strong/b,div[align],br,li,ol,ul,i,em,p,span[id=autocomplete]",
fix_list_elements : true,
autoresize_bottom_margin: 4,
content_css: [
'/css/tinymce.css'
],
mentions: {
delimiter: ['@', '#'],
source: function (query, process, delimiter) {
// When using multiple delimiters you can alter the query depending on the delimiter used
if (delimiter === '@') {
//TODO angular better integration (insert function)
ListProvider.getList(null,null,'ecli')
.then(function(data) {
process(data);
});
}
if (delimiter === '#') {
ListProvider.getList(null,null,'fundamentalRights')
.then(function(data) {
process(data);
});
}
},
renderDropdown: function() {
return '<ul class="rte-autocomplete tinymce-autocomplete dropdown-menu"></ul>';
}
}};
}]);
I have not tested it with 1.6 yet, and don't have the time at the moment.
Feel free to put out a PR if you have a fix to make it work with 1.6
At the very minimal please make a plunker demonstrating the issue so people can help debug and solve it.