Joomla-cms: TinyMCE Menu Linking, is slow.

Created on 22 Aug 2017  路  15Comments  路  Source: joomla/joomla-cms

So when you link to menu items etc, if you highlight text and link it doesn't work at all.

So you have to insert the menu item and then you need to change the text. This is a slow process.

Can we make it so when text is highlighted and then insert menu is used the text is just linked?

J3 Issue No Code Attached Yet

All 15 comments

That requires making it a TinyMCE plugin if I'm not mistaken, not our generic "extended editor" plugin.

Are you really talking about tinymce or the xtd-editor plugin - i am confused

Maybe a screencap will help to explain

Sorry yes, it is the Button - Menu Plugin. Its a bit confusing now given someone has merged buttons into the toolbar you assume / think it's part of the toolbar not a button.

But fundamentally it should work like the tinymce built in link plugin. From what I can see of the code we would just need to pass in the highlighted text into the data attrib for when we click the menu item in the list. But I can't fathom out how the link/code is generated from the button yet. Anyone fancy the challenge.. a JS dev should be able to do it fairly quickly ;-)

  • it doesn麓t work at the first time for me, i have to open it again and the second time the link is placed then.

Its a very non user friendly system at present.

@mbabker are right, it require making the plugin specifically to TinyMCE

xtd-editor plugin are general thing

Soo... who has the skillz to do it? is this a Dimitris area ;-). Ideally, it should work exactly like the Link linking.

@tonypartridge @Fedik the code for the core buttons as tinyMCE plugins already exists: https://github.com/joomla/joomla-cms/pull/7152/files

The missing part is extending the PHP API for the XTD_Buttons so they can return also the tinyMCE plugin path

The missing part is extending the PHP API for the XTD_Buttons so they can return also the tinyMCE plugin path

no need new API, just include plugin script, see Example of loading the plugin from another URL

only problem, that XTD_Buttons should check whether they loaded by tinyMCE editor

@dgt41 @Fedik JS isn't my forte... could one off you kinda persons take a look? :D

@tonypartridge @wilsonge @Fedik I'm gonna introduce one more method to our Joomla.Editors API:

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

Then every XTD Button could call this method, get the text do any fancy stuff and then return using the method replaceSelection

For the editor none the API will look like:

        const that = this;
        /** Register Editor */
        Joomla.editors.instances[that.childNodes[0].id] = {
            'id': that.childNodes[0].id,
            'element':  that,
            'getValue': () => { return that.childNodes[0].value; },
            'setValue': (text) => { return that.childNodes[0].value = text; },
            'getSelection' : () => {
                // obtain the index of the first selected character
                var start = that.childNodes[0].selectionStart;
                // obtain the index of the last selected character
                var finish = that.childNodes[0].selectionEnd;
                // obtain the selected text
                return that.childNodes[0].value.substring(start, finish);
            },
            'replaceSelection': (text) => { return that.insertAtCursor(text); },
            'onSave': () => {}
        };

Similar but easier implementation for tinyMCE and code mirror should be applied

@dgrammatiko that could work :wink:

Set to "closed" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/17665

Please test PR #23224


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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mbabker picture mbabker  路  4Comments

alex7r picture alex7r  路  4Comments

wilsonge picture wilsonge  路  4Comments

dougbevan picture dougbevan  路  4Comments

brianteeman picture brianteeman  路  4Comments