Enable direct editing of codeblocks
Is your feature request related to a problem? Please describe. After enabling the plugin, codeblocks can no longer be directly edited. This is mentioned in #1. I also don't see any "edit button" mentioned in that issue.
Currently if I need to edit a codeblock, which I do very often, I need to place the cursor above the codeblock and hit down arrow to enter it and then edit. It's inconvenient. I also rarely copy the entire codeblock and mostly copy individual commands.
Describe the solution you'd like I want an option to revert to the default behavior, maybe remove the copy button as well. Thank you.
Additional context
Live preview has this button in the upper right corner of the code block that can be used to edit it.
I don't see the edit button (any language), but clicking the top right corner does select all content in the codeblock.
It's better than before. Would be great to be able to edit directly tho.
It's better than before. Would be great to be able to edit directly tho.
That's not planned. Clicking into the code of a code block should not switch to editing the code block. Instead, it should let you select the code.
It's better than before. Would be great to be able to edit directly tho.
That's not planned. Clicking into the code of a code block should not switch to editing the code block. Instead, it should let you select the code.
Hi @mProjectsCode Thanks for your contribution on this plugin!
Actually, I agree with @niwazukihon . It is more convenient to directly editing the code block than selecting the edit button. It could be better to have an option for those who prefer direct editing.
A setting for this sounds good, but the bigger problem is that I don't know how to switch the code block to editing, as Obsidian induces the current behavior.
For reference, I am now trying to switch from the plugin cm editor syntax highlight to Shiki. For the former, code in the code blocks was editable, although it doesn't support as many syntaxes as Shiki does and is not maintained anymore.
I understand that it could be tricky to add this feature. Thanks for your prompt reply!
By default codeblock becomes editable on click, would be nice to have such feature with this plugin
If there were a feature to directly edit code blocks, it would be perfect. Currently, you still need to click the "Edit this block" button in the upper right corner.
I tried writing a plugin myself that would "click" the "Edit this block" button when double-clicking a code block, thinking it would solve this problem. However, the improvement was quite limited because clicking this button selects all the code in the code block. Even worse, when the code block is long (exceeding the screen), clicking the button to enter edit mode can cause unexpected movement of the vertical scroll bar, which is very inconvenient.
If there were a feature to directly edit code blocks, it would be perfect. Currently, you still need to click the "Edit this block" button in the upper right corner.
I tried writing a plugin myself that would "click" the "Edit this block" button when double-clicking a code block, thinking it would solve this problem. However, the improvement was quite limited because clicking this button selects all the code in the code block. Even worse, when the code block is long (exceeding the screen), clicking the button to enter edit mode can cause unexpected movement of the vertical scroll bar, which is very inconvenient.
I took a look, and it seems that clicking "Edit this block" to enter edit mode is a feature of "Expressive Code," and has nothing to do with this plugin. But I couldn't find any relevant documentation about this in the "Expressive Code" documentation. This is a bit troublesome... This problem doesn't seem so easy to solve.
I took a look, and it seems that clicking "Edit this block" to enter edit mode is a feature of "Expressive Code," and has nothing to do with this plugin. But I couldn't find any relevant documentation about this in the "Expressive Code" documentation. This is a bit troublesome... This problem doesn't seem so easy to solve.
No. The edit button is a feature of base Obsidian.
The fork here seems to work. (Although I wish that it doesn't select all the code when double clicked.) One can build locally and copy the files to the .obsidian/plugins folder or use this plugin and github actions to install it just like a regular plugin.