code style

This commit is contained in:
Philipp Kühn 2021-12-03 10:40:56 +01:00
parent b4ab7f079b
commit a96a57dd81

View File

@ -8,10 +8,21 @@ export default function resolveFocusPosition(
position: FocusPosition = null,
): Selection | null {
if (!position) { return null }
if (position === 'start' || position === true) { return Selection.atStart(doc) }
if (position === 'end') { return Selection.atEnd(doc) }
if (position === 'all') { return TextSelection.create(doc, 0, doc.content.size) }
if (!position) {
return null
}
if (position === 'start' || position === true) {
return Selection.atStart(doc)
}
if (position === 'end') {
return Selection.atEnd(doc)
}
if (position === 'all') {
return TextSelection.create(doc, 0, doc.content.size)
}
// Check if `position` is in bounds of the doc if `position` is a number.
const minPos = Selection.atStart(doc).from