-
-
Notifications
You must be signed in to change notification settings - Fork 377
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
New: add setValue
equivalent
#1108
Comments
This is the shortest equivalent I found: cmView = document.querySelector('.cm-content').cmView;
newContent = Math.random()+'';
transaction = cmView.view.state.update({
changes: {
from: 0,
to: cmView.view.state.doc.length,
insert: newContent,
},
});
cmView.view.update([transaction]); |
Also, |
fregante
added a commit
to fregante/GhostText
that referenced
this issue
Mar 11, 2023
Thank you! The helps a little. I feel that the new API is bit less friendly to amateurs (i.e. it requires a lot more code/research just go find the get/set/onchange equivalents) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a browser extension that gets/sets the value of fields and editors on the web and I'm trying to add support for CodeMirror 6:
As noted in a previous issue, there's no easy way to set the value of a document like
setValue
in CM5:Would it be possible to expose such method? The shortest way I found was via
ReplaceTransaction
, but being an extension, I don't have access to that class:Bad ChatGPT suggestion, ignore
getValue equivalent
setValue equivalent
Examples, not implemented
The text was updated successfully, but these errors were encountered: