views:

25

answers:

0

When you insert a flash object into the CKeditor the editor window will show this symbol:

alt text

I was wondering. Is it possible to do something similar when users inserts this tag into the editor (using regex {formbuilder=(\d+)}/ ):

{formbuilder=2}

If so, could someone please explain how to? :)

UPDATE:

I've been looking at the PageBreak plugin to try and understand what the hell is going on. The big difference between this plugin and mine is the way the HTML is inserted into the editor.

CKEDITOR.plugins.add('formbuilder',
{
    init: function(editor)
    {
        var pluginName = 'formbuilder';
        var windowObjectReference = null;

        editor.ui.addButton('Formbuilder',
            {

                label : editor.lang.common.form,
                command: pluginName,
                icon: 'http://' + top.location.host + '/publish/ckeditor/images/formbuilder.png',
                click: function (editor)
                    {     
                        if (windowObjectReference == null || windowObjectReference.closed){
                            var siteid = $('#siteid').val();

                            windowObjectReference = window.open('/publish/formbuilder/index.php?siteid='+siteid,'Formbuilder','scrollbars=0,width=974,height=650');
                        } else {
                            windowObjectReference.focus();
                        }
                    }
            });
    }
});

As you can see, my plugin opens a new window and the tag is inserted with:

function InsertForm(form_id)
        {
            // Get the editor instance that we want to interact with.
            var oEditor = CKEDITOR.instances.page_content;

            // Check the active editing mode.
            if ( oEditor.mode == 'wysiwyg' )
            {
                // Insert the desired HTML.
                oEditor.insertHtml( '{formbuilder='+form_id+'}' );
            }
            else
                alert( 'You must be on WYSIWYG mode!' );
        }

The PageBreak plugin does everything when you click on the toolbar icon. This makes it possible to make the fakeImage inside the plugin file. For me on ther other hand, I don't see how this is possible :\