Skip to content

Type Definitions

TypeScript type reference for Editu.

Overview

Editu provides TypeScript types organized into the following categories:

CategoryDescription
Editor TypesCore editor options, content, and state types
Feature OptionsConfiguration types for all editor features

Quick Reference

Most Used Types

typescript
// Editu types from @editu/core
import type {
  // Editor
  EdituEditorOptions,
  EdituEditorState,
  
  // Features
  EdituFeatureOptions,
  
  // Auto-Save
  EdituAutoSaveOptions,
  EdituSaveStatus,
  
  // Theme
  EdituTheme,
  EdituResolvedTheme,
} from '@editu/core';

// Tiptap types from @tiptap/core
import type { JSONContent } from '@tiptap/core';

Example Usage

typescript
import type { EdituEditorOptions } from '@editu/core';
import type { JSONContent } from '@tiptap/core';

const options: EdituEditorOptions = {
  initialContent: {
    type: 'doc',
    content: [
      { type: 'paragraph', content: [{ type: 'text', text: 'Hello' }] }
    ],
  },
  features: {
    slashCommand: true,
    markdown: true,
    dragHandle: true,
  },
  onUpdate: ({ editor }) => {
    const content: JSONContent = editor.getJSON();
    console.log(content);
  },
};

Next Steps

Released under the MIT License.