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

Cannot read property 'body' of undefined #311

@antonioaltamura

Description

@antonioaltamura

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>';
            }
        }};

    }]);

Activity

deeg

deeg commented on Dec 16, 2016

@deeg
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @deeg@antonioaltamura

        Issue actions

          Cannot read property 'body' of undefined · Issue #311 · angular-ui/ui-tinymce