我有一个带有span标记的tinymce textarea:<span data-range-id="4oYnl5fH0">...</span>
。
单击文本范围时,我想在文本旁边显示一个弹出窗口。
问题是文本隐藏在iframe中,因此JQuery无法访问它。
有没有办法用JQuery更改iframe中的内容,特别是使用tinymce?我不能只复制内容然后再粘贴,因为我需要来获取文本在屏幕上的位置的坐标为此,我会使用它:
position = $(this).offset();
其中this
是范围标记
答案 0 :(得分:5)
是的,这是可能的,也很容易。
var editor = tinymce.editors[0]; // or tinymce.get('your_editor_id') or tinymce.activeEditor
var $ed_body = $(editor.getBody());
// do whatever you want with the editor content located inside the body