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
Option to make editor disabled #266
Comments
Has this been implemented anywhere? I would also find this feature very useful. |
What is the usecase for this? I don't want to add this to the core since it's rarely used and easy to implement Something like editor.container.style.pointerEvents="none"
editor.container.style.opacity=0.5 // or use svg filter to make it gray
editor.renderer.setStyle("disabled", true)
editor.blur() or this var cover = document.createElement("div")
editor.container.appendChild(cover)
cover.style.cssText = "position:absolute;\
top:0;bottom:0;right:0;left:0;\
background:rgba(150,150,150,0.5);\
z-index:100"
cover.addEventListener("mousedown", function(e){e.stopPropagation()}, true) would work. |
The aim isn't to make it visually look disabled, the aim is to remove the ability for the user to interact with it. I.e. they can't control the cursor, (even better, the cursor doesn't exist). Both the samples of code don't really accomplish this. Neither of them removes the cursor, and while they do a pretty good job of not letting the user control the cursor, focus can be tabbed onto the editor. |
Ah, i see now. To hide cursor and line highlights editor.setOptions({
readOnly: true,
highlightActiveLine: false,
highlightGutterLine: false
})
editor.renderer.$cursorLayer.element.style.opacity=0 to make editor non tabbable editor.textInput.getElement().tabIndex=-1
or
editor.textInput.getElement().disabled=true to disable all shortcuts editor.commands.commmandKeyBinding={} also i can add destroy methods for $mouseHandler and textInput to disable them altogether |
Excellent, that has the effect I was after. I agree about the requirements differing based on the exact use case, but it might be handy to have several options to disable things like the cursors, or the shortcuts etc. Also, the last line of code above seems to stop the editor displaying anything at all. :/ |
do you mean |
Thanks for this! |
Thanks, definitely need an option to make the editor disabled ! |
Hi, did you implement the $mouseHandler destroyer? I am a little bit lost (newbie here). Or is there any way to disable it? Thanks for editor disabling btw :-) |
@nightwing |
I found there are two method in VirtualRenderer,hideCursor() and setCursorStyle(), and I try to use them in belowing way.But it dosen't work as well. |
Is it work in progress? I would like to disable the editor when the focus out of it. |
Same here! I would like to use renderer.hideCursor() method but it doesn't seem to work. I tried to call it in my editor init block and in |
for people still want to disable cursor, use css3 property |
How do I disable the editor, still just a new react developer? Please would appreciate any help |
How do you disable the editor ? |
|
Worked like a charm
…On Wed, Sep 23, 2020, 10:27 PM Nehal Hasnayeen ***@***.***> wrote:
for people still want to disable cursor, use css3 property pointer-events:
none; on the editor element.
How do you disable the editor ?
editor.setOptions({
readOnly: true,
})
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#266 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALIR2LMEV5BHDXPXO7RT5BTSHKVAPANCNFSM4AESJK3A>
.
|
I think this works without any js: .ace_editor textarea:read-only ~ .ace_scroller .ace_cursor-layer,
.ace_editor textarea:read-only ~ .ace_scroller .ace_marker-layer .ace_bracket {
display: none;
} |
Similar to the 'disabled' attribute of a textarea.
it will be similar to the readOnly mode, only no user interaction will be allowed with the editor. So, cursor and any line markers will be hidden.
@Gissues:{"order":73.29192546583863,"status":"backlog"}
The text was updated successfully, but these errors were encountered: