diff --git a/python/jupytercad_core/src/stlplugin/model.ts b/python/jupytercad_core/src/stlplugin/model.ts index 4e495956..9b1c9322 100644 --- a/python/jupytercad_core/src/stlplugin/model.ts +++ b/python/jupytercad_core/src/stlplugin/model.ts @@ -17,6 +17,10 @@ export class JupyterCadStlDoc extends JupyterCadDoc { this._source.observeDeep(this._sourceObserver); } + setSource(value: string) { + this._source.insert(0, value); + } + get version(): string { return '0.1.0'; } diff --git a/python/jupytercad_core/src/stlplugin/modelfactory.ts b/python/jupytercad_core/src/stlplugin/modelfactory.ts index 94756fbd..339b70e7 100644 --- a/python/jupytercad_core/src/stlplugin/modelfactory.ts +++ b/python/jupytercad_core/src/stlplugin/modelfactory.ts @@ -1,10 +1,11 @@ import { IJupyterCadDoc, JupyterCadModel } from '@jupytercad/schema'; import { DocumentRegistry } from '@jupyterlab/docregistry'; import { Contents } from '@jupyterlab/services'; +import { JupyterCadStlDoc } from './model'; class JupyterCadSTLModel extends JupyterCadModel { fromString(data: string): void { - this.sharedModel.source = data; + (this.sharedModel as JupyterCadStlDoc).setSource(data); this.dirty = true; } }