question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UniqueID extension adds extra empty paragraphs when used with HocusPocus

See original GitHub issue

What’s the bug you are facing?

If the UniqueId extension (2.0.0-beta.11) is enabled with collaborative editing (via HocusPocus), TipTap adds an empty paragraph (sometimes in different locations) on every page reload.

How can we reproduce the bug on our side?

TipTap editor setup:

export const Tiptap = () => {
  const websocketProvider = useMemo(() => new HocuspocusProvider({
    url: 'ws://localhost:1234',
    name: 'unique-id-test-01',
  }), []);

  const editor = useEditor({
    extensions: [
      StarterKit.configure({
        history: false
      }),
      UniqueID.configure({
        types: ['paragraph'],
        // seems to happen with any filterTransaction,
        // whether returning true or false
        filterTransaction: isChangeOrigin,
      }),
      Collaboration.configure({
        document: websocketProvider.document,
      }),
    ],
  }, [websocketProvider]);

  return (
      <div style={{ border: '1px solid blue'}}>
        <EditorContent editor={editor} />
      </div>
  );
};

HocusPocus setup:

const server = Server.configure({
  port: 1234,
  extensions: [
    new RocksDB()
  ]
});
server.listen();

Steps to reproduce:

  • open the app
  • refresh the browser
  • see that it added an empty paragraph

Can you provide a CodeSandbox?

No response

What did you expect to happen?

No empty paragraphs should be added.

Anything to add? (optional)

No response

Did you update your dependencies?

  • Yes, I’ve updated my dependencies to use the latest version of all packages.

Are you sponsoring us?

  • Yes, I’m a sponsor. 💖

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
philippkuehncommented, Jan 27, 2022

oh stupid me 🤦‍♂️

filterTransaction: t => !isChangeOrigin(t) is correct!

I fixed it in the docs.

0reactions
bkempecommented, Feb 25, 2022

@philippkuehn @hanspagel I think the change made for this has some side-effects: when using collaboration/HocusPocus, the first paragraph you start on won’t have the attribute from UniqueId until you type at least one letter.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gutenberg blocks editor enabled, empty paragraphs in code ...
Hi! There is a problem when Gutenberg editor enabled for popups in plugin's settings. There are paragraphs in the content that are empty...
Read more >
Paragraph – Tiptap Editor
Without this extension you won't even be able to use paragraphs in the editor. ... Custom HTML attributes that should be added to...
Read more >
Untitled
Blackpool planning app search, Pulse extender weidmuller, Olmstedville ny bakery, Linzer gugl games, Share bear music downloads free?
Read more >
How to remove all empty paragraphs in Word? - ExtendOffice
The Find and Replace function in Word is commonly used as long as we know that empty paragraph symbol can be found as...
Read more >
Empty paragraph killer | Drupal.org
Empty paragraph killer is a filter module, helpful on sites which use ... the paragraph spacing, so the extra empty paragraphs created can ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found