如何使tinymce textarea编辑器可放置? [英] How to make tinymce textarea editor droppable?

查看:320
本文介绍了如何使tinymce textarea编辑器可放置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个html:

 <ul id="some_words">
   <li>Word 1</li>
   <li>Word 2</li>
   <li>Word 3</li>
 </ul>

我通过以下方式将这些单词(word1,word2,word3)制成draggable:

I made these words ( word1; word2; word3 ) draggable by this:

$(#some_words li").draggable({helper:'clone'}));

$("#some_words li").draggable({helper: 'clone'});

要创建droppable文本字段,我做了:

And to make droppable textfield I did:

$(#my-text_field").droppable({ 接受:#some_words li", 删除:function(ev,ui){ 警报('发射');// } });

$("#my-text_field").droppable({ accept: "#some_words li", drop: function(ev, ui) { alert('fired');// } });

还有一个<textarea>,其中应用了TinyMCE(编辑器),因此像我在文本字段中所做的那样,该Tinymce如何成为droppable.

There is also an <textarea> where TinyMCE (editor) is applied so how can this Tinymce be droppable as I did for the text field.

现在,当我尝试将任何单词放入文本字​​段时,它会显示警报框,但是当尝试将其放入tinyMCE(文本区域)时,什么也没发生.

Now when I try to drop any word into text field it shows alert box but when try to drop it into a tinyMCE (textarea) then nothing happens.

是否有人知道如何使"TinyMCE"可投放?

If anybody know how to make 'TinyMCE' droppable?

谢谢

推荐答案

TinyMCE隐藏文本区域以在其旁边创建iframe.因此,您必须获取要拖放的iframe元素.

TinyMCE hides the textarea to create an iframe just next to it. So you have to get the element of the iframe you want droppable.

基本上,您可以使用:

$('#my-textarea')
    .next('span.mceEditor')
    .find('iframe')
    .contents()
    .find('.mceContentBody')

(通过检查器在 TinyMCE演示 for jquery中找到)

(found with inspector on TinyMCE demo for jquery)

确保先加载TinyMCE,然后才能应用可放置对象.

Make sure you load TinyMCE first, then you can apply your droppable.

这篇关于如何使tinymce textarea编辑器可放置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆