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

@editora/slash-commands

v1.0.1

Published

Slash commands plugin for Editora Rich Text Editor

Readme

@editora/slash-commands

Version License TypeScript Size

[!IMPORTANT] Live Website: https://editora-ecosystem.netlify.app/
Storybook: https://editora-ecosystem-storybook.netlify.app/

Slash command palette plugin for Editora. Type / to quickly run editor commands.

Features

  • Native framework-agnostic implementation (no React dependency)
  • Works in React (Vite/CRA) and web components
  • Keyboard navigation (ArrowUp, ArrowDown, Enter, Tab, Escape)
  • Keyboard shortcut: Ctrl/Cmd + / to open slash commands without typing /
  • Accessible listbox semantics (role=listbox, role=option, aria-selected)
  • Light/dark theme compatible popup styles
  • Custom command items and actions
  • Reliable built-in command catalog (headings, lists, table, divider, formatting)

Installation

npm install @editora/slash-commands @editora/core

React Usage

import { EditoraEditor } from '@editora/react';
import { SlashCommandsPlugin, BoldPlugin, HeadingPlugin, ListPlugin } from '@editora/plugins';

const plugins = [
  BoldPlugin(),
  HeadingPlugin(),
  ListPlugin(),
  SlashCommandsPlugin(),
];

<EditoraEditor plugins={plugins} />;

Web Component Usage

<editora-editor id="editor"></editora-editor>
<script>
  const el = document.getElementById('editor');
  el.setConfig({
    plugins: 'bold heading list slashCommands',
    toolbar: { items: 'bold heading | openSlashCommands' },
    pluginConfig: {
      slashCommands: {
        maxSuggestions: 10,
      },
    },
  });
</script>

Aliases accepted for plugin config lookup: slashCommands, slash-commands, slashcommands.

Options

  • triggerChar?: string default '/'
  • minChars?: number default 0
  • maxQueryLength?: number default 48
  • maxSuggestions?: number default 10
  • requireBoundary?: boolean default true
  • includeDefaultItems?: boolean default true
  • items?: SlashCommandItem[]
  • itemRenderer?: (item, query) => string
  • emptyStateText?: string default 'No commands found'
  • panelLabel?: string default 'Slash commands'

SlashCommandItem

interface SlashCommandItem {
  id: string;
  label: string;
  description?: string;
  keywords?: string[];
  command?: string;
  commandValue?: any;
  insertHTML?: string;
  action?: (ctx) => boolean | void | Promise<boolean | void>;
}

Execution order per item:

  1. action
  2. insertHTML
  3. command

Custom Item Example

import { SlashCommandsPlugin } from '@editora/plugins';

const slash = SlashCommandsPlugin({
  items: [
    {
      id: 'date',
      label: 'Insert Date',
      description: 'Insert current date',
      keywords: ['time', 'now'],
      action: ({ insertHTML }) => insertHTML(`<p>${new Date().toLocaleDateString()}</p>`),
    },
    {
      id: 'h2',
      label: 'Heading 2',
      command: 'heading2',
    },
  ],
});

Advanced Usage

Extend built-in commands

const slash = SlashCommandsPlugin({
  includeDefaultItems: true,
  items: [
    {
      id: 'insert-signature',
      label: 'Insert Signature Block',
      description: 'Insert email signature snippet',
      keywords: ['signature', 'email', 'footer'],
      action: ({ insertHTML }) =>
        insertHTML('<p>Regards,<br><strong>Jane Doe</strong><br>VP Engineering</p>'),
    },
  ],
});

Use this pattern to add plugin-specific commands such as insertMention, toggleTrackChanges, togglePreview, insertMath, openEmojiDialog, etc., only when those plugins are enabled in your editor.

Use only your custom command set

const slash = SlashCommandsPlugin({
  includeDefaultItems: false,
  items: [
    { id: 'h2', label: 'Heading 2', command: 'heading2' },
    { id: 'divider', label: 'Divider', command: 'insertHorizontalRule' },
  ],
});

Command item that passes value

const slash = SlashCommandsPlugin({
  items: [
    {
      id: 'align-center',
      label: 'Align Center',
      command: 'setTextAlignment',
      commandValue: 'center',
    },
  ],
});

Edge Case Behavior

  • If command execution fails (for example plugin command not registered), the typed invocation like /table is restored instead of being lost.
  • Multi-instance safe: each editor gets unique list item IDs to avoid aria-activedescendant collisions.
  • Popup repositions on selection changes, window resize, and scroll.
  • Enter on empty result set closes the popup without forcing a command.
  • Popup auto-closes when selection leaves editor or editor becomes read-only.

Toolbar Command

The plugin exposes openSlashCommands toolbar/command entry.

  • Add openSlashCommands to custom toolbar string to open the panel without typing /.
  • The same command is also bound to Ctrl/Cmd + / by plugin keymap.