Part of init in the file editor.bootstrap.js not working

Part of init in the file editor.bootstrap.js not working

perrotinperrotin Posts: 39Questions: 9Answers: 1

Hi,

I've update the Editor files, move 1.5.4 to 1.5.6, but the part of init in the file editor.bootstrap.js not working

dte.on( 'open.dtebs', function ( e, type ) {
    if ( type === 'inline' || type === 'bubble' ) {
        $('div.DTE input[type=text], div.DTE select, div.DTE textarea').addClass( 'form-control' );
    }
} );

in Version 1.5.4, I don't have problem and event was call well.
In 1.5.6, if i put a console log in this event, nothing appear.
Have you an idea why it's not call ?

Answers

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    Can you give me a link to a page showing the issue please? If you load the Bootstrap example and then in your browser's console enter:

    $('#example').on( 'click', 'tbody td', function () {
      editor.inline( this );
    } );
    

    to enable inline editing, clicking on any cell in the table shows a correctly formatted input element.

    Allan

  • mahaluxmahalux Posts: 2Questions: 1Answers: 0
    edited October 2016

    Hello Allan, I came to this problem to. It is caused by this condition:
    if ( ! self._dom.content ) {

    the event registration:
    dte.on( 'open.dtebs', function ( e, type ) {

    is done somehow only for the first instance - I confirm this bug, it is replicable with two or more tables. The inline edit input nodes in the not first table are missing the form-control class.

    It can be fixed by moving the registration function outside the condition. Maybe you can suggest better fix as this will maybe register it again and again and 1000th edit will be 1000x slower... Please advice and fix in next release.

    Michael

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    Hi Michael,

    Many thanks for the additional information and details about what you've found. I completely concur with your assessment and your fix. Listening for the open event from each Editor instance is the correct thing to do here, and that listener should be moved outside of the if condition as you suggest. It will only register once per Editor instance, so I don't think each subsequent edit will be any slower.

    This fix will be included in the next release.

    Regards,
    Allan

This discussion has been closed.