mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-06-13 05:11:04 +08:00
don’t check for canReplaceWith within replaceRange
This commit is contained in:
parent
e0895bd919
commit
b131330ca1
@ -16,15 +16,15 @@ declare module '@tiptap/core' {
|
|||||||
export const replaceRange: RawCommands['replaceRange'] = (range, typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
|
export const replaceRange: RawCommands['replaceRange'] = (range, typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
|
||||||
const type = getNodeType(typeOrName, state.schema)
|
const type = getNodeType(typeOrName, state.schema)
|
||||||
const { from, to } = range
|
const { from, to } = range
|
||||||
const $from = tr.doc.resolve(from)
|
// const $from = tr.doc.resolve(from)
|
||||||
const index = $from.index()
|
// const index = $from.index()
|
||||||
|
|
||||||
if (!$from.parent.canReplaceWith(index, index, type)) {
|
// if (!$from.parent.canReplaceWith(index, index, type)) {
|
||||||
return false
|
// return false
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (dispatch) {
|
if (dispatch) {
|
||||||
tr.replaceWith(from, to, type.create(attributes))
|
tr.replaceRangeWith(from, to, type.create(attributes))
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user