add code threshold for highlighting#2371
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
| const diffRange = getDiffRange(node.getChildren(), highlightNodes); | ||
| const {from, to, nodesForReplacement} = diffRange; | ||
| if (from !== to || nodesForReplacement.length) { | ||
| console.log("Length: ", code.length) |
| const diffRange = getDiffRange(node.getChildren(), highlightNodes); | ||
| const {from, to, nodesForReplacement} = diffRange; | ||
| if (from !== to || nodesForReplacement.length) { | ||
| console.log("Length: ", code.length) |
There was a problem hiding this comment.
ooops! will make sure to always take them out
| const {from, to, nodesForReplacement} = diffRange; | ||
| if (from !== to || nodesForReplacement.length) { | ||
| console.log("Length: ", code.length) | ||
| if ((from !== to || nodesForReplacement.length) && code.length <= threshold) { |
There was a problem hiding this comment.
It'll need some update:
what we want is if code length > threshold, then convert content back into plain text, so if you have 50 chars, and type 51st, then whole code block content should convert from code highlight nodes to text nodes
There was a problem hiding this comment.
Okay got it, working on that now.
|
|
||
| useEffect(() => { | ||
| return registerCodeHighlighting(editor); | ||
| return registerCodeHighlighting(editor, 50); |
There was a problem hiding this comment.
You can use 50 as a test value, but for a playground it should be 5000-10000
|
@lateefazeez Maybe just rebase this branch onto main again and then push it to remote? For some reason the E2E test suite doesn't to seem to have run completely. |
Starter Task 1