1
我使用ace編輯器來處理我的項目 - 包括enableEmmet: true
。ACE編輯器 - update_image_size不起作用
https://ace.c9.io/demo/emmet.html
但顯然動作update_image_size
不工作,而不是我收到此錯誤信息:
TypeError: Cannot read property 'locateFile' of undefined
代碼片段:https://github.com/cloud9ide/emmet-core/blob/master/emmet.js#L9972-L10002
/**
* Returns image dimensions for source
* @param {IEmmetEditor} editor
* @param {String} src Image source (path or data:url)
*/
function getImageSizeForSource(editor, src, callback) {
var fileContent;
var au = require('actionUtils');
if (src) {
// check if it is data:url
if (/^data:/.test(src)) {
fileContent = require('base64').decode(src.replace(/^data\:.+?;.+?,/, ''));
return callback(au.getImageSize(fileContent));
}
var file = require('file');
var absPath = file.locateFile(editor.getFilePath(), src);
if (absPath === null) {
throw "Can't find " + src + ' file';
}
file.read(absPath, function(err, content) {
if (err) {
throw 'Unable to read ' + absPath + ': ' + err;
}
content = String(content);
callback(au.getImageSize(content));
});
}
}
日誌表明var file = require('file');
總是undefined
。
如果您只是看看我的問題並分享一些您的科學知識,我會非常感激。謝謝!
非常感謝您的親切信息! – UserNaN