Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Rich Text Editor error when pasting between Editors

default discord avatar
notchr7 months ago
2

Good morning Payload! Today I noticed that when copying the word "Test" from one rich text editor to another, it would freeze editing and start logging some errors.



Payload Version: 1.7.2



Error:

Uncaught Error: Cannot resolve a Slate point from DOM point: [object

OH WAIT - it's happening even when just typing, not just on paste



Relevant Field config:


{
      name: "positionSummaryText",
      label: "Summary",
      type: "richText",
      required: false,
      admin: {
        elements: [
          "h1",
          "h2",
          "h3",
          "h4",
          "h5",
          "h6",
          "indent",
          "link",
          "ol",
          "ul",
        ],
        leaves: ["bold", "italic", "underline", "strikethrough"],
      },
    },
    {
      name: "responsibilities",
      label: "Responsibilities",
      type: "richText",
      required: false,
      admin: {
        elements: [
          "h1",
          "h2",
          "h3",
          "h4",
          "h5",
          "h6",
          "indent",
          "link",
          "ol",
          "ul",
        ],
        leaves: ["bold", "italic", "underline", "strikethrough"],
      },
    },
    {
      name: "positionReqText",
      label: "Requirements",
      type: "richText",
      required: false,
      admin: {
        elements: [
          "h1",
          "h2",
          "h3",
          "h4",
          "h5",
          "h6",
          "indent",
          "link",
          "ol",
          "ul",
        ],
        leaves: ["bold", "italic", "underline", "strikethrough"],
      },
    },
    {
      name: "positionSkillsText",
      label: "Other Skills and Abilities",
      type: "richText",
      required: false,
      admin: {
        elements: [
          "h1",
          "h2",
          "h3",
          "h4",
          "h5",
          "h6",
          "indent",
          "link",
          "ol",
          "ul",
        ],
        leaves: ["bold", "italic", "underline", "strikethrough"],
      },
    },


Uncaught Error: Cannot get the start point in the node at path [] because it has no start text node.


AH FOUND IT



So....



If you have remnants of a fieldName, say it was an array



Even after clearing out the items, that's not sufficient if you wish to reuse the field name



Changing the field names to new names resolved the issue. Don't re-use field names on changed field types is the lesson here



Haha thanks Sean! Going forward I should clean the DB up if I do a field type change 😄

  • discord user avatar
    seanzubrickas
    last year

    I was just going to ask some clarifying questions but you solved it all on your own, no surprise!



    🏆



    lessons learned!



    Are you experincing this with Slate, or Lexical?

  • default discord avatar
    pomme2poule8 months ago

    Hello ! Has this issue been addressed? We're having issues with the rich text editor as well where pasting doesn't work with a similar error messages. Has someone looked into it?



    We have the same situation, no pasting and then not being able to type into the fields.



    Here are our error messages:



    Cannot get the start point in the node at path [] because it has no start text node.


    Cannot read properties of undefined (reading 'children')


    Cannot resolve a Slate point from DOM point: [object HTMLDivElement],0



    I think I'm going to create an issue about it.



    We're using Slate



    I've just published an issue on GitHub:

    https://github.com/payloadcms/payload/issues/7653

    We found the origin of the problem, and it is of our own making. Everything is resolved 👍

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.