1

当您将 Flash 对象插入 CKeditor 时,编辑器窗口将显示此符号:

替代文字

我想知道。当用户将此标签插入编辑器时是否可以做类似的事情(使用正则表达式 {formbuilder=(\d+)}/ ):

{formbuilder=2}

如果是这样,有人可以解释一下如何吗?:)

更新:

我一直在查看 PageBreak 插件,试图了解到底发生了什么。这个插件和我的最大区别在于 HTML 插入编辑器的方式。

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();
                        }
                    }
            });
    }
});

如您所见,我的插件会打开一个新窗口,并插入标签:

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!' );
        }

当您单击工具栏图标时,PageBreak 插件会执行所有操作。这使得在插件文件中制作 fakeImage 成为可能。另一方面,对我来说,我不明白这怎么可能:\

4

1 回答 1

0

I'm looking to solve a similar issue, except that all my stuff looks like XML. So like, <cms:include page="whatever" />. In your case, you would be able to copy the placeholder plugin and change the placeholder regex to match your tags. In my case, looks like I'll be modifying the iframe plugin or something, and hopefully figuring out how to add each of my tags as self-closing...

于 2011-01-26T22:35:45.057 回答