Issue #2754💬 AnsweredOpened May 6, 2020by shakil-official0 reactions

How can i customize video blocks a

快速解答by artf

Hi @ShakilAhmedMunna, you have to use custom Components

Read full answer below ↓

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,

代码片段TEXT
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)

artfMay 12, 2020

Hi @ShakilAhmedMunna, you have to use custom Components

shakil-officialMay 12, 2020

I did not understand how to use that .. Have any tutorial that

nadhu2013October 3, 2023

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.

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...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.