This is a migrated thread and some comments may be shown as answers.

Uncaught TypeError: Cannot use 'in' operator to search for 'getSelection' in undefined

1 Answer 1322 Views
Editor
This is a migrated thread and some comments may be shown as answers.
kgill
Top achievements
Rank 1
kgill asked on 29 Sep 2020, 10:35 PM

Hi, 

I am seeing error with Kendo Editor : Uncaught TypeError: Cannot use 'in' operator to search for 'getSelection' in undefined. Editor loads and render fine. When text value is changed or updated in the editor in edit mode and then if I click outside of editor , js error is shown right away.  Have tried calling refresh() on change event, that still gives me same error.  If I call refresh on editor select event, it prevents the error, but won't let user type due to focus. Will have to click and hold the mouse down while typing to not lose focus instantly to use refresh method.

Browser: Chrome.

onEditorSelect: function (e) {
  var editor = e.sender.element.closest('[data-role="editor"]').data('kendoEditor');
  editor.refresh();   
 }
 onEditorChange: function (e) {
   var test = $(".page-editor").find("[data-role=editor]").data("kendoEditor");
    test.refresh();
}

 

Stack Trace/Error

kendo.all.js:75062 Uncaught TypeError: Cannot use 'in' operator to search for 'getSelection' in undefined
at Object.selectionFromWindow (kendo.all.js:75062)
 at Object.selectionFromDocument (kendo.all.js:75075)
 at init.getSelection (kendo.all.js:73878)
 at init.getRange (kendo.all.js:73886)
 at init.refreshTools (kendo.all.js:76998)
 at init.value (kendo.all.js:73799)
 at init.refresh (kendo.all.js:9960)
 at init.<anonymous> (kendo.all.js:9070)
 at init.trigger (kendo.all.js:192)
  at init.change (kendo.all.js:8900)

 

View

<div class="page-editor"
                 data-bind="visible: TestCheck">
                <textarea data-role="editor"
                          class="editor"
                          id="TestEditor"
                          style="height: 100px;"
                          data-tools="['bold',
                        'italic'']"
                           data-bind="value: Text,
                        events: {
                            select: onEditorSelect,
                            select: onEditorChange
                        }">
            </textarea>
            </div>

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 01 Oct 2020, 01:57 PM

Hello,

I used the provided snippet to prepare the following Dojo example. The getSelection method is invoked correctly on my end.

May I ask you to modify the example to replicate the behavior the way it is at your end and send it back to us for a review? Thus we could inspect the issue locally and advise you further.  

Looking forward to your reply.

Regards,
Neli
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

Tags
Editor
Asked by
kgill
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or