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:
- Save Template: Select content and save it as a reusable template
- Browse Library: Access all saved templates from the library
- Organize: Group templates by category for easy access
- 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