@milkdown/prose
Advanced tools
Comparing version 6.5.4 to 7.0.0-next.0
@@ -64,2 +64,3 @@ import { InputRule } from 'prosemirror-inputrules'; | ||
declare const calculateTextPosition: (view: EditorView, target: HTMLElement, handler: (start: Rect, end: Rect, targetRect: DOMRect, parentRect: DOMRect) => Point) => void; | ||
declare function posToDOMRect(view: EditorView, from: number, to: number): DOMRect; | ||
@@ -92,3 +93,3 @@ declare const cloneTr: (tr: Transaction) => Transaction; | ||
export { ContentNodeWithPos, NodeWithPos, browser, calculateNodePosition, calculateTextPosition, cloneTr, customInputRules, customInputRulesKey, equalNodeType, findChildren, findChildrenByMark, findParentNode, findParentNodeClosestToPos, findSelectedNodeOfType, flatten, getMarkFromSchema, getNodeFromSchema, markRule }; | ||
export { ContentNodeWithPos, NodeWithPos, browser, calculateNodePosition, calculateTextPosition, cloneTr, customInputRules, customInputRulesKey, equalNodeType, findChildren, findChildrenByMark, findParentNode, findParentNodeClosestToPos, findSelectedNodeOfType, flatten, getMarkFromSchema, getNodeFromSchema, markRule, posToDOMRect }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -146,2 +146,21 @@ import { PluginKey, Plugin, NodeSelection } from 'prosemirror-state'; | ||
var __defProp = Object.defineProperty; | ||
var __defProps = Object.defineProperties; | ||
var __getOwnPropDescs = Object.getOwnPropertyDescriptors; | ||
var __getOwnPropSymbols = Object.getOwnPropertySymbols; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __propIsEnum = Object.prototype.propertyIsEnumerable; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __spreadValues = (a, b) => { | ||
for (var prop in b || (b = {})) | ||
if (__hasOwnProp.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
if (__getOwnPropSymbols) | ||
for (var prop of __getOwnPropSymbols(b)) { | ||
if (__propIsEnum.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
} | ||
return a; | ||
}; | ||
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); | ||
const calculateNodePosition = (view, target, handler) => { | ||
@@ -178,2 +197,34 @@ const state = view.state; | ||
}; | ||
function minMax(value = 0, min = 0, max = 0) { | ||
return Math.min(Math.max(value, min), max); | ||
} | ||
function posToDOMRect(view, from, to) { | ||
const minPos = 0; | ||
const maxPos = view.state.doc.content.size; | ||
const resolvedFrom = minMax(from, minPos, maxPos); | ||
const resolvedEnd = minMax(to, minPos, maxPos); | ||
const start = view.coordsAtPos(resolvedFrom); | ||
const end = view.coordsAtPos(resolvedEnd, -1); | ||
const top = Math.min(start.top, end.top); | ||
const bottom = Math.max(start.bottom, end.bottom); | ||
const left = Math.min(start.left, end.left); | ||
const right = Math.max(start.right, end.right); | ||
const width = right - left; | ||
const height = bottom - top; | ||
const x = left; | ||
const y = top; | ||
const data = { | ||
top, | ||
bottom, | ||
left, | ||
right, | ||
width, | ||
height, | ||
x, | ||
y | ||
}; | ||
return __spreadProps(__spreadValues({}, data), { | ||
toJSON: () => data | ||
}); | ||
} | ||
@@ -239,3 +290,3 @@ const cloneTr = (tr) => { | ||
export { browser, calculateNodePosition, calculateTextPosition, cloneTr, customInputRules, customInputRulesKey, equalNodeType, findChildren, findChildrenByMark, findParentNode, findParentNodeClosestToPos, findSelectedNodeOfType, flatten, getMarkFromSchema, getNodeFromSchema, markRule }; | ||
export { browser, calculateNodePosition, calculateTextPosition, cloneTr, customInputRules, customInputRulesKey, equalNodeType, findChildren, findChildrenByMark, findParentNode, findParentNodeClosestToPos, findSelectedNodeOfType, flatten, getMarkFromSchema, getNodeFromSchema, markRule, posToDOMRect }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@milkdown/prose", | ||
"type": "module", | ||
"version": "6.5.4", | ||
"version": "7.0.0-next.0", | ||
"license": "MIT", | ||
@@ -60,2 +60,6 @@ "repository": { | ||
"import": "./lib/view.js" | ||
}, | ||
"./tables": { | ||
"types": "./lib/tables.d.ts", | ||
"import": "./lib/tables.js" | ||
} | ||
@@ -99,2 +103,5 @@ }, | ||
"lib/view.d.ts" | ||
], | ||
"tables": [ | ||
"lib/tables.d.ts" | ||
] | ||
@@ -117,6 +124,7 @@ } | ||
"prosemirror-state": "^1.4.1", | ||
"prosemirror-tables": "^1.2.5", | ||
"prosemirror-transform": "^1.7.0", | ||
"prosemirror-view": "^1.28.0", | ||
"tslib": "^2.4.0", | ||
"@milkdown/exception": "6.5.4" | ||
"@milkdown/exception": "7.0.0-next.0" | ||
}, | ||
@@ -123,0 +131,0 @@ "nx": { |
@@ -47,3 +47,3 @@ /* Copyright 2021, Milkdown by Mirone. */ | ||
return stored | ||
return tr.selectionSet || tr.docChanged ? null : prev | ||
return (tr.selectionSet || tr.docChanged) ? null : prev | ||
}, | ||
@@ -50,0 +50,0 @@ }, |
@@ -64,1 +64,37 @@ /* Copyright 2021, Milkdown by Mirone. */ | ||
} | ||
function minMax(value = 0, min = 0, max = 0): number { | ||
return Math.min(Math.max(value, min), max) | ||
} | ||
export function posToDOMRect(view: EditorView, from: number, to: number): DOMRect { | ||
const minPos = 0 | ||
const maxPos = view.state.doc.content.size | ||
const resolvedFrom = minMax(from, minPos, maxPos) | ||
const resolvedEnd = minMax(to, minPos, maxPos) | ||
const start = view.coordsAtPos(resolvedFrom) | ||
const end = view.coordsAtPos(resolvedEnd, -1) | ||
const top = Math.min(start.top, end.top) | ||
const bottom = Math.max(start.bottom, end.bottom) | ||
const left = Math.min(start.left, end.left) | ||
const right = Math.max(start.right, end.right) | ||
const width = right - left | ||
const height = bottom - top | ||
const x = left | ||
const y = top | ||
const data = { | ||
top, | ||
bottom, | ||
left, | ||
right, | ||
width, | ||
height, | ||
x, | ||
y, | ||
} | ||
return { | ||
...data, | ||
toJSON: () => data, | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
70184
81
1046
14
2
+ Addedprosemirror-tables@^1.2.5
+ Added@milkdown/exception@7.0.0-next.0(transitive)
+ Addedprosemirror-tables@1.6.2(transitive)
- Removed@milkdown/exception@6.5.4(transitive)