-
Notifications
You must be signed in to change notification settings - Fork 110
Improve image attachment management #2426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
945a811 to
8f7f263
Compare
|
@max-nextcloud I found a reasonable solution for 2.a. and 2.b. : move the content of the
The image loading has been moved in a method as well ( The |
b7509a6 to
c9d9645
Compare
|
/compile |
|
/compile amend |
059b730 to
6457ce5
Compare
6457ce5 to
c2c3425
Compare
|
@vinicius73 Thanks for the review. If you have any idea about how to fix the Jest tests. It seems the checks are done before the async stuff is finished. |
|
Let's commit the compiled code in the end to make our lives easier. So don't forget to compile locally 😉. |
src/nodes/ImageView.vue
Outdated
| this.loadImage(this.getTextApiUrl(imageFileName)).catch((e) => { | ||
| this.onImageLoadFailure() | ||
| }) |
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.
You can simplify this code.
| this.loadImage(this.getTextApiUrl(imageFileName)).catch((e) => { | |
| this.onImageLoadFailure() | |
| }) | |
| this.loadImage(this.getTextApiUrl(imageFileName)) | |
| .catch(this.onImageLoadFailure) |
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.
Also, we can use async/await and wrap this.init() and handle error from this.init()
| this.loadImage(this.getTextApiUrl(imageFileName)).catch((e) => { | |
| this.onImageLoadFailure() | |
| }) | |
| await this.loadImage(this.getTextApiUrl(imageFileName)) |
or
| this.loadImage(this.getTextApiUrl(imageFileName)).catch((e) => { | |
| this.onImageLoadFailure() | |
| }) | |
| return this.loadImage(this.getTextApiUrl(imageFileName)) |
and, change this.init() call.
this.init().catch(this.onImageLoadFailure)c2c3425 to
e7f8e53
Compare
|
Thanks a lot for picking up the idea. 😍 |
|
/compile |
…n ImageView Signed-off-by: Julien Veyssier <[email protected]>
…to attachment API Signed-off-by: Julien Veyssier <[email protected]>
Signed-off-by: Julien Veyssier <[email protected]>
Signed-off-by: Julien Veyssier <[email protected]>
70b408f to
7b8c4e2
Compare
|
/compile |
Signed-off-by: Julien Veyssier <[email protected]>
cc11bf5 to
b95deb9
Compare
|
/compile |
|
@vinicius73 @max-nextcloud Ready to merge! |
| ',;:!?.§-_a_', | ||
| 'a`a`.png', | ||
| ]; | ||
| public function testGetOldAttachmentNamesFromContent() { |
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.
Something for a separate PR but we should move those tests into tests/unit/Service/ImageServiceTest.php
juliusknorr
left a comment
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.
Minor comments, but feel free to address them separately :)
f416565 to
e78c3ea
Compare
|
@vinicius73 Thanks |
Signed-off-by: Julien Veyssier <[email protected]>
e78c3ea to
1715a7c
Compare
|
/compile |
Signed-off-by: nextcloud-command <[email protected]>
|
Should we backport this to stable24? I think we should. |
|
/backport to stable24 |
|
The backport to stable24 failed. Please do this backport manually. |
…ment Signed-off-by: Julien Veyssier <[email protected]>
refs #2411
Implementation of the behaviour suggested by @max-nextcloud in #2411 (comment) with which I completely agree ❤️ :
.attachments.MD_FILE_ID/FILENAMEuse FILENAME to get the image with the attachment API..attachments.OTHER_FILE_ID/FILENAMESo this PR brings back the relative path in the markdown content's image target. We now write:
The problem with 2.a. and 2.b. is that
imageUrlis a computed prop in which we would need a non-async (sync?) image loading check. But we can only make async network calls in a computed prop 😁.There already is a check which depends on
imageUrl.In short, we would need to make deeper changes to ImageView to allow 2.a. and 2.b.
We could discuss that and in the meantime I might come up with a first solution.