You need to be logged in to post in the forum - Log In
An active JCE Pro Subscription is required to post in the forum - Buy a Subscription
- Support
- Forum
- JCE Editor
- Internal Link Target
Support is currently Online
Official support hours:
Monday To Friday
From 09:00 To 17:00 Europe/London (BST)
From 09:00 To 17:00 Europe/London (BST)
Hello, just a random question here but users can never remember to set external links to new window. I think it's kind of important but I also don't want to set links to new window globally because I don't want internal links opening a new window.
So is it even remotely possible to have global links set to blank and if an internal link is added the system strips that out keeping its target self?
Just curious, thank you.
So is it even remotely possible to have global links set to blank and if an internal link is added the system strips that out keeping its target self?
Just curious, thank you.
Hey careful man, there's a beverage here!
Create a file called editor.js in media/jce/js, containing the following:
(function () {
tinyMCE.onAddEditor.add(function (mgr, ed) {
ed.onPreInit.add(function (ed) {
function updateNode(node) {
var href = node.getAttribute('href');
if (href.indexOf('://') !== -1) {
node.setAttribute('target', '_blank');
node.setAttribute('rel', 'noopener');
}
}
ed.onGetContent.add(function(ed, o) {
tinymce.each(ed.dom.select('a[href]', o.node),updateNode);
});
ed.onGetContent.add(function(ed, o) {
if (o.get) {
tinymce.each(ed.dom.select('a[href]', ed.getBody()), updateNode);
}
});
});
});
})();
Just because you're not paranoid doesn't mean everybody isn't out to get you.
Also, is it possible to remove the choices in the link target be only not set and new window? None of my users will ever use any iframe links so I want it to be very simple if they must choose one.
Actually you can do this with a bit of a css hack.
Create a file called plugin.css in media/jce/css containing the following:
[data-plugin="link"] option[value="_parent"],
[data-plugin="link"] option[value="_top"] {
display: none;
}
Just because you're not paranoid doesn't mean everybody isn't out to get you.
Do you think you would ever consider adding the internal link option to the system? I bet many could benefit from this. It's pretty much industry standard to do this anyway, self for internal, new for external.
Thank you
Thank you
Hey careful man, there's a beverage here!
Hello, both of these fixes work very well. I have one happy customer now who was begging me for this solution!!
Since not set is also replacing the window like the Open in current window / iframe what is the additional string to hide that so only not set and new window are the options?
I don't know what to add to the list of css display none.
[data-plugin="link"] option[value="_current"]???
Thanks again, you're awesome. Time for a price increase? I'll pay.
Since not set is also replacing the window like the Open in current window / iframe what is the additional string to hide that so only not set and new window are the options?
I don't know what to add to the list of css display none.
[data-plugin="link"] option[value="_current"]???
Thanks again, you're awesome. Time for a price increase? I'll pay.
Hey careful man, there's a beverage here!
Since not set is also replacing the window like the Open in current window / iframe what is the additional string to hide that so only not set and new window are the options?
I don't know what to add to the list of css display none.
[data-plugin="link"] option[value="_current"]???
[data-plugin="link"] option[value="_self"]
[data-plugin="link"] option[value="_parent"],
[data-plugin="link"] option[value="_top"] {
display: none;
}
Just because you're not paranoid doesn't mean everybody isn't out to get you.
- Page :
- 1
There are no replies made for this post yet.
Be one of the first to reply to this post!
Be one of the first to reply to this post!