Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge from upstream #3

Open
wants to merge 112 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
1eb5358
Fix missing mark when parsing nested mark with same type
lastnigtic Sep 10, 2020
83d39b7
Adjust code style in 1eb53581cffbe7f28ba40a7184bc325a9ecd794c
marijnh Sep 11, 2020
c1593e8
Add release note
marijnh Sep 11, 2020
34e3e43
Mark version 1.11.1
marijnh Sep 11, 2020
b8f177e
Fix mark with attrs missing in nested mark rule parsing
Sep 11, 2020
c7c65ea
Fix findIndex is not supported in IE (#53)
lastnigtic Sep 12, 2020
bd08108
Mark version 1.11.2
marijnh Sep 12, 2020
4d62ca2
fix typo
Xheldon Sep 23, 2020
9df6d80
chore: fix linter errors
hedgepigdaniel Sep 30, 2020
9ed7f47
Allow DOMOutputSpec values to already be {dom, contentDOM} objects
marijnh Oct 11, 2020
31cf53a
Mark version 1.12.0
marijnh Oct 11, 2020
5564b0e
Make rollup.config.js more Windows-compatible
marijnh Dec 1, 2020
d5a82e5
Implement nonconsuming parse rules (RFC 11)
marijnh Dec 11, 2020
cc53b08
Mark version 1.13.0
marijnh Dec 11, 2020
ae6ab85
Fix dropping of whitespace at start of content expression
marijnh Dec 18, 2020
6ab3beb
Fix incorrectly applied to other nodes while parsing nested same mark…
lastnigtic Dec 20, 2020
d385eff
Add release note
marijnh Dec 20, 2020
b7aa9df
Mark version 1.13.1
marijnh Dec 20, 2020
18fd890
Add note about style parse rules only producing marks
marijnh Feb 2, 2021
185cf4b
Make sure MarkType.removeFromSet removes _all_ instances
marijnh Feb 4, 2021
a0556b8
Mark version 1.13.2
marijnh Feb 4, 2021
28aef80
Fix bug where the DOM parser would apply marks in invalid places
marijnh Feb 4, 2021
67d65f2
Mark version 1.13.3
marijnh Feb 4, 2021
024384b
Document Fragment.textBetween
marijnh Feb 19, 2021
06a044a
Make Node.check check mark set validity
marijnh Feb 22, 2021
eef20c8
Remove carriage return characters from parsed DOM content
marijnh Mar 10, 2021
41b48ab
Make sure ignored BR nodes create an inline context
marijnh Apr 6, 2021
71c174d
Mark version 1.14.0
marijnh Apr 6, 2021
f28b89a
Don't ignore whitespace-only modes in DOM parsing when preserveWhites…
marijnh Apr 26, 2021
3c0b054
Mark version 1.14.1
marijnh Apr 26, 2021
9ef5746
More aggressively assign inline context in parseSlice
marijnh Jun 16, 2021
c1119ee
Mark version 1.14.2
marijnh Jun 16, 2021
cf06d61
Make serializeNode include marks
marijnh Jul 22, 2021
5ff774f
Mark version 1.14.3
marijnh Jul 22, 2021
ab627a1
Add an .npmrc that turns off lock files
marijnh Oct 15, 2021
babdac8
Upgrade Mocha
marijnh Oct 15, 2021
039a2ee
Extend textBetween API by accepting function to stringify leaf nodes
kepta Oct 25, 2021
ce7fbbb
Mark version 1.15.0
marijnh Oct 25, 2021
428a8ba
Add index parameter to documentation for Node.descendants
jacobez Nov 3, 2021
2322130
Fix type comments
marijnh Nov 12, 2021
ffbe05b
Clarify doc comment for textBetween
marijnh Dec 22, 2021
b9085fb
Add NodeSpec.whitespace
marijnh Dec 27, 2021
fdc81cb
Mark version 1.16.0
marijnh Dec 27, 2021
2de8628
Fix whitespace option propagation in DOMParser
marijnh Dec 29, 2021
95298fb
Mark version 1.16.1
marijnh Dec 29, 2021
b8c5166
Document the new definingForContent and definingAsContext node options
marijnh Mar 18, 2022
fc9113f
Add a clarifying sentence to doc comment for Fragment.descendants
marijnh Apr 26, 2022
c8c7b62
Port code to TypeScript
marijnh May 4, 2022
696f1e7
Don't directly reference the global Node type
marijnh May 21, 2022
26c634f
Make sure ParseContext.open doesn't become negative
marijnh May 25, 2022
10f2e2e
Mark version 1.17.0
marijnh May 30, 2022
de1b852
Allow a leaf node to customize its textContent
ocavue Jun 7, 2022
c10cf98
Add stronger typing for Schema
cmlenz Jun 7, 2022
d40def1
Clarify Schema type parameters
marijnh Jun 7, 2022
278e717
Mark version 1.18.0
marijnh Jun 7, 2022
6789b33
Explicitly specify the type of nodeFromJSON
marijnh Jun 8, 2022
bddb01a
Make compatibleContent public
marijnh Jun 13, 2022
eb9cc6f
Upgrade to orderedmap 2.0
marijnh Jun 15, 2022
152ce93
Mark version 1.18.1
marijnh Jun 15, 2022
8df218e
Make it compile in typescript 3
dreusel Jul 13, 2022
b99fa72
Add NodeType.checkContent method
ocavue Jul 13, 2022
cdb4819
Change the array type in DOMOutputSpec to readonly
lastnigtic Jul 27, 2022
777079a
Suppress type errors
marijnh Aug 11, 2022
5e6c84d
Ensure Node.inlineContent returns a boolean
scq Aug 16, 2022
cc6c475
Remove gitter link
marijnh Oct 9, 2022
dacd4cb
Close blocks with inline content on seeing block-level elements
marijnh Nov 14, 2022
1b843bf
Mark version 1.18.2
marijnh Nov 14, 2022
35e4fd6
Copy all spec properties to Schema.spec
marijnh Nov 16, 2022
0395aae
Mark version 1.18.3
marijnh Nov 18, 2022
be4ae4e
Allow style parse rules to clear marks
marijnh Jan 18, 2023
93e9a40
Mark version 1.19.0
marijnh Jan 18, 2023
018df43
Remove a labeled loop that breaks Bublé
marijnh Jan 18, 2023
e8778de
Update maintainer email
marijnh Jan 24, 2023
9201015
Small clarification of docs of Node.nodesBetween
tslocke Jan 31, 2023
1cbef0f
Expose the index parameter in the Fragment descendants callback
whawker Mar 21, 2023
8ff6941
Add release note
marijnh May 17, 2023
e486c6f
Mark version 1.19.1
marijnh May 17, 2023
4ba155f
Allow active marks to be cleared by clearMark parse rules
marijnh May 19, 2023
5a5aeba
Mark version 1.19.2
marijnh May 23, 2023
4947c38
Don't apply style parse rules for skipped nodes
marijnh Jul 13, 2023
387576a
Mark version 1.19.3
marijnh Jul 13, 2023
49db562
Make sure textBetween includes block separators around empty textblocks
marijnh Oct 8, 2023
1b2ebc7
Upgrade jsdom for tests
marijnh Dec 11, 2023
a37b6b3
Mark version 1.19.4
marijnh Dec 11, 2023
79a3806
Make ParseRule a union type
marijnh Apr 7, 2024
4ea136e
Mark version 1.20.0
marijnh Apr 8, 2024
a8a8041
Add support for linebreak replacement nodes in schema configuration
marijnh May 6, 2024
b71f73f
Mark version 1.21.0
marijnh May 6, 2024
d616169
Make some internal types more precise
ocavue May 20, 2024
7726c3b
Clean up outdated doc comment
marijnh May 20, 2024
899a98e
Use the parsed DOM styles instead of parsing them separately
marijnh Jun 2, 2024
c6bbbbd
Use getPropertyValue to fetch style values
marijnh Jun 3, 2024
a6c5ce1
Mark version 1.21.1
marijnh Jun 3, 2024
d326751
Properly mark Node.findIndex as internal
marijnh Jun 18, 2024
cde085e
Add some missing type declarations
s524797336 Jun 24, 2024
54de8c0
Use a WeakMap in the resolved position cache to avoid leaking
marijnh Jun 25, 2024
68c3cd5
Mark version 1.21.2
marijnh Jun 25, 2024
1f0c6ed
Directly query style props used in parse rules
marijnh Jun 26, 2024
751134c
Mark version 1.21.3
marijnh Jun 26, 2024
fca6ef9
Add attribute value validation
marijnh Jul 14, 2024
1357ec7
Mark version 1.22.0
marijnh Jul 14, 2024
6e977d7
Add code to actively guard against corrupted-attribute XSS attacks
marijnh Jul 14, 2024
3360cdc
Mark version 1.22.1
marijnh Jul 14, 2024
e313240
Fix a type error
marijnh Jul 18, 2024
fc27a3c
Include type and attribute name in validate error messages
ocavue Jul 18, 2024
25285b6
Expose the extra blockArraysIn parameter to renderSpec in a hidden way
marijnh Jul 18, 2024
e1f6e22
Add release note
marijnh Jul 18, 2024
343fcd7
Mark version 1.22.2
marijnh Jul 18, 2024
17709d3
Fix a typo in the comment
ocavue Jul 18, 2024
d47033e
Overhaul the way marks are tracked in DOMParser
marijnh Aug 6, 2024
be711f9
Mark version 1.22.3
marijnh Aug 6, 2024
a575315
Make sure DOMParser can find node positions after contentDOM nodes
marijnh Aug 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/node_modules
.tern-port
/dist
/test/*.js
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
212 changes: 212 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,215 @@
## 1.22.3 (2024-08-06)

### Bug fixes

Fix some corner cases in the way the DOM parser tracks active marks.

## 1.22.2 (2024-07-18)

### Bug fixes

Make attribute validation messages more informative.

## 1.22.1 (2024-07-14)

### Bug fixes

Add code to `DOMSerializer` that rejects DOM output specs when they originate from attribute values, to protect against XSS attacks that use corrupt attribute input.

## 1.22.0 (2024-07-14)

### New features

Attribute specs now support a `validate` property that can be used to provide a validation function for the attribute, to guard against corrupt JSON input.

## 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)

### Bug fixes

Make sure resolved positions (and thus the document and schema hanging off them) don't get kept in the cache when their document can be garbage-collected.

## 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)

### New features

The new `linebreakReplacement` property on node specs makes it possible to configure a node type that `setBlockType` will convert to and from line breaks when appropriate.

## 1.20.0 (2024-04-08)

### New features

The `ParseRule` type is now a union of `TagParseRule` and `StyleParseRule`, with more specific types being used when appropriate.

## 1.19.4 (2023-12-11)

### Bug fixes

Make `textBetween` emit block separators for empty textblocks.

## 1.19.3 (2023-07-13)

### Bug fixes

Don't apply style parse rules for nodes that are skipped by other parse rules.

## 1.19.2 (2023-05-23)

### Bug fixes

Allow parse rules with a `clearMark` directive to clear marks that have already been applied.

## 1.19.1 (2023-05-17)

### Bug fixes

Fix the types of `Fragment.desendants` to include the index parameter to the callback. Add release note

Include CommonJS type declarations in the package to please new TypeScript resolution settings.

## 1.19.0 (2023-01-18)

### New features

Parse rules for styles can now provide a `clearMark` property to remove pending marks (for example for `font-style: normal`).

## 1.18.3 (2022-11-18)

### Bug fixes

Copy all properties from the input spec to `Schema.spec`.

## 1.18.2 (2022-11-14)

### Bug fixes

Improve DOM parsing of nested block elements mixing block and inline children.

## 1.18.1 (2022-06-15)

### Bug fixes

Upgrade to orderedmap 2.0.0 to avoid around a TypeScript compilation issue.

## 1.18.0 (2022-06-07)

### New features

Node specs for leaf nodes now support a property `leafText` which, when given, will be used by `textContent` and `textBetween` to serialize the node.

Add optional type parameters to `Schema` for the node and mark names. Clarify Schema type parameters

## 1.17.0 (2022-05-30)

### Bug fixes

Fix a crash in DOM parsing.

### New features

Include TypeScript type declarations.

## 1.16.1 (2021-12-29)

### Bug fixes

Fix a bug in the way whitespace-preservation options were handled in `DOMParser`.

## 1.16.0 (2021-12-27)

### New features

A new `NodeSpec` property, `whitespace`, allows more control over the way whitespace in the content of the node is parsed.

## 1.15.0 (2021-10-25)

### New features

`textBetween` now allows its leaf text argument to be a function.

## 1.14.3 (2021-07-22)

### Bug fixes

`DOMSerializer.serializeNode` will no longer ignore the node's marks.

## 1.14.2 (2021-06-16)

### Bug fixes

Be less agressive about dropping whitespace when the context isn't know in `DOMParser.parseSlice`.

## 1.14.1 (2021-04-26)

### Bug fixes

DOM parsing with `preserveWhitespace: "full"` will no longer ignore whitespace-only nodes.

## 1.14.0 (2021-04-06)

### Bug fixes

`Node.check` will now error if a node has an invalid combination of marks.

Don't leave carriage return characters in parsed DOM content, since they confuse Chrome's cursor motion.

### New features

`Fragment.textBetween` is now public.

## 1.13.3 (2021-02-04)

### Bug fixes

Fix an issue where nested tags that match mark parser rules could cause the parser to apply marks in invalid places.

## 1.13.2 (2021-02-04)

### Bug fixes

`MarkType.removeFromSet` now removes all instances of the mark, not just the first one.

## 1.13.1 (2020-12-20)

### Bug fixes

Fix a bug where nested marks of the same type would be applied to the wrong node when parsing from DOM.

## 1.13.0 (2020-12-11)

### New features

Parse rules can now have a `consuming: false` property which allows other rules to match their tag or style even when they apply.

## 1.12.0 (2020-10-11)

### New features

The output of `toDOM` functions can now be a `{dom, contentDOM}` object specifying the precise parent and content DOM elements.

## 1.11.2 (2020-09-12)

### Bug fixes

Fix issue where 1.11.1 uses an array method not available on Internet Explorer.

## 1.11.1 (2020-09-11)

### Bug fixes

Fix an issue where an inner node's mark information could reset the same mark provided by an outer node in the DOM parser.

## 1.11.0 (2020-07-08)

### New features
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (C) 2015-2017 by Marijn Haverbeke <[email protected]> and others
Copyright (C) 2015-2017 by Marijn Haverbeke <[email protected]> and others

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# prosemirror-model

[ [**WEBSITE**](https://prosemirror.net) | [**ISSUES**](https://github.com/prosemirror/prosemirror/issues) | [**FORUM**](https://discuss.prosemirror.net) | [**GITTER**](https://gitter.im/ProseMirror/prosemirror) | [**CHANGELOG**](https://github.com/ProseMirror/prosemirror-model/blob/master/CHANGELOG.md) ]
[ [**WEBSITE**](https://prosemirror.net) | [**ISSUES**](https://github.com/prosemirror/prosemirror/issues) | [**FORUM**](https://discuss.prosemirror.net) | [**CHANGELOG**](https://github.com/ProseMirror/prosemirror-model/blob/master/CHANGELOG.md) ]

This is a [core module](https://prosemirror.net/docs/ref/#model) of [ProseMirror](https://prosemirror.net).
ProseMirror is a well-behaved rich semantic content editor based on
Expand Down
13 changes: 0 additions & 13 deletions etc/link-self.js

This file was deleted.

32 changes: 17 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
{
"name": "prosemirror-model",
"version": "1.11.0",
"version": "1.22.3",
"description": "ProseMirror's document model",
"main": "dist/index.js",
"module": "dist/index.es.js",
"type": "module",
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"sideEffects": false,
"license": "MIT",
"maintainers": [
{
"name": "Marijn Haverbeke",
"email": "[email protected]",
"email": "[email protected]",
"web": "http://marijnhaverbeke.nl"
}
],
Expand All @@ -17,20 +24,15 @@
"url": "git://github.com/prosemirror/prosemirror-model.git"
},
"dependencies": {
"orderedmap": "^1.1.0"
"orderedmap": "^2.0.0"
},
"devDependencies": {
"mocha": "^3.0.2",
"ist": "^1.0.0",
"jsdom": "^10.1.0",
"prosemirror-test-builder": "^1.0.0",
"rollup": "^2.26.3",
"@rollup/plugin-buble": "^0.21.3"
"@prosemirror/buildhelper": "^0.1.5",
"jsdom": "^20.0.0",
"prosemirror-test-builder": "^1.0.0"
},
"scripts": {
"test": "node etc/link-self.js && mocha test/test-*.js",
"build": "rollup -c",
"watch": "rollup -c -w",
"prepare": "npm run build"
"test": "pm-runtests",
"prepare": "pm-buildhelper src/index.ts"
}
}
14 changes: 0 additions & 14 deletions rollup.config.js

This file was deleted.

4 changes: 4 additions & 0 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describes the type of the content, and holds a
@Fragment
@Mark
@Slice
@Attrs
@ReplaceError

### Resolved Positions
Expand Down Expand Up @@ -52,6 +53,9 @@ to use this module.)

@DOMParser
@ParseOptions
@GenericParseRule
@TagParseRule
@StyleParseRule
@ParseRule

@DOMSerializer
Expand Down
2 changes: 1 addition & 1 deletion src/comparedeep.js → src/comparedeep.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function compareDeep(a, b) {
export function compareDeep(a: any, b: any) {
if (a === b) return true
if (!(a && typeof a == "object") ||
!(b && typeof b == "object")) return false
Expand Down
Loading