Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
0

Debug JSX of a Illustrator CEP extension

New Here ,
Feb 19, 2019 Feb 19, 2019

Hi all,

I am trying to find the trick to debug the JSX part of an extension while I run it. I can debug the javascript referenced by the HTML fine, but not the JSX. I tried various tricks I read about other CC apps, but I must be missing something...

Help appreciated!

3.0K
Translate
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
Guru ,
Feb 19, 2019 Feb 19, 2019

Hi Guy,

I use the following techniques.

(a) Console

1) I include a console in the html with a logging function and a rewrite of the $.writeln function so it logs to the console display.

See GitHub - Trevor-/console  You can in your extension include the relevant parts from that repo or just use the repo as a base to your extensions.

The crucial parts you need to copy are.

1) The logging function console/com.creative-scripts.console/jsx at master Ā· Trevor-/console Ā· GitHub

You must change the com.creative-scripts.console.__log in the lines (currently 19 and 27) . See 3) Below

$.dispatch('com.creative-scripts.console.__log', [message, style, __class, elementType, consoleID].join(ARRAY_SPLIT));

and

$.dispatch('com.creative-scripts.console.__log', [message, style, __class, elementType, consoleID].join(ARRAY_SPLIT));

2) The jsx runner console/console.js at master Ā· Trevor-/console Ā· GitHub

You can use this as a standalone see http://creative-scripts.com/jsx-js/  This is the method for loading the jsx scripts or running snippets. See the link for setting up a button to reload the extension and you can make buttons to reload the jsx scripts.

3) The console funtion console/console.js at master Ā· Trevor-/console Ā· GitHub You can remove the not relevant parts from it.

You must change the com.creative-scripts.console.__log in the line (currently 152) .

csInterface.addEventListener('com.creative-scripts.console.__log', jsxLog);

The com.creative-scripts.console.__log both in this file and in the jsx file mentioned in 1) above should be be changed the same thing and something unique to the extension something like com.galroy.fab.extension.00001.console.__log would be good making sure to change for each extension.

4) You must include the Vue file console/vue.min.js at master Ā· Trevor-/console Ā· GitHub

5) In your HTML include the relevant files and the app div See console/index.html at master Ā· Trevor-/console Ā· GitHub

What do you gain from the above is an console that you can interact with your extensions jsx.

2019-02-19_15-24-59.png

You can see I've typed into the extension to identify a selected part and output the result with a red background (Can use any valid css in the second parameter).

One output the to the console from any of the jsx files or calls you make.

(b) Alert

A lot more primitive with no option to interact but worth mentioning.

(c) Logging

Again no option to interact but very useful. http://creative-scripts.com/logging-with-a-smile/

(d) vsCode

If you have access to pre-release you can get the extended script plugin for vsCode if note you can run the code on sublime text or the estk or cstk.

Granularize  i.e. break up the jsx code into testable files / functions and test them out out side of the extensions environment.

If you are working with InDesign and presumably InCopy then you can actually access the extensions target engine from the debug apps. Unfortunatly you can't do that with the other Adobe apps.

HTH

Trevor

Translate
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
Guru ,
Feb 19, 2019 Feb 19, 2019
LATEST

Forgot to mention that when the extension is not running in debug more you just hide the console parts.

Translate
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