Giter Club home page Giter Club logo

tiptap-comment-extension's Introduction

Tiptap Comment Extension:

GitHub Sponsors GitHub Repo stars DM Me on Discord - sereneinserenade#4869

Tiptap Extension for having Google-Docs like pro-commenting in Tiptap.

A โญ๏ธ to the repo if you ๐Ÿ‘ / โค๏ธ what I'm doing would be much appreciated. If you're using this extension and making money from it, it'd be very kind of you to โค๏ธ Sponsor me. If you're looking for a dev to work you on your project's Rich Text Editor with or as a frontend developer, DM me on Discord/Twitter/LinkedIn๐Ÿ‘จโ€๐Ÿ’ป๐Ÿคฉ.

I've made a bunch of extensions for Tiptap 2, some of them are Resiable Images And Videos, Search and Replace, LanguageTool integration with tiptap. You can check it our here https://github.com/sereneinserenade#a-glance-of-my-projects.

Demo:

Try live demo: https://sereneinserenade.github.io/tiptap-comment-extension/

tiptap-comment-extension.mp4

How to use

npm i @sereneinserenade/tiptap-comment-extension
import StarterKit from "@tiptap/starter-kit";
import CommentExtension from "@sereneinserenade/tiptap-comment-extension";

/* or
import { CommentExtension } from "@sereneinserenade/tiptap-comment-extension";
*/

const extensions = [
  StarterKit,
  Comment.configure({
    HTMLAttributes: {
      class: "my-comment",
    },
    onCommentActivated: (commentId) => {
      setActiveCommentId(commentId);

      if (commentId) setTimeout(() => focusCommentWithActiveId(commentId));
    },
  }),
];

For more details, look at react demo.

API:

Comment.configure

Comment.configure({
  HTMLAttributes: {
    class: "my-comment",
  },
  onCommentActivated: (commentId) => {
    setActiveCommentId(commentId);

    if (commentId) setTimeout(() => focusCommentWithActiveId(commentId));
  },
});

Commands:

  • setComment: Sets the comment for the current selection with the given commentId.
    Example: editor.commands.setComment('<a-comment-id>')
  • unsetComment: Unsets the comment for the given commentId.
    Example: editor.commands.setComment('<a-comment-id>')

Stargazers

Stargazers repo roster for @sereneinserenade/tiptap-comment-extension

tiptap-comment-extension's People

Contributors

erichasegawa avatar sereneinserenade avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tiptap-comment-extension's Issues

prevent extension from splitting inline-code and link marks

Currently, the extension will split around the inline code block or a link for the final markup as follows:
code block and the markup looks like this:

<span class="my-comment" data-comment-id="ac5353dc3-357f-4ea9-b9b8-9500bf7aa76fa">prevent extension from splitting </span>
<code>code</code>
<span class="my-comment" data-comment-id="ac5353dc3-357f-4ea9-b9b8-9500bf7aa76fa"> blocks and links</span>

I'd prefer it as follows:

<span class="my-comment" data-comment-id="ac5353dc3-357f-4ea9-b9b8-9500bf7aa76fa">
prevent extension from splitting <code>code</code> blocks and links
</span>

how to enable overlapping comments

If two comments select the same place, the new one overwrites the old one. If you delete the new ones, the old ones disappear. Is there a solution

Missing MIT License file

Thanks for creating this, Jeet! The package.json indicates that this library has an MIT license, but there's no LICENSE file in the repo. The standard MIT license has a clause which includes:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software

Without a LICENSE file, it's unclear how to comply with the MIT license of this project.

I'm happy to open a PR for a LICENSE file if requested.

Compatibility Issues with Next.js Integration

I am currently working on a Next.js project and have been trying to integrate the 'tiptap-comment-extension' . This extension has worked wonderfully in my React projects, and I'm eager to use its features in Next.js. However, I am encountering compatibility issues.

The specific problem arises when importing the extension into my Next.js project, which results in an internal server error. My suspicion is that this issue is related to Server-Side Rendering (SSR) in Next.js, as the extension was designed for a Vue or React environment.

I have checked the documentation and tried various approaches to resolve this, but have not been successful. I am reaching out for guidance or suggestions on adapting this extension for seamless integration with Next.js.

Here's a codesandbox/replit reproduction of your React demo in Next.js.

The BubleMenu does not close immediately after the selection is reset

How to reproduce:

You can reproduce it here: https://sereneinserenade.github.io/tiptap-comment-extension/

  1. Turn comments mode on
  2. Select text (bubble menu will open)
  3. Click anywhere on the text (bubble menu won't close)
  4. Click anywhere on the text again (bubble menu will close)

Possible solution:

Add one more option to "should-show" bubble menu props:
:should-show=" ({ editor, view, state, oldState, from, to }) => isCommentModeOn && !editor.state.selection.empty && !activeCommentsInstance.uuid && from !== to "

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.