Ckeditor中TinyMCE的附加/分离等效于什么?

Ckeditor中TinyMCE的附加/分离等效于什么?,ckeditor,wysiwyg,Ckeditor,Wysiwyg,我目前正在将所有TinyMCE插件迁移到CKeditor,并且在插入Line插件时遇到了问题 在TinyMCE中,我有如下代码: (function ($) { Drupal.wysiwyg.plugins['insertinline'] = { /** * Return whether the passed node belongs to this plugin. */ isNode: function(node) { return ($(node).is('im

我目前正在将所有TinyMCE插件迁移到CKeditor,并且在插入Line插件时遇到了问题

在TinyMCE中,我有如下代码:

(function ($) {
Drupal.wysiwyg.plugins['insertinline'] = {

  /**
   * Return whether the passed node belongs to this plugin.
   */
  isNode: function(node) {
    return ($(node).is('img.wysiwyg-inline-image'));
  },


  /**
   * Execute the button.
   */
  invoke: function(data, settings, instanceId) {
    alert(Drupal.t('This is a pseudo plugin/button.\nIt does not insert an inline image.\n\nPlease use the INSERT button from the image upload fieldset.'));
  },


  /**
   * Replace all <!-- INLINE:xxx;w=x;h=x --> tags with images.
   */
  attach: function(content, settings, instanceId) {
    that = this;

    // Replace inline images with physical image
    content = content.replace(new RegExp('<!-- INLINE:([0-9]*);w=([0-9]*);h=([0-9]*) -->', 'gi'), function($0, $1, $2, $3) { return that._getPlaceholder($1, $2, $3); });

    return content;
  },


  /**
   * Replace images with <!-- INLINE:xxx;w=x;h=x --> tags in content upon detaching editor.
   */
  detach: function(content, settings, instanceId) {
    var $content = $('<div>' + content + '</div>'); // No .outerHTML() in jQuery :(

    $.each($('img.wysiwyg-inline-image', $content), function (i, elem) {
      altText = ' ' + Drupal.checkPlain(elem.getAttribute('alt')) + ' ';

      if (elem.parentNode && elem.parentNode.parentNode && elem.parentNode.tagName == 'H2') {
        // Moving the current element to left side of H2 tag 
        elem.parentNode.parentNode.insertBefore(document.createComment(altText), elem.parentNode);
        elem.parentNode.removeChild(elem);
      }
      else {
        elem.parentNode.insertBefore(document.createComment(altText), elem);
        elem.parentNode.removeChild(elem);
      }
    });
    return $content.html();
  },


  /**
   * Helper function to return a HTML placeholder.
   */
  _getPlaceholder: function (fid, w, h) {
    if (!fid) {
      fid = '';
    }
    if (!w) {
      w = '240';
    }
    if (!h) {
      h = '240';
    }

    // Grab image detail data
    var imgData = Drupal.cnngo_inline.getInlineImageDetail(fid, w, h);

    // Build and return image tag
    return '<img src="' + imgData.src + '" alt="' + imgData.alt + '" title="' + imgData.title + '" class="wysiwyg-inline-image" width="' + w + '" height="' + h + '" />';
  }
};
})(jQuery);
工作原理:

假设我上传了一张600x600像素的图像,并将其插入所见即所得区域,默认情况下,它将插入一个img标签

如图所示单击“插入”按钮时。它会像这样插入img标签

<img class="wysiwyg-inline-image" title="Inline image 240x240" src="http://mydomain.com/sites/default/files/styles/inline_image_temp_240x240/public/2013/05/28/600x600_1.png" alt="INLINE:142879;w=240;h=240" width="240" height="240" data-mce-src="http://mydomain.com/sites/default/files/styles/inline_image_temp_240x240/public/2013/05/28/600x600_1.png"> 
见下图

现在,如果我要分离编辑器,单击切换到纯文本,img标记将替换为

<p><!-- INLINE:142879;w=240;h=240 --></p>
当我重新打开编辑器时,它将显示img标记将呈现img

有人能给我指出在Ckeditor中相当于detact/attach的正确方向吗


我在谷歌上花了几个小时,但找不到确切的答案,也许我的问题不对。

如果你能描述一下TinyMCE中这些方法的作用,那就容易多了。@Reinmar…在TinyMCE中,当我分离编辑器切换到源代码时,img标记将被替换,然后当我再次打开编辑器时,它将显示图像。@Reinmar我更新了我的邮局,嗯。。。您没有找到任何内容,因为CKEditor与此功能不等效。使用dataProcessor可以很容易地实现这一点,但是。。。为什么?你想用这个实现什么?你上传了太多的截图。请把你的问题尽量简短。否则,没有人会读它。