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

prosemirror-view

Package Overview
Dependencies
Maintainers
1
Versions
282
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prosemirror-view - npm Package Compare versions

Comparing version 1.34.3 to 1.35.0

29

dist/index.d.ts

@@ -268,15 +268,24 @@ import { EditorState, Transaction, Selection, Plugin } from 'prosemirror-state';

/**
When given, this will be called when the view is updating itself.
It will be given a node (possibly of a different type), an array
of active decorations around the node (which are automatically
drawn, and the node view may ignore if it isn't interested in
them), and a [decoration source](https://prosemirror.net/docs/ref/#view.DecorationSource) that
represents any decorations that apply to the content of the node
(which again may be ignored). It should return true if it was
able to update to that node, and false otherwise. If the node
view has a `contentDOM` property (or no `dom` property), updating
its child nodes will be handled by ProseMirror.
When given, this will be called when the view is updating
itself. It will be given a node, an array of active decorations
around the node (which are automatically drawn, and the node
view may ignore if it isn't interested in them), and a
[decoration source](https://prosemirror.net/docs/ref/#view.DecorationSource) that represents any
decorations that apply to the content of the node (which again
may be ignored). It should return true if it was able to update
to that node, and false otherwise. If the node view has a
`contentDOM` property (or no `dom` property), updating its child
nodes will be handled by ProseMirror.
*/
update?: (node: Node, decorations: readonly Decoration[], innerDecorations: DecorationSource) => boolean;
/**
By default, `update` will only be called when a node of the same
node type appears in this view's position. When you set this to
true, it will be called for any node, making it possible to have
a node view that representsmultiple types of nodes. You will
need to check the type of the nodes you get in `update` and
return `false` for types you cannot handle.
*/
multiType?: boolean;
/**
Can be used to override the way the node's selected status (as a

@@ -283,0 +292,0 @@ node selection) is displayed.

{
"name": "prosemirror-view",
"version": "1.34.3",
"version": "1.35.0",
"description": "ProseMirror's view component",

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

@@ -166,6 +166,2 @@ import {Selection} from "prosemirror-state"

selectionChanged(sel: DOMSelectionRange) {
return !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasFocusAndSelection(this.view) && !this.ignoreSelectionChange(sel)
}
flush() {

@@ -177,3 +173,4 @@ let {view} = this

let sel = view.domSelectionRange(), newSel = this.selectionChanged(sel)
let sel = view.domSelectionRange()
let newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasFocusAndSelection(view) && !this.ignoreSelectionChange(sel)

@@ -180,0 +177,0 @@ let from = -1, to = -1, typeOver = false, added: Node[] = []

@@ -115,6 +115,4 @@ import {Selection, NodeSelection, TextSelection} from "prosemirror-state"

if (browser.android && browser.chrome && event.keyCode == 13) return
if (event.keyCode != 229) view.domObserver.forceFlush()
if (view.domObserver.selectionChanged(view.domSelectionRange())) view.domObserver.flush()
else if (event.keyCode != 229) view.domObserver.forceFlush()
// On iOS, if we preventDefault enter key presses, the virtual

@@ -121,0 +119,0 @@ // keyboard gets confused. So the hack here is to set a flag that

@@ -36,14 +36,22 @@ import {DOMSerializer, Fragment, Mark, Node, TagParseRule} from "prosemirror-model"

/// When given, this will be called when the view is updating itself.
/// It will be given a node (possibly of a different type), an array
/// of active decorations around the node (which are automatically
/// drawn, and the node view may ignore if it isn't interested in
/// them), and a [decoration source](#view.DecorationSource) that
/// represents any decorations that apply to the content of the node
/// (which again may be ignored). It should return true if it was
/// able to update to that node, and false otherwise. If the node
/// view has a `contentDOM` property (or no `dom` property), updating
/// its child nodes will be handled by ProseMirror.
/// When given, this will be called when the view is updating
/// itself. It will be given a node, an array of active decorations
/// around the node (which are automatically drawn, and the node
/// view may ignore if it isn't interested in them), and a
/// [decoration source](#view.DecorationSource) that represents any
/// decorations that apply to the content of the node (which again
/// may be ignored). It should return true if it was able to update
/// to that node, and false otherwise. If the node view has a
/// `contentDOM` property (or no `dom` property), updating its child
/// nodes will be handled by ProseMirror.
update?: (node: Node, decorations: readonly Decoration[], innerDecorations: DecorationSource) => boolean
/// By default, `update` will only be called when a node of the same
/// node type appears in this view's position. When you set this to
/// true, it will be called for any node, making it possible to have
/// a node view that representsmultiple types of nodes. You will
/// need to check the type of the nodes you get in `update` and
/// return `false` for types you cannot handle.
multiType?: boolean
/// Can be used to override the way the node's selected status (as a

@@ -942,3 +950,3 @@ /// node selection) is displayed.

if (this.dirty == NODE_DIRTY) return false
if (this.spec.update) {
if (this.spec.update && (this.node.type == node.type || this.spec.multiType)) {
let result = this.spec.update(node, outerDeco, innerDeco)

@@ -945,0 +953,0 @@ if (result) this.updateInner(node, outerDeco, innerDeco, view)

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

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