Issue #2832💬 AnsweredOpened June 15, 2020by mbaird40 reactions

Replace/Override template for CategoryView?

快速解答by artf

No, unfortunately, it's not possible but you can always create your own blocks container and using HTML5 D&D to drop stuff Here you can find an example https://github.com/artf/grapesjs/issues/2595#issuecomment-593699277

Read full answer below ↓

Question

Hi,

Wondering if it's at all possible to use custom HTML to replace the CategoryView's template when adding a new block?

I've tried a couple things, but just based on the source code, I'm not seeing a way.

editor.BlockManager.add(name, {
            category: {
                view: {
                    template: '<div><h1>Layout</h1></div>',
                    render() {
                        this.$el.html(this.template);
                        return this;
                    }
                }
            },
            ...
        });

Answers (1)

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 →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.