Importers

A plugin can contribute file formats to File → Import, Home New → Import…, and the Home drop zone via contributes.importers in the manifest:

"contributes": {
  "importers": [
    { "id": "pub", "label": "Publisher (.pub)", "accept": [".pub"], "command": "import" }
  ]
}

When the user picks a matching file:

  • Import as new file / Home Import / drop — the host calls createNewFileOrExplain first (same refusals as New File). Only on success does it open the file and run your command with the bytes available from getImportFile() / getImportMode().
  • Import into this file — the host runs your command against the open document (edit access required).

The built-in formats go through the same path: PopCraft files (.popcraft), Lottie (.json, .lottie), PDF and SVG.

SVG comes in as layers

An SVG becomes editable vector layers, in one frame named after the file, however it arrives:

  • File → Import an .svg file;
  • paste SVG markup (what "Copy as SVG" in Figma or Illustrator, or copying an <svg> from a browser, puts on the clipboard);
  • drop .svg files on the canvas. They land at the drop point, selected, and the whole drop is one undo step.

Paths, basic shapes, groups, fills and strokes (dashes, caps, joins), linear and radial gradients, text, every transform and the viewBox all carry over, as do <use>, <style> rules, clip paths and masks, embedded images, and blur and drop-shadow filters. Patterns become their first solid colour. An SVG that will not convert, such as one that is mostly a large embedded photo, comes in as a picture instead.

Plugins and agents reach the same importer with importSvg / import_svg. Importing a .popcraft file into the open document:

Import a file into the open document · 0:03
Description

A launch post. ⋯ → Import into this file… opens the file picker, and a .popcraft file (a quote card) is picked: its pages and layers come into the open document. A plugin’s importers are offered on this same path, beside the built-in formats.

See Migrating from Publisher for the marketplace Publisher plugin.