-
Notifications
You must be signed in to change notification settings - Fork 8
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
[v1.16] Use of FileHandler #121
Comments
That would be great, though 'insert rule' (horizontal line insert) would need a separate a new separate entry |
@luke- What I have researched:
I see another approach:
So what we have to do to implement this solution:
|
@yurabakhtin Thanks for the research. Hmm, I'm not a big fan of the solution, that we always need to upload the file to the file list first and then add it to the Markdown editor. Some arguments against this:
Without digging deeper into the code, we need two parts:
Do you think we can use the existing event? We may also have to introduce a new event here and refactor the FileHandler a little. |
Ok, I agree with it.
Yes, it seems w can try to use the JS event |
@yurabakhtin Thanks, looks good. |
@luke- Currently I could implement only this way: I have 2 problems:
|
From discussion: Set global var on click file handler and on Normal link and on RichTextToolbar link. |
Commit 8fc807b. |
@yurabakhtin Why do we need this?
I would prefer file links to always trigger the file handler modal. Or are there situations where this should not be the case? |
@luke- Ok, but for this we need a small changes in core humhub/humhub#6824 because the modal window uses URL But please note the modal window with options/buttons of File Handler is opened only when at least one custom File Handler exists in system, but by default the modal window it not opened, instead we have a simple downloading and it depends on each File, it is from PHP side here https://github.com/humhub/humhub/blob/master/protected/humhub/modules/file/libs/FileHelper.php#L88-L89: $fileHandlers = FileHandlerCollection::getByType([
FileHandlerCollection::TYPE_VIEW,
FileHandlerCollection::TYPE_EXPORT,
FileHandlerCollection::TYPE_EDIT,
FileHandlerCollection::TYPE_IMPORT
], $file); // <= here $file is instance of humhub\modules\file\models\File
if (count($fileHandlers) === 1 && $fileHandlers[0] instanceof DownloadFileHandler) {
// Download link
} else {
// Modal window with custom File Handler
} For JS side we cannot detect this, so in all cases the modal window will be opened, and if no custom File Handler then it will looks like this: from PHP side the modal file view url is replaced with simple downloading url like this: Do you agree this? |
@yurabakhtin It is ok if a modal always opens within the richtext, even if only one download is possible. In my tests, e.g. with the https://github.com/humhub/text-editor module, it did not add the created text file correctly in the rich text. Otherwise it looks very good. |
@luke- For me it works correctly: |
@luke- Done in commit d696fd4, but please note there we don't use font-awesome icons, there svg path is used, so I could find this tool https://icomoon.io/app/#/select where I have found almost similar upload icon but it has a bit difference: |
@yurabakhtin Now it also works for me as described by you. However, the file appears twice. |
@luke- I have removed the menu item "Image" yesterday as you requested on the screenshot, but what if user wants to add an image from some existing URL without uploading, maybe we should revert that? |
@yurabakhtin Thanks for the hint. We have discussed it again internally and decided to leave out the "picture" icon. In case of need, users can add the image via the Markdown Source Mode. The line icon will also be removed also for now. Please just comment out these icons |
@luke- Ok I have removed the horizontal line icon:
I don't find how to implement this yet, because we can handle this by event
I.e. the same event is used, I tried to use and |
@yurabakhtin Ok thanks. Let me know when I can help. Maybe Serh kann also help. Didn't we introduced some global var to determine which triggered the file upload? e.g. |
@luke- Yes, it works, thanks for the advice.
|
@yurabakhtin Thanks it works as expected! |
Create File Handler
Open File Handler
Also in RichtText embedded files, should be open using the FileHandler Open Dialog, instead of immediately start the download.
The text was updated successfully, but these errors were encountered: