This would be a feature request as well as looking for some help creating the tool.
I would like to create a link assistant. Uploading and linking to files is great, but the end-user can't browse the entire site. I also have dynamic links with url parameters required to get the link.
What I would like to do is add a button that would open a dialogue. The dialogue would contain a form with the text for the link (and if there is a selection, this would be populated with the selected text). It would then show a list of links. The source for the form should be easy to customize so I can write a php or asp script to spit out common names for the links and the site's specific structure of potential links (e.g. Home; About Us; Products -> Widget 1, Widget 2, Widget 3; Events->Event 1, Event 2, etc).
When the user submits the form, the text will be inserted with the proper link at the right place.
I think I see the information for adding a button, though I have not reviewed it. What I have found a bit tough to figure out so far is how to get the cursor position with or without the selection and return the new content to the right place while making sure I don't split a tag like a [strong] tag. The JS API is a bit brief on this.
Is there a tutorial or a good place for me to start where someone has documented how to make one's own extension to do something like this? Also, I think something like this would be a nice feature addition. Have I posted in the right forum?
Thanks for any help!
Steven
I would like to create a link assistant. Uploading and linking to files is great, but the end-user can't browse the entire site. I also have dynamic links with url parameters required to get the link.
What I would like to do is add a button that would open a dialogue. The dialogue would contain a form with the text for the link (and if there is a selection, this would be populated with the selected text). It would then show a list of links. The source for the form should be easy to customize so I can write a php or asp script to spit out common names for the links and the site's specific structure of potential links (e.g. Home; About Us; Products -> Widget 1, Widget 2, Widget 3; Events->Event 1, Event 2, etc).
When the user submits the form, the text will be inserted with the proper link at the right place.
I think I see the information for adding a button, though I have not reviewed it. What I have found a bit tough to figure out so far is how to get the cursor position with or without the selection and return the new content to the right place while making sure I don't split a tag like a [strong] tag. The JS API is a bit brief on this.
Is there a tutorial or a good place for me to start where someone has documented how to make one's own extension to do something like this? Also, I think something like this would be a nice feature addition. Have I posted in the right forum?
Thanks for any help!
Steven
Re: Link assistant
I would recommend you looking at the dialogs code, to understand how such things are handled inside the editor. Also, you may check out plugins repository to take some ideas.
Frederico Knabben
CKEditor Project Lead and CKSource Owner
--
Follow us on: Twitter | Facebook | Google+ | LinkedIn
Re: Link assistant
Re: Link assistant
Thanks for the assistance. I developed the plugin, but I had to modify core files to do so.
I assume that is 'not the right way' so I posted (probably in the wrong forum) this question to conform the plugin:
http://www.fckeditor.net/forums/viewtopic.php?f=5&t=10583
Can you shine any light on the questions in that post. I want to replace link, image, flash, and perhaps anchor, but a) I can't find where FCK editor already has the icons, and b) would really like to substitute for the existing functions rather than require that all those standard menu choices be replaced with custom buttons like LA_Link and LA_Image.
The reason for replacing the functions is to add a button and authentication access to the buttons on the interfaces which have "browse server" and my custom button on them. I didn't see any standard for adding a button to an existing interface.
Did that all make sense? I know what I mean.
Re: Link assistant
Take a look at my ServerPreview plugin.
Re: Link assistant
Thanks for the feedback. I looked at your extension. Very nice.
I kinda just finished the plugin going the route of new buttons (LA_Link, LA_Image, etc.).
I would like to hi-jack the 'Link' button the way you hi-jacked the preview button, but I don't see a parallel for the Link button
like the FCKPreviewCommand.prototype.Execute function that you replaced to take over the preview buttons behavior.
How could I override the default function for the button "Link".
I am thinking the key would be in over-riding the code in fckeditor/editor/_source/internals/fckcommands.js so that it points to my file.
That seems like the most likely place, but can I override the value of the switch command in that file to change the behavior from
so that it would execute
I'm not sure how I would do that since it is in a specific switch command and not a member of an array or object to be overwritten.
I feel like I am missing something. That there is an object available for me to redefine the toolbar behavior of 'Link'.
Re: Link assistant
FCKCommands.GetCommand('Link') = my new command
Re: Link assistant
I couldn't seem to use the object , but I iterated the properties of the object FCKCommands.GetCommand('Link') and then added:
Now the last big problem I am having is translation.
From my Link dialogue is a button that opens another window. I get oEditor from the opening page:
which works as I can access FCKConfig, but I can't seem to access oEditor.FCKLanguageManager.TranslatePage(document) ;
any idea why would be helpful. I have tried a variety of combinations including...
oEditor.FCKLanguageManager.TranslatePage(document) ;
opener.oEditor.FCKLanguageManager.TranslatePage(document) ;
oEditor = opener.window.parent.InnerDialogLoaded();
oEditor.FCKLanguageManager.TranslatePage(document) ;
No luck. Can't seem to figure out why.
Re: Link assistant
I iterated the objects in sequence to see what was happening.
).
When I display the oEditor properties, I get what appears to be the full object (1630 lines).
When I display the oEditor.FCKLanguageManager object I also get what appears to be a complete object (I tried to paste but the editor here won't take it. Should use FCKeditor
When I display the oEditor.FCKLanguageManager.TranslatePage object I get
and when I try to display oEditor.FCKLanguageManager.TranslatePage(document) I get nothing.
Re: Link assistant
As a general rule you shouldn't do it, it's better to keep them "as is", and just use your own ones. You have to modify the config file to add the plugin, so you can modify at the same time the toolbar to use your commands, that way you can verify the behaviour in the original command and in your own one.
Re: Link assistant
What I am making I will never use unless browse server is used. The dialogues used are exactly the same as the native dialogues. The dialogues I modified still access the native fckeditor js files (e.g. my link dialogue still uses fck_link.js), so replacing the existing buttons, in this case is easiest for me.
I made both sets of code and in fckplugin.js provided comment indicating which code to enable or diable to replace existing buttons or create new buttons.
Re: Link assistant
Re: Link assistant
I'm making a plugin that adds a separate button that does an alternative function to the browse server. It creates a configurable link assistant that delivers to the user links and/or a form to populate the link dialog. It does not replace the browse server function but will always be desired where browse server is used.
The motivation is two fold. As an example, my client wants to add a link to the CMS home page that leads to the most recent event the client just added. Instead of explaining to the client how to go to the page, copy the url, and return to the CMS system and paste the link, the client can click on the link assistant and I can serve up a dynamic page that will spit out amongst other things, a dynamically generated set of links to the events with the link text being the title of the events.
When I get it buffed out a bit (and figure out this translation problem), I will make it available.
It doesn't replace the browse server function and I don't want to customize the browse server function because I don't want to remove the ability to use an alternative file browser.
Re: Link assistant
As per the previous posts, I have offered either to replace the existing dialogue or add a new toolbar command.
The link dialogue language feature works fine. It adds a button which opens a new window. I can confirm that the plugin's language variables are available in the newly opened window, but the elements with fckLang attributes are not getting replaced.
Any help identifying the function or method to make that happen would be much appreciated.