How can i customize video blocks a
Question
I want to create a video gallery-like image gallery. After drop video block shows the gallery . How can I do that?
I using grapesjs-preset-webpage plugin . try to below code that not working ..
var editor = grapesjs.init({
height: '100%',
showOffsets: 1,
noticeOnUnload: 0,
container: '#gjs',
fromElement: true,
plugins: ['gjs-preset-webpage' , 'gjs-blocks-basic'],
storageManager: {
autoload: 0,
autosave: false,
setStepsBeforeSave: 1,
contentTypeJson: true,
},
pluginsOpts: {
'gjs-preset-webpage': {},
'gjs-blocks-basic' : {
'block' : {
'video' : {
label: 'Updated simple block',
attributes: {
title: 'My title'
}
}
}
}
},
commands: {
defaults: [
],
},
});
editor.Panels.addButton
('options',
[{
id: 'save-db',
className: 'fa fa-floppy-o',
command: 'save-db',
attributes: {title: 'Save'}
}]
);
// Add the command
editor.Commands.add
('save-db',
{
run: function(editor, sender)
{
sender && sender.set('active', 0); // turn off the button
editor.store();
var htmldata = editor.getHtml();
var cssdata = editor.getCss();
console.log(htmldata);
console.log(cssdata);
console.log(htmldata);
console.log(cssdata);
$.post("https://reqbin.com/echo",
{
html: htmldata,
css: cssdata
});
}
});
var blockManager = editor.BlockManager;
var c = blockManager.get('video').set({
label: 'e',
category: 'Basic',
changing : true,
attributes: {
title: 'My title'
},
content: {
type: 'video', // Built-in 'video' component
style: {
},
removable: false, // Once inserted it can't be removed
}
})
console.log(c);Answers (3)
Hi @ShakilAhmedMunna, you have to use custom Components
I did not understand how to use that .. Have any tutorial that
is there any solution for this ticket because i need the same as I using grapesjs-preset-webpage plugin
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3442
BUG: Error after call `editor.destroy()`
Create editor instance Try destroy Got error
Issue #1761
[Question] how to defined textNoElement value after grapesjs.init
Hi, I try to define the values for textNoElement after I was initialized a grapesjs. but it not reflected in grapesjs UI. can anyone please...
Issue #384
Create and Edit Template into Database
This is my code to Create a new template and insert the inline html with style into the database : I am able to insert the template-data in...
Issue #862
Jquery Image Viewer plugin in GrapesJs custom Block
I want to integrate Image viewer jquery plugin in grapesjs new custom block but jquery code doesn't recognize. How can write jquery code in...
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.