2010-09-20 77 views
1

里面当你插入Flash对象到CKEDITOR编辑器窗口中会显示这个符号:CKEDITOR - 自定义标签和符号editorwindow

alt text

我想知道。是否有可能当用户插入此标记到编辑器做同样的事情(使用正则表达式{formbuilder =(\ d +)} /):

{formbuilder = 2}

如果是这样,可能有人请解释如何至? :)

UPDATE:

我一直在寻找的分页符插件,试图了解这到底是怎么回事。这个插件和我的最大区别在于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!'); 
     } 

的分页符插件做的一切,当你点击工具栏上的图标。这使得可以在插件文件中创建fakeImage。另一方面,对于我来说,我不明白这是如何实现的:\

回答

0

我正在寻找解决类似的问题,除了我的东西看起来像XML。如此,<cms:include page="whatever" />。在你的情况下,你将能够复制占位符插件并改变占位符正则表达式来匹配你的标签。就我而言,看起来我会修改iframe插件或其他东西,并希望弄清楚如何将每个标签添加为自闭合...