question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'getSelection' of undefined

See original GitHub issue

hi, I got a problem with use it. error BTW, I was use custom route strategy that implements RouteReuseStrategy. My router will store the old toute, then reuse it if necessary.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kzimnycommented, Dec 18, 2017

I suppose that the problem is due to the visibility of editor in your tabs. You can add click event to the <mat-tab (click)=“MyClick($event)”> elements and in your code hide or show the editor if needed. Add the visibility *ngIf to the html code:

<mat-tab-group>
     <mat-tab label="Tab1">
          <mat-tab-group>
              <mat-tab label="child tab 1" id="tab1" (click)="MyClick($event)">
                   <app-text-editor *ngIf="showEditor"></app-text-editor>
              </mat-tab>
              <mat-tab label="child tab 2" id="tab2" (click)="MyClick($event)">
                   {{tab content here}}
              </mat-tab>
        </mat-tab-group>
     <mat-tab label="Tab2">
      //basically same format as tab1
     </mat-tab>
     <mat-tab label="Notes"  id="tab3" (click)="MyClick($event)">
        {{tab content here}}
     </mat-tab>
</mat-tab-group>

and in component.ts add the event:


showEditor: boolean;

public MyClick($event: any): void {
switch($event.target.id) { 
   case "tab1": { 
      this.showEditor = true;
      break; 
   } 
   case "tab2":
   case "tab3":
 { 
      this.showEditor = false;
      break; 
   } 
}
}

Ia addition you can dispose and initialize the ckeditor in switch(…) if this is needed.

0reactions
Marshal27commented, Dec 18, 2017

@kzimny no worries at all. Thank you again for your help on this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read property 'getSelection' of ...
I have a list of articles. every time I clicked on any article a "dialog / modal" should be open. in such dialog...
Read more >
Cannot read property 'getSelected' of undefined at popup.js:7 ...
Hi all, I synced my experiment with Pavlovia and got this error. Any idea how to fix this? Part of the code that...
Read more >
Uncaught TypeError: Cannot read property 'getSelection' of ...
I just upgraded to 2.8.4 and when I try to enter free text in a comment section in the Gradebook, ckeditor throws an...
Read more >
Javascript – CkEditor – Uncaught TypeError: Cannot read ...
Then I started to have this error. TypeError: Cannot read property 'getSelection' of undefined at CKEDITOR.dom.selection.getNative (ckeditor.js:448) at new ...
Read more >
Cannot read property 'getSelection' of undefined (TypeError)
Cannot read property 'getSelection' of undefined (TypeError) 我在打开ckeditor时,提示这个!如何解决??我使用google chrome ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found