Commit bb2f4158 authored by dmacfarlane's avatar dmacfarlane
Browse files

Fixed content editable focus issue.

parent cbe1c0b4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ import { getCaretCoordinates } from './caret-coords';
    template: `
    <ul class="dropdown-menu scrollable-menu" [hidden]="hidden">
        <li *ngFor="let item of items; let i = index" [class.active]="activeIndex==i">
            <a class="text-primary" (click)="activeIndex=i;itemClick.emit()">{{item}}</a>
            <a class="text-primary" (mousedown)="activeIndex=i;itemClick.emit();$event.preventDefault()">{{item}}</a>
        </li>
    </ul>
    `
+8 −6
Original line number Diff line number Diff line
@@ -25,15 +25,17 @@ export function insertValue(el, start, end, text, iframe, noRecursion=false) {
  }
  else if (!noRecursion) {
    var selObj = getWindowSelection(iframe);
    if (selObj && selObj.rangeCount>0) {
      var selRange = selObj.getRangeAt(0);
      var position = selRange.startOffset;
      var anchorNode = selObj.anchorNode;
    if (text.endsWith(' ')) {
      text = text.substring(0, text.length-1) + '\xA0';
    }
      // if (text.endsWith(' ')) {
      //   text = text.substring(0, text.length-1) + '\xA0';
      // }
      insertValue(anchorNode, position-(end-start), position, text, iframe, true);
    }
  }
}

export function isInputOrTextAreaElement(el) {
  return el!=null && (el.nodeName == 'INPUT' || el.nodeName == 'TEXTAREA');