prosemirror-view
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -0,1 +1,9 @@ | ||
## 1.3.1 (2018-06-08) | ||
### Bug fixes | ||
The package can now be loaded in a web worker context (where `navigator` is defined but `document` isn't) without crashing. | ||
Dropping something like a list item into a textblock will no longer split the textblock. | ||
## 1.3.0 (2018-04-24) | ||
@@ -2,0 +10,0 @@ |
{ | ||
"name": "prosemirror-view", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "ProseMirror's view component", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
const result = {} | ||
export default result | ||
if (typeof navigator != "undefined") { | ||
if (typeof navigator != "undefined" && typeof document != "undefined") { | ||
const ie_edge = /Edge\/(\d+)/.exec(navigator.userAgent) | ||
@@ -6,0 +6,0 @@ const ie_upto10 = /MSIE \d/.test(navigator.userAgent) |
@@ -106,3 +106,3 @@ function compareObjs(a, b) { | ||
// :: (number, (view: EditorView, getPos: () → number) → dom.Node | dom.Node, ?Object) → Decoration | ||
// :: (number, union<(view: EditorView, getPos: () → number) → dom.Node, dom.Node>, ?Object) → Decoration | ||
// Creates a widget decoration, which is a DOM node that's shown in | ||
@@ -109,0 +109,0 @@ // the document at the given position. It is recommended that you |
@@ -457,7 +457,11 @@ import {Selection, NodeSelection, TextSelection} from "prosemirror-state" | ||
for (let i = 0; i < slice.openStart; i++) content = content.firstChild.content | ||
for (let d = $pos.depth; d >= 0; d--) { | ||
let bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1 | ||
let insertPos = $pos.index(d) + (bias > 0 ? 1 : 0) | ||
if ($pos.node(d).canReplace(insertPos, insertPos, content)) | ||
return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d + 1) : $pos.after(d + 1) | ||
for (let pass = 1; pass <= (slice.openStart == 0 && slice.length ? 2 : 1); pass++) { | ||
for (let d = $pos.depth; d >= 0; d--) { | ||
let bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1 | ||
let insertPos = $pos.index(d) + (bias > 0 ? 1 : 0) | ||
if (pass == 1 | ||
? $pos.node(d).canReplace(insertPos, insertPos, content) | ||
: $pos.node(d).contentMatchAt(insertPos).findWrapping(content.firstChild)) | ||
return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d + 1) : $pos.after(d + 1) | ||
} | ||
} | ||
@@ -464,0 +468,0 @@ return $pos.pos |
@@ -6,5 +6,4 @@ import {TextSelection, NodeSelection} from "prosemirror-state" | ||
// Track the state of the current editor selection. Keeps the editor | ||
// selection in sync with the DOM selection by polling for changes, | ||
// as there is no DOM event for DOM selection changes. | ||
// Track the state of the DOM selection, creating transactions to | ||
// update the selection state when necessary. | ||
export class SelectionReader { | ||
@@ -11,0 +10,0 @@ constructor(view) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
728621
8273