prosemirror-view 1.41.7 → 1.41.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 1.41.8 (2026-04-02)
2
+
3
+ ### Bug fixes
4
+
5
+ Make the types reflect that mark and node views should render elements, not any DOM node.
6
+
7
+ Fix a bug causing `dragCopies` to be ignored when it returned false.
8
+
1
9
  ## 1.41.7 (2026-03-18)
2
10
 
3
11
  ### Bug fixes
@@ -2076,7 +2084,7 @@ Fixes a problem where triple-clicking the editor would sometimes cause the scrol
2076
2084
 
2077
2085
  The `inclusiveLeft` and `inclusiveRight` options to inline decorations were renamed to [`inclusiveStart`](https://prosemirror.net/docs/ref/version/0.20.0.html#view.Decoration^inline^spec.inclusiveStart) and [`inclusiveEnd`](https://prosemirror.net/docs/ref/version/0.20.0.html#view.Decoration^inline^spec.inclusiveEnd) so that they also make sense in right-to-left text. The old names work with a warning until the next release.
2078
2086
 
2079
- The default styling for lists and blockquotes was removed from `prosemirror.css`. (They were moved to the [`example-setup`](https://github.com/ProseMirror/prosemirror-example-setup) module.)
2087
+ The default styling for lists and blockquotes was removed from `prosemirror.css`. (They were moved to the [`example-setup`](https://code.haverbeke.berlin/prosemirror/prosemirror-example-setup) module.)
2080
2088
 
2081
2089
  ### Bug fixes
2082
2090
 
@@ -2250,7 +2258,7 @@ Fix DOM parsing for decorated text nodes.
2250
2258
 
2251
2259
  The editor view no longer wraps its editable DOM element in a wrapper element. The `ProseMirror` CSS class now applies directly to the editable element. The `ProseMirror-content` CSS class is still present for ease of upgrading but will be dropped in the next release.
2252
2260
 
2253
- The editor view no longer draws a drop cursor when dragging content over the editor. The new [`prosemirror-dropcursor`](https://github.com/prosemirror/prosemirror-dropcursor) module implements this as a plugin.
2261
+ The editor view no longer draws a drop cursor when dragging content over the editor. The new [`prosemirror-dropcursor`](https://code.haverbeke.berlin/prosemirror/prosemirror-dropcursor) module implements this as a plugin.
2254
2262
 
2255
2263
  ### Bug fixes
2256
2264
 
package/CONTRIBUTING.md CHANGED
@@ -12,7 +12,7 @@ Community discussion, questions, and informal bug reporting is done on the
12
12
  ## Submitting bug reports
13
13
 
14
14
  Report bugs on the
15
- [GitHub issue tracker](http://github.com/prosemirror/prosemirror/issues).
15
+ [issue tracker](https://code.haverbeke.berlin/prosemirror/prosemirror/issues).
16
16
  Before reporting a bug, please read these pointers.
17
17
 
18
18
  - The issue tracker is for *bugs*, not requests for help. Questions
@@ -34,25 +34,28 @@ Before reporting a bug, please read these pointers.
34
34
 
35
35
  ## Contributing code
36
36
 
37
+ Code generated by a language model is not welcome in this project.
38
+ Please don't waste my time with it.
39
+
37
40
  If you want to make a change that involves a significant overhaul of
38
41
  the code or introduces a user-visible new feature, create an
39
- [RFC](https://github.com/ProseMirror/rfcs/) first with your proposal.
42
+ [issue](https://code.haverbeke.berlin/prosemirror/prosemirror/issues/)
43
+ first with your proposal.
40
44
 
41
- - Make sure you have a [GitHub Account](https://github.com/signup/free)
45
+ - Make sure you have a [Codeberg](https://codeberg.org/user/sign_up)
46
+ or [GitHub](https://github.com/signup/free) account.
47
+
48
+ - Use that to create a [code.haverbeke.berlin
49
+ account](https://code.haverbeke.berlin/user/login).
42
50
 
43
- - Fork the relevant repository
44
- ([how to fork a repo](https://help.github.com/articles/fork-a-repo))
51
+ - Fork the relevant repository.
45
52
 
46
53
  - Create a local checkout of the code. You can use the
47
- [main repository](https://github.com/prosemirror/prosemirror) to
54
+ [main repository](https://code.haverbeke.berlin/prosemirror/prosemirror) to
48
55
  easily check out all core modules.
49
56
 
50
57
  - Make your changes, and commit them
51
58
 
52
- - Follow the code style of the rest of the project (see below). Run
53
- `npm run lint` (in the main repository checkout) to make sure that
54
- the linter is happy.
55
-
56
59
  - If your changes are easy to test or likely to regress, add tests in
57
60
  the relevant `test/` directory. Either put them in an existing
58
61
  `test-*.js` file, if they fit there, or add a new file.
@@ -60,13 +63,13 @@ the code or introduces a user-visible new feature, create an
60
63
  - Make sure all tests pass. Run `npm run test` to verify tests pass
61
64
  (you will need Node.js v6+).
62
65
 
63
- - Submit a pull request ([how to create a pull request](https://help.github.com/articles/fork-a-repo)).
64
- Don't put more than one feature/fix in a single pull request.
66
+ - Submit a pull request. Don't put more than one feature/fix in a
67
+ single pull request.
65
68
 
66
69
  By contributing code to ProseMirror you
67
70
 
68
71
  - Agree to license the contributed code under the project's [MIT
69
- license](https://github.com/ProseMirror/prosemirror/blob/master/LICENSE).
72
+ license](https://code.haverbeke.berlin/prosemirror/prosemirror/blob/main/LICENSE).
70
73
 
71
74
  - Confirm that you have the right to contribute and license the code
72
75
  in question. (Either you hold all rights on the code, or the rights
@@ -86,19 +89,16 @@ By contributing code to ProseMirror you
86
89
  - Follow the surrounding code when it comes to spacing, brace
87
90
  placement, etc.
88
91
 
89
- - Brace-less single-statement bodies are encouraged (whenever they
90
- don't impact readability).
92
+ - Brace-less single-statement bodies are encouraged whenever they
93
+ don't impact readability.
91
94
 
92
- - [getdocs](https://github.com/marijnh/getdocs)-style doc comments
95
+ - [getdocs-ts](https://code.haverbeke.berlin/marijn/getdocs-ts)-style doc comments
93
96
  above items that are part of the public API.
94
97
 
95
98
  - When documenting non-public items, you can put the type after a
96
99
  single colon, so that getdocs doesn't pick it up and add it to the
97
100
  API reference.
98
101
 
99
- - The linter (`npm run lint`) complains about unused variables and
100
- functions. Prefix their names with an underscore to muffle it.
101
-
102
102
  - ProseMirror does *not* follow JSHint or JSLint prescribed style.
103
103
  Patches that try to 'fix' code to pass one of these linters will not
104
104
  be accepted.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # prosemirror-view
2
2
 
3
- [ [**WEBSITE**](https://prosemirror.net) | [**ISSUES**](https://github.com/prosemirror/prosemirror/issues) | [**FORUM**](https://discuss.prosemirror.net) | [**CHANGELOG**](https://github.com/ProseMirror/prosemirror-view/blob/master/CHANGELOG.md) ]
3
+ [ [**WEBSITE**](https://prosemirror.net) | [**ISSUES**](https://code.haverbeke.berlin/prosemirror/prosemirror/issues) | [**FORUM**](https://discuss.prosemirror.net) | [**CHANGELOG**](https://code.haverbeke.berlin/prosemirror/prosemirror-view/src/branch/main/CHANGELOG.md) ]
4
4
 
5
5
  This is a [core module](https://prosemirror.net/docs/ref/#view) of [ProseMirror](https://prosemirror.net).
6
6
  ProseMirror is a well-behaved rich semantic content editor based on
@@ -16,10 +16,10 @@ number of [examples](https://prosemirror.net/examples/) and the
16
16
  [documentation](https://prosemirror.net/docs/).
17
17
 
18
18
  This code is released under an
19
- [MIT license](https://github.com/prosemirror/prosemirror/tree/master/LICENSE).
19
+ [MIT license](https://code.haverbeke.berlin/prosemirror/prosemirror/src/branch/main/LICENSE).
20
20
  There's a [forum](http://discuss.prosemirror.net) for general
21
21
  discussion and support requests, and the
22
- [GitHub bug tracker](https://github.com/prosemirror/prosemirror/issues)
22
+ [bug tracker](https://code.haverbeke.berlin/prosemirror/prosemirror/issues)
23
23
  is the place to report issues.
24
24
 
25
25
  We aim to be an inclusive, welcoming community. To make that explicit,
package/dist/index.cjs CHANGED
@@ -3183,7 +3183,7 @@ var MouseDown = function () {
3183
3183
  var targetDesc = target ? view.docView.nearestDesc(target, true) : null;
3184
3184
  this.target = targetDesc && targetDesc.nodeDOM.nodeType == 1 ? targetDesc.nodeDOM : null;
3185
3185
  var selection = view.state.selection;
3186
- if (event.button == 0 && targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof prosemirrorState.NodeSelection && selection.from <= targetPos && selection.to > targetPos) this.mightDrag = {
3186
+ if (event.button == 0 && (targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof prosemirrorState.NodeSelection && selection.from <= targetPos && selection.to > targetPos)) this.mightDrag = {
3187
3187
  node: targetNode,
3188
3188
  pos: targetPos,
3189
3189
  addAttr: !!(this.target && !this.target.draggable),
@@ -3462,10 +3462,11 @@ var Dragging = _createClass(function Dragging(slice, move, node) {
3462
3462
  });
3463
3463
  var dragCopyModifier = mac ? "altKey" : "ctrlKey";
3464
3464
  function dragMoves(view, event) {
3465
- var moves = view.someProp("dragCopies", function (test) {
3466
- return !test(event);
3465
+ var copy;
3466
+ view.someProp("dragCopies", function (test) {
3467
+ copy = copy || test(event);
3467
3468
  });
3468
- return moves != null ? moves : !event[dragCopyModifier];
3469
+ return copy != null ? !copy : !event[dragCopyModifier];
3469
3470
  }
3470
3471
  handlers.dragstart = function (view, _event) {
3471
3472
  var event = _event;
package/dist/index.d.cts CHANGED
@@ -275,7 +275,7 @@ interface NodeView {
275
275
  /**
276
276
  The outer DOM node that represents the document node.
277
277
  */
278
- dom: DOMNode;
278
+ dom: HTMLElement;
279
279
  /**
280
280
  The DOM node that should hold the node's content. Only meaningful
281
281
  if the node view also defines a `dom` property and if its node
@@ -356,7 +356,7 @@ interface MarkView {
356
356
  /**
357
357
  The outer DOM node that represents the document node.
358
358
  */
359
- dom: DOMNode;
359
+ dom: HTMLElement;
360
360
  /**
361
361
  The DOM node that should hold the mark's content. When this is not
362
362
  present, the `dom` property is used as the content DOM.
package/dist/index.d.ts CHANGED
@@ -275,7 +275,7 @@ interface NodeView {
275
275
  /**
276
276
  The outer DOM node that represents the document node.
277
277
  */
278
- dom: DOMNode;
278
+ dom: HTMLElement;
279
279
  /**
280
280
  The DOM node that should hold the node's content. Only meaningful
281
281
  if the node view also defines a `dom` property and if its node
@@ -356,7 +356,7 @@ interface MarkView {
356
356
  /**
357
357
  The outer DOM node that represents the document node.
358
358
  */
359
- dom: DOMNode;
359
+ dom: HTMLElement;
360
360
  /**
361
361
  The DOM node that should hold the mark's content. When this is not
362
362
  present, the `dom` property is used as the content DOM.
package/dist/index.js CHANGED
@@ -3353,8 +3353,8 @@ class MouseDown {
3353
3353
  this.target = targetDesc && targetDesc.nodeDOM.nodeType == 1 ? targetDesc.nodeDOM : null;
3354
3354
  let { selection } = view.state;
3355
3355
  if (event.button == 0 &&
3356
- targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false ||
3357
- selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos)
3356
+ (targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false ||
3357
+ selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos))
3358
3358
  this.mightDrag = {
3359
3359
  node: targetNode,
3360
3360
  pos: targetPos,
@@ -3703,8 +3703,9 @@ class Dragging {
3703
3703
  }
3704
3704
  const dragCopyModifier = mac ? "altKey" : "ctrlKey";
3705
3705
  function dragMoves(view, event) {
3706
- let moves = view.someProp("dragCopies", test => !test(event));
3707
- return moves != null ? moves : !event[dragCopyModifier];
3706
+ let copy;
3707
+ view.someProp("dragCopies", test => { copy = copy || test(event); });
3708
+ return copy != null ? !copy : !event[dragCopyModifier];
3708
3709
  }
3709
3710
  handlers.dragstart = (view, _event) => {
3710
3711
  let event = _event;
@@ -3731,7 +3732,7 @@ handlers.dragstart = (view, _event) => {
3731
3732
  if (!event.dataTransfer.files.length || !chrome || chrome_version > 120)
3732
3733
  event.dataTransfer.clearData();
3733
3734
  event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML);
3734
- // See https://github.com/ProseMirror/prosemirror/issues/1156
3735
+ // See https://code.haverbeke.berlin/prosemirror/prosemirror/issues/1156
3735
3736
  event.dataTransfer.effectAllowed = "copyMove";
3736
3737
  if (!brokenClipboardAPI)
3737
3738
  event.dataTransfer.setData("text/plain", text);
@@ -5365,7 +5366,7 @@ class EditorView {
5365
5366
  this.pluginViews = [];
5366
5367
  /**
5367
5368
  Holds `true` when a hack node is needed in Firefox to prevent the
5368
- [space is eaten issue](https://github.com/ProseMirror/prosemirror/issues/651)
5369
+ [space is eaten issue](https://code.haverbeke.berlin/prosemirror/prosemirror/issues/651)
5369
5370
  @internal
5370
5371
  */
5371
5372
  this.requiresGeckoHackNode = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prosemirror-view",
3
- "version": "1.41.7",
3
+ "version": "1.41.8",
4
4
  "description": "ProseMirror's view component",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -25,7 +25,7 @@
25
25
  ],
26
26
  "repository": {
27
27
  "type": "git",
28
- "url": "git://github.com/prosemirror/prosemirror-view.git"
28
+ "url": "git+https://code.haverbeke.berlin/prosemirror/prosemirror-view.git"
29
29
  },
30
30
  "dependencies": {
31
31
  "prosemirror-model": "^1.20.0",
package/src/index.ts CHANGED
@@ -54,7 +54,7 @@ export class EditorView {
54
54
  /// @internal
55
55
  declare domObserver: DOMObserver
56
56
  /// Holds `true` when a hack node is needed in Firefox to prevent the
57
- /// [space is eaten issue](https://github.com/ProseMirror/prosemirror/issues/651)
57
+ /// [space is eaten issue](https://code.haverbeke.berlin/prosemirror/prosemirror/issues/651)
58
58
  /// @internal
59
59
  requiresGeckoHackNode: boolean = false
60
60
 
package/src/input.ts CHANGED
@@ -334,8 +334,8 @@ class MouseDown {
334
334
 
335
335
  let {selection} = view.state
336
336
  if (event.button == 0 &&
337
- targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false ||
338
- selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos)
337
+ (targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false ||
338
+ selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos))
339
339
  this.mightDrag = {
340
340
  node: targetNode,
341
341
  pos: targetPos,
@@ -673,8 +673,9 @@ export class Dragging {
673
673
  const dragCopyModifier: keyof DragEvent = browser.mac ? "altKey" : "ctrlKey"
674
674
 
675
675
  function dragMoves(view: EditorView, event: DragEvent) {
676
- let moves = view.someProp("dragCopies", test => !test(event))
677
- return moves != null ? moves : !event[dragCopyModifier]
676
+ let copy: boolean | undefined
677
+ view.someProp("dragCopies", test => { copy = copy || test(event) })
678
+ return copy != null ? !copy : !event[dragCopyModifier]
678
679
  }
679
680
 
680
681
  handlers.dragstart = (view, _event) => {
@@ -701,7 +702,7 @@ handlers.dragstart = (view, _event) => {
701
702
  if (!event.dataTransfer.files.length || !browser.chrome || browser.chrome_version > 120)
702
703
  event.dataTransfer.clearData()
703
704
  event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML)
704
- // See https://github.com/ProseMirror/prosemirror/issues/1156
705
+ // See https://code.haverbeke.berlin/prosemirror/prosemirror/issues/1156
705
706
  event.dataTransfer.effectAllowed = "copyMove"
706
707
  if (!brokenClipboardAPI) event.dataTransfer.setData("text/plain", text)
707
708
  view.dragging = new Dragging(slice, dragMoves(view, event), node)
package/src/viewdesc.ts CHANGED
@@ -30,7 +30,7 @@ export type ViewMutationRecord = MutationRecord | { type: "selection", target: D
30
30
  /// Objects returned as node views must conform to this interface.
31
31
  export interface NodeView {
32
32
  /// The outer DOM node that represents the document node.
33
- dom: DOMNode
33
+ dom: HTMLElement
34
34
 
35
35
  /// The DOM node that should hold the node's content. Only meaningful
36
36
  /// if the node view also defines a `dom` property and if its node
@@ -99,7 +99,7 @@ export interface NodeView {
99
99
  /// Objects returned as mark views must conform to this interface.
100
100
  export interface MarkView {
101
101
  /// The outer DOM node that represents the document node.
102
- dom: DOMNode
102
+ dom: HTMLElement
103
103
 
104
104
  /// The DOM node that should hold the mark's content. When this is not
105
105
  /// present, the `dom` property is used as the content DOM.
@@ -610,7 +610,7 @@ class CompositionViewDesc extends ViewDesc {
610
610
  // some cases they will be split more often than would appear
611
611
  // necessary.
612
612
  class MarkViewDesc extends ViewDesc {
613
- constructor(parent: ViewDesc, readonly mark: Mark, dom: DOMNode, contentDOM: HTMLElement, readonly spec: MarkView) {
613
+ constructor(parent: ViewDesc, readonly mark: Mark, dom: HTMLElement, contentDOM: HTMLElement, readonly spec: MarkView) {
614
614
  super(parent, [], dom, contentDOM)
615
615
  }
616
616
 
@@ -697,13 +697,13 @@ export class NodeViewDesc extends ViewDesc {
697
697
  if (descObj.parent) return descObj.parent.posBeforeChild(descObj)
698
698
  }, outerDeco, innerDeco)
699
699
 
700
- let dom = spec && spec.dom, contentDOM = spec && spec.contentDOM
700
+ let dom: DOMNode | undefined = spec && spec.dom, contentDOM = spec && spec.contentDOM
701
701
  if (node.isText) {
702
702
  if (!dom) dom = document.createTextNode(node.text!)
703
703
  else if (dom.nodeType != 3) throw new RangeError("Text must be rendered as a DOM text node")
704
704
  } else if (!dom) {
705
705
  let spec = (DOMSerializer.renderSpec as any)(document, node.type.spec.toDOM!(node), null, node.attrs)
706
- ;({dom, contentDOM} = spec as {dom: DOMNode, contentDOM?: HTMLElement})
706
+ ;({dom, contentDOM} = spec as {dom: HTMLElement, contentDOM?: HTMLElement})
707
707
  }
708
708
  if (!contentDOM && !node.isText && dom.nodeName != "BR") { // Chrome gets confused by <br contenteditable=false>
709
709
  if (!(dom as HTMLElement).hasAttribute("contenteditable")) (dom as HTMLElement).contentEditable = "false"
@@ -714,8 +714,8 @@ export class NodeViewDesc extends ViewDesc {
714
714
  dom = applyOuterDeco(dom, outerDeco, node)
715
715
 
716
716
  if (spec)
717
- return descObj = new CustomNodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM,
718
- spec, view, pos + 1)
717
+ return descObj = new CustomNodeViewDesc(parent, node, outerDeco, innerDeco, dom as HTMLElement, contentDOM || null,
718
+ nodeDOM as HTMLElement, spec, view, pos + 1)
719
719
  else if (node.isText)
720
720
  return new TextViewDesc(parent, node, outerDeco, innerDeco, dom, nodeDOM, view)
721
721
  else
@@ -985,7 +985,7 @@ class TrailingHackViewDesc extends ViewDesc {
985
985
  // customized.
986
986
  class CustomNodeViewDesc extends NodeViewDesc {
987
987
  constructor(parent: ViewDesc | undefined, node: Node, outerDeco: readonly Decoration[], innerDeco: DecorationSource,
988
- dom: DOMNode, contentDOM: HTMLElement | null, nodeDOM: DOMNode, readonly spec: NodeView,
988
+ dom: HTMLElement, contentDOM: HTMLElement | null, nodeDOM: HTMLElement, readonly spec: NodeView,
989
989
  view: EditorView, pos: number) {
990
990
  super(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos)
991
991
  }
@@ -23,7 +23,7 @@
23
23
  .ProseMirror-hideselection *::-moz-selection { background: transparent; }
24
24
  .ProseMirror-hideselection { caret-color: transparent; }
25
25
 
26
- /* See https://github.com/ProseMirror/prosemirror/issues/1421#issuecomment-1759320191 */
26
+ /* See https://code.haverbeke.berlin/prosemirror/prosemirror/issues/1421#issuecomment-1759320191 */
27
27
  .ProseMirror [draggable][contenteditable=false] { user-select: text }
28
28
 
29
29
  .ProseMirror-selectednode {