Appending a button inside the default (code view) modal.
Question
This is not actually an issue. I would like to add a button inside the original code view modal, it's like zip download button that @artf added inside this plugin.
Instead of modifying gjs export plugin, Is there any API option that I can achieve it in a few lines.
Probably, something like this..
var myBtn = document.createElement('BUTTON');
myBtn.innerHtml = "copy";
var modal = editor.Modal;
modal.append(myBtn);
It could be done by cloning a new code mirror as below. But there will be two code editors inside GJS editor and I think it's a bit more work for just a single button.
var codeViewer = editor.CodeManager.getViewer('CodeMirror').clone();
Answers (2)
I got it by listening this command run:export-template.
editor.on('run:export-template', () => {
editor.Modal.getContentEl().appendChild(myBtn);
})
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1421
[Bug]: "disabled" instead of "active" class for Panel Button View
Hello I assume there is a bug with class when Panel Button is disabled https://github.com/artf/grapesjs/blob/dev/src/panels/view/ButtonView...
Issue #1199
[Question] : Can we remove links?
I tried to add a button to remove links but i couldn't find a way. I can add them in a text with the RTE button and edit them by double-cli...
Issue #1300
Render blocks outside main editor not working
Hi @artf the render of blocks outside the main editor added in v 0.14.5 isn't working with gjs-preset-webpage plugin, otherwise it works li...
Issue #525
local2 example for storage not working
Using code provided in docs. https://github.com/artf/grapesjs/wiki/API-Storage-Manager in "add" examples. I am trying to create my own stor...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.