这是我的代码,我也安装了node模块,但它不工作。
var editor = grapesjs.init({
showOffsets: 1,
noticeOnUnload: 0,
container: '#gjs',
height: '100%',
fromElement: true,
plugins: ["gjs-blocks-basic"],
pluginsOpts: {
"gjs-blocks-basic": {
block: {
category: 'basic',
}
}
},发布于 2021-08-02 15:08:13
我认为你有一个额外的关键block插件选项,它应该是类别。
const editor = grapesjs.init({
showOffsets: 1,
noticeOnUnload: 0,
container: '#gjs',
height: '100%',
fromElement: true,
plugins: ["gjs-blocks-basic"],
pluginsOpts: {
"gjs-blocks-basic": {
category: "Basic"
}
});发布于 2021-10-29 13:28:58
自定义插件不能添加单引号
const editor = grapesjs.init({
showOffsets: 1,
noticeOnUnload:0,
container: '#gjs',
plugins: ['gjs-preset-webpage',myPlugin,'myNewComponentTypes' ],
pluginsOpts: {
'grapesjs-plugin-export': { /*option*/ },
'myPlugin':{ category: "myPlugin"},
},函数Reference中的
生成插件
//PLUGIN
function myPlugin(editor) {
editor.BlockManager.add('my-block',{
label:'Plug',
category: 'Basic',
content:'<div class="my-block"><p>Plugin Success</p></div>',
});
}https://stackoverflow.com/questions/68588528
复制相似问题