Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tracking on but changes hidden? #137

Open
porjo opened this issue Nov 30, 2017 · 2 comments
Open

tracking on but changes hidden? #137

porjo opened this issue Nov 30, 2017 · 2 comments

Comments

@porjo
Copy link

porjo commented Nov 30, 2017

I'd like to enable tracking, but have the changes hidden by default. It's not clear how I would achieve this.

Could an isVisible config option be added to complement the existing isTracking option?

My attempts to use toggleShow() after initialization have failed. Listening for LITE.Events.INIT fails with LITE is not defined e.g.

CKEDITOR.on( 'instanceReady', function( e ) { 
               e.editor.on( LITE.Events.INIT, function( evt ) { 
                        evt.data.lite.toggleShow(false);
                }); 
});

Finding the plugin instance from the editor instance fails with this._tracker is null e.g.

CKEDITOR.on( 'instanceReady', function( e ) { 
        e.editor.plugins.lite.findPlugin(e.editor).toggleShow(false);
});

(using Ckeditor 4.6.2 with bundled track changes plugin)

@nikmaslik
Copy link

nikmaslik commented Nov 30, 2017

For inline editor toggleShow works in 4.5.10 version :

 var editor = CKEDITOR.inline(editorId, config);
 editor.on(LITE.Events.INIT, function (event) {
                var lite = event.data.lite;
                lite.toggleTracking(true, false);
                lite.toggleShow(false, false);	
				});

@porjo
Copy link
Author

porjo commented Nov 30, 2017

I've found that if I wrap the editor.on() in a setTimeout() of 3 seconds e.g.

var editor = CKEDITOR.inline(editorId, config);
setTimeout(function() {
  editor.on(LITE.Events.INIT, function (event) {
    var lite = event.data.lite;
    lite.toggleTracking(true, false);
    lite.toggleShow(false, false);	
  });
},3000);

it works as required - otherwise I get LITE is not defined error. I have many other ckeditor instances on the same page, so I'm guessing it is taking a long time for everything to be ready. What is a better way to handle that?

EDIT: I came up with this workaround

var liteCheck = setInterval(function () {
                if(typeof LITE !== "undefined" ) { 
                        editor.on( LITE.Events.INIT, function( evt ) { 
                                evt.data.lite.toggleShow(false, false);
                        });
                        clearInterval(liteCheck);
                }
        }, 100);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants