简体   繁体   English

哪个所见即所得的编辑器可以与fancybox配合使用?

[英]Which wysiwyg editor works fine with fancybox?

I used to work with tinymce, but it causes lot of troubles when I want to put it to fancybox (fails with second start of fancybox window). 我曾经使用过tinymce,但是当我想将它放到fancybox时会引起很多麻烦(fancybox窗口的第二次启动失败)。 Cleditor doesn't work too (displays "true" instead of editor). Cleditor也不起作用(显示“ true”而不是编辑器)。 Is there any editor which will work without making any strange tricks? 是否有任何编辑器都可以工作而不会产生任何奇怪的花样?

Edit: 编辑:

$('.fancybox_with_wysiwyg').fancybox({padding: 1, scrolling: 'no',
        beforeShow: function () { tinymce.execCommand('mceToggleEditor', false, 'fbwysiwyg'); },
        beforeClose: function () { tinymce.EditorManager.execCommand('mceRemoveControl', true, 'fbwysiwyg'); }
    });

Edit2 (fixed callbacks) Edit2 (固定的回调)

  $('.fancybox_with_wysiwyg').fancybox({
    padding: 1,
    scrolling: 'no',
        onComplete : function() {
            tinyMCE.execCommand('mceToggleEditor', false, 'fbwysiwyg');
   },
        onCleanup : function() {
            tinyMCE.execCommand('mceRemoveControl', false, 'fbwysiwyg' );
    }        
});

Solution (thanks to Thariama) 解决方法 (感谢Thariama)

    $('.fancybox_with_wysiwyg').fancybox({padding: 1, scrolling: 'no',
            onComplete: function () { tinymce.execCommand('mceAddControl', false, 'fbwysiwyg'); },
            onClosed: function () { tinyMCE.execCommand('mceRemoveControl', false, 'fbwysiwyg' );  }
        });

CKEditor definately works as I've been working on putting it inside a Fancybox this afternoon :) CKEditor一定可以正常工作,因为今天下午我一直在努力将其放入Fancybox中:)

The problem you may encounter is when a modal window plugin removes and recreates the textarea within the modal. 您可能会遇到的问题是模态窗口插件删除并在模态内重新创建textarea时。 In this case you will need to re-bind the WYSIWYG when the textarea is shown. 在这种情况下,当显示文本区域时,您将需要重新绑定所见即所得。

>I used to work with tinymce, but it causes lot of troubles when I want to put 
>it to fancybox (fails with second start of fancybox window).

The simple solution for this case is to shut down tinymce correctly before you reinitialize it the second time. 这种情况的简单解决方案是在第二次重新初始化tinymce之前,先正确关闭它。

To shut your editor instance down call 要关闭您的编辑器实例调用

tinyMCE.execCommand('mceRemoveControl', false, 'fbwysiwyg' ); 

Update: You need to use 更新:您需要使用

$('.fancybox_with_wysiwyg').fancybox({padding: 1, scrolling: 'no',
        beforeShow: function () { tinymce.execCommand('mceToggleEditor', false, 'fbwysiwyg'); },
        beforeClose: function () { tinyMCE.execCommand('mceRemoveControl', false, 'fbwysiwyg' );  }
    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM