Skip to content
Snippets Groups Projects
Commit 88171efc authored by chris's avatar chris
Browse files

image fixes

parent 5f57e9c5
No related branches found
No related tags found
No related merge requests found
...@@ -85,7 +85,10 @@ const ImageUpload = ({ item, fileUpload, view }) => { ...@@ -85,7 +85,10 @@ const ImageUpload = ({ item, fileUpload, view }) => {
<input <input
id="file-upload" id="file-upload"
onChange={e => fileUpload(e.target.files[0])} onChange={e => {
fileUpload(e.target.files[0]);
if (inputRef.current) inputRef.current.value = '';
}}
ref={inputRef} ref={inputRef}
type="file" type="file"
/> />
......
...@@ -22,7 +22,14 @@ export default (view, fileUpload, placeholderPlugin) => file => { ...@@ -22,7 +22,14 @@ export default (view, fileUpload, placeholderPlugin) => file => {
view.dispatch(tr); view.dispatch(tr);
fileUpload(file).then( fileUpload(file).then(
(url, extraData = {}) => { fileData => {
let url = fileData;
let extraData = {};
if (typeof fileData === 'object') {
url = fileData.url;
extraData = fileData.extraData;
}
const pos = findPlaceholder(view.state, id, placeholderPlugin); const pos = findPlaceholder(view.state, id, placeholderPlugin);
// If the content around the placeholder has been deleted, drop // If the content around the placeholder has been deleted, drop
// the image // the image
......
...@@ -53,42 +53,42 @@ const DropDownComponent = ({ view, tools }) => { ...@@ -53,42 +53,42 @@ const DropDownComponent = ({ view, tools }) => {
const dropDownOptions = [ const dropDownOptions = [
{ {
label: '1. Multiple Choice', label: 'Multiple Choice',
value: '0', value: '0',
item: tools[0], item: tools[0],
}, },
{ {
label: '2. Multiple Choice (single correct)', label: 'Multiple Choice (single correct)',
value: '1', value: '1',
item: tools[1], item: tools[1],
}, },
{ {
label: '3. True/False', label: 'True/False',
value: '2', value: '2',
item: tools[2], item: tools[2],
}, },
{ {
label: '4. True/False (single correct)', label: 'True/False (single correct)',
value: '3', value: '3',
item: tools[3], item: tools[3],
}, },
{ {
label: '5. Matching', label: 'Matching',
value: '4', value: '4',
item: tools[4], item: tools[4],
}, },
{ {
label: '6. Essay', label: 'Essay',
value: '5', value: '5',
item: tools[5], item: tools[5],
}, },
{ {
label: '7. Multiple DropDown', label: 'Multiple DropDown',
value: '6', value: '6',
item: tools[6], item: tools[6],
}, },
{ {
label: '8. Fill The Gap', label: 'Fill The Gap',
value: '7', value: '7',
item: tools[7], item: tools[7],
}, },
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment