Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: No UI defined for command 'generate' #220

Open
zicen opened this issue Feb 8, 2024 · 3 comments
Open

Uncaught Error: No UI defined for command 'generate' #220

zicen opened this issue Feb 8, 2024 · 3 comments

Comments

@zicen
Copy link

zicen commented Feb 8, 2024

image
main.ts:

import { showUI } from '@create-figma-plugin/utilities'

export default function () {
  figma.codegen.on('preferenceschange', (event: CodegenPreferencesEvent) => {
    console.log("preferenceschange", event);
    if (event.propertyName === 'editor') {
      showUI({ height: 240, width: 320 })
    } 
    return Promise.resolve();
  });
}

package.json:

{
  "dependencies": {
    "@create-figma-plugin/ui": "^3.1.0",
    "@create-figma-plugin/utilities": "^3.1.0",
    "preact": ">=10",
    "prismjs": "1.29.0",
    "react-simple-code-editor": "0.13.1"
  },
  "devDependencies": {
    "@create-figma-plugin/build": "^3.1.0",
    "@create-figma-plugin/tsconfig": "^3.1.0",
    "@figma/plugin-typings": "1.82.0",
    "@types/prismjs": "1.26.3",
    "typescript": ">=4"
  },
  "scripts": {
    "build": "build-figma-plugin --typecheck --minify",
    "watch": "build-figma-plugin --typecheck --watch"
  },
  "figma-plugin": {
    "editorType": [
      "figma",
      "dev"
    ],
    "id": "react-editor",
    "name": "React Editor2",
    "main": "src/main.ts",
    "ui": "src/ui.tsx",
    "capabilities": [
      "codegen",
      "inspect"
    ],
    "codegenLanguages": [
      {
        "label": "Snippets",
        "value": "snippets"
      }
    ],
    "codegenPreferences": [
      {
        "itemType": "action",
        "propertyName": "editor",
        "label": "编辑"
      }
    ]
  }
}

@zicen
Copy link
Author

zicen commented Feb 8, 2024

I have an existing plugin and I'm planning to migrate it to React. Therefore, I used this plugin, but I encountered an issue with the UI display when clicking on the options in the 'generate' menu. The code above is my modification based on the plugin/react-editor template. Could you help me identify the problem?

@zicen
Copy link
Author

zicen commented Feb 8, 2024

I have uploaded the code here. https://github.com/zicen/react-editor-2

@anas-araid
Copy link

I have the same issue, in the manifest.json i have this command

  "relaunchButtons": [
    {
      "command": "open",
      "name": "Open Rive to Figma"
    }
  ],

and in main.ts this one:
figma.root.setRelaunchData({ open: "Description" });

but when i try to open the plugin from the sidebar, it throws me this error:

Uncaught Error: No UI defined for command 'open'

Docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants