<NME> main.ts
<BEF> /**
 * @license
 * Copyright 2016 Google Inc.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @file Main entry point for default neuroglancer viewer.
 */
import {setupDefaultViewer} from 'neuroglancer/ui/default_viewer_setup';

window.addEventListener('DOMContentLoaded', () => {
  setupDefaultViewer();
});
  makeDefaultKeyBindings(viewer.keyMap);

  document.addEventListener('copy', (event: ClipboardEvent) => {
    const {tagName} = (<HTMLElement>event.target);
    if (tagName === 'TEXTAREA' || tagName === 'INPUT') {
      return;

<MSG> fix: ensure default copy action is performed when there is a selection.

<DFF> @@ -28,6 +28,10 @@ window.addEventListener('DOMContentLoaded', () => {
   makeDefaultKeyBindings(viewer.keyMap);
 
   document.addEventListener('copy', (event: ClipboardEvent) => {
+    const selection = window.getSelection();
+    if (!selection.isCollapsed) {
+      return;
+    }
     const {tagName} = (<HTMLElement>event.target);
     if (tagName === 'TEXTAREA' || tagName === 'INPUT') {
       return;

fix: ensure default copy action is performed when there is a selection.