• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Unable to use Spectrum React Objects in UXP Plugin (createTreeWalker is not a function)

Explorer ,
Apr 12, 2024 Apr 12, 2024

Copy link to clipboard

Copied

Hi, I'm trying to spin up a UXP plugin and use spectrum elements in the UI. However, when I attempt to run the plugin with a spectrum object I recieve the following error. I've looked all over and installed various packages via npm but no luck so far. Any help would be appreciated!

Phil815_0-1712958768667.png

import React from "react";

import { WC } from "./WC.jsx";
import '@swc-uxp-wrappers/button/sp-button.js';

import "./Home.css";

export const Home = () => {
    return (
        <div>
            <WC>
                <p className="display">Congratulations! You just created your first React Plugin.</p>
            </WC>
            <sp-button variant="primary">I'm a SWC button</sp-button> 



       </div>
    );
}
TOPICS
How to , UXP Scripting

Views

195

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 12, 2024 Apr 12, 2024

https://developer.adobe.com/indesign/uxp/reference/uxp-api/reference-js/Global%20Members/HTML%20DOM/Document/

 

createTreeWalker(root, whatToShow, filter)

[ This feature is behind a feature flag. You must turn on enableSWCSupport in the featureFlags section of plugin manifest to use the same ]

 

Have you turned it on?

 

Or can you show the actual code?

 

Votes

Translate

Translate
Community Expert ,
Apr 12, 2024 Apr 12, 2024

Copy link to clipboard

Copied

LATEST

https://developer.adobe.com/indesign/uxp/reference/uxp-api/reference-js/Global%20Members/HTML%20DOM/...

 

createTreeWalker(root, whatToShow, filter)

[ This feature is behind a feature flag. You must turn on enableSWCSupport in the featureFlags section of plugin manifest to use the same ]

 

Have you turned it on?

 

Or can you show the actual code?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines