Format Extension

This article will illustrate the basic concepts of format extension plugins.

The main purpose of format extension plugins is to enable Eagle to preview file formats that are not yet supported. Unlike other types of plugins, format extension plugins do not need to define the main attribute in manifest.json, but need to set the preview attribute. Here is an example code:

"preview": {}

In the preview, you can define the file extensions you want to extend. For example, if you want Eagle to support the icns icon format, you can enter "icns": {}:

"preview" : {
    "icns": {}
}

If you need to set multiple extensions, you can use a comma , to separate different extensions for definition, for example:

"preview" : {
    "icns,ico": {}
}

Format extension plugins can be divided into two parts:

  1. "thumbnail.path": Provides the .js file for parsing the thumbnail of the file format to be extended.

  2. "viewer.path": Provides the .html file for previewing the format to be extended.

"preview": {
    "icns": {
        "thumbnail": {
            "path": "thumbnail/icns.js",
            "size": 400,
            "allowZoom": false
        },
        "viewer": {
            "path": "viewer/icns.html"
        }
    }
}

After setting other metadata.json fields, the final code is as follows:

{
    "id": "LARSKLB8OTOC2",
    "version": "1.0.0",
    "platform": "all",
    "arch": "all",
    "name": "Preview Plugin",
    "logo": "/logo.png",
    "keywords": [
        "icns"
    ],
    "devTools": false,
    "preview": {
        "icns": {
            "thumbnail": {
                "path": "thumbnail/icns.js",
                "size": 400,
                "allowZoom": false
            },
            "viewer": {
                "path": "viewer/icns.html"
            }
        }
    }
}

Please note that currently the format extension plugins do not support Eagle Plugin API and DevTools debugging functionality.

最后更新于