mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 19:59:02 +08:00
remove prosemirror-utils
This commit is contained in:
parent
126894d9d1
commit
d13210820d
@ -41,7 +41,6 @@
|
||||
"prosemirror-state": "^1.3.4",
|
||||
"prosemirror-tables": "^1.1.1",
|
||||
"prosemirror-transform": "^1.2.9",
|
||||
"prosemirror-utils": "^1.0.0-0",
|
||||
"prosemirror-view": "^1.16.3"
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { findParentNode } from 'prosemirror-utils'
|
||||
import { NodeType } from 'prosemirror-model'
|
||||
import { Command } from '../types'
|
||||
import getNodeType from '../helpers/getNodeType'
|
||||
import findParentNode from '../helpers/findParentNode'
|
||||
import isList from '../helpers/isList'
|
||||
|
||||
/**
|
||||
|
7
packages/core/src/helpers/findParentNode.ts
Normal file
7
packages/core/src/helpers/findParentNode.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { Selection } from 'prosemirror-state'
|
||||
import findParentNodeClosestToPos from './findParentNodeClosestToPos'
|
||||
import { Predicate } from '../types'
|
||||
|
||||
export default function findParentNode(predicate: Predicate) {
|
||||
return (selection: Selection) => findParentNodeClosestToPos(selection.$from, predicate)
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
import { ResolvedPos, Node as ProsemirrorNode } from 'prosemirror-model'
|
||||
|
||||
export type Predicate = (node: ProsemirrorNode) => boolean
|
||||
import { ResolvedPos, Node as ProseMirrorNode } from 'prosemirror-model'
|
||||
import { Predicate } from '../types'
|
||||
|
||||
export default function findParentNodeClosestToPos($pos: ResolvedPos, predicate: Predicate): ({
|
||||
pos: number,
|
||||
start: number,
|
||||
depth: number,
|
||||
node: ProsemirrorNode,
|
||||
node: ProseMirrorNode,
|
||||
} | undefined) {
|
||||
for (let i = $pos.depth; i > 0; i -= 1) {
|
||||
const node = $pos.node(i)
|
||||
|
@ -135,3 +135,5 @@ export type Range = {
|
||||
from: number,
|
||||
to: number,
|
||||
}
|
||||
|
||||
export type Predicate = (node: ProseMirrorNode) => boolean
|
||||
|
@ -11874,11 +11874,6 @@ prosemirror-transform@^1.2.9:
|
||||
dependencies:
|
||||
prosemirror-model "^1.0.0"
|
||||
|
||||
prosemirror-utils@^1.0.0-0:
|
||||
version "1.0.0-0"
|
||||
resolved "https://registry.yarnpkg.com/prosemirror-utils/-/prosemirror-utils-1.0.0-0.tgz#7dfd112abf69001508a76200f9c8660fda7fa85f"
|
||||
integrity sha512-11hTMG4Qwqlux6Vwp/4m16mLDg6IwWb0/odsWXGtWvvRJo61SfG0RGYlA8H72vExmbnWpiXa7PNenZ6t12Rkqw==
|
||||
|
||||
prosemirror-view@^1.0.0, prosemirror-view@^1.1.0, prosemirror-view@^1.13.3, prosemirror-view@^1.16.3:
|
||||
version "1.17.2"
|
||||
resolved "https://registry.yarnpkg.com/prosemirror-view/-/prosemirror-view-1.17.2.tgz#666c865ae79e129a8933112bdcdf218a42c5a3b5"
|
||||
|
Loading…
Reference in New Issue
Block a user