Browse Source

[codemirror] Minor fixes

akosyakov 8 years ago
parent
commit
e2a7bfcb6d
3 changed files with 10 additions and 4 deletions
  1. 3 3
      src/codemirror/editor.ts
  2. 3 0
      src/codemirror/index.ts
  3. 4 1
      src/codemirror/model.ts

+ 3 - 3
src/codemirror/editor.ts

@@ -58,7 +58,7 @@ class CodeMirrorEditor implements CodeEditor.IEditor {
   constructor(host: HTMLElement, options: CodeMirrorEditor.IOptions) {
     host.classList.add(EDITOR_CLASS);
     this.uuid = this.uuid;
-    this.selectionStyle = this.selectionStyle;
+    this.selectionStyle = options.selectionStyle;
 
     this._model = new CodeMirrorModel();
 
@@ -245,7 +245,7 @@ class CodeMirrorEditor implements CodeEditor.IEditor {
   getSelections(): CodeEditor.ITextSelection[] {
     const selections = this._model.doc.listSelections();
     if (selections.length > 0) {
-      return this._model.doc.listSelections().map(selection => this.toSelection(selection));
+      return selections.map(selection => this.toSelection(selection));
     }
     const cursor = this._model.doc.getCursor();
     const selection = this.toSelection({ anchor: cursor, head: cursor });
@@ -334,7 +334,7 @@ class CodeMirrorEditor implements CodeEditor.IEditor {
   }
 
   /**
-   * Converts a code mirror selectio to an editor selection.
+   * Converts a code mirror selection to an editor selection.
    */
   protected toSelection(selection: CodeMirror.Selection): CodeEditor.ITextSelection {
     return {

+ 3 - 0
src/codemirror/index.ts

@@ -1,3 +1,6 @@
+// Copyright (c) Jupyter Development Team.
+// Distributed under the terms of the Modified BSD License.
+
 export * from './mode';
 export * from './model';
 export * from './editor';

+ 4 - 1
src/codemirror/model.ts

@@ -21,7 +21,7 @@ import {
  * An implementation of the code editor model using code mirror.
  */
 export
-  class CodeMirrorModel implements CodeEditor.IModel {
+class CodeMirrorModel implements CodeEditor.IModel {
 
   /**
    * A signal emitted when a content of the model changed.
@@ -49,6 +49,9 @@ export
     });
   }
 
+  /**
+   * An underying CodeMirror document.
+   */
   get doc(): CodeMirror.Doc {
     return this._doc;
   }