lucid-extension-sdk

0.0.256

You can now duplicate items on a document.

0.0.255

You can now duplicate pages within the current document with duplicatePages in editorclient and duplicate in pageproxy.

0.0.247

You can now add an optional expandCallback parameter when registering unfurl link handlers.
This callback is called when the expand button on an unfurl link is clicked, but before attempting to expand the iframe.
The expand button appears when the expandCallback is defined or an iframe was set on the unfurl block.


const client = new EditorClient();

private async performUnfurl(url: string): Promise<UnfurlDetails | undefined> {

    //...

}

public async performExpandCallback(blockProxy: LinkUnfurlBlockProxy, url: string) {

    //...

}

client.registerUnfurlHandler('my.url.com', {

    unfurlCallback: async (url: string) => performUnfurl(url),

    expandCallback: async (blockProxy: LinkUnfurlBlockProxy, url: string) => performExpandCallback(blockProxy, url),

});

0.0.246

You can now create groups on a page

0.0.242

You can now use an array of strings in an `i18n`` string.

0.0.217

You can now add and remove columns and rows using the TableBlockProxy class.

0.0.209

There are new, more specific functions for adding menu items.
Extensions can add menus to the top level menus, context menu, and left side content dock in Lucid Spark.
Instead of one entry point for all these there are now three different functions each with specific parameters: addDropdownMenu, addContextMenu, addContentDockMenu.

0.0.173

You can now specify Modal and Panel classes as opening a URL in the iframe rather than specifying the HTML directly.
Additionally, you can now include static resources in a directory named public at the root of your extension package.
Those static resources can be used as the URL for a modal or panel, and other resources in that directory can be accessed via relative URLs.

0.0.140

You can now extend CustomBlockProxy for custom shapes defined in your extension package, and that class will automatically be used instead of CustomBlockProxy whenever you get a reference to a block of that type.

For more details, see Identifying custom shapes.

0.0.134

You can now programmatically examine data changes made locally that have not yet been synced back to the original source.

0.0.106

i18n support was just added to extensions, with the recommendation being to store your strings in JSON files under resources/i18n inside your editor extensions.
The default webpack.config.js previously had all files inside /resources/ using the raw-loader, which is incompatible with JSON.

If you want to add i18n to an editor extension created before this update, make sure you add exclude: /\.json$/ to the raw-loader entry in module.exports.module.rules in webpack.config.js, e.g.

module.exports = {
    entry: './src/extension.ts',
    module: {
        rules: [
            {
                test: /\.tsx?$/,
                use: 'ts-loader',
                exclude: /node_modules/,
            },
            {
                test: /[\\\/]resources[\\\/]/,
                use: 'raw-loader',
                exclude: /\.json$/, // <- Newly added
            },
        ],
    },
    resolve: {
        extensions: ['.ts', '.js'],
    },
    output: {
        filename: 'bin/extension.js',
        path: __dirname,
    },
    mode: 'development',
};

You also need to make sure resources/resource.d.ts specifies the type of your i18n files:

declare module '*.json' {
    const content: Record<string, string>;
    export default content;
}

0.0.84

You can now check which Lucid product is currently loaded with EditorClient.getProduct.

0.0.27

Custom panels can now be placed into the toolbox area on the left of Lucidchart by specifying PanelLocation.ContentDock.

0.0.26

If a data URL is provided as an image fill style for a block, that image will be uploaded to Lucid's image service on the current user's account to optimize performance.

0.0.25

Extensions can now read, set, or clear simple static icon data graphics on shapes using BlockProxy.getSimpleStaticDataGraphic and BlockProxy.setSimpleStaticDataGraphic.
For example:

const client = new EditorClient();
const viewport = new Viewport(client);

client.registerAction('toggleIcon', () => {
    const selection = viewport.getSelectedItems();
    for (const block of selection) {
        if (block instanceof BlockProxy) {
            const icon = block.getSimpleStaticDataGraphic();
            if (icon) {
                block.setSimpleStaticDataGraphic(undefined);
            } else {
                block.setSimpleStaticDataGraphic({
                    icon: {
                        set: DataGraphicIconSets.STATUS_ICONS,
                        index: 0,
                    },
                    position: {
                        horizontalPos: HorizontalBadgePos.RIGHT,
                        verticalPos: VerticalBadgePos.TOP,
                        layer: BadgeLayerPos.EDGE,
                        responsive: BadgeResponsiveness.STACK,
                    },
                    color: '#ff0000',
                });
            }
        }
    }
});

0.0.24

Extensions can now easily read, set, or clear drop shadows on shapes using BlockProxy.getShadow and BlockProxy.setShadow.

0.0.21

Custom panels can now allow users to drag and drop blocks from the custom panel onto the current page.
See the new section Drag and drop blocks from a panel for details.

0.0.20

Extension can now mark themselves as required for a document. See the new section
Marking an extension as required for a document for details.

0.0.15

Menu items can now prompt the user to select files to be read by your extension. See the
new section Custom file upload in the Developer Guide.

0.0.14

The EditorClient class now has new
alert and confirm methods. See the new section on standard modals
in the Developer Guide.

0.0.13

The Viewport class added the ability to hook
the selection changing.

0.0.12

The Viewport class added the ability to hook
text editing. See the new section Hook Text Editing in the Developer Guide.

0.0.11

The DocumentProxy class added
methods to hook creating new items (blocks, lines, and groups) on the document.

The BlockProxy class added a
linkText method that connects a field value on one of the block's reference keys to one
of the block's text areas, so that editing that text area also writes the change back to
the linked data record.

0.0.10

The LineProxy class added methods to add
text areas as well as read and write the position of existing text areas on the line. See the
new section on Managing text in the Developer Guide.

0.0.9

The Panel class was added, allowing the creation of
custom UI in the right dock area of Lucidchart. See the new section on
Custom UI in the Developer Guide. In order to
use this new functionality you need to add the CUSTOM_UI scope to your editor extension
definition in manifest.json.

0.0.8

The EditorClient class now has a new method, oauthXhr, for making OAuth-protected API calls.
See the new section on Using OAuth APIs in the Developer Guide.