mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-21 00:13:58 +08:00
15 lines
345 B
TypeScript
15 lines
345 B
TypeScript
|
import { Command } from '../Editor'
|
||
|
|
||
|
export default (attributes: {}): Command => ({ tr, state, dispatch }) => {
|
||
|
const { selection } = tr
|
||
|
const { from, to } = selection
|
||
|
|
||
|
state.doc.nodesBetween(from, to, (node, pos) => {
|
||
|
if (!node.type.isText && dispatch) {
|
||
|
tr.setNodeMarkup(pos, undefined, attributes)
|
||
|
}
|
||
|
})
|
||
|
|
||
|
return true
|
||
|
}
|