image selection does not override name
This commit is contained in:
parent
6daf69f783
commit
b6eb4c076b
2 changed files with 5 additions and 3 deletions
|
@ -27,6 +27,7 @@ function previewAndStageFile(selectedFile){
|
||||||
var preview = document.getElementById('image-preview');
|
var preview = document.getElementById('image-preview');
|
||||||
var dropzone = document.getElementById('drop-zone');
|
var dropzone = document.getElementById('drop-zone');
|
||||||
var previewReader = new FileReader();
|
var previewReader = new FileReader();
|
||||||
|
var nameInput = document.getElementById('publish-name');
|
||||||
|
|
||||||
preview.style.display = 'block';
|
preview.style.display = 'block';
|
||||||
dropzone.style.display = 'none';
|
dropzone.style.display = 'none';
|
||||||
|
@ -36,9 +37,10 @@ function previewAndStageFile(selectedFile){
|
||||||
};
|
};
|
||||||
|
|
||||||
if (selectedFile) {
|
if (selectedFile) {
|
||||||
console.log(selectedFile);
|
|
||||||
previewReader.readAsDataURL(selectedFile); // reads the data and sets the img src
|
previewReader.readAsDataURL(selectedFile); // reads the data and sets the img src
|
||||||
document.getElementById('publish-name').value = selectedFile.name.substring(0, selectedFile.name.indexOf('.')); // updates metadata inputs
|
if (nameInput.value === "") {
|
||||||
|
nameInput.value = selectedFile.name.substring(0, selectedFile.name.indexOf('.'));
|
||||||
|
}
|
||||||
stagedFiles = [selectedFile]; // stores the selected file for upload
|
stagedFiles = [selectedFile]; // stores the selected file for upload
|
||||||
} else {
|
} else {
|
||||||
preview.src = '';
|
preview.src = '';
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<div class="col-right">
|
<div class="col-right">
|
||||||
<textarea id="direct-link-holder" hidden="true">No URL yet</textarea>
|
<textarea id="direct-link-holder" hidden="true">No URL yet</textarea>
|
||||||
<div id="publish-active-area">
|
<div id="publish-active-area">
|
||||||
<input type="text" id="publish-name" value="Name" class="form-control">
|
<input type="text" id="publish-name" placeholder="Your claim name" class="form-control">
|
||||||
<p>
|
<p>
|
||||||
<label for="publish-license">License:</label>
|
<label for="publish-license">License:</label>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
Loading…
Reference in a new issue