Closed domingoladron closed 8 months ago
Hey @domingoladron, you can use the getCmInstance()
export for this purpose.
First, import the method:
import { getCmInstance } from "./_content/GaelJ.BlazorCodeMirror6/index.js"
Then pass the instance's ID to getCmInstance():
var view = getCmInstance(id).view;
You'll then have access to the object. Hope that helps!
Aw, that's mint! Cheers for the great answer and rapid turnaround. Super helpful!
One last thing. HOW do I get the ID of the current CodeMirror from my Blazor code so I can pass it along to the javascript? I note the "ID" property of the CodeMirror6Wrapper
has been removed in more recent versions of the library.
CodeMirror6Wrapper
has a Setup
property of type CodeMirrorSetup
, which exposes a public string Id
.
Ah, there it is! That's great. Thanks again.
Hey there,
I know that the BlazorCodeMirror is a Blazor wrapper over the underlying CodeMirror javascript objects and code. So I want to be able to access the CodeMirror javascript object from my js code. Is there a convention or simple means of getting a handle on the CodeMirror Editor js object in my javascript? I want to be able to hook into the underlying CodeMirror js code to manipulate it accordingly, then use Blazor JSInterop to trigger these behaviours from user interaction.
Cheers