我正在使用Froala編輯器,並試圖插入多個圖像時偶然發現問題。問題是隻有第一張圖片被插入,而其他圖片沒有被插入。我在網上搜索了答案,但找不到任何答案。是否可以一次插入多個圖像?Froala編輯器 - 插入多個圖像
這裏是我的代碼:
function show() {
$current_image = editor.image.get();
var image = {
id: 0
}
angular
.element($('html'))
.scope()
.showImageManager(image)
.then(function (imageList) {
for (var i = 0; i < imageList.length; i++) {
insert(imageList[i].url);
}
});
}
function insert(url) {
if (!$current_image) {
// Make sure we have focus.
editor.events.focus(true);
editor.selection.restore();
}
else {
$current_image.trigger('click');
}
editor.undo.saveStep();
editor.image.insert(url, false, {}, $current_image, { });
}