Replies: 1 comment 1 reply
-
I don't think this is an easy task. The main conflict is that you need to handle two different display contents for the same node. Deciding the selection area, on the other hand, isn't that complicated. My suggestion is to use decorators or renderLeaf to modify only the style when the cursor moves. For example, when the cursor is on the current line, it still shows "# This is a heading" but without the heading style. When the cursor leaves the line, the style is applied. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
This seems like a great editor-baseline.
I am currently trying to make a markdown editor. I am using PrismJS to tokenize the text.
Now, my wanted behavior is to render headings, links etc without the markdown parts when the cursor is outside the element.
Coursor is outside
This is a heading
, but when the cursor is moved inside# This is a heading
.Same goes for links,
To read more click this link.
, when cursor moves insideTo read more click [this](https://example.com) link
.(Cursor as in editor cursor, not mouse cursor).
Currently I am trying to use the
decorate
-callback to tokenize.I do a
if cursor is inside: text = text with markdown. Else: text = plain text
I can see that I push the leaf correctly, and inside the
renderLeaf
I can see that the leaf is as expected..but it still renders the whole text with markdown and all.
I feel like I am attacking this from the wrong angle; should I use something else than
decorate
andrenderLeaf
callback?Not looking for a complete answer, just some pointers.
Beta Was this translation helpful? Give feedback.
All reactions