Jelajahi Sumber

Use uuid function that is not deprecated.

Ian Rose 8 tahun lalu
induk
melakukan
a826612bdf
2 mengubah file dengan 8 tambahan dan 15 penghapusan
  1. 4 7
      packages/cells/src/model.ts
  2. 4 8
      packages/notebook/src/model.ts

+ 4 - 7
packages/cells/src/model.ts

@@ -9,16 +9,12 @@ import {
   ISignal, Signal
 } from '@phosphor/signaling';
 
-import {
-  utils
-} from '@jupyterlab/services';
-
 import {
   CodeEditor
 } from '@jupyterlab/codeeditor';
 
 import {
-  IChangedArgs, nbformat
+  IChangedArgs, nbformat, uuid
 } from '@jupyterlab/coreutils';
 
 import {
@@ -132,7 +128,7 @@ class CellModel extends CodeEditor.Model implements ICellModel {
   constructor(options: CellModel.IOptions) {
     super({modelDB: options.modelDB});
 
-    this._id = options.id || utils.uuid();
+    this._id = options.id || uuid();
 
     this.value.changed.connect(this.onGenericChange, this);
 
@@ -441,7 +437,8 @@ namespace CodeCellModel {
   /**
    * The options used to initialize a `CodeCellModel`.
    */
-  export interface IOptions extends CellModel.IOptions {
+  export
+  interface IOptions extends CellModel.IOptions {
     /**
      * The factory for output area model creation.
      */

+ 4 - 8
packages/notebook/src/model.ts

@@ -5,10 +5,6 @@ import {
   each
 } from '@phosphor/algorithm';
 
-import {
-  utils
-} from '@jupyterlab/services';
-
 import {
   DocumentModel, DocumentRegistry
 } from '@jupyterlab/docregistry';
@@ -19,7 +15,7 @@ import {
 } from '@jupyterlab/cells';
 
 import {
-  IObservableJSON, IObservableUndoableVector,
+  IObservableJSON, IObservableUndoableVector, uuid,
   IObservableVector, ObservableVector, nbformat, IModelDB
 } from '@jupyterlab/coreutils';
 
@@ -425,7 +421,7 @@ namespace NotebookModel {
       }
       if (this._modelDB) {
         if (!options.id) {
-          options.id = utils.uuid();
+          options.id = uuid();
         }
         options.modelDB = this._modelDB.view(options.id);
       }
@@ -443,7 +439,7 @@ namespace NotebookModel {
     createMarkdownCell(options: CellModel.IOptions): IMarkdownCellModel {
       if (this._modelDB) {
         if (!options.id) {
-          options.id = utils.uuid();
+          options.id = uuid();
         }
         options.modelDB = this._modelDB.view(options.id);
       }
@@ -461,7 +457,7 @@ namespace NotebookModel {
     createRawCell(options: CellModel.IOptions): IRawCellModel {
       if (this._modelDB) {
         if (!options.id) {
-          options.id = utils.uuid();
+          options.id = uuid();
         }
         options.modelDB = this._modelDB.view(options.id);
       }