prosemirror-model
Advanced tools
+6
-0
@@ -0,1 +1,7 @@ | ||
| ## 1.21.1 (2024-06-03) | ||
| ### Bug fixes | ||
| Improve performance and accuracy of `DOMParser` style matching by using the DOM's own `style` object. | ||
| ## 1.21.0 (2024-05-06) | ||
@@ -2,0 +8,0 @@ |
+1
-1
@@ -805,3 +805,3 @@ import OrderedMap from 'orderedmap'; | ||
| Returns true if the given fragment is valid content for this node | ||
| type with the given attributes. | ||
| type. | ||
| */ | ||
@@ -808,0 +808,0 @@ validContent(content: Fragment): boolean; |
+1
-1
@@ -805,3 +805,3 @@ import OrderedMap from 'orderedmap'; | ||
| Returns true if the given fragment is valid content for this node | ||
| type with the given attributes. | ||
| type. | ||
| */ | ||
@@ -808,0 +808,0 @@ validContent(content: Fragment): boolean; |
+1
-1
| { | ||
| "name": "prosemirror-model", | ||
| "version": "1.21.0", | ||
| "version": "1.21.1", | ||
| "description": "ProseMirror's document model", | ||
@@ -5,0 +5,0 @@ "type": "module", |
+7
-13
@@ -448,5 +448,5 @@ import {Fragment} from "./fragment" | ||
| withStyleRules(dom: HTMLElement, f: () => void) { | ||
| let style = dom.getAttribute("style") | ||
| if (!style) return f() | ||
| let marks = this.readStyles(parseStyles(style)) | ||
| let style = dom.style | ||
| if (!style || !style.length) return f() | ||
| let marks = this.readStyles(dom.style) | ||
| if (!marks) return // A style with ignore: true | ||
@@ -544,7 +544,8 @@ let [addMarks, removeMarks] = marks, top = this.top | ||
| // had a rule with `ignore` set. | ||
| readStyles(styles: readonly string[]) { | ||
| readStyles(styles: CSSStyleDeclaration) { | ||
| let add = Mark.none, remove = Mark.none | ||
| for (let i = 0; i < styles.length; i += 2) { | ||
| for (let i = 0, l = styles.length; i < l; i++) { | ||
| let name = styles.item(i) | ||
| for (let after = undefined;;) { | ||
| let rule = this.parser.matchStyle(styles[i], styles[i + 1], this, after) | ||
| let rule = this.parser.matchStyle(name, styles.getPropertyValue(name), this, after) | ||
| if (!rule) break | ||
@@ -836,9 +837,2 @@ if (rule.ignore) return null | ||
| // Tokenize a style attribute into property/value pairs. | ||
| function parseStyles(style: string): string[] { | ||
| let re = /\s*([\w-]+)\s*:\s*([^;]+)/g, m, result = [] | ||
| while (m = re.exec(style)) result.push(m[1], m[2].trim()) | ||
| return result | ||
| } | ||
| function copy(obj: {[prop: string]: any}) { | ||
@@ -845,0 +839,0 @@ let copy: {[prop: string]: any} = {} |
+4
-4
@@ -17,3 +17,3 @@ import OrderedMap from "orderedmap" | ||
| // attributes. | ||
| function defaultAttrs(attrs: Attrs) { | ||
| function defaultAttrs(attrs: {[name: string]: Attribute}) { | ||
| let defaults = Object.create(null) | ||
@@ -28,3 +28,3 @@ for (let attrName in attrs) { | ||
| function computeAttrs(attrs: Attrs, value: Attrs | null) { | ||
| function computeAttrs(attrs: {[name: string]: Attribute}, value: Attrs | null) { | ||
| let built = Object.create(null) | ||
@@ -174,3 +174,3 @@ for (let name in attrs) { | ||
| /// Returns true if the given fragment is valid content for this node | ||
| /// type with the given attributes. | ||
| /// type. | ||
| validContent(content: Fragment) { | ||
@@ -649,3 +649,3 @@ let result = this.contentMatch.matchFragment(content) | ||
| function gatherMarks(schema: Schema, marks: readonly string[]) { | ||
| let found = [] | ||
| let found: MarkType[] = [] | ||
| for (let i = 0; i < marks.length; i++) { | ||
@@ -652,0 +652,0 @@ let name = marks[i], mark = schema.marks[name], ok = mark |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
512981
-0.08%10959
-0.15%53
1.92%