preOpen event claims to be cancelable but it still shows the form

preOpen event claims to be cancelable but it still shows the form

neoglezneoglez Posts: 6Questions: 2Answers: 0

when doing something like:

editor.on('preOpen', function (e) {
            console.log(e);
            return false;
        });

the form is still beeing shown. Is this the expected behavior or should be considered as a bug?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,678Questions: 1Answers: 10,497 Site admin
    Answer ✓

    A bug for certain - thanks for letting me know about that. I'll have the fix in the next release (which will likely now be next week).

    In the mean time the fix can be applied in the Editor.prototype.open method. If you find:

    this._preopen( 'main' );
    

    and replace with:

        var ret = this._preopen( 'main' );
        if ( ! ret ) {
            return this;
        }
    

    that will do it.

    Regards,
    Allan

  • neoglezneoglez Posts: 6Questions: 2Answers: 0

    Thanks for the answer!
    I just overwrote the corresponding functions on the buttons as a kind of work around, not being the most elegant solution (certainly a lot of duplicated code ) it did the job. I'll wait for the release and refactor the code.

This discussion has been closed.