2012-03-16 26 views

答えて

5

私はこれがあなたが探しているものだと思います:

CKEDITOR.on('instanceCreated', function(e) { 
    e.editor.on('mode', function(e){ 
     // Do your stuff here 
     alert(e.editor.mode); 
    }); 
}); 
0

あなたが意味する場合は、ソースモードの変更を取得したいが、あなたはこのような何かを試みることができる:


//add this to your CKeditor’s config.js 
$('textarea.cke_source').live('keyup', function() { 
    $(this) 
    .closest('.cke_wrapper') 
    .parent() 
    .parent() 
    .prev() 
    .ckeditorGet() 
    .fire('change'); 
}); 

この議論は、同様に役立つかもしれない:ckEditor を希望するものは

+0

申し訳ありませんが、多分私は少し正確ではありませんでした。ユーザーがビューを切り替えたときに「何かをする」ことはできません。タグ「

」は、サイズ変更や移動が可能な画像(iFrameなど)に変換する必要があります。そのために、私は "ハックイン"する場所を知る必要があります。 – lony

0

あなたはwysiwyg-viewのための偽の要素を作るためのプラグインを書くべきだと思います。

Ckeditorは、交換が必要な要素をfake-elementsで認識できます。

私はあなたのためのスタートを切った。

(function() { 
CKEDITOR.plugins.add('myPlugin', { 
    requires : [ 'fakeobjects' ], 
    init: function(editor) { 
     var me = this; 
     var pluginName = 'myPlugin'; 
     editor.addCommand(pluginName, new CKEDITOR.dialogCommand(pluginName)); 

     editor.addCss(// your custom css for your placeholder here 
      'div.myPluginElement' + 
      '{' + 
       'border: 1px solid #a9a9a9;' + 
       'width: 70px;' + 
       'height: 50px;' + 
      '}' 
     ); 

    }, 
    afterInit : function(editor) { 
     var dataProcessor = editor.dataProcessor, 
      dataFilter = dataProcessor && dataProcessor.dataFilter; 

     if (dataFilter) { 
      dataFilter.addRules({ 
       elements : { 
        div : function(element) { 
         if (typeof element.attributes['class'] !== 'undefined' && element.attributes['class'].indexOf('myPluginElement') != -1) 
          return editor.createFakeParserElement(element, 'myPluginElement', 'div', false); 
         else return; 
        } 
       } 
      }); 
     } 
    } 
}); 

})();

関連する問題