Changes between Initial Version and Version 1 of Ticket #11461, comment 6
- Timestamp:
- Aug 31, 2014, 11:24:12 AM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #11461, comment 6
initial v1 1 1 == Problems: == 2 2 3 There are some problems related to image upload.3 There are some problems related to ~~image upload~~ [[Reinmar: files upload in general]]. 4 4 5 In general s (ex. drop file from the file system) we need to handle 2 asynchronous operations:5 In general (e.g. drop file from the file system) we need to handle 2 asynchronous operations: 6 6 - get file from disc, 7 7 - upload files. 8 8 9 In some cases (e x. paste from Word, paste from Paint) image is already given as Base64 data in the source of a`img` element so we need to handle only upload.9 In some cases (e.g. paste from Word, paste from Paint) image is already given as Base64 data in the source of an `img` element so we need to handle only upload. 10 10 11 During this asynchronous operation (ex. file is uploading) user can modify the content of the editor. Lets focus on 4 critical cases: 12 1. undo/redo 11 During this asynchronous operation (e.g. file is uploading) user can modify the content of the editor. Let's focus on 4 critical cases: 12 13 1. undo/redo, 13 14 2. getData/switch to the source mode, 14 15 3. image modification/dialogs, … … 17 18 == Expected behavior: == 18 19 19 1. Undo/Redo should work s fine,in every case. Scenario:20 1. Undo/Redo should work fine in every case. Scenario: 20 21 - user pastes image which should be uploaded, 21 22 - user modifies some content, creates an undo snapshot, before upload is done, 22 23 - upload is done, 23 - user press undo.24 Content should be restored, but the uploading image should be replaceswith the uploaded image (url instead of data in source).24 - user presses undo. 25 Content should be restored, but the image that was being uploaded should be replaced with the uploaded image (url instead of data in source). 25 26 26 2. If user call getData or switch to the source mode before image is fully uploaded, then the uploading imageshould be removed from the HTML content. We should not show Base64 data to user.27 2. If user calls getData or switches to the source mode before image is fully uploaded, then the image being uploaded should be removed from the HTML content. We should not show Base64 data to user. 27 28 28 29 3. We can not show Base64 data to the end user in the dialog too. 29 Firstly, it would be a very bad UX, these are definitely data that end use donot care about.30 Firstly, it would be a very bad UX, these are definitely data that end user does not care about. 30 31 Secondly, putting such a big string in the dialog we can hang or break a browser. 31 32 `src` field in the dialog or whole dialog should be disabled. 32 33 33 4. Drag, drop, copy, cut and paste should not break an editor or caused second upload of the same image. If user cut or delete image upload should be canceled. 34 4. Drag, drop, copy, cut and paste should not break an editor or caused second upload of the same image. If user cut or delete image upload should be canceled. [[Reinmar: when user duplicates an image (e.g. copy+paste few times) every image's src should be updated]]. 34 35 35 36 == Solution: == … … 37 38 ==== Image loading: 38 39 39 For the first asynchronous operation best solution seems to be delay paste event until we get files from hard disc. I measured it with ~1 MB image, SSD and H HD and it takes no more then 20ms for native Ubuntu with Chorme 36 and 100-250ms for virtual machine (Windows 7 with Chrome, Firefox or IE). Keep in mind that:40 - the only case when we get files for the hard disc is when dataVauleis empty so there should be no conflicts with other plugins,40 For the first asynchronous operation best solution seems to be delay paste event until we get files from hard disc. I measured it with ~1 MB image, SSD and HDD and it takes no more than 20ms for native Ubuntu with Chrome 36 and 100-250ms for virtual machine (Windows 7 with Chrome, Firefox or IE). Keep in mind that: 41 - the only case when we get files for the hard disc is when `dataVaule` is empty so there should be no conflicts with other plugins, 41 42 - we are talking only about jpg/png images here, these are relatively small files. 42 43 … … 48 49 ==== Image uploading: 49 50 50 For the image upload I'd prefer to use a widget. Thank to the widget:51 For the image upload I'd prefer to use a widget. Thanks to the widget system: 51 52 - problem 2 can be fixed with 1 line of code (downcast method will return an empty text node), 52 53 - problem 3 can be fixed out of the box,