reactjs-tiptap-editor
Copilot instructions749 starsChanged 2 months agoMITView on GitHub
This is a modular rich-text editor library built on Tiptap 3.x with Shadcn UI patterns. It ships as a pnpm monorepo: Extensions live in src/extensions/{Name}/ with this structure: Extension example (Bold.ts): When creating new extensions: UI components in src/components/ui/ follow Shadcn conventions: Import alias: @/ maps to src/ (see vite.config.ts) Uses reactjs-signal for reactive state: Theme and locale actions are exposed via: Library builds to lib/ with dual format: Package exports are auto-generated from src/extensions/*/ (see vite.config.ts glob logic). Translations…
- Installs packages
Where files are headingNew Copilot instructions files have more rules about branches and pull requests, and fewer about code style.
Of the Copilot instructions files we read, the 2,349 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository5 other files it gives its agents.
The file
We split this copilot-instructions.md into the rules it gives an agent
9 rules. About 0 are common, 2 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
CSS isolation: All Tailwind classes prefixed with richtext- (configured in vite.config.ts postcss)
- Distinctive: line 51
When creating new extensions:
- Very specific: line 54
Add button option returning { component, componentProps } for toolbar integration
- Very specific: line 56
Create matching RichText{Name} component for toolbar
- Very specific: line 62
Use Radix primitives (@radix-ui/react-*)
- Very specific: line 110
Create src/locales/{lang}.ts following en.ts structure
- Very specific: line 112
Use t('editor.{key}') in components
- Distinctive: line 116
Always test in playground after modifying extensions:
- Very specific: line 120
Import your extension in playground/src/App.tsx
≈ “Common” is an estimate: at least 1 in 5 of the 3,779 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Copilot Instructions for reactjs-tiptap-editor
Architecture Overview
This is a modular rich-text editor library built on Tiptap 3.x with Shadcn UI patterns. It ships as a pnpm monorepo:
src/- Main library source (published to npm)playground/- Development demo appdocs/- Documentation site (VitePress)
Key Design Decisions
- Tree-shakable extensions: Each of 40+ extensions is independently importable (
reactjs-tiptap-editor/bold) - Tiptap-native: Uses
@tiptap/react'suseEditorhook directly—no custom wrapper - Signal-based state: Uses
reactjs-signalfor theme, locale, and editor state - CSS isolation: All Tailwind classes prefixed with
richtext-(configured invite.config.tspostcss)
Extension Pattern
Extensions live in src/extensions/{Name}/ with this structure:
src/extensions/Bold/
├── Bold.ts # Extends Tiptap extension, adds `button` option
├── index.ts # Re-exports (export * from './Bold')
└── components/ # Optional React components (RichTextBold toolbar item)Extension example (Bold.ts):
export const Bold = TiptapBold.extend<BoldOptions>({
addOptions() {
return {
...this.parent?.(),
button: ({ editor, t, extension }) => ({
component: ActionButton,
componentProps: {
action: () => editor.commands.toggleBold(),
isActive: () => editor.isActive('bold'),
icon: 'Bold',
shortcutKeys: extension.options.shortcutKeys ?? ['mod', 'B'],
tooltip: t('editor.bold.tooltip'),
},
}),
};
},
});When creating new extensions:
- Extend the Tiptap extension using
@__PURE__annotation for tree-shaking - Add
buttonoption returning{ component, componentProps }for toolbar integration - Export types extending
GeneralOptions<T>fromsrc/types.ts - Create matching
RichText{Name}component for toolbar
Component Patterns
UI components in src/components/ui/ follow Shadcn conventions:
- Use Radix primitives (
@radix-ui/react-*) - Style with
class-variance-authority(cva) - Prefix all classes with
richtext-
Import alias: @/ maps to src/ (see vite.config.ts)
State Management
Uses reactjs-signal for reactive state:
// src/store/store.ts pattern
const signal = createSignal<boolean>(false);
const useValue = () => useSignalValue(signal);
const useSetValue = () => useSetSignal(signal);Theme and locale actions are exposed via:
reactjs-tiptap-editor/theme→themeActions.setTheme(),themeActions.setColor()reactjs-tiptap-editor/locale-bundle→localeActions.setLang()
Development Commands
pnpm install # Install all workspace dependencies
pnpm build:lib:dev # Build library with watch mode (required before playground)
pnpm playground # Start playground dev server
pnpm build:lib # Production build → outputs to lib/
pnpm lint && pnpm fmt # Lint (oxlint) and format (oxfmt)
pnpm type-check # TypeScript validation
pnpm docs:dev # Run documentation site locallyBuild Output
Library builds to lib/ with dual format:
- ESM:
lib/{Extension}.js - CJS:
lib/{Extension}.cjs - Types:
lib/extensions/{Extension}/index.d.ts
Package exports are auto-generated from src/extensions/*/ (see vite.config.ts glob logic).
i18n
Translations in src/locales/{lang}.ts. Add new locale:
- Create
src/locales/{lang}.tsfollowingen.tsstructure - Register in
src/locales/index.tsLANG.message object - Use
t('editor.{key}')in components
Testing Changes
Always test in playground after modifying extensions:
pnpm build:lib:dev(keep running)pnpm playground(in another terminal)- Import your extension in
playground/src/App.tsx
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

