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

Unable to close model with froala editor in angular #260

Open
creativearish opened this issue Dec 6, 2021 · 0 comments
Open

Unable to close model with froala editor in angular #260

creativearish opened this issue Dec 6, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@creativearish
Copy link

Versions

  • Convergence Version: 1.0.0-rc.12
  • OS: MacOS (Big Sur)
  • Browser: chrome
  • Angular Version: 12

Describe the Bug

I am using convergence with Froala editor and angular.

We will be having different pages where we will need froala with convergence. So it is necessary to close the model whenever necessary (also to update live collaborators on each page).

But I am unable to close the model.

Following is the code which I am using to close the model:-

import { RealTimeModel } from '@convergence/convergence';
export class ConvergenceService {
public realTimeModel: RealTimeModel | undefined = undefined;
  public closeModel() {
    this.realTimeModel.close();
  }
}

I am checking if model is not getting closed (on opening the page) by

modelService.isOpen(model_id)

and everytime I call closeModel() and opens the page it shows that model is not closed (by logging above code line)

I also enabled logging and played with the convergence code a little bit and found that it logs in console the following lines:-

DEBUG 05:50:07.142 RealtimeModel.close() called: my_unique_model_id
DEBUG 05:50:07.142 Model("my_unique_model_id"): Close called on a non-resyncing model
DEBUG 05:50:07.142 Model("my_unique_model_id"): Close initiated (online)
DEBUG 05:50:07.187 Model("my_unique_model_id"): Closed with server

However it is not logging:-

DEBUG 05:50:07.189 Model("my_unique_model_id"): Finishing close

If I comment this line from convergence code (in node_modules) code in src then it works fine.
Not sure why it is checking !this._connection.isConnected() and value of this._concurrencyControl.isCommitted() is false, though nothing has been changed in model.

Also I have tried to close the model without navigating away and it works well. But I would like to call closeModel in ngOnDestroy() because I want to make sure that model gets closed whenver user leaves the page.

And if I do not call closeModel then it works well for the first time (when opening the page for the first time) but after navigating back (by going back to previous page and opening it again) to that page I am unable to see anything in editor. And If I edit the doc then all my changes gets vanished and it overwrites the whole model. But if I open the page and go back and refresh the window and open that page again everything works well.

Expected Behavior

model should get closed and logs should be with 'Finishing close', like below:-

DEBUG 05:50:07.142 RealtimeModel.close() called: my_unique_model_id
DEBUG 05:50:07.142 Model("my_unique_model_id"): Close called on a non-resyncing model
DEBUG 05:50:07.142 Model("my_unique_model_id"): Close initiated (online)
DEBUG 05:50:07.187 Model("my_unique_model_id"): Closed with server
DEBUG 05:50:07.189 Model("my_unique_model_id"): Finishing close

I hope that everything is clear. Please let me know if anything is confusing or misunderstood by me. If you want anything from my side, please feel free to let me know. I tried to create stackblitz demo, but I am really sorry as it is not possible at the moment.

I really need this to be fixed as early as possible.

Thanks!

@creativearish creativearish added the bug Something isn't working label Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant