mirror of
https://github.com/n8n-io/n8n.git
synced 2024-09-20 23:07:32 -07:00
🐛 Fix issue that nodes can not be opened in readOnly-Mode
This commit is contained in:
parent
afe0d16a9a
commit
9cae58c787
|
@ -29,12 +29,6 @@ export const nodeBase = mixins(nodeIndex).extend({
|
||||||
isMacOs (): boolean {
|
isMacOs (): boolean {
|
||||||
return /(ipad|iphone|ipod|mac)/i.test(navigator.platform);
|
return /(ipad|iphone|ipod|mac)/i.test(navigator.platform);
|
||||||
},
|
},
|
||||||
isReadOnly (): boolean {
|
|
||||||
if (['NodeViewExisting', 'NodeViewNew'].includes(this.$route.name as string)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
nodeName (): string {
|
nodeName (): string {
|
||||||
return NODE_NAME_PREFIX + this.nodeIndex;
|
return NODE_NAME_PREFIX + this.nodeIndex;
|
||||||
},
|
},
|
||||||
|
@ -276,11 +270,18 @@ export const nodeBase = mixins(nodeIndex).extend({
|
||||||
this.instance.addEndpoint(this.nodeName, newEndpointData);
|
this.instance.addEndpoint(this.nodeName, newEndpointData);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.isReadOnly === false) {
|
// TODO: This caused problems with displaying old information
|
||||||
|
// https://github.com/jsplumb/katavorio/wiki
|
||||||
|
// https://jsplumb.github.io/jsplumb/home.html
|
||||||
// Make nodes draggable
|
// Make nodes draggable
|
||||||
this.instance.draggable(this.nodeName, {
|
this.instance.draggable(this.nodeName, {
|
||||||
grid: [10, 10],
|
grid: [10, 10],
|
||||||
start: (params: { e: MouseEvent }) => {
|
start: (params: { e: MouseEvent }) => {
|
||||||
|
if (this.isReadOnly === true) {
|
||||||
|
// Do not allow to move nodes in readOnly mode
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (params.e && !this.$store.getters.isNodeSelected(this.data.name)) {
|
if (params.e && !this.$store.getters.isNodeSelected(this.data.name)) {
|
||||||
// Only the node which gets dragged directly gets an event, for all others it is
|
// Only the node which gets dragged directly gets an event, for all others it is
|
||||||
// undefined. So check if the currently dragged node is selected and if not clear
|
// undefined. So check if the currently dragged node is selected and if not clear
|
||||||
|
@ -290,6 +291,7 @@ export const nodeBase = mixins(nodeIndex).extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$store.commit('addActiveAction', 'dragActive');
|
this.$store.commit('addActiveAction', 'dragActive');
|
||||||
|
return true;
|
||||||
},
|
},
|
||||||
stop: (params: { e: MouseEvent }) => {
|
stop: (params: { e: MouseEvent }) => {
|
||||||
if (this.$store.getters.isActionActive('dragActive')) {
|
if (this.$store.getters.isActionActive('dragActive')) {
|
||||||
|
@ -332,7 +334,7 @@ export const nodeBase = mixins(nodeIndex).extend({
|
||||||
},
|
},
|
||||||
filter: '.node-description, .node-description .node-name, .node-description .node-subtitle',
|
filter: '.node-description, .node-description .node-name, .node-description .node-subtitle',
|
||||||
});
|
});
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
isCtrlKeyPressed (e: MouseEvent | KeyboardEvent): boolean {
|
isCtrlKeyPressed (e: MouseEvent | KeyboardEvent): boolean {
|
||||||
|
|
Loading…
Reference in a new issue