fix image resizing

This commit is contained in:
Ali Abid 2020-08-05 17:25:27 -07:00
parent 2943492564
commit b9718cd484
2 changed files with 18 additions and 22 deletions

View File

@ -107,17 +107,15 @@ const image_input = {
image_data: null,
set_image_data: function(data, update_editor) {
let io = this;
resizeImage.call(this, data, 600, 600, function(image_data) {
io.image_data = image_data
io.target.find(".image_preview").attr('src', image_data);
if (update_editor) {
io.tui_editor.loadImageFromURL(io.image_data, 'input').then(function (sizeValue) {
io.tui_editor.clearUndoStack();
io.tui_editor.ui.activeMenuEvent();
io.tui_editor.ui.resizeEditor({ imageSize: sizeValue });
});
}
})
io.image_data = data
io.target.find(".image_preview").attr('src', data);
if (update_editor) {
io.tui_editor.loadImageFromURL(io.image_data, 'input').then(function (sizeValue) {
io.tui_editor.clearUndoStack();
io.tui_editor.ui.activeMenuEvent();
io.tui_editor.ui.resizeEditor({ imageSize: sizeValue });
});
}
},
load_preview_from_files: function(files) {
if (!files.length || !window.FileReader || !/^image/.test(files[0].type)) {

View File

@ -107,17 +107,15 @@ const image_input = {
image_data: null,
set_image_data: function(data, update_editor) {
let io = this;
resizeImage.call(this, data, 600, 600, function(image_data) {
io.image_data = image_data
io.target.find(".image_preview").attr('src', image_data);
if (update_editor) {
io.tui_editor.loadImageFromURL(io.image_data, 'input').then(function (sizeValue) {
io.tui_editor.clearUndoStack();
io.tui_editor.ui.activeMenuEvent();
io.tui_editor.ui.resizeEditor({ imageSize: sizeValue });
});
}
})
io.image_data = data
io.target.find(".image_preview").attr('src', data);
if (update_editor) {
io.tui_editor.loadImageFromURL(io.image_data, 'input').then(function (sizeValue) {
io.tui_editor.clearUndoStack();
io.tui_editor.ui.activeMenuEvent();
io.tui_editor.ui.resizeEditor({ imageSize: sizeValue });
});
}
},
load_preview_from_files: function(files) {
if (!files.length || !window.FileReader || !/^image/.test(files[0].type)) {