@codemirror/lang-html
Advanced tools
Comparing version 6.1.1 to 6.1.2
@@ -0,1 +1,7 @@ | ||
## 6.1.2 (2022-09-27) | ||
### Bug fixes | ||
Make tag auto-closing consume `>` characters after the cursor. | ||
## 6.1.1 (2022-09-05) | ||
@@ -2,0 +8,0 @@ |
@@ -600,4 +600,7 @@ import { parser, configureNesting } from '@lezer/html'; | ||
if (text == ">" && around.name == "OpenTag") { | ||
if (((_b = (_a = around.parent) === null || _a === void 0 ? void 0 : _a.lastChild) === null || _b === void 0 ? void 0 : _b.name) != "CloseTag" && (name = elementName(state.doc, around.parent, head))) | ||
return { range: EditorSelection.cursor(head + 1), changes: { from: head, insert: `></${name}>` } }; | ||
if (((_b = (_a = around.parent) === null || _a === void 0 ? void 0 : _a.lastChild) === null || _b === void 0 ? void 0 : _b.name) != "CloseTag" && (name = elementName(state.doc, around.parent, head))) { | ||
let hasRightBracket = view.state.doc.sliceString(head, head + 1) === ">"; | ||
let insert = `${hasRightBracket ? "" : ">"}</${name}>`; | ||
return { range: EditorSelection.cursor(head + 1), changes: { from: head + (hasRightBracket ? 1 : 0), insert } }; | ||
} | ||
} | ||
@@ -607,4 +610,6 @@ else if (text == "/" && around.name == "OpenTag") { | ||
if (empty.from == head - 1 && ((_c = base.lastChild) === null || _c === void 0 ? void 0 : _c.name) != "CloseTag" && (name = elementName(state.doc, base, head))) { | ||
let insert = `/${name}>`; | ||
return { range: EditorSelection.cursor(head + insert.length), changes: { from: head, insert } }; | ||
let hasRightBracket = view.state.doc.sliceString(head, head + 1) === ">"; | ||
let insert = `/${name}${hasRightBracket ? "" : ">"}`; | ||
let pos = head + insert.length + (hasRightBracket ? 1 : 0); | ||
return { range: EditorSelection.cursor(pos), changes: { from: head, insert } }; | ||
} | ||
@@ -611,0 +616,0 @@ } |
{ | ||
"name": "@codemirror/lang-html", | ||
"version": "6.1.1", | ||
"version": "6.1.2", | ||
"description": "HTML 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
58779
1324