You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Plate's code block plugin supplies a code_line block type which we re-implement in a basic fashion. I believe this is meant to exist for each line of code within a code_block. However, even though the mdast-to-slate transformer creates these (seemingly correctly), on the first edit within the code lock Plate will collapse all of them into a single code_line.
While I am not 100% positive this is incorrect, I believe it is, and I belive it is related to a few other issues:
Unindenting code (shift+tab) does not work once the code_lines are reduced to a single code_line
Copy / paste (esp. if in middle of code) has all sorts of odd behavior
I dug for a while but don't understand enough about Plate's mechanics to even get a break point into the right spot, to understand which Plate plugin / component is behaving unexpected. My best guess is it has to do with Prism and specifically packages/code-block/src/client/decorateCodeLine.ts:
// comes from Slate DOMconstcodeBlock=getParentNode<TCodeBlockElement>(editor,path);// later, is normalizedletlangName=codeBlock[0].lang??'';// Prism appliedconsttokens=tokenize(text,lang);// Serialized to ranges with token types applied:for(constelementoftokens){if(elementinstanceofToken){ranges.push({[ELEMENT_CODE_SYNTAX]: true,anchor: { offset, path },focus: {offset: offset+element.length, path },tokenType: element.type,});}offset+=element.length;}// return ranges
The text was updated successfully, but these errors were encountered:
Plate's code block plugin supplies a
code_line
block type which we re-implement in a basic fashion. I believe this is meant to exist for each line of code within acode_block
. However, even though themdast-to-slate
transformer creates these (seemingly correctly), on the first edit within the code lock Plate will collapse all of them into a singlecode_line
.While I am not 100% positive this is incorrect, I believe it is, and I belive it is related to a few other issues:
I dug for a while but don't understand enough about Plate's mechanics to even get a break point into the right spot, to understand which Plate plugin / component is behaving unexpected. My best guess is it has to do with Prism and specifically
packages/code-block/src/client/decorateCodeLine.ts
:The text was updated successfully, but these errors were encountered: