Project

General

Profile

Actions

Feature #8233

closed

Load ckeditor js plugin only when user is logged on

Added by José Loguercio over 7 years ago. Updated over 7 years ago.

Status:
Feature implemented
Priority:
Normal
Category:
Plugins
Target version:
Start date:
12/05/2016
Due date:
% Done:

100%

Estimated time:
Complexity:
Normal
SCRUM pts - complexity:
?
Actions #1

Updated by José Loguercio over 7 years ago

  • Subject changed from Load ckeditor js plugin only is user is logged on to Load ckeditor js plugin only when user is logged on
Actions #2

Updated by José Loguercio over 7 years ago

  • Status changed from New to Feature implemented
Actions #3

Updated by Julio Montoya over 7 years ago

  • Status changed from Feature implemented to Needs more info

This change will cause some errors when the $formValidator use the html editor.

What's wrong with ckeditor?

One option could be to transform htmleditor to textarea if user is anonymous.

Also make sure "nobody else" uses ckeditor outside formValidator

Actions #4

Updated by José Loguercio over 7 years ago

Yep, my bad, fixed now : https://github.com/chamilo/chamilo-lms/pull/1156

Escribiré esto en español, Yannick me pidió que para optimizar la página de inicio, quitara la llamada al plugin del ckeditor ya que pesa más 500kb.

Actions #5

Updated by Julio Montoya over 7 years ago

José Loguercio wrote:

Yep, my bad, fixed now : https://github.com/chamilo/chamilo-lms/pull/1156

Escribiré esto en español, Yannick me pidió que para optimizar la página de inicio, quitara la llamada al plugin del ckeditor ya que pesa más 500kb.

not fixed yet, needs to convert ckeditor to textareas (block ckeditor js code) file HtmlEditor.php

Actions #6

Updated by Yannick Warnier over 7 years ago

  • Assignee changed from José Loguercio to Julio Montoya

Julio Montoya wrote:

José Loguercio wrote:

Yep, my bad, fixed now : https://github.com/chamilo/chamilo-lms/pull/1156

Escribiré esto en español, Yannick me pidió que para optimizar la página de inicio, quitara la llamada al plugin del ckeditor ya que pesa más 500kb.

not fixed yet, needs to convert ckeditor to textareas (block ckeditor js code) file HtmlEditor.php

Julio, could you be more specific about the problem it causes?
Normally, a user not logged in shouldn't have access to any textarea/ckeditor... The only exception I can see is the "Contact" form in 1.11, but this should already be a textarea...

Actions #7

Updated by Julio Montoya over 7 years ago

  • Assignee changed from Julio Montoya to Yannick Warnier

If you call "$form->addHtmlEditor()" this code will use the ckeditor js code.
That function should be modifed so when rendering "$form->addHtmlEditor()" no js code should be added:

example:

"CKEDITOR.replace( 'editor1', {
    language: 'fr',
    uiColor: '#9AB8F3'
});" 

To avoid remember all the exceptions is better to modified that function/file (HtmlEditor.php)

Actions #8

Updated by Yannick Warnier over 7 years ago

  • Assignee changed from Yannick Warnier to Julio Montoya

That still doesn't give me a clue as to the specific problems it causes. Could you give an example of where we can see the error happening, so we can reproduce it and be satisfied with the patch? I think no textarea appears when a user is not connected...

As I said, maybe the new contact form gives a textarea, but otherwise all places where a textarea appears are places where the user is logged in.

One other exception I can see: if the registration form contains extra fields... (considering this, yes, it would make sense to modify the function you mention).

Actions #9

Updated by Yannick Warnier over 7 years ago

  • Status changed from Needs more info to Assigned
  • Assignee changed from Julio Montoya to José Loguercio
  • % Done changed from 100 to 50

José, please change the HtmlEditor.php file as Julio suggests.

Actions #10

Updated by Yannick Warnier over 7 years ago

  • Assignee changed from José Loguercio to Yannick Warnier
Actions #11

Updated by Yannick Warnier over 7 years ago

  • Status changed from Assigned to Feature implemented
  • % Done changed from 50 to 100

I changed the strategy: I added a constant on the homepage and in global.inc.php to avoid loading CKeditor. This is then taken and validated by template.lib.php and header.js.tpl to ignore the lib and dependencies. So if we know of a page we want to optimize but for which we're not going to need CKeditor, we can use it.

The definition of the additional constant in global.inc.php might have some very light efficiency impact, though. This should be watched (and possibly reverted in future versions if we find a more efficient way).

https://github.com/chamilo/chamilo-lms/commit/cbca6874407130615849ac3b70f6b19e9ada7cc8

Actions

Also available in: Atom PDF