fix: add support for multiple ranges in clipboardTextSerializer, fix #1982

This commit is contained in:
Philipp Kühn 2021-12-05 17:20:43 +01:00
parent 4cb9fe0e27
commit 98a1cb3640

View File

@ -15,7 +15,9 @@ export const ClipboardTextSerializer = Extension.create({
const { editor } = this
const { state, schema } = editor
const { doc, selection } = state
const { from, to } = selection
const { ranges } = selection
const from = Math.min(...ranges.map(range => range.$from.pos))
const to = Math.max(...ranges.map(range => range.$to.pos))
const textSerializers = getTextSeralizersFromSchema(schema)
const range = { from, to }