Closed matt-zm closed 2 years ago
Since angular 13, the API to insert dynamic components is simplified, Hence I switched to it in this commit https://github.com/sibiraj-s/ngx-tiptap/commit/454be3e23a8a6925521619089b2202fff38ac222.
It uses ViewContainerRef
to create component, where ViewContainerRef can only be injected to components or directives, and not to services
. Hence you are facing the issue. May be I can revert that 🤔
Also having second thoughts, since the editor is typically the view. Should it be initialized in the view layer or it is okay to create from services 🤔
In any case, this is breaking change for v4. I will park this for v5 and revert them for now.
Fixed in v4.0.3
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in the thread.
Hey, I found the next bug with the latest update (4.0.2).
Now you aren't able to add nodes to the editor if you provide the Editor via a service, if you try to add the nodes to the editor you get an error like this:
ERROR Error: R3InjectorError(AppModule)[ViewContainerRef -> ViewContainerRef -> ViewContainerRef]: NullInjectorError: No provider for ViewContainerRef!
But if instead you declare the Editor inside the component you can add the nodes normally.
You can check that in the next Stackblitz: https://stackblitz.com/edit/angular-13-template-apxkmf?file=src/app/editor.service.ts
Let me know if in fact that is a bug, I'm doing something wrong or now with the new changes that works as intended, and you can't use services in order to provide the editor.