@neo4j-cypher/react-codemirror
Advanced tools
Comparing version 1.0.0-next.11 to 1.0.0-next.12
@@ -32,4 +32,3 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
_defineProperty(this, "valueChanged", (value, changes) => { | ||
this.innerValue = value; | ||
this.value = value; | ||
this.lastValue = value; | ||
const { | ||
@@ -56,2 +55,5 @@ onValueChanged | ||
_defineProperty(this, "positionChanged", positionObject => { | ||
this.lastPosition = (positionObject || { | ||
position: null | ||
}).position; | ||
const { | ||
@@ -83,2 +85,4 @@ onPositionChanged | ||
}; | ||
this.lastValue = null; | ||
this.lastPosition = null; | ||
} | ||
@@ -93,2 +97,3 @@ componentDidMount() { | ||
history, | ||
indentUnit, | ||
lineNumberFormatter, | ||
@@ -103,2 +108,4 @@ lineNumbers, | ||
schema, | ||
search, | ||
searchTop, | ||
tabKey, | ||
@@ -111,3 +118,3 @@ theme, | ||
} = this.props; | ||
this.value = this.innerValue = value; | ||
this.value = value; | ||
const { | ||
@@ -122,2 +129,3 @@ editor | ||
history, | ||
indentUnit, | ||
lineNumberFormatter, | ||
@@ -132,2 +140,4 @@ lineNumbers, | ||
schema, | ||
search, | ||
searchTop, | ||
tabKey, | ||
@@ -178,8 +188,21 @@ theme, | ||
const key = Object.keys(prop).pop(); | ||
// Call setValue only if the change comes from the outside | ||
if (key === "value" && this.innerValue === this.value) { | ||
return; // TODO - this probably isn't needed for React (only needed for bind:value in Svelte?) | ||
if (key === "value") { | ||
if (prop[key] === this.lastValue) { | ||
return; | ||
} else { | ||
this.lastValue = prop[key]; | ||
} | ||
} | ||
if (key === "position") { | ||
const { | ||
position | ||
} = this.cypherEditor.getPositionForValue(prop[key]) || { | ||
position: null | ||
}; | ||
if (position === this.lastPosition) { | ||
return; | ||
} else { | ||
this.lastPosition = position; | ||
} | ||
} | ||
const methodName = "set" + key[0].toUpperCase() + key.slice(1); | ||
@@ -186,0 +209,0 @@ if (this.cypherEditor[methodName]) { |
@@ -41,4 +41,3 @@ "use strict"; | ||
(0, _defineProperty2.default)(this, "valueChanged", (value, changes) => { | ||
this.innerValue = value; | ||
this.value = value; | ||
this.lastValue = value; | ||
const { | ||
@@ -65,2 +64,5 @@ onValueChanged | ||
(0, _defineProperty2.default)(this, "positionChanged", positionObject => { | ||
this.lastPosition = (positionObject || { | ||
position: null | ||
}).position; | ||
const { | ||
@@ -92,2 +94,4 @@ onPositionChanged | ||
}; | ||
this.lastValue = null; | ||
this.lastPosition = null; | ||
} | ||
@@ -102,2 +106,3 @@ componentDidMount() { | ||
history, | ||
indentUnit, | ||
lineNumberFormatter, | ||
@@ -112,2 +117,4 @@ lineNumbers, | ||
schema, | ||
search, | ||
searchTop, | ||
tabKey, | ||
@@ -120,3 +127,3 @@ theme, | ||
} = this.props; | ||
this.value = this.innerValue = value; | ||
this.value = value; | ||
const { | ||
@@ -131,2 +138,3 @@ editor | ||
history, | ||
indentUnit, | ||
lineNumberFormatter, | ||
@@ -141,2 +149,4 @@ lineNumbers, | ||
schema, | ||
search, | ||
searchTop, | ||
tabKey, | ||
@@ -187,8 +197,21 @@ theme, | ||
const key = Object.keys(prop).pop(); | ||
// Call setValue only if the change comes from the outside | ||
if (key === "value" && this.innerValue === this.value) { | ||
return; // TODO - this probably isn't needed for React (only needed for bind:value in Svelte?) | ||
if (key === "value") { | ||
if (prop[key] === this.lastValue) { | ||
return; | ||
} else { | ||
this.lastValue = prop[key]; | ||
} | ||
} | ||
if (key === "position") { | ||
const { | ||
position | ||
} = this.cypherEditor.getPositionForValue(prop[key]) || { | ||
position: null | ||
}; | ||
if (position === this.lastPosition) { | ||
return; | ||
} else { | ||
this.lastPosition = position; | ||
} | ||
} | ||
const methodName = "set" + key[0].toUpperCase() + key.slice(1); | ||
@@ -195,0 +218,0 @@ if (this.cypherEditor[methodName]) { |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "1.0.0-next.11", | ||
"version": "1.0.0-next.12", | ||
"author": "Neo4j Inc.", | ||
@@ -42,3 +42,3 @@ "license": "GPL-3.0", | ||
"@babel/runtime": "^7.20.6", | ||
"@neo4j-cypher/codemirror": "1.0.0-next.10", | ||
"@neo4j-cypher/codemirror": "1.0.0-next.11", | ||
"codemirror": "^6.0.1" | ||
@@ -45,0 +45,0 @@ }, |
@@ -70,2 +70,8 @@ import * as React from "react"; | ||
/** | ||
* The indent text to use when tabKey is enabled | ||
* | ||
* @defaultValue " " | ||
*/ | ||
indentUnit?: string; | ||
/** | ||
* The formatter for the line numbers of the editor | ||
@@ -125,2 +131,14 @@ * | ||
/** | ||
* Whether search is enabled | ||
* | ||
* @defaultValue true | ||
*/ | ||
search?: boolean; | ||
/** | ||
* Whether search is shown at the top of the editor window | ||
* | ||
* @defaultValue false | ||
*/ | ||
searchTop?: boolean; | ||
/** | ||
* Whether the tab key is enabled | ||
@@ -127,0 +145,0 @@ * |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23779
716
+ Added@codemirror/commands@6.8.0(transitive)
+ Added@neo4j-cypher/codemirror@1.0.0-next.11(transitive)
- Removed@codemirror/commands@6.7.1(transitive)
- Removed@neo4j-cypher/codemirror@1.0.0-next.10(transitive)