add manual image upload function to whiteboard
This commit is contained in:
parent
3edc96a5ce
commit
a49716abc9
@ -333,7 +333,18 @@ function initWhiteboard() {
|
|||||||
.off("click")
|
.off("click")
|
||||||
.click(function () {
|
.click(function () {
|
||||||
if (ReadOnlyService.readOnlyActive) return;
|
if (ReadOnlyService.readOnlyActive) return;
|
||||||
showBasicAlert("Please drag the image into the browser.");
|
showBasicAlert(`Please drag the image into the browser.<br>
|
||||||
|
Or upload here: <input type="file" id="manualFileUpload" name="myfile" />`);
|
||||||
|
document.getElementById("manualFileUpload").addEventListener(
|
||||||
|
"change",
|
||||||
|
function (e) {
|
||||||
|
$(".basicalert").remove();
|
||||||
|
if (ReadOnlyService.readOnlyActive) return;
|
||||||
|
e.originalEvent = { dataTransfer: { files: e.target.files } };
|
||||||
|
handleFileUploadEvent(e);
|
||||||
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// save image as imgae
|
// save image as imgae
|
||||||
@ -621,10 +632,8 @@ function initWhiteboard() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#whiteboardContainer").on("drop", function (e) {
|
function handleFileUploadEvent(e) {
|
||||||
//Handle drop
|
console.log(e);
|
||||||
if (ReadOnlyService.readOnlyActive) return;
|
|
||||||
|
|
||||||
if (e.originalEvent.dataTransfer) {
|
if (e.originalEvent.dataTransfer) {
|
||||||
if (e.originalEvent.dataTransfer.files.length) {
|
if (e.originalEvent.dataTransfer.files.length) {
|
||||||
//File from harddisc
|
//File from harddisc
|
||||||
@ -766,6 +775,13 @@ function initWhiteboard() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#whiteboardContainer").on("drop", function (e) {
|
||||||
|
//Handle drop
|
||||||
|
if (ReadOnlyService.readOnlyActive) return;
|
||||||
|
|
||||||
|
handleFileUploadEvent(e);
|
||||||
dragCounter = 0;
|
dragCounter = 0;
|
||||||
whiteboard.dropIndicator.hide();
|
whiteboard.dropIndicator.hide();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user