IE问题:无法将文本复制到第二个tinymce编辑器V4(api4)

时间:2013-12-04 14:48:13

标签: javascript html5 tinymce tinymce-4

我已经设法让它在firefox和chrome中运行,但它在IE中不起作用。

我想从第一个编辑器复制文本并将其粘贴到第二个突出显示的位置,任何帮助将不胜感激!

HTML:

        <textarea id="tinymce1" style="height:35em;">Your content here.</textarea>

    <td> <input type = "button" name="copy" id = "copyButton" value="Copy"  

        <textarea id="tinymce2" style="height:35em;">my content here</textarea>

的javascript:

    tinymce.init({
    selector:'textarea', 
    setup: function(ed) {
    ed.on('keyup', function(e) {
    actualCaretPositionBookmark = tinyMCE.activeEditor.selection.getBookmark();


    });
     ed.on('click', function(e) {
    actualCaretPositionBookmark = tinyMCE.activeEditor.selection.getBookmark();

    });
    }
    });  


function copySelected() 
{
    var selection =   tinyMCE.editors.tinymce1.selection.getContent({format : 'text'});       
   //tinymce.editors.tinymce2.execCommand('mceInsertContent', false, selection); 
    if (tinymce.ie > 0) {
            tinyMCE.activeEditor.selection.moveToBookmark(actualCaretPositionBookmark);
           // tinyMCE.editors.tinymce2.execCommand('mceInsertContent',false, 'IE boyus'); 
            tinymce.editors.tinymce2.execCommand('mceInsertContent', false, selection);
            alert("yoyoy");
        }else {
            tinyMCE.editors.tinymce2.execCommand('insertHTML',false, selection); 
        }

 }

0 个答案:

没有答案