@rifrocket/fdt-plugin-clipboard
v3.0.4
Published
Copy/paste/duplicate/group/select-all/nudge keyboard shortcuts for the FabricJS Design Tool v2, registered via the core plugin system.
Readme
@rifrocket/fdt-plugin-clipboard
Copy/paste/duplicate/group and nudge keyboard shortcuts for Fabric Design Tool.
A pure engine plugin — install() registers a full set of clipboard/selection keyboard shortcuts, built entirely from the public engine API (engine.selection, engine.shortcuts, engine.addObject(), engine.setObjectProperty(), Fabric's own object.clone()). Nothing here needs special internal access, so it's also a reasonable reference for writing your own shortcut plugin.
Features
| Shortcut | Action |
|---|---|
| Ctrl+C | Copy selection |
| Ctrl+V | Paste (offset +20px from the copy point) |
| Ctrl+D | Duplicate in place |
| Ctrl+G | Group selection |
| Ctrl+Shift+G | Ungroup |
| Ctrl+A | Select all |
| Arrow keys | Nudge 1px |
| Shift + arrow keys | Nudge 10px |
Every combo is registered through engine.shortcuts.register(). Included in both <DesignEditor preset="default"> and preset="minimal".
clipboardPlugin.uninstall(engine) unregisters every shortcut this plugin added to that engine, and only that engine — safe to call under plugin-pages' multi-engine model without affecting any other page.
Install
npm install @rifrocket/fdt-plugin-clipboardPeer dependencies: fabric.
Depends on @rifrocket/fabricjs-design-tool.
Quick start
import { clipboardPlugin, cloneFabricObject } from "@rifrocket/fdt-plugin-clipboard";
engine.use(clipboardPlugin);cloneFabricObject is exported as a standalone entry point to the same clone-and-offset logic the plugin uses internally for Ctrl+D/paste — reach for it directly if you need to duplicate an object outside of a keyboard shortcut (e.g. from a toolbar button).
Documentation
License
MIT © Fabric Design Tool Contributors
