Would it be possible for the Linkit button to be available (not grayed out) when you haven't selected any text or an element? If no text or element was selected the link text could simply be entered as the title of the node, term, user or view the user was linking to. If it's an external link, the link text could just be the full URL entered.

CommentFileSizeAuthor
#13 ckeditor.zip2.8 KBanon
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

anon’s picture

Yes, this would be a nice feature.

To do this, I think we have to have a little description text in the linkit popup to describe this.

Do you have any suggestions for this?

timwood’s picture

I'm an awful writer but here goes:

Your link text will appear as the node, term, user or view title you are linking to.

It should only show this text when the user initiates Linkit in this manner.

anon’s picture

ok thats a good start, But we also have to tell them that if the have selected a text to link, that text will be uses.

I will see what I can do about this.

timwood’s picture

What I meant was, if possible, you should only show my suggested message above when the user DOESN'T select any text to link to, that way you don't need any other message.

anon’s picture

oh, my bad, thats a pretty good idea.

Let me work on it.

njbooher’s picture

I too would like to be able to link to nodes and automatically use their title as link text.

anon’s picture

Assigned: Unassigned » anon
anon’s picture

Its quite easy to implement this with CKeditor and FCKeditor, but TinyMCE is a bit trickier though.

Thats because
tinyMCEPopup.execCommand("CreateLink", false, '#linkit-href#', {skip_undo : 1});
will create a link with the selection the user have made.

This is in TinyMCE core, and I have not been able to set a "fake selection" (result title) before this.

Anyone have any suggestions on how to do?

Glottus’s picture

Any hints on how to apply this with CKEditor only? I too would love to be able to insert a link without selecting text first (and have the node title become the linked text).

anon’s picture

@Glottus: I have solved that, but I dont what to make a realese when we are missing this functionallity with TinyMCE.
When we have a solution for that, I will create a new release.

But, I can post my soluton for CKeditor when I get home. (at work right now)

timwood’s picture

Anon,
Project NodePicker appears to have this functionality and it works in TinyMCE. Only difference is they use special codes when inserting links that the included input filter changes to correct, path aliased links. Maybe you can borrow code from that project for this functionality?

anon’s picture

@timwood: Thanks, thats a start.

How ever, after I analyzed NodePicker I have seen that it doesnt handle the creation of links the "TinyMCE" way. They have somekind of own method for this, which I dont think is the "best" way to go.

But I will try to figure out if we could combine those two methods.

anon’s picture

FileSize
2.8 KB

@Glottus: In this zip, there is 2 js files. Put them in /sites/all/modules/linkit/editors/ckeditor-

Glottus’s picture

Thanks! Can't wait to check this out tomorrow morning!

Glottus’s picture

Hmmm-

This doesn't seem to work for me. I doubt that it's related, but I should mention that I had to change the code I added to ckeditor.config.js since I didn't want to store this or any other module in sites/all/modules (this work will need to be transferred to another server, and I like keeping all the contributed modules I need in the site-specific folder). I had edited it to find the Linkit plugin files under CKeditor's plugin directory, so that is where I copied these edits. I did clear all caches as well.

The Linkit button shows up and works as expected (autocompleting with node titles) when clicked on, but it no longer inserts any link at all if no text was selected.

Also (perhaps related if selectors are the problem?), I notice that in IE, when I click on "Insert", a new Linkit window gets opened, but again, nothing is added to the actual editor window.

Also, to be clear, I am not using the WYSIWYG module for integration, just the straight-up CKEditor module.

anon’s picture

Status: Active » Fixed

I have comitted a few changes to linkit now that will handle this issue.

timwood’s picture

Thanks! I'll test it out today.

Glottus’s picture

Can't wait to try this. Thanks for the efforts.

Status: Fixed » Closed (fixed)

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