Merge branch 'develop' into feature/browser_export
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "wisemapping-font-end",
|
"name": "wisemapping-front-end",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"bootstrap": "lerna bootstrap",
|
"bootstrap": "lerna bootstrap",
|
||||||
"build": "lerna run build",
|
"build": "lerna run build",
|
||||||
|
Before Width: | Height: | Size: 228 KiB After Width: | Height: | Size: 209 KiB |
Before Width: | Height: | Size: 152 KiB After Width: | Height: | Size: 136 KiB |
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 3.0 MiB |
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 104 KiB |
Before Width: | Height: | Size: 178 KiB After Width: | Height: | Size: 160 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 119 KiB |
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 92 KiB |
@ -79,7 +79,7 @@ class Designer extends Events {
|
|||||||
|
|
||||||
// Init Screen manager..
|
// Init Screen manager..
|
||||||
const screenManager = new ScreenManager(divElement);
|
const screenManager = new ScreenManager(divElement);
|
||||||
this._workspace = new Workspace(screenManager, this._model.getZoom());
|
this._workspace = new Workspace(screenManager, this._model.getZoom(), !!options.readOnly);
|
||||||
|
|
||||||
// Init layout manager ...
|
// Init layout manager ...
|
||||||
this._eventBussDispatcher = new EventBusDispatcher(this.getModel());
|
this._eventBussDispatcher = new EventBusDispatcher(this.getModel());
|
||||||
|
@ -169,7 +169,11 @@ class Relationship extends ConnectionLine {
|
|||||||
workspace.append(this._controlPointsController);
|
workspace.append(this._controlPointsController);
|
||||||
|
|
||||||
this._controlPointControllerListener = this._initializeControlPointController.bind(this);
|
this._controlPointControllerListener = this._initializeControlPointController.bind(this);
|
||||||
|
if (workspace.isReadOnly) {
|
||||||
|
this._line2d.setCursor('default');
|
||||||
|
} else {
|
||||||
this._line2d.addEvent('click', this._controlPointControllerListener);
|
this._line2d.addEvent('click', this._controlPointControllerListener);
|
||||||
|
}
|
||||||
this._isInWorkspace = true;
|
this._isInWorkspace = true;
|
||||||
|
|
||||||
workspace.append(this._startArrow);
|
workspace.append(this._startArrow);
|
||||||
@ -187,7 +191,9 @@ class Relationship extends ConnectionLine {
|
|||||||
removeFromWorkspace(workspace) {
|
removeFromWorkspace(workspace) {
|
||||||
workspace.removeChild(this._focusShape);
|
workspace.removeChild(this._focusShape);
|
||||||
workspace.removeChild(this._controlPointsController);
|
workspace.removeChild(this._controlPointsController);
|
||||||
|
if (!workspace.isReadOnly) {
|
||||||
this._line2d.removeEvent('click', this._controlPointControllerListener);
|
this._line2d.removeEvent('click', this._controlPointControllerListener);
|
||||||
|
}
|
||||||
this._isInWorkspace = false;
|
this._isInWorkspace = false;
|
||||||
workspace.removeChild(this._startArrow);
|
workspace.removeChild(this._startArrow);
|
||||||
if (this._endArrow) workspace.removeChild(this._endArrow);
|
if (this._endArrow) workspace.removeChild(this._endArrow);
|
||||||
|
@ -19,13 +19,14 @@ import { $assert, $defined } from '@wisemapping/core-js';
|
|||||||
import { Workspace as Workspace2D, Toolkit } from '@wisemapping/web2d';
|
import { Workspace as Workspace2D, Toolkit } from '@wisemapping/web2d';
|
||||||
|
|
||||||
class Workspace {
|
class Workspace {
|
||||||
constructor(screenManager, zoom) {
|
constructor(screenManager, zoom, isReadOnly) {
|
||||||
// Create a suitable container ...
|
// Create a suitable container ...
|
||||||
$assert(screenManager, 'Div container can not be null');
|
$assert(screenManager, 'Div container can not be null');
|
||||||
$assert(zoom, 'zoom container can not be null');
|
$assert(zoom, 'zoom container can not be null');
|
||||||
|
|
||||||
this._zoom = zoom;
|
this._zoom = zoom;
|
||||||
this._screenManager = screenManager;
|
this._screenManager = screenManager;
|
||||||
|
this._isReadOnly = isReadOnly;
|
||||||
|
|
||||||
const divContainer = screenManager.getContainer();
|
const divContainer = screenManager.getContainer();
|
||||||
this._screenWidth = parseInt(divContainer.css('width'), 10);
|
this._screenWidth = parseInt(divContainer.css('width'), 10);
|
||||||
@ -44,6 +45,10 @@ class Workspace {
|
|||||||
this._eventsEnabled = true;
|
this._eventsEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isReadOnly() {
|
||||||
|
return this._isReadOnly;
|
||||||
|
}
|
||||||
|
|
||||||
_createWorkspace() {
|
_createWorkspace() {
|
||||||
// Initialize workspace ...
|
// Initialize workspace ...
|
||||||
const coordOriginX = -(this._screenWidth / 2);
|
const coordOriginX = -(this._screenWidth / 2);
|
||||||
|
@ -26,23 +26,30 @@ class LinkIconTooltip extends FloatingTip {
|
|||||||
const nativeElement = $(linkIcon.getImage().peer._native);
|
const nativeElement = $(linkIcon.getImage().peer._native);
|
||||||
super(nativeElement, {
|
super(nativeElement, {
|
||||||
// Content can also be a function of the target element!
|
// Content can also be a function of the target element!
|
||||||
content: LinkIconTooltip._buildContent(linkIcon),
|
content() {
|
||||||
|
return LinkIconTooltip._buildContent(linkIcon);
|
||||||
|
},
|
||||||
html: true,
|
html: true,
|
||||||
placement: 'bottom',
|
placement: 'bottom',
|
||||||
container: 'body',
|
container: 'body',
|
||||||
title: $msg('LINK'),
|
title: $msg('LINK'),
|
||||||
trigger: 'manual',
|
trigger: 'manual',
|
||||||
template: '<div id="linkPopover" class="popover" onmouseover="$(this).mouseleave(function() {$(this).fadeOut(200); });" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>',
|
template: '<div id="linkPopover" class="popover" onmouseover="jQuery(this).mouseleave(function() {jQuery(this).fadeOut(200); });" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>',
|
||||||
|
destroyOnExit: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static _buildContent(linkIcon) {
|
static _buildContent(linkIcon) {
|
||||||
|
const url = linkIcon.getModel().getUrl();
|
||||||
|
const linkText = `URL: ${url}`;
|
||||||
|
const linkPreview = `http://free.pagepeeker.com/v2/thumbs.php?size=m&url=${url}`;
|
||||||
|
|
||||||
const result = $('<div></div>').css({
|
const result = $('<div></div>').css({
|
||||||
padding: '5px',
|
padding: '5px',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
});
|
});
|
||||||
|
|
||||||
const text = $('<div></div>').text(`URL: ${linkIcon.getModel().getUrl()}`)
|
const text = $('<div id="linkPopoverUrl"></div>').text(linkText)
|
||||||
.css({
|
.css({
|
||||||
'white-space': 'pre-wrap',
|
'white-space': 'pre-wrap',
|
||||||
'word-wrap': 'break-word',
|
'word-wrap': 'break-word',
|
||||||
@ -57,15 +64,15 @@ class LinkIconTooltip extends FloatingTip {
|
|||||||
'padding-top': '5px',
|
'padding-top': '5px',
|
||||||
});
|
});
|
||||||
|
|
||||||
const img = $('<img>')
|
const img = $('<img id="linkPopoverPreview">')
|
||||||
.prop('src', `http://free.pagepeeker.com/v2/thumbs.php?size=m&url=${linkIcon.getModel().getUrl()}`)
|
.prop('src', linkPreview)
|
||||||
.prop('img', linkIcon.getModel().getUrl())
|
.prop('img', url)
|
||||||
.prop('alt', linkIcon.getModel().getUrl());
|
.prop('alt', url);
|
||||||
|
|
||||||
img.css('padding', '5px');
|
img.css('padding', '5px');
|
||||||
|
|
||||||
const link = $('<a></a>').attr({
|
const link = $('<a id="linkPopoverAnchor"></a>').attr({
|
||||||
href: linkIcon.getModel().getUrl(),
|
href: url,
|
||||||
alt: 'Open in new window ...',
|
alt: 'Open in new window ...',
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
});
|
});
|
||||||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 166 KiB After Width: | Height: | Size: 151 KiB |
Before Width: | Height: | Size: 139 KiB After Width: | Height: | Size: 116 KiB |
Before Width: | Height: | Size: 351 KiB After Width: | Height: | Size: 321 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 319 KiB After Width: | Height: | Size: 296 KiB |
@ -34,6 +34,9 @@ class ElementPeer {
|
|||||||
this._size = { width: 1, height: 1 };
|
this._size = { width: 1, height: 1 };
|
||||||
this._changeListeners = {};
|
this._changeListeners = {};
|
||||||
// http://support.adobe.com/devsup/devsup.nsf/docs/50493.htm
|
// http://support.adobe.com/devsup/devsup.nsf/docs/50493.htm
|
||||||
|
|
||||||
|
// __handlers stores handlers references so they can be removed afterwards
|
||||||
|
this.__handlers = new Map();
|
||||||
}
|
}
|
||||||
|
|
||||||
setChildren(children) {
|
setChildren(children) {
|
||||||
@ -95,12 +98,15 @@ class ElementPeer {
|
|||||||
* http://developer.mozilla.org/en/docs/addEvent
|
* http://developer.mozilla.org/en/docs/addEvent
|
||||||
*/
|
*/
|
||||||
addEvent(type, listener) {
|
addEvent(type, listener) {
|
||||||
this._native.addEventListener(type, listener);
|
// wrap it so it can be ~backward compatible with jQuery.trigger
|
||||||
|
const wrappedListener = (e) => listener(e, e.detail);
|
||||||
|
this.__handlers.set(listener, wrappedListener);
|
||||||
|
this._native.addEventListener(type, wrappedListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger(type, event) {
|
trigger(type, event) {
|
||||||
// TODO: check this for correctness and for real jQuery.trigger replacement
|
// TODO: check this for correctness and for real jQuery.trigger replacement
|
||||||
this._native.dispatchEvent(new CustomEvent(type, event));
|
this._native.dispatchEvent(new CustomEvent(type, { detail: event }));
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line class-methods-use-this
|
// eslint-disable-next-line class-methods-use-this
|
||||||
@ -109,7 +115,8 @@ class ElementPeer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
removeEvent(type, listener) {
|
removeEvent(type, listener) {
|
||||||
this._native.removeEventListener(type, listener);
|
this._native.removeEventListener(type, this.__handlers.get(listener));
|
||||||
|
this.__handlers.delete(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
setSize(width, height) {
|
setSize(width, height) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Running tests with cypress.
|
# Running tests with cypress.
|
||||||
|
|
||||||
For details on why we picked Cypress, check the following [PR](https://bitbucket.org/wisemapping/wisemapping-react/pull-requests/1)
|
For details on why we picked Cypress, check the following [PR](https://bitbucket.org/wisemapping/wisemapping-frontend/pull-requests/1)
|
||||||
|
|
||||||
Check the [Cypress docs](https://docs.cypress.io/guides/overview/why-cypress.html) for more information
|
Check the [Cypress docs](https://docs.cypress.io/guides/overview/why-cypress.html) for more information
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 54 KiB |