mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-25 15:47:55 +01:00
Merge branch 'develop' of https://bitbucket.org/wisemapping/wisemapping-frontend into feature/import-freemind-to-wisemapping
This commit is contained in:
commit
2b953a3bd6
@ -11,7 +11,6 @@ This is a work in progress and for now mindplot needs to be instantiated using t
|
|||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<Editor
|
<Editor
|
||||||
mapId={1}
|
mapId={1}
|
||||||
memoryPersistence={false}
|
|
||||||
readOnlyMode={false}
|
readOnlyMode={false}
|
||||||
locale="en"
|
locale="en"
|
||||||
onAction={(action) => console.log('action called:', action)}
|
onAction={(action) => console.log('action called:', action)}
|
||||||
|
@ -73,7 +73,7 @@ class ImageIcon extends Icon {
|
|||||||
|
|
||||||
static _getNextFamilyIconId(iconId) {
|
static _getNextFamilyIconId(iconId) {
|
||||||
const familyIcons = ImageIcon._getFamilyIcons(iconId);
|
const familyIcons = ImageIcon._getFamilyIcons(iconId);
|
||||||
$assert(familyIcons != null, `Family Icon not found: ${iconId}`);
|
$assert(familyIcons !== null, `Family Icon not found: ${iconId}`);
|
||||||
|
|
||||||
let result = null;
|
let result = null;
|
||||||
for (let i = 0; i < familyIcons.length && result == null; i++) {
|
for (let i = 0; i < familyIcons.length && result == null; i++) {
|
||||||
|
@ -27,27 +27,19 @@ class RESTPersistenceManager extends PersistenceManager {
|
|||||||
|
|
||||||
private lockUrl: string;
|
private lockUrl: string;
|
||||||
|
|
||||||
private timestamp: string;
|
|
||||||
|
|
||||||
private session: string;
|
|
||||||
|
|
||||||
private onSave: boolean;
|
private onSave: boolean;
|
||||||
|
|
||||||
private clearTimeout;
|
private clearTimeout;
|
||||||
|
|
||||||
constructor(options) {
|
constructor(options: { documentUrl: string, revertUrl: string, lockUrl: string }) {
|
||||||
$assert(options.documentUrl, 'documentUrl can not be null');
|
$assert(options.documentUrl, 'documentUrl can not be null');
|
||||||
$assert(options.revertUrl, 'revertUrl can not be null');
|
$assert(options.revertUrl, 'revertUrl can not be null');
|
||||||
$assert(options.lockUrl, 'lockUrl can not be null');
|
$assert(options.lockUrl, 'lockUrl can not be null');
|
||||||
$assert(options.session, 'session can not be null');
|
|
||||||
$assert(options.timestamp, 'timestamp can not be null');
|
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.documentUrl = options.documentUrl;
|
this.documentUrl = options.documentUrl;
|
||||||
this.revertUrl = options.revertUrl;
|
this.revertUrl = options.revertUrl;
|
||||||
this.lockUrl = options.lockUrl;
|
this.lockUrl = options.lockUrl;
|
||||||
this.timestamp = options.timestamp;
|
|
||||||
this.session = options.session;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
saveMapXml(mapId: string, mapXml: Document, pref: string, saveHistory: boolean, events): void {
|
saveMapXml(mapId: string, mapXml: Document, pref: string, saveHistory: boolean, events): void {
|
||||||
@ -57,9 +49,7 @@ class RESTPersistenceManager extends PersistenceManager {
|
|||||||
properties: pref,
|
properties: pref,
|
||||||
};
|
};
|
||||||
|
|
||||||
let query = `minor=${!saveHistory}`;
|
const query = `minor=${!saveHistory}`;
|
||||||
query = `${query}×tamp=${this.timestamp}`;
|
|
||||||
query = `${query}&session=${this.session}`;
|
|
||||||
|
|
||||||
if (!this.onSave) {
|
if (!this.onSave) {
|
||||||
// Mark save in process and fire a event unlocking the save ...
|
// Mark save in process and fire a event unlocking the save ...
|
||||||
@ -80,7 +70,6 @@ class RESTPersistenceManager extends PersistenceManager {
|
|||||||
},
|
},
|
||||||
).then(async (response: Response) => {
|
).then(async (response: Response) => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
persistence.timestamp = await response.text();
|
|
||||||
events.onSuccess();
|
events.onSuccess();
|
||||||
} else {
|
} else {
|
||||||
console.log(`Saving error: ${response.status}`);
|
console.log(`Saving error: ${response.status}`);
|
||||||
|
@ -60,7 +60,7 @@ class LinkEditor extends BootstrapDialog {
|
|||||||
|
|
||||||
// Add Input
|
// Add Input
|
||||||
const input = $('<input id="inputUrl"/>').attr({
|
const input = $('<input id="inputUrl"/>').attr({
|
||||||
placeholder: 'http://www.example.com/',
|
placeholder: 'https://www.example.com/',
|
||||||
required: 'true',
|
required: 'true',
|
||||||
autofocus: 'autofocus',
|
autofocus: 'autofocus',
|
||||||
class: 'form-control',
|
class: 'form-control',
|
||||||
@ -92,9 +92,10 @@ class LinkEditor extends BootstrapDialog {
|
|||||||
const me = this;
|
const me = this;
|
||||||
this.form.unbind('submit').submit((event) => {
|
this.form.unbind('submit').submit((event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (me.checkURL(input.val())) {
|
let inputValue = input.val();
|
||||||
|
inputValue = this.hasProtocol(inputValue) ? inputValue : `https://${inputValue}`;
|
||||||
|
if (me.checkURL(inputValue)) {
|
||||||
me.cleanError();
|
me.cleanError();
|
||||||
const inputValue = input.val();
|
|
||||||
if (inputValue != null && $.trim(inputValue) !== '') {
|
if (inputValue != null && $.trim(inputValue) !== '') {
|
||||||
model.setValue(inputValue);
|
model.setValue(inputValue);
|
||||||
}
|
}
|
||||||
@ -115,7 +116,16 @@ class LinkEditor extends BootstrapDialog {
|
|||||||
* @return {Boolean} true if the url is valid
|
* @return {Boolean} true if the url is valid
|
||||||
*/
|
*/
|
||||||
checkURL(url) {
|
checkURL(url) {
|
||||||
const regex = /^(http|https|ftp):\/\/[a-z0-9]+([-.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/i;
|
const regex = /^(http|https):\/\/[a-z0-9]+([-.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/i;
|
||||||
|
return (regex.test(url));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* checks whether the input is a valid url
|
||||||
|
* @return {Boolean} true if the url is valid
|
||||||
|
*/
|
||||||
|
hasProtocol(url) {
|
||||||
|
const regex = /^(http|https):\/\//i;
|
||||||
return (regex.test(url));
|
return (regex.test(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ class LinkIconTooltip extends FloatingTip {
|
|||||||
|
|
||||||
static _buildContent(linkIcon) {
|
static _buildContent(linkIcon) {
|
||||||
const url = linkIcon.getModel().getUrl();
|
const url = linkIcon.getModel().getUrl();
|
||||||
const linkText = `URL: ${url}`;
|
const linkText = `${url}`;
|
||||||
const linkPreview = `http://free.pagepeeker.com/v2/thumbs.php?size=m&url=${url}`;
|
const linkPreview = `https://free.pagepeeker.com/v2/thumbs.php?size=m&url=${url}`;
|
||||||
|
|
||||||
const result = $('<div></div>').css({
|
const result = $('<div></div>').css({
|
||||||
padding: '5px',
|
padding: '5px',
|
||||||
|
@ -22,7 +22,6 @@ import {
|
|||||||
import {
|
import {
|
||||||
buildDesigner,
|
buildDesigner,
|
||||||
} from './components/DesignerBuilder';
|
} from './components/DesignerBuilder';
|
||||||
import RESTPersistenceManager from './components/RestPersistenceManager';
|
|
||||||
import PersistenceManager from './components/PersistenceManager';
|
import PersistenceManager from './components/PersistenceManager';
|
||||||
import LocalStorageManager from './components/LocalStorageManager';
|
import LocalStorageManager from './components/LocalStorageManager';
|
||||||
import DesignerOptionsBuilder from './components/DesignerOptionsBuilder';
|
import DesignerOptionsBuilder from './components/DesignerOptionsBuilder';
|
||||||
@ -34,15 +33,7 @@ require('../../../libraries/bootstrap/js/bootstrap.min');
|
|||||||
|
|
||||||
// Configure designer options ...
|
// Configure designer options ...
|
||||||
let persistence: PersistenceManager;
|
let persistence: PersistenceManager;
|
||||||
if (!global.memoryPersistence && !global.readOnly) {
|
if (global.readOnly) {
|
||||||
persistence = new RESTPersistenceManager({
|
|
||||||
documentUrl: '/c/restful/maps/{id}/document',
|
|
||||||
revertUrl: '/c/restful/maps/{id}/history/latest',
|
|
||||||
lockUrl: '/c/restful/maps/{id}/lock',
|
|
||||||
timestamp: global.lockTimestamp,
|
|
||||||
session: global.lockSession,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
const historyId = global.historyId ? `${global.historyId}/` : '';
|
const historyId = global.historyId ? `${global.historyId}/` : '';
|
||||||
persistence = new LocalStorageManager(
|
persistence = new LocalStorageManager(
|
||||||
`/c/restful/maps/{id}/${historyId}document/xml${!global.isAuth ? '-pub' : ''}`,
|
`/c/restful/maps/{id}/${historyId}document/xml${!global.isAuth ? '-pub' : ''}`,
|
||||||
|
2
packages/webapp/src/@types/index.d.ts
vendored
2
packages/webapp/src/@types/index.d.ts
vendored
@ -2,8 +2,6 @@ declare module '*.png';
|
|||||||
declare module '*.svg';
|
declare module '*.svg';
|
||||||
declare module '*.wxml';
|
declare module '*.wxml';
|
||||||
declare global {
|
declare global {
|
||||||
const lockTimestamp: string;
|
|
||||||
const lockSession: string;
|
|
||||||
const isAuth: boolean;
|
const isAuth: boolean;
|
||||||
const mapId: number;
|
const mapId: number;
|
||||||
const userOptions: { zoom: string | number } | null;
|
const userOptions: { zoom: string | number } | null;
|
||||||
|
@ -618,17 +618,10 @@ export default class RestClient implements Client {
|
|||||||
|
|
||||||
let persistence: PersistenceManager;
|
let persistence: PersistenceManager;
|
||||||
if (editorMode === 'edition-owner' || editorMode === 'edition-editor') {
|
if (editorMode === 'edition-owner' || editorMode === 'edition-editor') {
|
||||||
|
|
||||||
if (!global.lockSession) {
|
|
||||||
throw new Error(`Session could not be found: global.lockSession: '${global.lockSession}' - global.lockTimestamp: '${global.lockTimestamp}' - ${global.mindmapLocked} - ${global.mindmapLockedMsg}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
persistence = new RESTPersistenceManager({
|
persistence = new RESTPersistenceManager({
|
||||||
documentUrl: '/c/restful/maps/{id}/document',
|
documentUrl: '/c/restful/maps/{id}/document',
|
||||||
revertUrl: '/c/restful/maps/{id}/history/latest',
|
revertUrl: '/c/restful/maps/{id}/history/latest',
|
||||||
lockUrl: '/c/restful/maps/{id}/lock',
|
lockUrl: '/c/restful/maps/{id}/lock',
|
||||||
timestamp: global.lockTimestamp,
|
|
||||||
session: global.lockSession,
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
persistence = new LocalStorageManager(
|
persistence = new LocalStorageManager(
|
||||||
|
Loading…
Reference in New Issue
Block a user