New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TinyMCE Menu Linking, is slow. #17665
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 ;-) |
|
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 |
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 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 😉 |
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. |
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?
The text was updated successfully, but these errors were encountered: