Browse Source

CodeEditor.Model ctor takes initial value

Vidar Tonaas Fauske 8 năm trước cách đây
mục cha
commit
2af507a902
1 tập tin đã thay đổi với 8 bổ sung1 xóa
  1. 8 1
      src/codeeditor/editor.ts

+ 8 - 1
src/codeeditor/editor.ts

@@ -197,6 +197,13 @@ namespace CodeEditor {
    */
   export
   class Model implements IModel {
+    /**
+     * Construct a new Model
+     */
+    constructor(value?: string) {
+      this._value = new ObservableString(value);
+    }
+
     /**
      * A signal emitted when a mimetype changes.
      */
@@ -255,7 +262,7 @@ namespace CodeEditor {
       this._value.dispose();
     }
 
-    private _value = new ObservableString();
+    private _value: ObservableString;
     private _selections = new ObservableMap<ITextSelection[]>();
     private _mimetype = 'text/plain';
     private _isDisposed = false;