From d2307018887e60064daa3b8526eb2524e19fb4e2 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Wed, 23 Oct 2024 18:46:03 +0200 Subject: [PATCH] Trying something else --- python/jupytercad_core/src/stlplugin/model.ts | 4 ++++ python/jupytercad_core/src/stlplugin/modelfactory.ts | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) 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; } }