Issue #1887Opened March 13, 2019by sakshigarg90 reactions

Get JSON of specific gjs-data-type

Question

I want to export JSON of only a specific gjs-data-type="img" I'm trying this but it doesn't give any result:

id: "show-json",
          className: "btn-show-json",
          label: "JSON",
          context: "show-json",
          command(editor) {
            editor.Modal.setTitle("Components JSON")
              .setContent(
                `<textarea style="width:100%; height: 500px;">
            ${JSON.stringify(editor.getType('img')}
          </textarea>`
              )
              .open();
          }

Answers (3)

prashant2018March 14, 20190 reactions

Could you please include the file name which contains this code snippet ? If I am not wrong it is in panels/index.js

sakshigarg9March 15, 20190 reactions

Yes

sakshigarg9March 15, 20190 reactions

thanks @prashant2018 using editor.DomComponents.componentById.image I was able to get the desired JSON

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.