Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public markContent(): void {
- const selection = window.getSelection();
- const selectionRange = window.getSelection().getRangeAt(0);
- if (selectionRange.startOffset !== selectionRange.endOffset) {
- if (this.markerEvent === 'p' || this.markerEvent === 'mark' || this.markerEvent === 'strong') {
- const textSeleted = window.getSelection().toString();
- const range = window.getSelection().getRangeAt(0).cloneRange();
- if (this.markerEvent !== 'mark') {
- const marker = document.createElement('mark');
- marker.setAttribute('class', this.colorMarker);
- marker.textContent = textSeleted;
- range.surroundContents(marker);
- this.libraryServices.changeBobblePosition({ top: 0, left: 0, display: 'none' });
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment