J4 Issue ?
avatar Scrabble96
Scrabble96
13 Oct 2019

Steps to reproduce the issue

Create an article
Toggle to html editor and add some code, e.g.

<div style="border: 1px solid red; padding: 10px;">
    <div style="border: 1px solid blue; padding: 10px;">Some text here</div>
</div>

(Without toggling Editor) Click/tap 'Save'

Expected result

New code should be saved and, if appropriate, displayed

Actual result

Code disappears.

System information (as much as possible)

J4 Nightly from 13/10/2019

Additional comments

If, however, you toggle the Editor back to WYSIWYG before saving, the code is saved.
I have tested this in J3 and it works as expected.

avatar Scrabble96 Scrabble96 - open - 13 Oct 2019
avatar joomla-cms-bot joomla-cms-bot - change - 13 Oct 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 13 Oct 2019
avatar brianteeman
brianteeman - comment - 13 Oct 2019

I have tested this in J3 and it works as expected.

It is a completely different version of tinymce

avatar Scrabble96
Scrabble96 - comment - 14 Oct 2019

It is a completely different version of tinymce

None-the-less, it is a problem in J4x.

avatar schnuti
schnuti - comment - 14 Oct 2019

Can't confirm the issue.
@Scrabble96 Did you test with another browser? Is it a large text you edit? Very fast page reload? The Javascript should "save" the text back to the editor before closing the page and reloading..

avatar schnuti
schnuti - comment - 14 Oct 2019

By the way - I removed this toggle button with a layout override for my own component to only use tiny's built in "code" button.

avatar Scrabble96
Scrabble96 - comment - 14 Oct 2019

Ok. Brand new installation of J4 Dev 12 nightly full package from last night (14 Oct). Using Firefox but it does the same on Chrome:

tinyMCE-20191014

avatar brianteeman
brianteeman - comment - 14 Oct 2019

I can confirm this behaviour

avatar schnuti
schnuti - comment - 14 Oct 2019

I can now confirm it.
My alpha 12 installation was a bit old. Something has obviously happened in between. Now installed the nightly build from today 14/10.

avatar schnuti
schnuti - comment - 14 Oct 2019

The problem should come from a change in Joomla code somewhere.
I copied tiny's vendor directory from the new alpha 12 installation to an older alpha 12 instance. To save the text as described then still works.

avatar infograf768 infograf768 - change - 15 Oct 2019
Labels Added: J4 Issue
avatar infograf768 infograf768 - labeled - 15 Oct 2019
avatar infograf768 infograf768 - change - 11 May 2020
Labels Added: ?
avatar infograf768 infograf768 - labeled - 11 May 2020
avatar dgrammatiko
dgrammatiko - comment - 30 May 2020

The problem should come from a change in Joomla code somewhere.

So I spend quite some time on this one today. The problem is that version 5 of tinyMCE break compatibility with version 4 in this part. There are 2 solutions here:

  • destroy the instance when we go out of tiny and recreate the instance when re switching
  • drop the button bellow and use the build in html view

None of them is ideal but not my decision here

avatar HLeithner
HLeithner - comment - 31 May 2020

Destroying and recreate seams the more consistent way also for other editors what's the drawback if we do this?

avatar dgrammatiko
dgrammatiko - comment - 31 May 2020

@HLeithner destroying and recreating the instance should be avoided, it should be the last resort not the first option. IIRC both me and @Fedik have avoided this pattern so far in J4. The obvious reason, especially with scripts that have very well documented API on their lifecycle, is that devs might do something on after initialisation of the script. If the instance is destroyed on recreation their code will be ignored and (depending if their using event or not) might not re execute. Let me raise a question on their tracker, it might be an easier (undocumented) way to do this.

avatar HLeithner
HLeithner - comment - 31 May 2020

I don't say it'S a good method but it's the better then removing the button and since that's the only 2 options you gave me I had to choose ;-)

But just for clarification to trigger this problem:

  • you switch the editor off
  • write something in it
  • press the save button
  • joomla activates the editor again (which is right)
  • joomla execute the submit button but transmit the old content

right?

avatar dgrammatiko
dgrammatiko - comment - 31 May 2020

Yes, the steps are correct. If you follow my issue upstream you’ll find out that the problem is only on the submit event. I guess they can flip some part of their code so if there is an attach functionality on that event that will happen before they push their existing data. I’m quite confident that this will be solved on their side

avatar Fedik
Fedik - comment - 1 Jun 2020

I would just trash that button, this function should belong to the editor instance itself.
Just a legacy, maybe from 1.0, in reason no one can explain.

avatar dgrammatiko
dgrammatiko - comment - 1 Jun 2020

@Fedik people are familiar with it also the fix turns out to be super easy (if you knew deeply their API, of course I didn’t but I asked). check my pr...

avatar HLeithner
HLeithner - comment - 1 Jun 2020

I'm closing this since we have a PR #29351 thank @dgrammatiko

avatar HLeithner HLeithner - close - 1 Jun 2020
avatar HLeithner HLeithner - change - 1 Jun 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-06-01 11:54:53
Closed_By HLeithner
Labels Added: ?
Removed: ?
avatar wilsonge wilsonge - change - 18 Dec 2020
Labels Removed: ?
avatar wilsonge wilsonge - unlabeled - 18 Dec 2020

Add a Comment

Login with GitHub to post a comment