grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

Add new views and new content

Open blackbirdzzz opened this issue 9 years ago • 11 comments

Hi, i'm back for some question haha, So i wanted to create a new views and add some information example "The name of the file that you gonna download at the "Export" " That can be change by a form in the "Views" .. so i created a new one but i don't know in the src "i'm using the grapejs - preset newsletter notice this", how to add some line and content in my new "Views named : "EDITOR" so i want to do something like this see the picture : https://image.noelshack.com/fichiers/2017/36/1/1504517384-screenshot-at-sept-04-11-27-11.png

Thanks, for my second question i wanted to do something while you drag something from the BlockManager, i wanted to create something like a modal when you drag a special block from the BlockManager example a block named "Product" and after draged it , open a gui like the gui of "Picture" to add an input like Enter the ref of the product and i will use some var to, replace the good name and price of an object in html by a ref. thanks again !

blackbirdzzz avatar Sep 04 '17 09:09 blackbirdzzz

For the Panel, I'd just add the content once the editor is loaded

const content = document.querySelector('#your-content');
editor.on('load', () => {
     document.querySelector('.your-custom-panel'). appendChild(content);
})

Check out #174 to see how to setup commands on drop

artf avatar Sep 05 '17 12:09 artf

What type of content did u need to add to add some : button or input ?

blackbirdzzz avatar Sep 05 '17 13:09 blackbirdzzz

Just add whatever content/input/button you want...

artf avatar Sep 05 '17 19:09 artf

Haha, i know sorry you misunderstand me, can u give me a sample of code to add some button or input i try something with document.querySelector('') , don't understand why it does'nt work :x

blackbirdzzz avatar Sep 06 '17 08:09 blackbirdzzz

<div id="your-content">
     Input: <input/>
     ...
     <button>Button</button> 
      <!-- eg. bind a click event on button and do something with GrapesJS API -->
</div>
const content = document.querySelector('#your-content');

artf avatar Sep 06 '17 12:09 artf

Oh thanks a lot did you know where i need to place the html part ? in the index or i can place it on my main.js ?

blackbirdzzz avatar Sep 06 '17 12:09 blackbirdzzz

You can place it in index

artf avatar Sep 06 '17 12:09 artf

When i place the html part in the index it display in the front part did i need to use style: hidden ? Thanks a lot for your answers 👍

blackbirdzzz avatar Sep 06 '17 12:09 blackbirdzzz

https://image.noelshack.com/fichiers/2017/36/3/1504701299-screenshot-at-sept-06-14-34-34.png Its automaticaly display and not in the view part (You can see the screenshot)

My index code https://codeshare.io/aV3zOR

blackbirdzzz avatar Sep 06 '17 12:09 blackbirdzzz

You have to append it

const content = document.querySelector('#your-content');
editor.on('load', () => {
     document.querySelector('.your-custom-panel'). appendChild(content);
})

artf avatar Sep 07 '17 11:09 artf

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.

lock[bot] avatar Sep 18 '19 12:09 lock[bot]