prosemirror-model
Advanced tools
Comparing version 1.21.2 to 1.21.3
@@ -0,1 +1,7 @@ | ||
## 1.21.3 (2024-06-26) | ||
### Bug fixes | ||
Fix an issue where parse rules for CSS properties that were shorthands for a number of more detailed properties weren't matching properly. | ||
## 1.21.2 (2024-06-25) | ||
@@ -2,0 +8,0 @@ |
{ | ||
"name": "prosemirror-model", | ||
"version": "1.21.2", | ||
"version": "1.21.3", | ||
"description": "ProseMirror's document model", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -184,2 +184,4 @@ import {Fragment} from "./fragment" | ||
/// @internal | ||
matchedStyles: readonly string[] | ||
/// @internal | ||
normalizeLists: boolean | ||
@@ -196,5 +198,11 @@ | ||
) { | ||
let matchedStyles: string[] = this.matchedStyles = [] | ||
rules.forEach(rule => { | ||
if (isTagRule(rule)) this.tags.push(rule) | ||
else if (isStyleRule(rule)) this.styles.push(rule) | ||
if (isTagRule(rule)) { | ||
this.tags.push(rule) | ||
} else if (isStyleRule(rule)) { | ||
let prop = /[^=]*/.exec(rule.style)![0] | ||
if (matchedStyles.indexOf(prop) < 0) matchedStyles.push(prop) | ||
this.styles.push(rule) | ||
} | ||
}) | ||
@@ -547,6 +555,11 @@ | ||
let add = Mark.none, remove = Mark.none | ||
for (let i = 0, l = styles.length; i < l; i++) { | ||
let name = styles.item(i) | ||
for (let after: StyleParseRule | undefined = undefined;;) { | ||
let rule = this.parser.matchStyle(name, styles.getPropertyValue(name), this, after) | ||
// Because many properties will only show up in 'normalized' form | ||
// in `style.item` (i.e. text-decoration becomes | ||
// text-decoration-line, text-decoration-color, etc), we directly | ||
// query the styles mentioned in our rules instead of iterating | ||
// over the items. | ||
if (styles.length) for (let i = 0; i < this.parser.matchedStyles.length; i++) { | ||
let name = this.parser.matchedStyles[i], value = styles.getPropertyValue(name) | ||
if (value) for (let after: StyleParseRule | undefined = undefined;;) { | ||
let rule = this.parser.matchStyle(name, value, this, after) | ||
if (!rule) break | ||
@@ -553,0 +566,0 @@ if (rule.ignore) return null |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
515191
11016