tma03
// TODO: Q1(c)(iii)
// Make an event listener to save text when it changes:
// …get the textarea element’s current value
// (getting HTML input values is in Block 2 Part 2 Section 6)
// …make a text item using the value
// (demonstrated elsewhere in this file)
// …store the item in local storage using the given key
// (local storage is in Block 3 Part 5)
// Connect the event listener to the textarea element:
// TODO: Q1(c)(iv) Task 1 of 3
// Instead of adding a dummy image:
// …trigger the click event of the hidden file input element
// (demonstrated in Block 3 Part 4)
}
// Function to handle a new file being selected
function processFile(event) {
// TODO: Q1(c)(iv) Task 2 of 3
// Complete this event listener to read the file when it is selected:
// (reading files into a data URL using FileReader is demonstrated in Block 3 Part 4)
// …then rather than using the data URL as src for an Image element,
// …use it to add a new image entry, using the current timestamp to make a key
// (demonstrated elsewhere in this file)
//
// TODO: Q1(c)(iv) Task 3 of 3
// In the same event listener, make an image item using the data URL
// (demonstrated elsewhere in this file)
// Store the item in local storage using the given key
// (demonstrated elsewhere in this file)