Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change default Link type in editor
#1
When you insert a link with the WYSIWYG editor, the default Link type is "Local page". If you want to insert an external/full URL you must click the dropdown menu, then select "URL".

Is it possible/can you think of a way to change this, so that the default is "URL" instead of "Local page"?

(Or even remove the "local page" option, I don't really need it)
Reply
#2
this function deals with the link-dialogue: "function ckeditor_add_page_link()" in template_functions.php

I just identified it, I never modified it, so it's up to you!
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#3
Carlos,

if you uncomment lines 811 and 812 in admin/inc/template-functions.php

Code:
// content.items.unshift(['Link to local page', 'localPage']);
        // content['default'] = 'localPage';

links to local pages (internal links) will not be listed in the select-box

But I do not recommend that, this is absolutely non-GetSimple-style ;=(
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#4
Thanks a lot Connie!

I tried by removing the call to the function you identified, ckeditor_add_page_link(), and seems to work.

I changed admin/edit.php line 340 (in GS 3.0, or line 360 in 3.1 beta) to:
Code:
//ckeditor_add_page_link();
(I inserted "//" in the beginning, to comment it)

Update: in GS 3.1 stable it is line 363.

Update: in GS 3.1.2 it is line 360.
Reply
#5
Thank you Carlos! I have done that in admin/edit.php line 340 (in my GS 3.1 final) as a hotfix for I18N "Include Language in URL" ("%language%/%parent%/%slug%"). No more "Link to local page" is there.
Advanced HTML5 & CSS3 coder. Simple JS & PHP hacker (not enough for new function coding). Build one webpage with GS (late 2012). Focusing on Theme customizing/Template files. Experience with WP.
Reply
#6
You're welcome...

BTW the change has to be made to line 363 in GS 3.1 stable/final, not line 340 (that was for GS 3.0).
Reply
#7
It would be nice to have a gsconfig setting or something for this, so that we (us who don't need/like/want the "link to local page" default option) don't have to edit core files.
Reply
#8
It would be nice if there was not a drop down, and just both on the same tab.
We can fix this in the future. THE FUTURE tm
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#9
(2013-02-05, 07:56:23)shawn_a Wrote: It would be nice if there was not a drop down, and just both on the same tab.

Sorry I don't understand what you mean.
Reply
#10
Why have a dropdown to pick between, just put the dropdown of pages and the url on the same page.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#11
IMO a gsconfig setting to be able to disable the "link to local page" option would be nice anyway. This would be useful for:

- sites with many pages
- sites where most links are to external ones
- sites using the I18N plugin with a custom permalink structure having %language% or %nondefaultlanguage%, where links in the dropdown are broken - even the plugin itself could disable this.
Reply
#12
I'd rather make this a filter, its json anyway so we could just turn it off, if there are no lists.
Ideally the picker would be replaced with a popup, like filebrowser, not a silly combobox and correct for static urls.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#13
So i am thinking the proper way to fix this would be to have proper permalinks, since that would automatically fix this.

In 3.3.0 beta the removal can be handled in config.js ( naturally you would make a copy and use gseditoroptions to use your own copy custom config cke js file )

You can then remove whatever you want or change the code.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#14
Now that GS 3.3 has changed this stuff...

Could it be possible to change (with some jquery, I suppose) the default link type to "URL" instead of "Link to local page"?

Or if I wanted to remove "Link to local" option, must I use a custom config.js or could it be possible to remove/hide it with jquery?
Reply
#15
You can define this before cke inits, js global linkdefault

Code:
<script type="text/javascript">
var linkdefault = 'url';
</script>

You can also write your own ondialogdefinition
content.setup = function(data) {}

To override the one core loads

but you probably cannot modify it with jquery since that code gets instantiated every time a dialog opens

But this is tied to all ckeditor instances, it gets to be a pain if you need to modify individual ckeditors.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#16
(2014-11-04, 05:40:02)shawn_a Wrote: You can define this before cke inits, js global linkdefault

Great! Thank you Shawn.
Reply




Users browsing this thread: 2 Guest(s)