Comments (6)
@Tealons I think I've experienced that same issue. In every page that uses the editor, try have the page implement the IDisposable
interface then in the Dispose
method call Editor.DisposeEditor()
(where Editor is a reference to the StandaloneCodeEditor
component)
from blazormonaco.
Hello - i have the same problem.
The solution with Dispose() did not work...
from blazormonaco.
Having the same issue.
public async ValueTask DisposeAsync()
{
await editor.DisposeEditor();
editor.Dispose();
}
or just
public async ValueTask DisposeAsync()
{
await editor.DisposeEditor();
}
does NOT work.
from blazormonaco.
So:
doing (pulled from the readme)
private StandaloneEditorConstructionOptions EditorConstructionOptions(StandaloneCodeEditor editor)
{
return new StandaloneEditorConstructionOptions
{
AutomaticLayout = true,
Language = "javascript",
Value = "function xyz() {\n" +
" console.log(\"Hello world!\");\n" +
"}"
};
}
/ using the Value
prop seems to be what causes the problem.
If you create a method on the
<StandaloneCodeEditor @ref="@editor" Id="my-editor" ConstructionOptions="@EditorConstructionOptions" OnDidInit="InitEditor"/>
private async Task InitEditor()
{
await editor.SetModel(await Global.CreateModel("some content here", "javascript"));
}
Then everything seems to work. And i did not have to implement IDisposable
Though it raises suspicions / concerns that there is a memory leak or something is being cached?
from blazormonaco.
The approach shown by @StephenOTT works,
but I had to inject the JS runtime to make it work with Blazor server
private async Task InitEditor()
{
await editor.SetModel(await Global.CreateModel(jsRuntime, "SELECT * FROM TABLE", "sql"));
}
from blazormonaco.
I think this is the same issue as: #136
Seems like this PR would fix this: #137
from blazormonaco.
Related Issues (20)
- Dotnet 8 Support HOT 4
- Not working when debugging, but works after publishing and running executable HOT 1
- Is there any way to clear the CompletionList for a CompletionItemProvider? HOT 3
- Other supported languages HOT 1
- Unable to editor.GetValue() with more than ~500 lines of code HOT 1
- Cannot access a disposed object HOT 4
- Problems with Mudblazor? "Found markup with unexpected name 'StandaloneCodeEditor' HOT 2
- Async CompletionItemProvider HOT 3
- onkeydown and onkeyup invalid cast HOT 1
- Sometimes not initialized correctly HOT 2
- Disposing wrong editor when multiple editors are on the screen
- .NET 8 FluentUIBlazor (Server-side)
- Diff Editor Merging
- Two way binding with Editor HOT 1
- Microsoft.JSInterop.JSException: Couldn't find the editor with id: entity-view editors.length: 0 HOT 5
- Syntax Highlighting only work when I refresh my page, not when I navigate to it. HOT 1
- Blazor Monaco Editor is never instanced! (within an Aspire project) HOT 3
- Code editor is not disposed properly HOT 1
- RegisterCompletionItemProvider problem
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blazormonaco.