Skip to content

Code highlighter threshold#4

Open
lateefazeez wants to merge 4 commits into
MLH-Fellowship:mainfrom
lateefazeez:code-highlighter-threshold
Open

Code highlighter threshold#4
lateefazeez wants to merge 4 commits into
MLH-Fellowship:mainfrom
lateefazeez:code-highlighter-threshold

Conversation

@lateefazeez
Copy link
Copy Markdown

Issue 2118 - Introduce CodeLineNode that will wrap each line of code.

  • I created a CodeLineNode which creates a new div for each code line
  • I replaced the instances of LineBreakNode and its methods with CodeLineNode and its own methods.
  • CodeLine node still uses code gutter
    Screen Shot 2022-06-27 at 9 12 09 PM
    .

RootNode,
TextNode,
LineBreakNode,
CodeLineNode,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not add line node here (by default), it should be added by editor user if they actually want to have code nodes. IT should be registered at the same place where CodeNOde and CodeHighlightNode are registered

const childKey = children[children.length - 1];
const node = nodeMap.get(childKey);
return $isLineBreakNode(node) || $isDecoratorNode(node);
return $isCodeLineNode(node) || $isDecoratorNode(node);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to rollback linebreak -> isColdeLineNode changes in reconciler, selection and utils. We should keep all changes for the code blocks with lexical/code. Reason for it: codeNode is not a core node, meaning it's not required for editor to have it registered to work. Hence all features/functionality should be isolated into its own package

We can look into reasons why this change was required after that

@@ -0,0 +1,171 @@
/**
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to move this into @lexical/code

@Srinivas-Thiru
Copy link
Copy Markdown

Hi guys, I am new to this field and I really wanna contribute. But I don't know even where to start. I have some knowledge in C and Java. Can anyone please help and guide me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants