【发布时间】:2018-06-06 19:44:04
【问题描述】:
我在撇号 2.x 中创建了多个工作正常的小部件。现在我想正确地组织和组织它们。 我的大多数模块都有从内容宽度更改为浏览器宽度的选项。我试图概括这个函数,而不把代码放在每个模块中。
例如在我的 layout-widget/index.js 我有这个:
module.exports = {
extend: 'apostrophe-widgets',
label: 'Layout',
addFields: [{
name: 'size',
label: 'Modulbreite',
type: 'select',
choices: [{
label: 'Content width',
value: 'content-width'
},
{
label: 'Full width',
value: 'full-width'
}
],
required: true
}]
};
现在我想通过扩展这个通用模块配置来创建其他小部件,以获得单独的配置选项以及此选择。 文件:test-widget/index.js
module.exports = {
extend: 'layout-widgets',
label: 'Test',
addFields: [{
name: 'headline',
label: 'Headline',
type: 'string',
required: true
},
{
name: 'content',
label: 'Add Element',
type: 'area',
options: {
widgets: {
'fact': {},
'text': {}
}
}
}
]
};
但目前我在我的 CMS 中没有看到测试小部件的大小选项。我只看到直接在测试模块中定义的选项。这甚至可能还是我必须将尺寸选择插入每个模块本身?
最好的问候
【问题讨论】:
标签: apostrophe-cms