我正在尝试apostrophe-images-widgets
为我的网站创建自定义布局。我目前已经在lib/modules/apostrophe-images-widgets/views/widget.html
. 我遇到的问题是,每当我选择要放入自定义区域的图像时,apos.attachments.url
都会调用两次:一次是我选择的图像,一次是undefined
附件。
我的自定义widget.html
看起来像这样:
<a href="/"><img class="logo" src="{{ apos.attachments.url(image.attachment, { size: 'full'}) }}" /></a>
我的整个lib
目录如下所示:
我app.js
的设置是默认配置。
我的习惯layout.html
是像这样引用图像:
{{
apos.area(data.page, 'web-logo', {
widgets: {
'apostrophe-images': {
size: 'full'
}
}
})
}}
我不确定我可以给你什么其他信息,除了这里抛出的异常apostrophe-attachments/lib/api.js
:
self.url = function(attachment, options) {
options = options || {};
// THROWS ERROR AT `attachment._id`
var path = '/attachments/' + attachment._id + '-' + attachment.name;
if (!options.uploadfsPath) {
path = self.uploadfs.getUrl() + path;
}
// other code
}
我不太确定在哪里可以找到解决方案......我还能提供什么,请告诉我。
我没有覆盖index.js
ofapostrophe-images-widgets
或apostrophe-images
我得到的确切错误很长,但这是堆栈跟踪的开始
TypeError: Cannot read property '_id' of undefined
不是很有帮助,但就是这样。
感谢您的阅读和任何帮助!