GetSimple Support Forum
Change default Link type in editor - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: Change default Link type in editor (/showthread.php?tid=2596)



Change default Link type in editor - Carlos - 2012-01-09

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)


Change default Link type in editor - Connie - 2012-01-09

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!


Change default Link type in editor - Connie - 2012-01-09

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 ;=(


Change default Link type in editor - Carlos - 2012-01-10

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.


Change default Link type in editor - ChriS - 2012-03-17

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.


Change default Link type in editor - Carlos - 2012-03-17

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


RE: Change default Link type in editor - Carlos - 2013-02-05

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.


RE: Change default Link type in editor - shawn_a - 2013-02-05

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


RE: Change default Link type in editor - Carlos - 2013-02-13

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


RE: Change default Link type in editor - shawn_a - 2013-02-13

Why have a dropdown to pick between, just put the dropdown of pages and the url on the same page.


RE: Change default Link type in editor - Carlos - 2013-05-01

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.


RE: Change default Link type in editor - shawn_a - 2013-05-01

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.


RE: Change default Link type in editor - shawn_a - 2013-11-11

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.


RE: Change default Link type in editor - Carlos - 2014-11-04

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?


RE: Change default Link type in editor - shawn_a - 2014-11-04

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.


RE: Change default Link type in editor - Carlos - 2014-11-04

(2014-11-04, 05:40:02)shawn_a Wrote: You can define this before cke inits, js global linkdefault

Great! Thank you Shawn.