The QuillKit plugin system allows you to:
This editor has all plugins loaded:
This editor only loads basic text formatting plugins:
This editor only loads table and image plugins:
Control which plugins are loaded at runtime:
// All plugins loaded by default
const editor = QuillKit.init('#my-editor');
// Load only specific plugins
const editor = QuillKit.init('#my-editor', {
plugins: ['textFormatting', 'alignment', 'history']
});
// Load only image and table plugins
const editor = QuillKit.init('#my-editor', {
plugins: ['image', 'table', 'history']
});
// Get the plugin manager
const pluginManager = editor.pluginManager;
// List all registered plugins
console.log(pluginManager.getRegisteredPlugins());
// Check if a plugin is loaded
if (pluginManager.isLoaded('math')) {
console.log('Math plugin is loaded');
}
// Get a specific plugin instance
const historyPlugin = pluginManager.get('history');
// Import the Plugin base class
import { Plugin } from '@atlarafirm/quillkit';
class MyCustomPlugin extends Plugin {
constructor(editor, options = {}) {
super(editor, options);
this.name = 'MyCustomPlugin';
}
getToolbarButtons() {
return [{
name: 'my-custom-buttons',
buttons: [
{ command: 'myCommand', label: '⚡', title: 'My Custom Command' }
]
}];
}
executeCommand(command, value) {
if (command === 'myCommand') {
// Your custom logic here
alert('Custom command executed!');
}
}
getMetadata() {
return {
name: 'My Custom Plugin',
version: '1.0.0',
description: 'A custom plugin example',
author: 'Your Name'
};
}
}
// Register and use your custom plugin
const editor = QuillKit.init('#my-editor', {
usePluginSystem: true
});
editor.pluginManager.register('myCustom', MyCustomPlugin);
editor.pluginManager.load('myCustom');