是否可以在不覆盖 array-modal.js (撇号-schemas/public/js) 的情况下扩展数组模式对话框?
我正在尝试在全局模块中创建一个链接数组,为此我创建了:
...
name: 'links',
label: 'Links',
type: 'array',
titleField: 'title',
schema: [{
name: 'title',
label: 'Title',
type: 'string'
}, {
name: 'url',
label: 'Url',
type: 'url'
}, {
name: '_page',
label: 'Page',
type: 'joinByOne',
withType: 'apostrophe-page',
idField: 'pageId',
filter: {
projection: {
title: 1,
slug: 1
}
}
}]
...
现在我想设置标题字段并在选择页面时禁用 url 字段。或者使用标题和 url 字段。如果我注册这样的脚本:
apos.define('apostrophe-array-editor-modal', {
extend: 'apostrophe-modal',
source: 'arrayEditor',
...
});
我覆盖了原始的array-modal.js,但我只想注册一个更改处理程序并在保存之前检查输入。
我的目标是管理员可以在全局部分编辑的(页脚/静态)链接列表,我可以在多个页面中使用它们。
谢谢!