Unable to remove upload feature from Lexical editor

default discord avatar
kalon_robson
last month
4

@alessiogr Hope you don't mind me tagging you in on this. I didn't want to flag it as a bug until verified



I've attempted to filter out the upload feature from the editor using


    {
      name: 'content',
      type: 'richText',
      editor: lexicalEditor({
        features: ({ defaultFeatures }) => [
          ...defaultFeatures.filter((feature) => !['relationship', 'upload'].includes(feature.key)),
        ],
      }),
    },


But it seems somewhere the editor relies on this being present. (See screenshot)



Browser console log


Lexical.dev.js:9212  Uncaught Error: parseEditorState: type "upload" + not found
    at $parseSerializedNodeImpl (Lexical.dev.js:9212:1)
    at $parseSerializedNodeImpl (Lexical.dev.js:9230:1)
    at parseEditorState (Lexical.dev.js:9258:1)
    at LexicalEditor.parseEditorState (Lexical.dev.js:11518:1)
    at initializeEditor (LexicalComposer.dev.js:106:1)
    at LexicalComposer.dev.js:66:1
    at mountMemo (react-dom.development.js:17225:1)
    at Object.useMemo (react-dom.development.js:17670:1)
    at Object.useMemo (react.development.js:1650:1)
    at LexicalComposer (LexicalComposer.dev.js:46:1)
  • discord user avatar
    alessiogr
    Payload Team
    last month

    hmhmm



    weird



    Can you open a github issue for this? Just so I can keep track of it - if it's no issue, I'll just close it. Not sure if I have time to investigate this today

  • default discord avatar
    kalon_robson
    last month

    Not a problem. I'll open it now

  • discord user avatar
    alessiogr
    Payload Team
    last month

    ah



    wait I think I know what it could be



    If the editor saved some node in the past, and then it doesn't become available, it would error.



    It looks like you've added an upload node to the editor, saved, then removed the upload feature and opened it again



    Can you verify this happens to a completely empty editor?

  • default discord avatar
    kalon_robson
    last month

    I'm a dumbass, apologies, that's exactly what has happened.



    What makes the above worse, is I now recall doing this exact same thing in v1 but worked it out as such.

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

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