0

おそらく、クリックしてカーソルを移動したり、テキストのブロックを選択したりするときに、フレーミング DIV がクリックをキャッチしているため、カーソルを配置できない編集可能なテキスト ボックスがあります。確かではありませんが、ドラッグ可能なことが関係していると思います。

どんな入力でも大歓迎です。

これが私のコードです(「curObj」はフレーム、「inner」は編集可能に設定したdivです)。

function textbox_editable() {
    var curObj = window.curObj;
    var inner = '#' + $(curObj).attr("id") + ' .object_inner';

    //unless the doubleclick was in a textbox that is already activated for editability...
    if ( $(inner).attr('contentEditable') != 'true' ) {
        $(inner).attr('contentEditable',true); //set attribute editable
        $(curobj).draggable( "destroy" );//remove draggable (it blocks the click-to-move-cursor functionality
        $(curobj).resizable( "destroy" );//remove resizable (it blocks the click-to-move-cursor functionality
        //make cursor text
        $(inner).css( "cursor", 'text' );
        setEndOfContenteditable(inner)
    }
}

//called when we are done editing the contents of a textbox
function textbox_uneditable() {

    $( ".object_textbox .object_inner" ).removeAttr('contentEditable'); //remove editable attribute if it was present
    $( ".object_textbox" ).draggable(); //reinstate draggable
    $( ".object_textbox" ).resizable(); //reinstate draggable
    //restore cursor
    $( ".object_textbox" ).css( "cursor", 'move' );
}
4

1 に答える 1