Support line editing in live preview#44
Support line editing in live preview#44Thylane wants to merge 1 commit intomProjectsCode:masterfrom Thylane:feature/line-edit
Conversation
|
I am not sure if I like this. Looking at the code, this should break when lines above the code block are added or removed and when the code block is in a sub-section, such as a callout. |
I'm not sure if I understand the problem right, but I've been using it for a while and haven't encountered this.
Yes, the buttons won't be added if the code block is in a callout. Edit block button can be changed to use the top-level section's button instead of this code block's, which is easy. But the main problem is that it currently relies on |
QQ2025519-18453.mp4How about that. I referred to the textarea on the https://shiki.style/ page. The principle is to stack textarea and pre together. Warning This strategy has a drawback: it is very susceptible to the influence of themes/plugins/styles, etc. Because it is necessary to ensure that the It's still the same display: |

This is more of an idea. It's related to #19, but still not direct editing.
A row edit button is added to each line of the code block. When clicked, it selects the corresponding line.
This allows us to start editing from the middle of the block rather than from the beginning.
The feature is shown in the video below (click the edit button on line 15 to edit the line).
Recording-2025-01-11.212053.mp4
To avoid the edit buttons being obscured by native buttons, I also added some settings to hide copy buttons and edit block buttons, which default to false.
Known limitations:
Appreciate any improvements :)