From 39661a2b67ea929368bd42a800e3ad3aa85687b6 Mon Sep 17 00:00:00 2001 From: Dmitry Rodionov Date: Fri, 16 Feb 2024 13:41:54 +0400 Subject: [PATCH] Use modern Sketch API to invoke plugin commands --- sketch/src/sketch/actions/plugin.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sketch/src/sketch/actions/plugin.js b/sketch/src/sketch/actions/plugin.js index 2d11bd7..1d91dad 100644 --- a/sketch/src/sketch/actions/plugin.js +++ b/sketch/src/sketch/actions/plugin.js @@ -69,7 +69,11 @@ export function perform(condition, layer, params) { setCommandParamsToMetadata(layer, params) // run the command - NSApp.delegate().runPluginCommand(command) + if (NSApp.delegate().runPluginCommand_fromMenu_context_) { + NSApp.delegate().runPluginCommand_fromMenu_context_(command, null, {}) + } else { + throw new Error("The current version of Sketch is not supported.") + } // remove params removeCommandParamsFromMetadata(layer)