This repository has been archived by the owner on Jun 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
t/225: The ImageUploadCommand should check whether it can be executed in the selection context. #228
Merged
t/225: The ImageUploadCommand should check whether it can be executed in the selection context. #228
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
594b12c
Fix: The ImageUploadCommand should check whether it can be executed i…
oleq 949259c
Merge branch 'master' into t/225
jodator be5e3a4
Merge branch 'master' into t/225
jodator 12ca8a0
Changed: Support multiple file uploads in ImageUploadCommand.
jodator 0b6be9e
Merge branch 'master' into t/225
jodator 4b3e1cf
Rename options.file to option.files in ImageUploadCommand.
jodator 5ba392d
Changed: The ImageUploadCommand not the ImageUploadUI should calculat…
jodator b5940b5
Removed the insertAt option from `ImageUploadCommand`. The `ImageUplo…
jodator f22029d
Disable image upload command when selection is on Object or inside ot…
jodator 678d6ac
Docs: Update private method comments.
jodator File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm missing a comment why this check and parent swapping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ps.: Also this doesn't look consistent as it might swap to:
Maybe it should lookup for allowed parent or something other in the schema?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ps.: A comment would be sufficient also :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH, I copy&pasted it from the
InsertTableCommand
implementation without any deeper analysis. The upload command never splits the block, it inserts the new image next to the one the selection is anchored to. So I guess theif
is correct here because it comes down toThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, have you seen https://github.com/ckeditor/ckeditor5-image/issues/225#issuecomment-407021363? Do you have any idea how to include a fix for that without breaking the multi-upload?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check that and let you know :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oleq Sorry for longer reply. So I've manage to make #227 work by adding multi-file upload support to the
FileUploadCommand
itself:Where
uploadImage()
is the method that previously uploaded a file (contents ofeditor.model.change
block.This way the command can be disabled when an image is selected but it will allow UI to pass multiple files to upload at once - not as it is currently where each file is processed individually by a command. The problem is that after
execute()
the first image is selected and the command itself was disabled so next files were discarded as the command goes disabled then.I have no other idea for solving this as probably the expected behavior is to select newly inserted image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ps.: the
ImageUploadUI
was modified to:but those two snippets must be checked if there are OK as the files are inserted in revers order (AFAICS).