diff --git a/packages/mindplot/src/components/Command.js b/packages/mindplot/src/components/Command.js index 87d4d4ea..6496551a 100644 --- a/packages/mindplot/src/components/Command.js +++ b/packages/mindplot/src/components/Command.js @@ -15,6 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { $defined } from '@wisemapping/core-js'; const Command = new Class(/** @lends mindplot.Command */{ /** diff --git a/packages/mindplot/src/components/CommandContext.js b/packages/mindplot/src/components/CommandContext.js index 6c1e94f4..9a11432e 100644 --- a/packages/mindplot/src/components/CommandContext.js +++ b/packages/mindplot/src/components/CommandContext.js @@ -15,102 +15,101 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { $assert } from "@wisemapping/core-js"; - +import { $assert, $defined } from "@wisemapping/core-js"; class CommandContext { - constructor(designer) { - $assert(designer, 'designer can not be null'); - this._designer = designer; + constructor(designer) { + $assert(designer, 'designer can not be null'); + this._designer = designer; + } + + /** */ + findTopics(topicsIds) { + $assert($defined(topicsIds), 'topicsIds can not be null'); + if (!(topicsIds instanceof Array)) { + topicsIds = [topicsIds]; } - /** */ - findTopics(topicsIds) { - $assert($defined(topicsIds), 'topicsIds can not be null'); - if (!(topicsIds instanceof Array)) { - topicsIds = [topicsIds]; - } + const designerTopics = this._designer.getModel().getTopics(); + const result = designerTopics.filter((topic) => topicsIds.contains(topic.getId())); - const designerTopics = this._designer.getModel().getTopics(); - const result = designerTopics.filter((topic) => topicsIds.contains(topic.getId())); + if (result.length !== topicsIds.length) { + const ids = designerTopics.map((topic) => topic.getId()); + $assert( + result.length === topicsIds.length, + `Could not find topic. Result:${result + } Filter Criteria:${topicsIds + } Current Topics: [${ids + }]`, + ); + } + return result; + } - if (result.length !== topicsIds.length) { - const ids = designerTopics.map((topic) => topic.getId()); - $assert( - result.length === topicsIds.length, - `Could not find topic. Result:${result - } Filter Criteria:${topicsIds - } Current Topics: [${ids - }]`, - ); - } - return result; + /** */ + deleteTopic(topic) { + this._designer.removeTopic(topic); + } + + /** */ + createTopic(model) { + $assert(model, 'model can not be null'); + return this._designer.nodeModelToNodeGraph(model); + } + + /** */ + createModel() { + const mindmap = this._designer.getMindmap(); + return mindmap.createNode(NodeModel.MAIN_TOPIC_TYPE); + } + + /** */ + addTopic(topic) { + const mindmap = this._designer.getMindmap(); + return mindmap.addBranch(topic.getModel()); + } + + /** */ + connect(childTopic, parentTopic) { + childTopic.connectTo(parentTopic, this._designer._workspace); + } + + /** */ + disconnect(topic) { + topic.disconnect(this._designer._workspace); + } + + /** */ + addRelationship(model) { + $assert(model, 'model cannot be null'); + return this._designer.addRelationship(model); + } + + /** */ + deleteRelationship(relationship) { + this._designer.deleteRelationship(relationship); + } + + /** */ + findRelationships(relIds) { + $assert($defined(relIds), 'relId can not be null'); + if (!(relIds instanceof Array)) { + relIds = [relIds]; } - /** */ - deleteTopic(topic) { - this._designer.removeTopic(topic); - } + const designerRel = this._designer.getModel().getRelationships(); + return designerRel.filter((rel) => relIds.contains(rel.getId())); + } - /** */ - createTopic(model) { - $assert(model, 'model can not be null'); - return this._designer.nodeModelToNodeGraph(model); - } - - /** */ - createModel() { - const mindmap = this._designer.getMindmap(); - return mindmap.createNode(NodeModel.MAIN_TOPIC_TYPE); - } - - /** */ - addTopic(topic) { - const mindmap = this._designer.getMindmap(); - return mindmap.addBranch(topic.getModel()); - } - - /** */ - connect(childTopic, parentTopic) { - childTopic.connectTo(parentTopic, this._designer._workspace); - } - - /** */ - disconnect(topic) { - topic.disconnect(this._designer._workspace); - } - - /** */ - addRelationship(model) { - $assert(model, 'model cannot be null'); - return this._designer.addRelationship(model); - } - - /** */ - deleteRelationship(relationship) { - this._designer.deleteRelationship(relationship); - } - - /** */ - findRelationships(relIds) { - $assert($defined(relIds), 'relId can not be null'); - if (!(relIds instanceof Array)) { - relIds = [relIds]; - } - - const designerRel = this._designer.getModel().getRelationships(); - return designerRel.filter((rel) => relIds.contains(rel.getId())); - } - - /** */ - moveTopic(topic, position) { - $assert(topic, 'topic cannot be null'); - $assert(position, 'position cannot be null'); - EventBus.instance.fireEvent(EventBus.events.NodeMoveEvent, { - node: topic.getModel(), - position, - }); - } + /** */ + moveTopic(topic, position) { + $assert(topic, 'topic cannot be null'); + $assert(position, 'position cannot be null'); + EventBus.instance.fireEvent(EventBus.events.NodeMoveEvent, { + node: topic.getModel(), + position, + }); + } } // eslint-disable-next-line import/prefer-default-export export default CommandContext; diff --git a/packages/mindplot/src/components/ImageIcon.js b/packages/mindplot/src/components/ImageIcon.js index e3498476..9604122f 100644 --- a/packages/mindplot/src/components/ImageIcon.js +++ b/packages/mindplot/src/components/ImageIcon.js @@ -15,6 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { $assert } from "@wisemapping/core-js"; import Icon from './Icon'; import ActionDispatcher from './ActionDispatcher'; diff --git a/packages/mindplot/src/components/LinkIcon.js b/packages/mindplot/src/components/LinkIcon.js index 27c02d36..1e98b9c6 100644 --- a/packages/mindplot/src/components/LinkIcon.js +++ b/packages/mindplot/src/components/LinkIcon.js @@ -16,6 +16,7 @@ * limitations under the License. */ import { $assert } from '@wisemapping/core-js'; +import $ from '@libraries/jquery-2.1.0'; import Icon from './Icon'; import LinkIconTooltip from './widget/LinkIconTooltip'; diff --git a/packages/mindplot/src/components/LocalStorageManager.js b/packages/mindplot/src/components/LocalStorageManager.js index e4aafe8b..8b7f12a2 100644 --- a/packages/mindplot/src/components/LocalStorageManager.js +++ b/packages/mindplot/src/components/LocalStorageManager.js @@ -15,6 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import $ from '@libraries/jquery-2.1.0'; import PersistenceManager from './PersistenceManager'; const LocalStorageManager = new Class({ diff --git a/packages/mindplot/src/components/commands/GenericFunctionCommand.js b/packages/mindplot/src/components/commands/GenericFunctionCommand.js index 193c7254..ac81ddcc 100644 --- a/packages/mindplot/src/components/commands/GenericFunctionCommand.js +++ b/packages/mindplot/src/components/commands/GenericFunctionCommand.js @@ -15,6 +15,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { $defined, $assert } from '@wisemapping/core-js'; +import _ from '@libraries/underscore-min'; import Command from '../Command'; const GenericFunctionCommand = new Class(/** @lends GenericFunctionCommand */{ diff --git a/packages/mindplot/src/components/layout/AbstractBasicSorter.js b/packages/mindplot/src/components/layout/AbstractBasicSorter.js index 505363c7..b15f1b68 100644 --- a/packages/mindplot/src/components/layout/AbstractBasicSorter.js +++ b/packages/mindplot/src/components/layout/AbstractBasicSorter.js @@ -15,6 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import _ from '@libraries/underscore-min'; import ChildrenSorterStrategy from './ChildrenSorterStrategy'; /** diff --git a/packages/mindplot/src/components/layout/RootedTreeSet.js b/packages/mindplot/src/components/layout/RootedTreeSet.js index b2d5e86f..b1e48f49 100644 --- a/packages/mindplot/src/components/layout/RootedTreeSet.js +++ b/packages/mindplot/src/components/layout/RootedTreeSet.js @@ -15,6 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import _ from '@libraries/underscore-min'; import { $assert, $defined } from '@wisemapping/core-js'; const RootedTreeSet = new Class( diff --git a/packages/mindplot/src/components/layout/SymmetricSorter.js b/packages/mindplot/src/components/layout/SymmetricSorter.js index 1054ba8c..e1e85688 100644 --- a/packages/mindplot/src/components/layout/SymmetricSorter.js +++ b/packages/mindplot/src/components/layout/SymmetricSorter.js @@ -15,9 +15,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import _ from '@libraries/underscore-min'; import { $assert, $defined } from '@wisemapping/core-js'; import AbstractBasicSorter from './AbstractBasicSorter'; + const SymmetricSorter = new Class( /** @lends SymmetricSorter */ { Extends: AbstractBasicSorter, diff --git a/packages/mindplot/src/components/model/INodeModel.js b/packages/mindplot/src/components/model/INodeModel.js index bac00b1e..5ab13755 100644 --- a/packages/mindplot/src/components/model/INodeModel.js +++ b/packages/mindplot/src/components/model/INodeModel.js @@ -1,3 +1,4 @@ +/* eslint-disable class-methods-use-this */ /* * Copyright [2015] [wisemapping] * diff --git a/packages/mindplot/src/components/model/IconModel.js b/packages/mindplot/src/components/model/IconModel.js index 4896a7a7..4ded13e1 100644 --- a/packages/mindplot/src/components/model/IconModel.js +++ b/packages/mindplot/src/components/model/IconModel.js @@ -15,6 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { $assert } from '@wisemapping/core-js'; import FeatureModel from './FeatureModel'; class IconModel extends FeatureModel { diff --git a/packages/mindplot/src/components/model/LinkModel.js b/packages/mindplot/src/components/model/LinkModel.js index 84364e4d..c2852ade 100644 --- a/packages/mindplot/src/components/model/LinkModel.js +++ b/packages/mindplot/src/components/model/LinkModel.js @@ -15,6 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { $assert } from '@wisemapping/core-js'; import FeatureModel from './FeatureModel'; class LinkModel extends FeatureModel { @@ -35,7 +36,7 @@ class LinkModel extends FeatureModel { setUrl(url) { $assert(url, 'url can not be null'); - const fixedUrl = this._fixUrl(url); + const fixedUrl = LinkModel._fixUrl(url); this.setAttribute('url', fixedUrl); const type = fixedUrl.contains('mailto:') ? 'mail' : 'url'; diff --git a/packages/mindplot/src/components/util/FadeEffect.js b/packages/mindplot/src/components/util/FadeEffect.js index dcab59ee..05da9be6 100644 --- a/packages/mindplot/src/components/util/FadeEffect.js +++ b/packages/mindplot/src/components/util/FadeEffect.js @@ -15,6 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import _ from '@libraries/underscore-min'; // FIXME: this Class should be reimplemented import Events from '../Events'; diff --git a/packages/mindplot/src/components/widget/LinkIconTooltip.js b/packages/mindplot/src/components/widget/LinkIconTooltip.js index 0f2efe1c..bf540b9c 100644 --- a/packages/mindplot/src/components/widget/LinkIconTooltip.js +++ b/packages/mindplot/src/components/widget/LinkIconTooltip.js @@ -15,6 +15,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { $assert } from "@wisemapping/core-js"; +import $ from '@libraries/jquery-2.1.0'; import FloatingTip from './FloatingTip'; class LinkIconTooltip extends FloatingTip { diff --git a/packages/mindplot/src/index.js b/packages/mindplot/src/index.js index 5d2618b4..1bcc6547 100644 --- a/packages/mindplot/src/index.js +++ b/packages/mindplot/src/index.js @@ -1,6 +1,5 @@ /* eslint-disable no-unused-vars */ import '@libraries/mootools-core-1.4.5'; -import _ from '@libraries/underscore-min'; import Mindmap from './components/model/Mindmap'; import PersistenceManager from './components/PersistenceManager'; diff --git a/packages/mindplot/test/playground/map-render/js/editor.js b/packages/mindplot/test/playground/map-render/js/editor.js index ebce7060..523c8e39 100644 --- a/packages/mindplot/test/playground/map-render/js/editor.js +++ b/packages/mindplot/test/playground/map-render/js/editor.js @@ -51,9 +51,8 @@ function buildDesigner(options) { // Register load events ... designer = new Designer(options, container); designer.addEvent('loadSuccess', () => { - window.waitDialog.close(); - window.waitDialog = null; window.mindmapLoadReady = true; + console.log("Map loadded successfully"); }); const onerrorFn = function onerror(message, url, lineNo) {