Skip to main content

@rifrocket/fdt-plugin-clipboard

Kind: Pure engine plugin · Peer dependencies: fabric

Registers copy/paste/duplicate/group/select-all/nudge as keyboard shortcuts, built entirely from public API — engine.selection, engine.shortcuts, engine.addObject(), engine.setObjectProperty(), and Fabric's own object.clone(). Nothing here has special internal access; a third-party plugin could build the same thing.

import { clipboardPlugin } from "@rifrocket/fdt-plugin-clipboard";

engine.use(clipboardPlugin);

Shortcuts registered

ComboAction
Ctrl+CCopy selection
Ctrl+VPaste (each successive paste offsets by 20px so pasted copies don't stack exactly on top of each other)
Ctrl+DDuplicate selection in place
Ctrl+GGroup selection
Ctrl+Shift+GUngroup
Ctrl+ASelect all objects
Arrow keysNudge selection by 1px
Shift + Arrow keysNudge selection by 10px

Every registered combo goes through engine.shortcuts.register(), so it composes with any other plugin's shortcuts through the same KeyboardShortcutManager — see Custom Property Fields and the architecture overview for how the shortcut registry fits alongside the other registries.

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.

Exports

  • clipboardPlugin — the EditorPlugin
  • cloneFabricObject(object, offset?) — the clone helper used internally by paste/duplicate, exported in case you want the same offset-on-paste behavior in your own plugin

Included in both <DesignEditor preset="default"> and preset="minimal".