Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prosemirror-model

Package Overview
Dependencies
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prosemirror-model - npm Package Compare versions

Comparing version 1.21.0 to 1.21.1

6

CHANGELOG.md

@@ -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 @@

2

dist/index.d.ts

@@ -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;

{
"name": "prosemirror-model",
"version": "1.21.0",
"version": "1.21.1",
"description": "ProseMirror's document model",

@@ -5,0 +5,0 @@ "type": "module",

@@ -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} = {}

@@ -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 not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc