chamilo-lms icon indicating copy to clipboard operation
chamilo-lms copied to clipboard

WYSIWYG Editor filemanager (tinymce)

Open jmontoyaa opened this issue 4 years ago • 9 comments

Implement the filemanager in ckeditor using resources

jmontoyaa avatar Feb 23 '21 10:02 jmontoyaa

This was replaced with tinymce and it works when open the editor inside a course.

Filemanager doesn´t work yet outside a course.

jmontoyaa avatar May 24 '21 14:05 jmontoyaa

https://github.com/chamilo/chamilo-lms/commit/5f6a97ca5ae6ef34a787b1c201b78a3797387fc9

jmontoyaa avatar May 24 '21 14:05 jmontoyaa

The personal files (#3792) should be connect to the filemanager.

jmontoyaa avatar May 29 '21 09:05 jmontoyaa

An image picker for tinymce has been added in courses tools (no documents) with code legacy in this commit https://github.com/chamilo/chamilo-lms/commit/ef3c8b0b15684ead7298bdb937ec910c19599994

For tinimce with vuejs inside course is added this commit https://github.com/chamilo/chamilo-lms/commit/5f6a97ca5ae6ef34a787b1c201b78a3797387fc9 , It should be add in other tools when it is using vuejs,

For tiniymce outside a course with vuejs to use the filemanager created for tool documents (vuejs) changing the browser url by personal files [/resources/personal_files/]

christianbeeznest avatar Mar 07 '23 19:03 christianbeeznest

It is added editor filemanager for documents and messages in this PR https://github.com/chamilo/chamilo-lms/pull/4756

christianbeeznest avatar Jun 21 '23 23:06 christianbeeznest

The tinyMCE works on many page. The missing point are extension that we had before like mathjack but probably it could be removed for 2.0 and reintegrated later.

NicoDucou avatar Jan 18 '24 14:01 NicoDucou

Work on this with @daniboygg to generalize the implementation of the filemanager in TinyMCE:

  • as a component on top of Vue components
  • that supports the same/similar options as toolbars (as were previously used by CkEditor - see CkEditor.php)
  • that is configurable per tool (see all classes available in src/CoreBundle/Component/Editor/CkEditor/Toolbar/ (App.vue then captures in line 104 the presence of CkEditor.php)

ywarnier avatar Feb 14 '24 17:02 ywarnier

Reference code: https://github.com/chamilo/chamilo-lms/commit/c111d5d160a326d4ce2e69c1065aae2fb2c1f5d1

ywarnier avatar Feb 29 '24 14:02 ywarnier

At the moment this saves the image as base64 in the database. The images should be saved on disk in var/[tool-name]/[uuid].[extension].

ywarnier avatar Feb 29 '24 16:02 ywarnier

  • wrapper for tinymce
  • configuration of plugins
  • upload images directly (not base64)

ywarnier avatar Mar 04 '24 08:03 ywarnier

I've done a little research about uploading files.

Checking the documentation https://www.tiny.cloud/docs/general-configuration-guide/upload-images/ we need:

  1. A method in the backend that accepts an image via POST and store it in the correct folder.
    • The method should return a json object containing the image location (relative to chamilo site)
    • According to the documentation a request per images will be sent
    • An example is provided in the link to implement it in PHP https://www.tiny.cloud/docs/advanced/php-upload-handler/)
  2. Call editor.uploadImages() before uploading the content. We must await this to finish before submitting the content

Do we have a method like this implemented in the backend?

Regarding the version of TinyMCE used, there is a warning in the documentation:

NOTE: TinyMCE 5 reached End of Support in April 2023. No more bug fixes, security updates, or new features will be introduced to TinyMCE 5. We recommend you upgrade to TinyMCE 6 or consider TinyMCE 5 Long Term Support (LTS) if you need more time.

Should we consider migrating to TinyMCE 6 before making the feature to upload images?

daniboygg avatar Mar 05 '24 13:03 daniboygg

@christianbeeznest will work on upload of images with the backend call.

ywarnier avatar Mar 07 '24 14:03 ywarnier

A backend controller has been implemented for the TinyMCE image upload feature, which accepts images via POST, stores them appropriately in personal_files and resource_file tables, and returns their location in a JSON format. On the frontend, TinyMCE is configured to utilize this backend controller (FileManagerController) through the file_picker_callback option, enabling integration with a custom file manager or direct uploads from the user's device, depending on the useFileManager setting. It ensures all images are uploaded with editor.uploadImages() before submitting the content. The useFileManager option adds flexibility in file handling, allowing users to choose between direct uploads or using a file manager for more efficient organization.

The changes are in this PR https://github.com/chamilo/chamilo-lms/pull/5241 and merged now, also it is added this page for demo /resources/pages/editor-demo

christianbeeznest avatar Mar 14 '24 04:03 christianbeeznest

Here is the list of all different configurations of CKeditor's toolbar in Chamilo 1.11.x: https://github.com/chamilo/chamilo-lms/tree/1.11.x/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar

ywarnier avatar Mar 21 '24 16:03 ywarnier