y-prosemirror
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "y-prosemirror", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Prosemirror bindings for Yjs", | ||
@@ -15,7 +15,8 @@ "main": "./dist/y-prosemirror.cjs", | ||
"dist": "rm -rf dist && rollup -c && tsc", | ||
"test": "rollup -c && node dist/test.cjs", | ||
"test": "npm run lint && rollup -c && node dist/test.cjs", | ||
"lint": "standard", | ||
"watch": "rollup -wc", | ||
"debug": "concurrently 'http-server -o test.html' 'npm run watch'", | ||
"preversion": "npm run lint && npm run dist && npm run test" | ||
"preversion": "npm run lint && npm run dist && npm run test", | ||
"start": "concurrently 'http-server -o demo/prosemirror.html' 'npm run watch'" | ||
}, | ||
@@ -22,0 +23,0 @@ "files": [ |
@@ -1,2 +0,2 @@ | ||
# y-prosemirror | ||
# y-prosemirror [![Build Status](https://travis-ci.com/yjs/y-prosemirror.svg?branch=master)](https://travis-ci.com/yjs/y-prosemirror) | ||
@@ -3,0 +3,0 @@ > [ProseMirror](http://prosemirror.net/) Binding for [Yjs](https://github.com/yjs/yjs) - [Demo](https://demos.yjs.dev/prosemirror/prosemirror.html) |
@@ -221,3 +221,3 @@ /** | ||
if (environment.isBrowser && this._domSelectionInView === null) { | ||
// Calculte the domSelectionInView and clear by next tick after all events are finished | ||
// Calculate the domSelectionInView and clear by next tick after all events are finished | ||
setTimeout(() => { | ||
@@ -238,2 +238,13 @@ this._domSelectionInView = null | ||
// This is a workaround for an edgecase where getBoundingClientRect will | ||
// return zero values if the selection is collapsed at the start of a newline | ||
// see reference here: https://stackoverflow.com/a/59780954 | ||
const rects = range.getClientRects() | ||
if (rects.length === 0) { | ||
// probably buggy newline behavior, explicitly select the node contents | ||
if (range.startContainer && range.collapsed) { | ||
range.selectNodeContents(range.startContainer) | ||
} | ||
} | ||
const bounding = range.getBoundingClientRect() | ||
@@ -240,0 +251,0 @@ const documentElement = dom.doc.documentElement |
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
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 not supported yet
3750316
36637