? Pending

User tests: Successful: Unsuccessful:

avatar dgrammatiko
dgrammatiko
3 Dec 2018

Pull Request for Issue #17665 .

Summary of Changes

This PR introduces one more method to our Joomla.Editors API:

getSelection() { /* return the current selection */ }

Why?
Well it's a missing piece of the puzzle but mainly because it allows DEVs to do more advanced stuff instead of always replacing some selected text.

As this is a PR for the issue linked above, the menu button is the only place where this API is used at the moment. Also this part (in media/com_menus/js/admin-items-modal.js might be removed depending on the decision about B/C break, check the notes bellow)

Testing Instructions

Apply patch select some text in the editor and then through the menu button (xtd_button) try to insert a link! The link will have as text the selected text in the editor instead of the default menu name.

Repeat the process for all three core editors: none, tinyMCE and codemirror

Expected result

When you link to menu items etc, if you highlight text and link it the selected text gets replaced.

Actual result

When you link to menu items etc, if you highlight text and link it the selected text becomes the link text.

Preview

screenshot 2018-12-03 at 20 19 12
screenshot 2018-12-03 at 20 19 26

Documentation Changes Required

This PR is not breaking any API but it changes the behaviour. Eg

  • old behaviour: either some text is selected or nothing then the link will have the default menu text and the selected text gets replaced
  • new behaviour: if some text is selected then that will become the text of the menu item. If nothing is selected the link will have the default menu text.

@mbabker @wilsonge please make up your mind on the B/C here

@tonypartridge this one is for you ?

avatar dgrammatiko dgrammatiko - open - 3 Dec 2018
avatar dgrammatiko dgrammatiko - change - 3 Dec 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 3 Dec 2018
Category JavaScript External Library
avatar tonypartridge
tonypartridge - comment - 3 Dec 2018

Dimitris my hero! Personally I don’t think it’s a BC Break as nothing is breaking but changing for the better in the way it’s always been assumed it should work....
On 3 Dec 2018, 19:21 +0000, dGrammatiko notifications@github.com, wrote:

Pull Request for Issue #17665 .
Summary of Changes
This PR introduces one more method to our Joomla.Editors API:
getSelection() { /* return the current selection */ }
Why?
Well it's a missing piece of the puzzle but mainly because it allows DEVs to do more advanced stuff instead of always replacing some selected text.
As this is a PR for the issue linked above, the menu button is the only place where this API is used at the moment. Also this part (in media/com_menus/js/admin-items-modal.js might be removed depending on the decision about B/C break, check the notes bellow)
Testing Instructions
Apply patch select some text in the editor and then through the menu button (xtd_button) try to insert a link! The link will have as text the selected text in the editor instead of the default menu name.
Repeat the process for all three core editors: none, tinyMCE and codemirror
Expected result
When you link to menu items etc, if you highlight text and link it the selected text gets replaced.
Actual result
When you link to menu items etc, if you highlight text and link it the selected text becomes the link text.
Preview

Documentation Changes Required
This PR is not breaking any API but it changes the behaviour. Eg

• old behaviour: either some text is selected or nothing then the link will have the default menu text and the selected text gets replaced
• new behaviour: if some text is selected then that will become the text of the menu item. If nothing is selected the link will have the default menu text.

@mbabker @wilsonge please make up your mind on the B/C here
@tonypartridge this one is for you ?
You can view, comment on, or merge this pull request online at:
#23224
Commit Summary

• extend editors API

File Changes

• M media/com_menus/js/admin-items-modal.js (6)
• M media/com_menus/js/admin-items-modal.min.js (2)
• M media/editors/none/js/none.js (24)
• M media/editors/none/js/none.min.js (2)
• M media/editors/tinymce/js/tinymce.js (1)
• M media/editors/tinymce/js/tinymce.min.js (2)

Patch Links:

https://github.com/joomla/joomla-cms/pull/23224.patch
https://github.com/joomla/joomla-cms/pull/23224.diff


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

avatar dgrammatiko dgrammatiko - change - 3 Dec 2018
Labels Added: ?
avatar wilsonge
wilsonge - comment - 5 Dec 2018

I'm happy with this new proposed behaviour. Is there a reason we don't have an implementation for codemirror?

avatar dgrammatiko
dgrammatiko - comment - 5 Dec 2018

Is there a reason we don't have an implementation for codemirror

Yes! Basically the Joomla's API for the editors is a one to one match for the some public functions of code mirror (naming methods is hard ?). BTW the images above showcase that this is working with codemirror

avatar wilsonge
wilsonge - comment - 5 Dec 2018

Cool. One test here and I'm happy

avatar infograf768
infograf768 - comment - 6 Dec 2018

I have tested this item successfully on 939cfa6

Tested fine here also in multilingual


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

avatar infograf768 infograf768 - test_item - 6 Dec 2018 - Tested successfully
avatar wilsonge wilsonge - change - 6 Dec 2018
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-12-06 13:24:34
Closed_By wilsonge
avatar wilsonge wilsonge - close - 6 Dec 2018
avatar wilsonge wilsonge - merge - 6 Dec 2018

Add a Comment

Login with GitHub to post a comment