jQWidgets Forums

jQuery UI Widgets Forums Editors Editor Finding caret position in jqxEditor

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 10 years, 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Finding caret position in jqxEditor #65906

    Ankit Shah
    Participant

    Hi JQX team,

    We are developing a functionality where on jqxEditor we want a drag and drop functionality. The items are dragged from a list box and dropped on jqxEditor. When item is dropped to editor, it should appended to the existing text of editor where the cursor/caret is positioned.
    Below is the code we are using.

         <link rel="stylesheet" href="jqwidgets/styles/jqx.base.css" type="text/css" />
        <script type="text/javascript" src="scripts/jquery-1.11.1.min.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxcore.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxdata.js"></script> 
        <script type="text/javascript" src="jqwidgets/jqxbuttons.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxscrollbar.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxmenu.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxcheckbox.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxlistbox.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxdropdownlist.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxinput.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxdropdownbutton.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxcolorpicker.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxwindow.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxeditor.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxtooltip.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxdragdrop.js"></script>
        <script type="text/javascript" src="scripts/demos.js"></script>
            
        <script type="text/javascript">
    
            $(document).ready(function () {
                var data1 = [
                    "Affogato",
                    "Americano",
                    "Bicerin",
                    "Breve",
                    "Café Bombón",
                    "Café au lait",
                    "Caffé Corretto",
                    "Café Crema",
                    "Caffé Latte",
                    "Caffé macchiato",
                    "Café mélange",
                    "Coffee milk",
                    "Cafe mocha"
                ];
                var data2 = [
                    "Cappuccino",
                    "Carajillo",
                    "Cortado",
                    "Cuban espresso",
                    "Espresso",
                    "Eiskaffee",
                    "The Flat White",
                    "Frappuccino",
                    "Galao",
                    "Greek frappé coffee",
                    "Iced Coffee",
                    "Indian filter coffee",
                    "Instant coffee",
                    "Irish coffee",
                    "Liqueur coffee"
                ];
                
                $("#listBoxB").jqxListBox({
                    allowDrop: true, allowDrag: true, source: data2, width: 200, height: 250
                   
                });
    
                $("#expressoinEditor").jqxEditor({
                    height: 300, width: 600, pasteMode: 'text'
                   
                });
    
             
                $("#listBoxB").off('dragEnd');
                $("#listBoxB").on('dragEnd', function (event) {
                    
                    /*
    
                    What should be here to capture caret/cursor position 
                    and append text to existing text at that position
    
                    */
                  
                });
    
            });
    
        </script>
    </head>
    <div id='content'>
        <div id='jqxWidget'>
            <div style="float: left;" id="listBoxA">
            </div>
            <div style="margin-left: 20px; float: left;" id="listBoxB">
            </div>
            <div style="width: 200px; height: 200px; float: left; margin-left: 20px;">
                <textarea id="expressoinEditor"></textarea>
            </div>
    
        </div>
    </div>
    

    Also we want to know that if we want to have a functionality of autocomplete on jqxEditor control, can you please suggest anything on that regard.
    Your help is much appreciated.
    Thanks,

    Finding caret position in jqxEditor #65908

    Peter Stoev
    Keymaster

    Hi AnkitShah,

    At present, we do not provide API for getting caret position or inserting something at specific caret position. We do not plan development of auto-complete functionality about this particular widget, too.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.