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

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,

Code SnippetTEXT
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, 20200 reactions

Hi @ShakilAhmedMunna, you have to use custom Components

shakil-officialMay 12, 20200 reactions

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

nadhu2013October 3, 20230 reactions

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

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.