plate icon indicating copy to clipboard operation
plate copied to clipboard

Missing id with deserializeHtml

Open kristian-puccio opened this issue 11 months ago • 0 comments

Description

When a Plate editor is created with the createNodeIdPlugin I would expect html that is deserialized to contain ids.

If you run this code in the browser then if functions correctly and id's are added but if you run in a test framework then all the ids are missing.

My intention is to be able to run a deserialize command in a process in a server, thus the lack of a dom.

- Expected
+ Received

  Array [
    Object {
      "children": Array [
        Object {
          "text": "Paragraph",
        },
      ],
-     "id": "1",
      "type": "p",
    },
  ]

 ❯ src/index.spec.ts:23:17
     21|
     22|     console.log(doc);
     23|     expect(doc).toEqual(expected);
       |                 ^
     24|   });
     25| });

Steps

  1. Go to https://codesandbox.io/p/sandbox/serene-greider-vw85kd?file=%2Fsrc%2Findex.ts
  2. Run the test task, see the test failure.

Sandbox

https://codesandbox.io/p/sandbox/serene-greider-vw85kd?file=%2Fvite.config.ts%3A1%2C37

Expectation

ID's are added to the deserialized blocks.

Funding

  • You can sponsor this specific effort via a Polar.sh pledge below
  • We receive the pledge once the issue is completed & verified
Fund with Polar

kristian-puccio avatar Jul 14 '23 06:07 kristian-puccio