📋 Template Plugin

Use reusable templates for content creation

Overview

The Template plugin allows users to save and reuse content templates. Create templates for common document types, email structures, or any recurring content patterns, then quickly insert them into new documents.

Features

  • ✓ Save content as templates
  • ✓ Template library management
  • ✓ Quick insert from library
  • ✓ Template categorization
  • ✓ Search templates
  • ✓ Template sharing
  • ✓ Variable placeholders
  • ✓ Cloud sync support

Installation

npm install @editora/plugin-template

Basic Usage

import Editora from '@editora/core';
import TemplatePlugin from '@editora/plugin-template';

const editor = new Editora('#editor');
editor.use(TemplatePlugin);

// Save current content as template
editor.execCommand('saveAsTemplate', {
    name: 'My Template',
    category: 'business'
});

Template Management

Create templates for different scenarios:

  1. Save Template: Select content and save it as a reusable template
  2. Browse Library: Access all saved templates from the library
  3. Organize: Group templates by category for easy access
  4. Insert: Quickly insert any template into your document

Common Templates

  • Email: Standard email layout with greeting, body, and signature
  • Report: Report structure with title, summary, and sections
  • Invoice: Invoice format with headers, items, and totals
  • Meeting Notes: Notes template with date, attendees, and action items

API Methods

  • saveAsTemplate(): Save selected content as template
  • insertTemplate(id): Insert template by ID
  • listTemplates(): Get all available templates
  • deleteTemplate(id): Delete a template