Skip to content
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

Closed
tonypartridge opened this issue Aug 22, 2017 · 15 comments
Closed

TinyMCE Menu Linking, is slow. #17665

tonypartridge opened this issue Aug 22, 2017 · 15 comments

Comments

@tonypartridge
Copy link
Contributor

tonypartridge commented Aug 22, 2017

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?

@mbabker
Copy link
Contributor

mbabker commented Aug 22, 2017

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

@brianteeman
Copy link
Contributor

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

Maybe a screencap will help to explain

@tonypartridge
Copy link
Contributor Author

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.

@tonypartridge
Copy link
Contributor Author

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 ;-)

@coolcat-creations
Copy link
Contributor

  • 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.

@tonypartridge
Copy link
Contributor Author

Its a very non user friendly system at present.

@Fedik
Copy link
Member

Fedik commented Sep 17, 2017

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

xtd-editor plugin are general thing

@tonypartridge
Copy link
Contributor Author

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

@dgrammatiko
Copy link
Contributor

@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

@Fedik
Copy link
Member

Fedik commented Sep 18, 2017

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

@tonypartridge
Copy link
Contributor Author

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

@dgrammatiko
Copy link
Contributor

dgrammatiko commented Aug 15, 2018

@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

@Fedik
Copy link
Member

Fedik commented Aug 16, 2018

@dgrammatiko that could work 😉

@joomla-cms-bot
Copy link

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

@Quy
Copy link
Contributor

Quy commented Dec 3, 2018

Please test PR #23224


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants