HendrixString / adobe-cep-react-create

Create Adobe-CEP extension with React, Material-UI, Native Node modules, Webpack, Babel and ExtendScript
Apache License 2.0
125 stars 27 forks source link

Problem sending CSEvent from client #1

Closed LizardTechDev closed 6 years ago

LizardTechDev commented 6 years ago

I'm trying this out and the front-end went really well. Kudos! However, now I'm trying to communicate back to a native C++ Photoshop Plugin using a CSEvent provided in CSInterface.js from App.tsx. I'm relatively new to React, JS and CEP, so I'm guessing this is probably something stupid on my end. When I run this code I get a Uncaught TypeError: _CSInterface.CSEvent is not a constructor

import {CSEvent, CSInterface} from '../libs/CSInterface.js'; ...

onExecutePlugin = (options) => {
      console.log('App:: onExecutePlugin');
      console.log(options);
      var okEvent = new CSEvent('com.adobe.csxs.events.OkClicked', 'APPLICATION', 'ILST', 'FreeGridUI');
      new CSInterface().dispatchEvent(okEvent);

      // here disable UI
      session.invokePlugin(options);
      // here enable ui
   }
HendrixString commented 6 years ago

Hi. Thanks.

Two things I would check

  1. Search for CSEvent in CSInterface. Is it defined there ?
  2. CSInterface is only applicable from inside PS. Where are you running from ? From inside Photoshop ? If so open chrome at the debugging port so we can get a better error debugging

In the future I will release a revamped UI for the plugin that includes a console for quick chrome debugging. Try to answer my questions first

LizardTechDev commented 6 years ago

Indeed, I was trying to run this from the webpack dev server rather than thru Photoshop. I've since moved my event down into Session.js (where CSInterface is already in-use) and all is well. Thank you for you prompt reply and great work on this project.