Posts: 3,491
Threads: 106
Joined: Mar 2010
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)
Posts: 2,928
Threads: 195
Joined: Feb 2011
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!
Posts: 2,928
Threads: 195
Joined: Feb 2011
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 ;=(
Posts: 3,491
Threads: 106
Joined: Mar 2010
2012-01-10, 04:50:33
(This post was last modified: 2012-03-17, 07:47:38 by fotothink.)
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.
Posts: 58
Threads: 9
Joined: Jan 2012
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.
Posts: 3,491
Threads: 106
Joined: Mar 2010
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).
Posts: 3,491
Threads: 106
Joined: Mar 2010
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.
Posts: 6,266
Threads: 181
Joined: Sep 2011
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
Posts: 3,491
Threads: 106
Joined: Mar 2010
(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.
Posts: 6,266
Threads: 181
Joined: Sep 2011
Why have a dropdown to pick between, just put the dropdown of pages and the url on the same page.
Posts: 3,491
Threads: 106
Joined: Mar 2010
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.
Posts: 6,266
Threads: 181
Joined: Sep 2011
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.
Posts: 6,266
Threads: 181
Joined: Sep 2011
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.
Posts: 3,491
Threads: 106
Joined: Mar 2010
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?
Posts: 6,266
Threads: 181
Joined: Sep 2011
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.
Posts: 3,491
Threads: 106
Joined: Mar 2010
(2014-11-04, 05:40:02)shawn_a Wrote: You can define this before cke inits, js global linkdefault
Great! Thank you Shawn.
|