npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tinymce-inline-comments

v0.1.3

Published

Headless inline comments plugin for TinyMCE

Downloads

460

Readme

tinymce-inline-comments

npm license downloads

A headless, Google Docs–style inline comments plugin for TinyMCE.

This plugin enables inline annotations on selected text and emits comment lifecycle events (add, select, delete) while keeping UI, backend APIs, permissions, mentions, and threading logic fully in your app.

Designed for:

  • Contract & legal editors
  • Review & approval workflows
  • Collaborative document tools
  • Enterprise-grade editors

🔗 Links

  • GitHub Repository
    https://github.com/chiraagb/tinymce-inline-comments

  • Issues & Feature Requests
    https://github.com/chiraagb/tinymce-inline-comments/issues

  • Live Demo (CodeSandbox)
    https://codesandbox.io/s/c85wj6


✨ Why Headless?

Most comment plugins tightly couple UI + storage + editor logic.

This plugin does only one thing:

Manage inline annotations and emit meaningful editor events.

You control everything else.

Benefits:

  • Works with any backend
  • Works with any UI framework
  • No assumptions about permissions or workflows
  • Easy to extend for enterprise use

✨ Features

  • Inline comment annotations using <span>
  • Selection-based comments
  • Event-driven architecture (no backend coupling)
  • Annotation delete / unwrap API
  • Framework-agnostic
  • React / Vue / Angular / Vanilla JS friendly
  • Thread-ready architecture (annotationId as thread key)

📦 Installation

npm install tinymce-inline-comments

🚀 Basic Usage (React Example)

import { Editor } from "@tinymce/tinymce-react";
import { registerInlineComments } from "tinymce-inline-comments";

<Editor
  init={{
    extended_valid_elements: "span[class|data-annotation-id]",
    content_style: `
      .inline-comment {
        background: rgba(145,166,255,0.22);
        border-bottom: 2px solid #6C48C5;
        cursor: pointer;
      }
      .inline-comment.active {
        background: rgba(108,72,197,0.25);
      }
    `,
    setup: (editor) => {
      registerInlineComments(editor);

      editor.on("inline-comments:add", (e) => {
        console.log("Comment added", e.annotationId, e.selectedText);
      });

      editor.on("inline-comments:select", (e) => {
        console.log("Comment selected", e.annotationId);
      });

      editor.on("inline-comments:delete", (e) => {
        console.log("Comment deleted", e.annotationId);
      });
    },
    toolbar: "undo redo | inlineComment",
  }}
/>;

🔔 Events

inline-comments:add

Fired when a comment is added to selected text.

{
  annotationId: string;
  selectedText: string;
}

inline-comments:select

Fired when an existing annotation is clicked.

{
  annotationId: string;
}

inline-comments:delete

Fired when an annotation is removed.

{
  annotationId: string;
}

🧠 API

editor.removeInlineComment(annotationId: string)

Removes the inline annotation wrapper while preserving the text content.

editor.removeInlineComment(annotationId);

🏗 Architecture

This plugin is intentionally headless.

| Concern | Where it lives | | -------------------- | -------------- | | UI (sidebar, modals) | Your app | | Backend APIs | Your app | | Auth & permissions | Your app | | Mentions | Your app | | Threaded comments | Your app | | Inline annotations | This plugin |


🧵 Threaded Comments (Recommended Pattern)

Use annotationId as the thread key:

{
  "annotation_id": "uuid",
  "thread": [
    { "id": "c1", "text": "Initial comment" },
    { "id": "c2", "text": "Reply" }
  ]
}

The plugin does not enforce a data model.


🔴 Live Demo(React)

Try the plugin in a real TinyMCE editor:

👉 CodeSandbox Demo https://codesandbox.io/s/c85wj6

Select text → click the comment icon → click highlighted text to select.


⚠️ Notes

  • This plugin does not store comments
  • This plugin does not make API calls
  • This plugin does not manage UI state

This is intentional.


📄 License

MIT © Chirag Bhandakkar