-
Notifications
You must be signed in to change notification settings - Fork 136
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
Add simple attachment button #823
Conversation
Signed-off-by: Felix Nüsse <felix.nuesse@t-online.de>
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.
Thanks for this PR!
On a sidenote, the uploadfeature may fail silently when the php upload size is set to lower than the file one tries to upload. The result is that the NoteService errors out because the 'tmp_name' field will be unset and fread cant read the file which has not been uploaded. Is this something we need to check against?
Yes, please! Could you please add additional checks for this to the PHP code and an error message to the JavaScript code?
Here are some other points:
- please implement the button using the
ActionButton
component inside of anActions
component. See e.g. https://github.com/nextcloud/notes/blob/v4.3.0/src/components/Note.vue#L41 - please add an appropriate icon (due to the text label, the button is too large) using
vue-material-design-icons
(e.g.file-image-plus
?) - please use
position: fixed
for positioning the button and place it directly (with an appropriate margin) left to the three-dot menu. - could we also add another
ActionButton
(inside the sameActions
) for adding existing images (your existing methodonClickSelect
)? - can we add the original file name as alternate text for the markdown code? (e.g.
![original filename](123456.jpg)
)
Thanks!
Signed-off-by: Felix Nüsse <felix.nuesse@t-online.de>
Signed-off-by: Felix Nüsse <felix.nuesse@t-online.de>
Signed-off-by: Felix Nüsse <felix.nuesse@t-online.de>
I implemented some of your changes! We now have the buttons directly next to the threedot, also the select image button is there. However, i have reused available icons. The name used is now the original filename, not the generated uuid (as displayvalue, not the actual file) I have also implemented a VERY basic check for tmp_file, though it really is not the best as it does not return a 500. If we want to expand on this, we should not do it in this pr because it requires quite a bit of changes. I have also not used actionbuttons. I consider this PR a stopgap measure, and i dont want to spend too much time refining this pr since it gets removed anyway. (that obviously excludes the server-check and the errormessages which certainly do not get overridden by the toolbar. Also that is the reason why i didnt add new icons, they will be updated in #788) Edit: I tried using actionbuttons as in the example, but that ended up in very strange behaviour that i didnt really want to debug, thats why i said i dont want to put too much effort in this |
688fbd5
to
9482695
Compare
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.
Thanks for your changes and sorry for having too less time for a review. I've rebased the branch to current master and did some support with switching to the ActionButton
and Actions
components. For now, this part is fine.
I have also implemented a VERY basic check for tmp_file, though it really is not the best as it does not return a 500. If we want to expand on this, we should not do it in this pr because it requires quite a bit of changes.
I don't think that it will require much changes. You just need to throw an Exception in the PHP code, the method Controller.Helper.handleErrorResponse()
does the remainder for you. But you will have to adjust the JavaScript code a little bit.
However, inserting an existing image has some issues. They exist already since #785:
- Insert existing image does not work, since the
PROPFIND
request results in a 404. I think it's becauseconst currentNotePath = apppath + '/' + categories
should use the current category instead of allcategories
- even if this would work, the inserted Markdown code contains a wrong path to the chosen image - at least when working in a subdirectory
Could you please fix these two issues? The fix will be also needed for the toolbar PR, so it's not wasteful. Any changes will also apply to the toolbar PR (when you rebase it after merging this one).
Signed-off-by: Felix Nüsse <felix.nuesse@t-online.de>
Signed-off-by: Felix Nüsse <felix.nuesse@t-online.de>
Signed-off-by: Felix Nüsse <felix.nuesse@t-online.de>
Signed-off-by: Felix Nüsse <felix.nuesse@t-online.de>
9482695
to
54ed311
Compare
…ture/74/imageupload # Conflicts: # src/components/EditorEasyMDE.vue
Signed-off-by: Felix Nüsse <felix.nuesse@t-online.de>
Signed-off-by: Felix Nüsse <felix.nuesse@t-online.de>
I implemented the 500 in the notesservice. I like what you did with the action buttons, the only thing i changed was adding a 5px margin to seperate the two buttons. |
Signed-off-by: Felix Nüsse <felix.nuesse@t-online.de>
Signed-off-by: Felix Nüsse <felix.nuesse@t-online.de>
@korelstar Ah yes now i know why adding images fails: if i assume that |
There was still an issue when uploading an image (reference to In addition, there was an issue with the relative path (e.g. if note is in All in all, I think it's done now. I will do some more tests and merge it then. Thanks! |
Oh yeah, that reference slipped, sorry. Well, using a library is ingenious, somehow i always stick to plain js for most of the logic. Maybe it's the left-pad-trauma, but anyhow: yours looks way better! |
Signed-off-by: Felix Nüsse felix.nuesse@t-online.de
This closes #74. It allows to upload arbitrary files to display as attachments. This should be superseeded and replaced by #790.
I did not add this button to the three dot menu because this would require the Note Vue component to hold references to the editor/view and react to it. This functionality however, will be part of #790.
On a sidenote, the uploadfeature may fail silently when the php upload size is set to lower than the file one tries to upload. The result is that the NoteService errors out because the 'tmp_name' field will be unset and fread cant read the file which has not been uploaded. Is this something we need to check against?