Add "Read more" editor button breaks, when using multiple HTML editors for description, only works in 1 lang

More
9 years 6 months ago - 9 years 5 months ago #54055 by pipedream
If you edit a multilanguage item in the frontend (and I guess also in the backoffice) via tabs for each translation supported by Falang, you can only insert one single "read more" break in all translations, rendering it useless.

This happens because there are JavaScript functions that get inserted repeatedly for each language editor, but then get mixing calls from them.

To overcome this problem, I had to change the following code in the function onSave of plugins/editors/jce/jce.php from:
Code:
return "WFEditor.getContent('" . $editor . "');";
to this:
Code:
return "WFEditor.getContent(editor);";

For someone who uses TinyMCE, a similar change has to be made in the function onGetContent in plugins/editors/tinymce/tinymce.php, from this:
Code:
return 'tinyMCE.get(\'' . $editor . '\').getContent();';
to this:
Code:
return 'tinyMCE.get(editor).getContent();';

I don't know if this breaks something else, but it really shouldn't, since the editor parameter seems to hold the correct editor name.
Last edit: 9 years 5 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago - 9 years 5 months ago #54082 by ggppdk
Hello

this is interesting information

yes we have noticed that editor buttons only work in 1st editor instance
- so you ara saying that this allows the buttons to work in all editor instances,
will test,

i don't know if suggesting such a change to Joomla and authors of the Joomla editors will be accepted
please post back if you see something broken


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 9 years 5 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago - 9 years 5 months ago #54119 by pipedream
Yes, so far I can at least create a "read more" break in both editor instances (PT and EN).

That' is also my "concern".
I guess this solution can be a very good improvement, precisely because it allows several instances of the editor to be opened in the same page.
There is at least one minor tweaking that must be done, even if it doesn't affect any functioning: each editor instance is creating the same duplicate JS functions, so it would be better that additional editors would check if these functions already exist (or if a first editor was already created).

Do you want to propose this to Joomla team?
I can do it, but I'm wondering if I should just open a ticket instead of creating a PR without further investigating all the implications of this change (something I don't have time for now).
Last edit: 9 years 5 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
9 years 5 months ago - 9 years 5 months ago #54857 by pipedream
Hi,

Something got broken.
While for instance editing a module with custom HTML, there is a JS error because the variable editor is not defined, ie the WFEditor.getContent(editor) is not called inside a function that has editor has an argument, so the editor variable is undefined.

So, I researched a little further and made the following changes:

In plugins/editors/jce/jce.php:
Code:
public function onGetContent($editor, $isVararg = false) { // NEW argument $isVararg // OLD return $this->onSave($editor); return $this->onSave($editor, $isVararg); } ... public function onSave($editor, $isVararg = false) { // NEW argument $isVararg // NEW START if ($isVararg) { return "WFEditor.getContent(editor);"; } else { return "WFEditor.getContent('" . $editor . "');"; } // NEW END // OLD return "WFEditor.getContent('" . $editor . "');"; }

In ./libraries/cms/editor/editor.php:
Code:
public function getContent($editor, $isVararg = false) // NEW argument $isVararg { $this->_loadEditor(); $args['name'] = $editor; $args['isvararg'] = $isVararg; // NEW $args['event'] = 'onGetContent'; ...

In plugins/editors-xtd/readmore/readmore.php:
Code:
public function onDisplay($name) { $doc = JFactory::getDocument(); // Button is not active in specific content components $getContent = $this->_subject->getContent($name, true); // NEW: plus second argument=true ...

What do you think of this?
I guess now this would be more robust and should cause no problems, but do you think that it might be welcome by Joomla team?
Last edit: 9 years 5 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
9 years 5 months ago - 9 years 5 months ago #54858 by ggppdk
Hello

indeed this seems useful change in regards
it is worth trying to get it accepted

will it also allow help with the other extra editor buttons ?


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 9 years 5 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
9 years 5 months ago - 9 years 5 months ago #54871 by pipedream
Don't know.

Can you please tell me which buttons have the same issues and I will try to have a look?
Last edit: 9 years 5 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.321 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline