Hi @ All,
i have just a simple question. Is it possible to insert a string from a dropdownlist into the fckeditor where my cursor is? And how?
thanks a lot
greetings
WW
i have just a simple question. Is it possible to insert a string from a dropdownlist into the fckeditor where my cursor is? And how?
thanks a lot
greetings
WW

Re: Insert from DropDownList
I've written a plug-in that was designed to insert pre-defined HTML based on a valid form field list; it's not terribly difficult once you find the right bit of code to hook in to.
I started by looking at the Style drop-down code. It, in turn, uses FCKToolbarSpecialCombo as a prototype. If you have a static list of stuff you want to insert, you only need to define a CreateItems function that loads whatever source of items you have for the drop-down (XML, JavaScript object...), register your new item to the system per the standard plug-in for toolbar instructions and your plug-in is pretty much complete.
Create a 'mynewcombo' directory in the editor/plugins directory, create a 'lang' directory under that, create a lang entry for your language for 'MyNewCombo', then create the fckplugin.js file in the 'mynewcombo' directory:
var MyNewCombo = function( tooltip, style) { if (tooltip === false ) return; this.CommandName = 'MyNewCombo'; this.Label = this.GetLabel() ; this.Tooltip = tooltip ? tooltip : this.Label; this.Style = style ? style: FCK_TOOLBARITEM_ICONTEXT; this.DefaultLabel = ''; } MyNewCombo.prototype = new FCKToolbarSpecialCombo; MyNewCombo.prototype.GetLabel = function () { return FCKLang.MyNewCombo; // Be sure to create a plugin lang directory and a language file for your plug-in } MyNewCombo.prototype.CreateItems = function ( target ) { // Add item code, specific to your plug-in - here's my basic framework minus the actual reading of each item... // while ( itemsToInsert ) { // var item = target.AddItem( optionVal, optionText ); // item.Name = optionVal; // item.Definition = HtmlToInsert; // } } var MyNewComboCommand = function() {} MyNewComboCommand.prototype = { Name: 'MyNewCombo'; Execute: function( name, item ) { FCKUndo.SaveUndoStep() ; FCK.InsertHtml( item.Definition ); FCKUndo.SaveUndoStep() ; FCK.Focus() ; FCK.Events.FireEvent( 'OnSelectionChange' ); }, GetState: function() { if ( FCK.EditMode != FCK_EDITMODE_WYSISYG || !FCK.EditorDocument ) { return FCK_TRISTATE_DISABLED; } return FCK_TRISTATE_OFF; } FCKCommands.RegisterCommand( 'MyNewCombo', new FCKMyNewComboCommand() ); var oMyNewComboItem = new MyNewCombo( 'MyNewCombo') ; FCKToolbarItems.RegisterItem( 'MyNewCombo', oMyNewComboItem);Add 'mynewcombo' as a plugin and 'MyNewCombo' to your Toolbar line in fckconfig.js and you're ready to rock and roll.
Re: Insert from DropDownList
thanks a lot, but i have two more questions.
1) What do you meen whith: create a lang entry for your language for 'MyNewCombo' ?
2) Add 'mynewcombo' as a plugin and 'MyNewCombo' to your Toolbar line in fckconfig.js <----- How should this look like?
thanks, greetings from Vienna
WW
Re: Insert from DropDownList
thanks a lot
WW
Re: Insert from DropDownList
LesBarstow has provided you with the code of a plugin to help you, he has explained the steps that you need to follow and you are demanding for a detailed step by step?
If you don't want to read the forums and the docs, and you need the code so badly that you can't wait even a single day, why don't you hire a developer?
Re: Insert from DropDownList
Take some time to read through the Developer Docs, especially the section on writing plug-ins, and you may also need to delve a bit into the source code if you want to find many useful functions that already exist in the editor code.