@codemirror/lang-javascript
Advanced tools
Comparing version 6.1.6 to 6.1.7
@@ -0,1 +1,7 @@ | ||
## 6.1.7 (2023-04-19) | ||
### Bug fixes | ||
Fix overeager JSX tag closing inside attribute values and in self-closing tags. | ||
## 6.1.6 (2023-04-13) | ||
@@ -2,0 +8,0 @@ |
@@ -365,2 +365,5 @@ import { parser } from '@lezer/javascript'; | ||
} | ||
function isEndTag(node) { | ||
return node && (node.name == "JSXEndTag" || node.name == "JSXSelfCloseEndTag"); | ||
} | ||
const android = typeof navigator == "object" && /*@__PURE__*//Android\b/.test(navigator.userAgent); | ||
@@ -378,7 +381,8 @@ /** | ||
let changes = state.changeByRange(range => { | ||
var _a, _b; | ||
var _a; | ||
let { head } = range, around = syntaxTree(state).resolveInner(head, -1), name; | ||
if (around.name == "JSXStartTag") | ||
around = around.parent; | ||
if (text == ">" && around.name == "JSXFragmentTag") { | ||
if (around.name == "JSXAttributeValue" && around.to > head) ; | ||
else if (text == ">" && around.name == "JSXFragmentTag") { | ||
return { range: EditorSelection.cursor(head + 1), changes: { from: head, insert: `></>` } }; | ||
@@ -396,3 +400,3 @@ } | ||
let openTag = findOpenTag(around); | ||
if (openTag && ((_b = openTag.lastChild) === null || _b === void 0 ? void 0 : _b.name) != "JSXEndTag" && | ||
if (openTag && !isEndTag(openTag.lastChild) && | ||
state.sliceDoc(head, head + 2) != "</" && | ||
@@ -399,0 +403,0 @@ (name = elementName(state.doc, openTag, head))) |
{ | ||
"name": "@codemirror/lang-javascript", | ||
"version": "6.1.6", | ||
"version": "6.1.7", | ||
"description": "JavaScript language support for the CodeMirror code editor", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
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
54477
1024