Hi,
First of all congrats on a great editor + nice work on integration with Linktocontent.

I've just installed the modified version of linktocontent-6.x-2.x that works with fckeditor-6.x-1.3
I'm running drupal-6.10 with Pathauto enabled. All relevant install/setups/permissions have been made for fckeditor and linktocontent.

All works fine except for a small bug: the html code generated by linktonode overwrites the original anchor text
and replaces it by the target node title.

Looking into the linktocontent code had me wonder about the javascript file linktocontent/tinymce_plugins/linktonode/jscripts/functions.js: function insertAction():line 79:elm = tinyMCE.getParentElement(elm, "a");

As I'm using fckeditor instead of tinymce this variable gets ALWAYS replaced by the node title, which seems to be the default behavior when inserting a "Link to Node" with no anchor text selected.
Unfortunately I don't know much about javascript and I have no clue how to patch the insertAction function so it also works in fckeditor.
Other than that the current combination of fckeditor+linktonode works like a charm! Tx.

Comments

zila’s picture

Subscribe.
The problem lies in this line (function.js line 88):

if (inst.selection.getSelectedText().length == 0) {
...

I tried to tweak with this ( !== 0) but the result is the same: it overwrites the selected text instead of using it as link text.

zila’s picture

Argh :)
The isertAction in function.js is used with tinyMCE (I suppose...). With FCKEditor a solution is:
utils.js line 60-63:

/*
 if ( aHasSelection )
                        sInnerHtml = oLink.innerHTML ;          // Save the innerHTML (IE changes it if it is like an URL).
*/

This commented out snippet preserves the selection, so the solution is to remove comments from around the snippet so it looks like:

 if ( aHasSelection )
                        sInnerHtml = oLink.innerHTML ;          // Save the innerHTML (IE changes it if it is like an URL).

Then clear all cache, reload, force-reload, whatever :) and Link to node preserves the original selection.

j3ann0t’s picture

Thanks a bunch! That was it (that is uncommenting lines 60 and 63 in utils.js). Now all works fine.

j3ann0t’s picture

Status: Active » Fixed

Thanks a bunch! That was it (that is uncommenting lines 60 and 63 in utils.js). Now all works fine.

wwalc’s picture

Fixed in CVS. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.