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

this.model.onDidChangeRawContentFast is not a function #1347

Closed
leonliang33 opened this issue Mar 6, 2019 · 4 comments
Closed

this.model.onDidChangeRawContentFast is not a function #1347

leonliang33 opened this issue Mar 6, 2019 · 4 comments

Comments

@leonliang33
Copy link

monaco-editor version: 0.16.0
Browser: Chrome
OS:

Steps or JS usage snippet reproducing the issue:
Using this on angular 7

import * as monaco from 'monaco-editor';

        this._editor = monaco.editor.create(this.editorContainer.nativeElement, {
            value: 'function hello() {\n\talert("Hello world!");\n}',
            language: 'javascript'
        });

When rendering it im getting the follow stack trace:

core.js:15714 ERROR Error: Uncaught (in promise): TypeError: this.model.onDidChangeRawContentFast is not a function
TypeError: this.model.onDidChangeRawContentFast is not a function
    at ViewModel.push../node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewModelImpl.js.ViewModel._registerModelEvents (viewModelImpl.js:141)
    at new ViewModel (viewModelImpl.js:68)
    at StandaloneEditor.push../node_modules/monaco-editor/esm/vs/editor/browser/widget/codeEditorWidget.js.CodeEditorWidget._attachModel (codeEditorWidget.js:939)
    at StandaloneEditor.push../node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneCodeEditor.js.StandaloneEditor._attachModel (standaloneCodeEditor.js:198)
    at new StandaloneEditor (standaloneCodeEditor.js:180)
    at standaloneEditor.js:57
    at withAllStandaloneServices (standaloneEditor.js:44)
    at Object.create (standaloneEditor.js:56)
    at MonacoComponent.<anonymous> (main.js:257238)
    at step (tslib.es6.js:97)
    at resolvePromise (zone.js:831)
    at new ZoneAwarePromise (zone.js:913)
    at Module.__awaiter (tslib.es6.js:67)
    at MonacoComponent.push../Source/app/shared/components/monaco/monaco.component.ts.MonacoComponent._createEditor (main.js:257221)
    at MonacoComponent.push../Source/app/shared/components/monaco/monaco.component.ts.MonacoComponent.ngAfterViewInit (main.js:257168)
    at callProviderLifecycles (core.js:22406)
    at callElementProvidersLifecycles (core.js:22380)
    at callLifecycleHooksChildrenFirst (core.js:22370)
    at checkAndUpdateView (core.js:23306)
    at callViewAction (core.js:23538)

@alexdima
Copy link
Member

alexdima commented Mar 12, 2019

This can happen only if an editor is created with a model option which is not an instance of a TextModel (aka monaco.editor.createModel). It therefore would not have defined the property onDidChangeRawContentFast

@gdYu
Copy link

gdYu commented Oct 24, 2019

how to fix it? @alexandrudima

@alexdima
Copy link
Member

Angular appears to be doing some kind of treeshaking which does not go well with the monaco editor (which is already treeshaken).

See:

@hediet
Copy link
Member

hediet commented Dec 8, 2021

Angular is currently outside the scope of this project.
I suggest to ask on Stackoverflow or the angular integration repository.

@hediet hediet closed this as completed Dec 8, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants