Remove global refernece to $msg

This commit is contained in:
Paulo Gustavo Veiga 2021-12-14 17:54:11 -08:00
parent 5b74b9cff3
commit f95e65f21b
12 changed files with 21 additions and 15 deletions

View File

@ -17,9 +17,9 @@
*/
import { $assert, $defined } from '@wisemapping/core-js';
import $ from 'jquery';
import Messages, { $msg } from './Messages';
import Events from './Events';
import Messages from './Messages';
import StandaloneActionDispatcher from './StandaloneActionDispatcher';
import CommandContext from './CommandContext';
@ -258,19 +258,15 @@ class Designer extends Events {
if (isConnected) {
// Improve this ...
const targetTopicModel = model.getParent();
let targetTopic = null;
// Find target topic with the same model ...
const topics = this.getModel().getTopics();
for (let i = 0; i < topics.length; i++) {
const t = topics[i];
if (t.getModel() === targetTopicModel) {
targetTopic = t;
// Disconnect the node. It will be connected again later ...
const targetTopic = topics.find((t) => t.getModel() === targetTopicModel);
if (targetTopic) {
model.disconnect();
break;
}
}
} else {
$assert(targetTopic, 'Could not find a topic to connect');
}
topic.connectTo(targetTopic, this._workspace);
}

View File

@ -33,7 +33,7 @@ class Messages {
}
// @Todo: fix global assignment.
global.$msg = function $msg(key) {
const $msg = function $msg(key) {
if (!Messages.__bundle) {
Messages.init('en');
}
@ -43,3 +43,4 @@ global.$msg = function $msg(key) {
Messages.BUNDLES = {};
export default Messages;
export { $msg };

View File

@ -17,6 +17,7 @@
*/
import { $assert } from '@wisemapping/core-js';
import $ from 'jquery';
import { $msg } from './Messages';
import Icon from './Icon';
import FloatingTip from './widget/FloatingTip';

View File

@ -16,6 +16,7 @@
* limitations under the License.
*/
import { $assert } from '@wisemapping/core-js';
import { $msg } from './Messages';
import PersistenceManager from './PersistenceManager';
class RESTPersistenceManager extends PersistenceManager{

View File

@ -16,6 +16,7 @@
* limitations under the License.
*/
import { $assert, $defined } from '@wisemapping/core-js';
import { $msg } from './Messages';
import { TopicShape } from './model/INodeModel';
class TopicStyle {

View File

@ -1,5 +1,5 @@
import Options from '../../Options';
import { $msg } from '../../Messages';
import $ from 'jquery';
class BootstrapDialog extends Options {
@ -36,7 +36,7 @@ class BootstrapDialog extends Options {
content.append(footer);
}
this._native.find('.modal-dialog').append(content);
this._native.on('hidden.bs.modal', function () {
this._native.on('hidden.bs.modal', function remove() {
$(this).remove();
});
this._native.on('shown.bs.modal', this.onDialogShown);

View File

@ -16,6 +16,7 @@
* limitations under the License.
*/
import { $assert } from '@wisemapping/core-js';
import { $msg } from '../Messages';
import PersistenceManager from '../PersistenceManager';
import { $notify } from './ToolbarNotifier';
import $notifyModal from './ModalDialogNotifier';

View File

@ -17,6 +17,7 @@
*/
import $ from 'jquery';
import { $assert } from '@wisemapping/core-js';
import { $msg } from '../Messages';
import BootstrapDialog from '../libraries/bootstrap/BootstrapDialog';
class LinkEditor extends BootstrapDialog {

View File

@ -17,6 +17,7 @@
*/
import { $assert } from "@wisemapping/core-js";
import $ from 'jquery';
import { $msg } from '../Messages';
import FloatingTip from './FloatingTip';
class LinkIconTooltip extends FloatingTip {

View File

@ -16,8 +16,8 @@
* limitations under the License.
*/
import $ from 'jquery';
import { $defined } from '@wisemapping/core-js';
import { $msg } from '../Messages';
import BootstrapDialogRequest from "../libraries/bootstrap/BootstrapDialogRequest";
import IMenu from './IMenu';
import FontFamilyPanel from './FontFamilyPanel';

View File

@ -18,6 +18,7 @@
import { $assert } from '@wisemapping/core-js';
import BootstrapDialog from '../libraries/bootstrap/BootstrapDialog';
import $ from 'jquery';
import { $msg } from '../Messages';
class NoteEditor extends BootstrapDialog {
constructor(model) {

View File

@ -18,6 +18,8 @@
import { $assert } from '@wisemapping/core-js';
import { PersistenceManager, Designer, LocalStorageManager, Menu } from '../../../../src/';
import * as mindplot from '../../../../src/';
import { $msg } from '../../../../src/components/Messages';
import $notifyModal from '../../../../src/components/widget/ModalDialogNotifier';
import $ from 'jquery';