Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Red Editor TypeScript Types

TypeScript type definitions for developing plugins for the Red editor.

Installation

npm install --save-dev @red-editor/types

or

yarn add -D @red-editor/types

Usage

In your plugin's TypeScript file:

/// <reference types="@red-editor/types" />

export async function activate(red: Red.RedAPI) {
    // Your plugin code with full type safety
    red.addCommand("MyCommand", async () => {
        const info = await red.getEditorInfo();
        red.log(`Current buffer: ${info.buffers[info.current_buffer_index].name}`);
    });
}

Or with ES modules:

import type { RedAPI } from '@red-editor/types';

export async function activate(red: RedAPI) {
    // Your plugin code
}

API Documentation

See the Plugin System Documentation for detailed API usage.

Type Coverage

The type definitions include:

  • All Red API methods
  • Event types with proper typing for event data
  • Configuration structure
  • Buffer and editor information interfaces
  • Style and UI component types

Contributing

If you find any issues with the type definitions or want to add missing types, please submit a pull request to the main Red editor repository.