refactoring of cmaps, widgets, etc.
This commit is contained in:
@@ -1153,6 +1153,12 @@ import { CmapView } from "./cmap-view.js";
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Replace the editor contents with a public CMap domain model. */
|
||||
replaceModel(model) {
|
||||
if (!(model instanceof CmapModel)) throw new TypeError("A CmapModel is required");
|
||||
return this.replaceDocument(model.toDocument());
|
||||
}
|
||||
|
||||
setZoom(percent) {
|
||||
const next = Math.max(25, Math.min(300, Number(percent) || 100));
|
||||
this.zoomFactor = next / 100;
|
||||
@@ -1866,6 +1872,19 @@ import { CmapView } from "./cmap-view.js";
|
||||
return this.synchronizeModel().toDocument();
|
||||
}
|
||||
|
||||
/** Return the synchronized domain model currently edited by this view. */
|
||||
currentModel() {
|
||||
this.saveCurrentContextLayout();
|
||||
this.refreshConceptMapReferences();
|
||||
return this.synchronizeModel();
|
||||
}
|
||||
|
||||
/** Load a public CMap domain model into an empty editor. */
|
||||
loadModel(model) {
|
||||
if (!(model instanceof CmapModel)) throw new TypeError("A CmapModel is required");
|
||||
this.loadDocument(model.toDocument());
|
||||
}
|
||||
|
||||
loadDocument(document = {}) {
|
||||
if (this.items.length || this.connectors.length || this.unresolvedConnectors.length) {
|
||||
throw new Error("A concept map document can only be loaded into an empty editor");
|
||||
|
||||
Reference in New Issue
Block a user