Rich Text Editor error when pasting between Editors

default discord avatar
notchr10 months ago
3

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

  • discord user avatar
    seanzubrickas
    10 months ago

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



    🏆

  • default discord avatar
    notchr10 months ago

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

  • discord user avatar
    seanzubrickas
    10 months ago

    lessons learned!

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.