1

I'm new to lexical and I find the documentation to be poor. I've been researching for a while but haven't found a way to change the default rich text editor node from paragraph to bullet list. Basically, I want the editor to create bulleted lists on enter press instead of paragraphs when the editor is first rendered. Here's the code that renders the editor:

  const editorConfig = {
  namespace: "MyEditor",

  theme: ExampleTheme,

  onError(error: any) {
    throw error;
  },

  nodes: [
    HeadingNode,
    ListNode,
    ListItemNode,
    QuoteNode,
    CodeNode,
    CodeHighlightNode,
    TableNode,
    TableCellNode,
    TableRowNode,
    AutoLinkNode,
    LinkNode,
  ],
};

const Editor = () => {
  return (
    <LexicalComposer initialConfig={editorConfig}>
      <div className="editor-container">
        <ToolbarPlugin />
        <div className="editor-inner">
          <RichTextPlugin
            contentEditable={<ContentEditable className="editor-input" />}
            placeholder={<Placeholder />}
            ErrorBoundary={LexicalErrorBoundary}
          />
          <HistoryPlugin />
          <AutoFocusPlugin />
          <ListPlugin />
          <LinkPlugin />
        </div>
      </div>
    </LexicalComposer>
  );
};

export default Editor;

0 Answers0