diff --git a/libs/plugin-types/index.d.ts b/libs/plugin-types/index.d.ts index 2ea9c0a..7c271da 100644 --- a/libs/plugin-types/index.d.ts +++ b/libs/plugin-types/index.d.ts @@ -1069,6 +1069,20 @@ export interface Context { * ``` */ createShapeFromSvg(svgString: string): Group | null; + /** + * Creates a Group from an SVG string. The SVG can have images and the method returns + * a Promise because the shape will be available after all images are uploaded. + * Requires `content:write` permission. + * @param svgString The SVG string representing the shapes to be converted into a group. + * @return Returns a promise with the newly created Group containing the shapes from the SVG. + * + * @example + * ```js + * const svgGroup = await context.createShapeFromSvgWithImages('...'); + * ``` + */ + createShapeFromSvgWithImages(svgString: string): Promise; + /** * Creates a Text shape with the specified text content. Requires `content:write` permission. * @param text The text content for the Text shape. diff --git a/libs/plugins-runtime/src/lib/api/index.ts b/libs/plugins-runtime/src/lib/api/index.ts index ba1655a..6ea2d1d 100644 --- a/libs/plugins-runtime/src/lib/api/index.ts +++ b/libs/plugins-runtime/src/lib/api/index.ts @@ -240,6 +240,11 @@ export function createApi( return plugin.context.createShapeFromSvg(svgString); }, + createShapeFromSvgWithImages(svgString: string): Promise { + checkPermission('content:write'); + return plugin.context.createShapeFromSvgWithImages(svgString); + }, + group(shapes: Shape[]): Group | null { checkPermission('content:write'); return plugin.context.group(shapes);