fix bugs and move to angular 21#44
Conversation
| "monaco-editor": "^0.52.2" | ||
| "@angular/common": "^21.0.0", | ||
| "@angular/core": "^21.0.0", | ||
| "monaco-editor": "^0.55.1" |
There was a problem hiding this comment.
Hi,
I was wondering if it wouldn't be better to put a more permissive range here
^0.55.1 is equivalent to >=0.55.1 <0.56.0-0
isn't the intended range more like >=0.55.1 <1.0.0-0 ? or is it intentional to force the exact minor version ?
There was a problem hiding this comment.
What about:
"peerDependencies": {
"@angular/common": ">=20",
"@angular/core": ">=20",
"monaco-editor": ">=0.51"
},
Because it works with angular 20 and 21 so far.
|
@miki995 thoughts? |
|
Thanks god, i also found the console error in my browser. So, is it means when we upgrading to latest monaco editor version can be fixed it? thanks again |
Are you using the latest monaco-editor 0.55.1? |
|
+1 |
|
I ended up using |
|
Any information on when we can move on to angular 21? If it helps, I had to do the following in my code to use monaco 0.52.1 with angular 19: angular.json: Remove leading / {
"glob": "**/*",
"input": "node_modules/monaco-editor",
"output": "/assets/monaco/"
}becomes {
"glob": "**/*",
"input": "node_modules/monaco-editor",
"output": "assets/monaco/"
}And register a base URL: `{ provide: NGX_MONACO_EDITOR_CONFIG, useValue: {} }`becomes: {
provide: NGX_MONACO_EDITOR_CONFIG, useFactory: () => {
const base = new URL('assets/monaco/min/vs', document.baseURI).toString().replace(/\/$/, '');
return {
baseUrl: base
};
}
} |
|
Also need an update, this is blocking our upgrade to Angular v21 |
@LiamCalculus I recommend integrating monaco and angular directly, it's not that hard https://tbo47.github.io/angular-monaco-editor.html |
|
@miki995 a release for Angular v21 will be super appreciated 🙏 |
## Proposed change Missing: - [ ] ngx-markdown still has a peer dependency on `zone.js` -> non-blocking, issue is tracked here jfcere/ngx-markdown#524 - [x] `@nx/angular` not updated to angular 21 -> fixed in 22.3.0 - [ ] `design-factory`, `@agnos-ui/angular-bootstrap` not updated to angular 21 -> non-blocking - [x] `jest-preset-angular` not updated to angular 21 -> fixed in 16.0 - [x] `@ngrx/router-store` not updated to angular 21 -> updated in 21.0.0 - [x] `@angular-builders/jest` not updated to angular 21 -> fixed in 21.0.0-beta - [ ] `ngx-monaco-editor-v2` not updated to angular 21 -> non-blocking, pull-request opened here miki995/ngx-monaco-editor-v2#44 ## Related issues <!-- Please make sure to follow the [contribution guidelines](https://github.com/amadeus-digital/Otter/blob/main/CONTRIBUTING.md) --> *- No issue associated -* <!-- * 🐛 Fix #issue --> <!-- * 🐛 Fix resolves #issue --> <!-- * 🚀 Feature #issue --> <!-- * 🚀 Feature resolves #issue --> <!-- *Pull Request #issue -->
|
Is there any chance of getting anything merged? 🤓 |
|
Is this version planned for release? The PR has been open for two weeks now. |
But it does get harder once you want to set and get the current value as well as have application wide defaults, or am I wrong? @tbo47 |
I updated the doc https://tbo47.github.io/angular-monaco-editor.html
|
|
Hi! Just checking in to see if there are any updates on this PR. It would really help us, as our Angular 21 upgrade currently depends on it. |
|
I will check this evening to release 21.Thanks for patience, cheersSent from my iPhoneOn Feb 3, 2026, at 6:25 PM, Ferenc Izsépi ***@***.***> wrote:ferencizsepi left a comment (miki995/ngx-monaco-editor-v2#44)
Hi! Just checking in to see if there are any updates on this PR. It would really help us, as our Angular 21 upgrade currently depends on it.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Thanks a lot, we also have been stuck with this for very long |
|
I currently have this in my (window as any).MonacoEnvironment = {
getWorkerUrl: function () {
return 'assets/monaco/min/vs/base/worker/workerMain.js';
},
};and this in my {
"glob": "**/*",
"input": "node_modules/monaco-editor/min/vs",
"output": "/assets/monaco/min/vs"
}Monaco 0.53.0 introduced significant changes to the AMD build (the It seems like the solution would be to switch to the ESM build, but I haven't tested how that would work. |
|
|
Angular 22 is releasing next month, I believe its safe to say we are cooked |
|
Any chance to make this package work with the upcoming Angular versions, or should we all switch to direct monaco integration? |
|
Could do with this change too, this is blocking our upgrade to angular 21 |
We have already started doing the direct integration in our company, even if he owner actually merges it, we can't rely on hopes and dreams for months to be able to upgrade our packages. |
|
Could do with this change too, this is blocking our upgrade to angular 21 |
|
@miki995, are you busy? Could you please take some time to review this pull request? |
|
We removed the lib and implemented the proposed way - thanks a lot @tbo47. Our solution is based on your implementation. Our main looks like this to avoid ts and eslint complains // Configure Monaco Editor environment with baseUrl support for locale-aware deployments
const monacoBaseUrl = new URL('assets/monaco', document.baseURI).href;
interface MonacoEnvironment {
getWorkerUrl(moduleId: string, label: string): string;
}
declare global {
interface Window {
MonacoEnvironment: MonacoEnvironment;
}
}
window.MonacoEnvironment = {
getWorkerUrl: (moduleId: string, label: string): string => {
if (label === 'json') {
return `${monacoBaseUrl}/esm/vs/language/json/json.worker.js`;
}
return `${monacoBaseUrl}/esm/vs/editor/editor.worker.js`;
},
};And our editor implementation, the dialog is a web component from another lib - thats why we implemented the open fn: export class CodeViewerComponent implements OnDestroy {
readonly ourWebComponentDialog = viewChild.required(OurWebComponentDialog);
private readonly editorContainer = viewChild<ElementRef<HTMLDivElement>>('editorContainer');
private monacoEditor?: monaco.editor.IStandaloneCodeEditor;
constructor() {
effect(() => {
const container = this.editorContainer();
if (container && !this.monacoEditor) {
this.initializeEditor(container.nativeElement);
}
});
}
ngOnDestroy(): void {
this.monacoEditor?.dispose();
}
open(data: CodeViewerData): void {
this.ourWebComponentDialog().open();
// Update content after a short delay to ensure editor is initialized
setTimeout(() => {
this.updateEditorContent(data);
}, 0);
}
private initializeEditor(container: HTMLDivElement): void {
this.monacoEditor = monaco.editor.create(container, {
... your init data here
});
}
private updateEditorContent(data: CodeViewerData): void {
if (!this.monacoEditor) {
return;
}
const model = this.monacoEditor.getModel();
if (model) {
monaco.editor.setModelLanguage(model, data.language);
model.setValue(data.formattedValue);
// Reset cursor and scroll position to top if opening with different data
this.monacoEditor.setScrollPosition({ scrollTop: 0, scrollLeft: 0 });
this.monacoEditor.setPosition({ lineNumber: 1, column: 1 });
}
}
}Have a nice day :) |
I tested this update with my angular 20 project. Everything works fine.
I updated angular 20 to 21 following this guide: https://angular.dev/update-guide?v=20.0-21.0&l=1
Update monaco lib to the latest 0.55.1
It fixes the error: