Skip to content

Commit

Permalink
extendMarkRange() is unused
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Apr 5, 2024
1 parent 988b81b commit 2a38680
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions src/extendMarkRange.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Thanks, tiptap
import { TextSelection } from "prosemirror-state"

function objectIncludes(object1, object2) {
const keys = Object.keys(object2)

Expand Down Expand Up @@ -66,22 +64,3 @@ export function getMarkRange($pos, type, attributes = {}) {
to: endPos,
}
}

export const extendMarkRange =
(type, attributes = {}) =>
(state, dispatch) => {
const { doc } = state
const { $from, from, to } = state.selection

if (dispatch) {
const range = getMarkRange($from, type, attributes)

if (range && range.from <= from && range.to >= to) {
const newSelection = TextSelection.create(doc, range.from, range.to)

dispatch(state.tr.setSelection(newSelection))
}
}

return true
}

0 comments on commit 2a38680

Please sign in to comment.