@codemirror/lang-html
Advanced tools
Comparing version
@@ -0,1 +1,7 @@ | ||
## 6.4.2 (2023-02-10) | ||
### Bug fixes | ||
Fix an issue where `autoCloseTags` would close self-closing tags when typed directly in front of a word. | ||
## 6.4.1 (2023-01-12) | ||
@@ -2,0 +8,0 @@ |
@@ -602,2 +602,3 @@ import { parser, configureNesting } from '@lezer/html'; | ||
} | ||
const selfClosers = /*@__PURE__*/new Set(/*@__PURE__*/"area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")); | ||
/** | ||
@@ -618,3 +619,5 @@ Extension that will automatically insert close tags when a `>` or | ||
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))) { | ||
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)) && | ||
!selfClosers.has(name)) { | ||
let hasRightBracket = view.state.doc.sliceString(head, head + 1) === ">"; | ||
@@ -627,3 +630,5 @@ let insert = `${hasRightBracket ? "" : ">"}</${name}>`; | ||
let empty = around.parent, base = empty === null || empty === void 0 ? void 0 : empty.parent; | ||
if (empty.from == head - 1 && ((_c = base.lastChild) === null || _c === void 0 ? void 0 : _c.name) != "CloseTag" && (name = elementName(state.doc, base, head))) { | ||
if (empty.from == head - 1 && ((_c = base.lastChild) === null || _c === void 0 ? void 0 : _c.name) != "CloseTag" && | ||
(name = elementName(state.doc, base, head)) && | ||
!selfClosers.has(name)) { | ||
let hasRightBracket = view.state.doc.sliceString(head, head + 1) === ">"; | ||
@@ -630,0 +635,0 @@ let insert = `/${name}${hasRightBracket ? "" : ">"}`; |
{ | ||
"name": "@codemirror/lang-html", | ||
"version": "6.4.1", | ||
"version": "6.4.2", | ||
"description": "HTML language support for the CodeMirror code editor", | ||
@@ -15,3 +15,3 @@ "scripts": { | ||
"name": "Marijn Haverbeke", | ||
"email": "marijnh@gmail.com", | ||
"email": "marijn@haverbeke.berlin", | ||
"url": "http://marijnhaverbeke.nl" | ||
@@ -18,0 +18,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
71576
0.98%1397
0.72%