materiahq / ngx-monaco-editor

Monaco Editor Library for Angular v6 and above
MIT License
159 stars 35 forks source link

Create more than one editor on the same page. Is it possible in this library ? #74

Open tyagirajat200 opened 2 years ago

tyagirajat200 commented 2 years ago

While creating more than one instance of the editor I am getting errors ->

Uncaught TypeError: Cannot set properties of undefined (setting 'browser') at :1:46 at MonacoEditorLoaderService.push../node_modules/@materia-ui/ngx-monaco-editor/fesm5/materia-ui-ngx-monaco-editor.js.MonacoEditorLoaderService.addElectronFixScripts (materia-ui-ngx-monaco-editor.js:232) at MonacoEditorLoaderService.push../node_modules/@materia-ui/ngx-monaco-editor/fesm5/materia-ui-ngx-monaco-editor.js.MonacoEditorLoaderService.loadMonaco (materia-ui-ngx-monaco-editor.js:203) at new MonacoEditorLoaderService (materia-ui-ngx-monaco-editor.js:148) at MonacoEditorLoaderService_Factory (materia-ui-ngx-monaco-editor.js:242) at _callFactory (core.js:20296) at createProviderInstance (core.js:20254) at resolveNgModuleDep (core.js:20229) at NgModuleRef.push../nodemodules/@angular/core/fesm5/core.js.NgModuleRef.get (core.js:20905) at resolveDep (core.js:21276) (anonymous) @ VM2874:1 push../node_modules/@materia-ui/ngx-monaco-editor/fesm5/materia-ui-ngx-monaco-editor.js.MonacoEditorLoaderService.addElectronFixScripts @ materia-ui-ngx-monaco-editor.js:232 push../node_modules/@materia-ui/ngx-monaco-editor/fesm5/materia-ui-ngx-monaco-editor.js.MonacoEditorLoaderService.loadMonaco @ materia-ui-ngx-monaco-editor.js:203 MonacoEditorLoaderService @ materia-ui-ngx-monaco-editor.js:148 MonacoEditorLoaderService_Factory @ materia-ui-ngx-monaco-editor.js:242 _callFactory @ core.js:20296 _createProviderInstance @ core.js:20254 resolveNgModuleDep @ core.js:20229 push../nodemodules/@angular/core/fesm5/core.js.NgModuleRef.get @ core.js:20905 resolveDep @ core.js:21276 createClass @ core.js:21148 createDirectiveInstance @ core.js:21027 createViewNodes @ core.js:29387 createEmbeddedView @ core.js:29295 callWithDebugContext @ core.js:30309 debugCreateEmbeddedView @ core.js:29833 push../nodemodules/@angular/core/fesm5/core.js.TemplateRef.createEmbeddedView @ core.js:20742 push../nodemodules/@angular/core/fesm5/core.js.ViewContainerRef.createEmbeddedView @ core.js:20608 push../node_modules/@angular/common/fesm5/common.js.NgIf._updateView @ common.js:4018 set @ common.js:3980 updateProp @ core.js:21303 checkAndUpdateDirectiveInline @ core.js:21054 checkAndUpdateNodeInline @ core.js:29495 checkAndUpdateNode @ core.js:29457 debugCheckAndUpdateNode @ core.js:30091 debugCheckDirectivesFn @ core.js:30051 eval @ FrontendEditorComponent.html:7 debugUpdateDirectives @ core.js:30043 checkAndUpdateView @ core.js:29439 callViewAction @ core.js:29680 execEmbeddedViewsAction @ core.js:29643 checkAndUpdateView @ core.js:29440 callViewAction @ core.js:29680 execEmbeddedViewsAction @ core.js:29643 checkAndUpdateView @ core.js:29440 callViewAction @ core.js:29680 execComponentViewsAction @ core.js:29622 checkAndUpdateView @ core.js:29445 callViewAction @ core.js:29680 execEmbeddedViewsAction @ core.js:29643 checkAndUpdateView @ core.js:29440 callViewAction @ core.js:29680 execEmbeddedViewsAction @ core.js:29643 checkAndUpdateView @ core.js:29440 callViewAction @ core.js:29680 execEmbeddedViewsAction @ core.js:29643 checkAndUpdateView @ core.js:29440 callViewAction @ core.js:29680 execComponentViewsAction @ core.js:29622 checkAndUpdateView @ core.js:29445 callViewAction @ core.js:29680 execEmbeddedViewsAction @ core.js:29643 checkAndUpdateView @ core.js:29440 callViewAction @ core.js:29680 execEmbeddedViewsAction @ core.js:29643 checkAndUpdateView @ core.js:29440 callViewAction @ core.js:29680 execEmbeddedViewsAction @ core.js:29643 checkAndUpdateView @ core.js:29440 callViewAction @ core.js:29680 execComponentViewsAction @ core.js:29622 checkAndUpdateView @ core.js:29445 callViewAction @ core.js:29680 execEmbeddedViewsAction @ core.js:29643 checkAndUpdateView @ core.js:29440 callViewAction @ core.js:29680 execComponentViewsAction @ core.js:29622 checkAndUpdateView @ core.js:29445 callWithDebugContext @ core.js:30309 debugCheckAndUpdateView @ core.js:30011 push../nodemodules/@angular/core/fesm5/core.js.ViewRef.detectChanges @ core.js:20686 push../node_modules/@angular/core/fesm5/core.js.ApplicationRef.tick @ core.js:27109 (anonymous) @ core.js:26998 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:391 onInvoke @ core.js:26256 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:390 push../node_modules/zone.js/dist/zone.js.Zone.run @ zone.js:150 push../node_modules/@angular/core/fesm5/core.js.NgZone.run @ core.js:26170 next @ core.js:26998 schedulerFn @ core.js:23735 push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub @ Subscriber.js:192 push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next @ Subscriber.js:130 push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next @ Subscriber.js:76 push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next @ Subscriber.js:53 push../node_modules/rxjs/_esm5/internal/Subject.js.Subject.next @ Subject.js:47 push../node_modules/@angular/core/fesm5/core.js.EventEmitter.emit @ core.js:23719 checkStable @ core.js:26225 onLeave @ core.js:26292 onInvokeTask @ core.js:26250 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:422 push../node_modules/zone.js/dist/zone.js.Zone.runTask @ zone.js:195 push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask @ zone.js:498 invokeTask @ zone.js:1693 globalZoneAwareCallback @ zone.js:1719 Show 64 more frames loader.js:1261 Duplicate definition of module 'vscode-languageserver-types/main' s.defineModule @ loader.js:1261 o @ loader.js:1713 (anonymous) @ cssMode.js:7 (anonymous) @ cssMode.js:7 loader.js:1261 Duplicate definition of module 'vscode-languageserver-types' s.defineModule @ loader.js:1261 o @ loader.js:1713 (anonymous) @ cssMode.js:7 3core.js:4002 ERROR Error: _this.onErrorStatusChange is not a function

TypeError: _this.onErrorStatusChange is not a function at materia-ui-ngx-monaco-editor.js:502 at e.fire (event.ts:563) at codeEditorWidget.ts:1247 at e.fire (event.ts:563) at t.endDeferredEmit (textModel.ts:2683) at o.pushEditOperations (textModel.ts:1034) at t.executeEdits (cursor.ts:633) at t.executeEdits (codeEditorWidget.ts:993) at firepad.min.js:1 at Array.forEach () at errors.ts:22 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423) at Object.onInvokeTask (core.js:26247) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195) at push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask (zone.js:498) at ZoneTask.invoke (zone.js:487) at timer (zone.js:3070) editor

jmarc-roy commented 2 years ago

Hello @tyagirajat200, Can you provide more previsions ? (electron or browser, angular version, lib version ?)

tyagirajat200 commented 2 years ago

when debugging this, I found that the issue comes only when I intialize firepad with monaco editor instance.