? ? ? Pending

User tests: Successful: Unsuccessful:

avatar dgt41
dgt41
26 Feb 2018

Pull Request for Issue # .

Summary of Changes

Without breaking the current API for the XTD-Buttons this PR is dropping the js that was passed in the json (a very bad practice for which I'll take the blame!). So instead of rendering a list of buttons it renders a dropdown with all the XTD-Buttons as links (with their icons). This can be improved by separating the core xt-buttons from the ones from 3rd PD for clarity and also to have more manageable dropdowns (this is a TODO, if people agree on the idea).

Also since we don't have the jModalClose() which we hacked to somehow work with bootstrap and since we are not gonna use the Bootstrap modal in J4 I propose to use the Joomla in this way:

Joomla.currentModal = {
  get: function() { 
    // check if nested 
    return this.currentModal;
  },
  set: function(element) {
   // check if nested
  this.currentModal = element;
  },
 currentModal: '',
 parentModal: ''
}
So how this thing works?

When a modal is called the setter is also called and it, what else, sets the element of the current modal.
Now wherever in the code (especially if you're not aware of the modal element) you can call:

jQuery(Joomla.currentModal.get()).modal('hide');
// or using the J4 UI modal
Joomla.currentModal.get().close();

Preview

screen shot 2018-02-26 at 19 00 50

Testing Instructions

Apply patch and test all the buttons in tinyMCE

Expected result

Actual result

Documentation Changes Required

NO

@Fedik @dneukirchen what do you think?

avatar dgt41 dgt41 - open - 26 Feb 2018
avatar dgt41 dgt41 - change - 26 Feb 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 26 Feb 2018
Category Layout JavaScript External Library Front End Plugins
avatar dgt41 dgt41 - change - 26 Feb 2018
The description was changed
avatar dgt41 dgt41 - edited - 26 Feb 2018
avatar brianteeman
brianteeman - comment - 26 Feb 2018

Based on the screenshot

What is the ordering of these? It should default to be alphabetical imho

avatar dgt41
dgt41 - comment - 26 Feb 2018

What is the ordering of these?

I have no clue, but I agree this doesn't look nice

avatar dgt41 dgt41 - change - 26 Feb 2018
Labels Added: ?
avatar ggppdk
ggppdk - comment - 26 Feb 2018

What is the ordering of these? It should default to be alphabetical imho
I have no clue, but I agree this doesn't look nice

It seems to be the ordering that plugins have in plugin manager when you filter via editors-xtd type

avatar dgt41 dgt41 - change - 26 Feb 2018
Title
Fix the bad implementation for the XTD-buttons on tinyMCE
[4.0] Fix the bad implementation for the XTD-buttons on tinyMCE
avatar dgt41 dgt41 - edited - 26 Feb 2018
avatar Fedik
Fedik - comment - 27 Feb 2018

@dgt41 looks good,
I just not sure whether it will work in multi instances, eg in subform,
I try to find a time to check

avatar dgt41
dgt41 - comment - 27 Feb 2018

@Fedik it should, the building process relies on the current editor settings/params

avatar Fedik
Fedik - comment - 27 Feb 2018

I meant the part with modal and it`s id:

var modal = document.getElementById(name.name.replace(' ', '') + 'Modal');
avatar dgt41
dgt41 - comment - 27 Feb 2018

@Fedik oops those modals are not unique enough, they also need the id of the editor there, easy patch

avatar brianteeman
brianteeman - comment - 27 Feb 2018

They need to be unique for a11y as well

avatar Fedik
Fedik - comment - 27 Feb 2018

@dgt41 maybe we could use class instead, and make more strict selector,
something like (fake code):

var editorWrapper = editor.getParentElement();
var modal = editorWrapper.querySelector('.modal-window-media');

with this you can just drop the id attribute

avatar dgt41
dgt41 - comment - 27 Feb 2018

@Fedik the editors, not only tinyMCE will eventually become Custom Elements because frankly they are fields... So we can implement a lot more things once we do the transition. Basically this PR was done just as a POC and also to get some feedback on the needed API change for closing the current modal, which is something that we miss in J4 and thus a lot of scripts are failing...

avatar joomla-cms-bot joomla-cms-bot - change - 27 Feb 2018
Category Layout JavaScript External Library Front End Plugins Administration Language & Strings Layout JavaScript External Library Front End Plugins
avatar dgt41
dgt41 - comment - 27 Feb 2018

Ok, multiple instances get modals with unique ids
So:
screen shot 2018-02-27 at 15 55 25
screen shot 2018-02-27 at 15 54 46

avatar brianteeman
brianteeman - comment - 27 Feb 2018

looks good but the icons will need to match the icons in the menu for those components ;)

avatar brianteeman
brianteeman - comment - 27 Feb 2018

I have tested this item ? unsuccessfully on 4b1b8e9

Notice: Undefined index: native in C:\htdocs\cms4\plugins\editors\tinymce\tinymce.php on line 531

Warning: array_merge(): Argument #2 is not an array in C:\htdocs\cms4\plugins\editors\tinymce\tinymce.php on line 531

Notice: Undefined index: paths in C:\htdocs\cms4\plugins\editors\tinymce\tinymce.php on line 534

Warning: array_merge(): Argument #2 is not an array in C:\htdocs\cms4\plugins\editors\tinymce\tinymce.php on line 534


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19789.
avatar brianteeman brianteeman - test_item - 27 Feb 2018 - Tested unsuccessfully
avatar dgt41 dgt41 - change - 27 Feb 2018
Labels Added: ?
avatar dgt41
dgt41 - comment - 27 Feb 2018

@brianteeman thanks, now should be fine

PS about the icons:
This is the before
screen shot 2018-02-27 at 20 37 03

this is the after
screen shot 2018-02-27 at 15 55 25

So in essence those icons are not changed. Maybe in the new skin that is proposed by the design team we can use the font awesome (or a part of it, don't forget that tiny is still in an iframe) to get some more meaningful icons

avatar brianteeman brianteeman - test_item - 27 Feb 2018 - Tested unsuccessfully
avatar brianteeman
brianteeman - comment - 27 Feb 2018

I have tested this item ? unsuccessfully on 3c21b07

no xtd-buttons at all now


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19789.

bba5384 28 Feb 2018 avatar dgt41 CS
avatar dgt41
dgt41 - comment - 28 Feb 2018

@brianteeman please clear your browser's cache

avatar brianteeman
brianteeman - comment - 28 Feb 2018

@dgt41 I am not a newbie - of course I cleared the cache. I even tested it on multiple browsers - at least one of which has never been used before on this computer for anything at all (ie11)

avatar dgt41
dgt41 - comment - 4 Mar 2018

@brianteeman just curious here, did you used patchtester for this one?

avatar brianteeman
brianteeman - comment - 4 Mar 2018

Probably I don't remember

avatar brianteeman
brianteeman - comment - 4 Mar 2018

now that I have escaped scotland I will try again with git this week

avatar brianteeman
brianteeman - comment - 5 Mar 2018

must have been a patchtester issue as installing your fork works correctly as expected

avatar brianteeman
brianteeman - comment - 5 Mar 2018

I have tested this item successfully on 9dbfcb5


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19789.

avatar brianteeman brianteeman - test_item - 5 Mar 2018 - Tested successfully
avatar Anu1601CS
Anu1601CS - comment - 9 Mar 2018

I have tested this item successfully on 9dbfcb5


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19789.

avatar Anu1601CS Anu1601CS - test_item - 9 Mar 2018 - Tested successfully
avatar dgt41
dgt41 - comment - 9 Mar 2018

@wilsonge if you agree with this one can you please merge it?

avatar Quy Quy - change - 9 Mar 2018
Status Pending Ready to Commit
avatar Quy
Quy - comment - 9 Mar 2018

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19789.

avatar wilsonge wilsonge - change - 9 Mar 2018
Labels Added: ?
avatar wilsonge wilsonge - change - 9 Mar 2018
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-03-09 22:57:18
Closed_By wilsonge
avatar wilsonge wilsonge - close - 9 Mar 2018
avatar wilsonge wilsonge - merge - 9 Mar 2018
avatar dgt41
dgt41 - comment - 10 Mar 2018

@regularlabs can you have a look on this one and provide some feedback?

avatar regularlabs
regularlabs - comment - 10 Mar 2018

I haven't tested this. But I can give you my opinion.

Placing all these editor button plugins in a separate dropdown feels a bit weird to me.
I would leave this to be controlled by the administrator. Let him/her decide if stuff needs to be grouped, and which buttons should get grouped.

Having stuff you use a lot and want there at-the-ready - like the read more button - is now hidden away in some undescriptive bucket full of random stuff that most likely have nothing to do with each other.
Also there are editor buttons that will show a dropdown/submenu thing themselves (at least one, Content Templater ;) ). So that will pose an issue for that extension.

Personally I was not very happy with the editor buttons getting forced into the editor in the first place. It caused all sorts of issues (styling, scripts, etc). I expect the same thing with this new approach.
I still prefer just using JCE (like everyone else) which shows the editor buttons under the editor (in Joomla 3 anyway), like we were use to.

But I am not very bothered about any of it.
As an extension developer I will just work my way around any new issues or workflows Joomla throws at me.

Add a Comment

Login with GitHub to post a comment