Checklists in the body, colour from tags, and commit-derived CalVer #4
@@ -10,10 +10,18 @@ position in the text, so a separate list could only ever render AFTER the prose.
|
|||||||
the items in the body, a list can sit between two paragraphs — which is the thing that
|
the items in the body, a list can sit between two paragraphs — which is the thing that
|
||||||
could not be built before and no amount of restyling would have delivered.
|
could not be built before and no amount of restyling would have delivered.
|
||||||
|
|
||||||
## This migration rewrites real content
|
## This migration rewrites note bodies
|
||||||
|
|
||||||
Every note that has items gets its body appended to. The Google Keep import is genuine
|
Every note that has items gets its body appended to. The rules below are strict
|
||||||
content on this instance, not fixtures, so the rules here are strict:
|
because rewriting somebody's text deserves it — not, as an earlier draft of this
|
||||||
|
docstring claimed, because this instance holds imported Google Keep notes. It does
|
||||||
|
not; note 2916's headline is that nothing here is anyone's work but the operator's
|
||||||
|
test data. What 2916 actually says about imports is conditional — text arriving from
|
||||||
|
another app WOULD be real, and any import path has to treat it that way — and the
|
||||||
|
importer this migration shares a format with is one nobody here has run.
|
||||||
|
|
||||||
|
Careful was still the right call. It cost little, and the same care is what the rule
|
||||||
|
demands the day someone does import something:
|
||||||
|
|
||||||
* Rows are read BEFORE the table is dropped, in this one transaction.
|
* Rows are read BEFORE the table is dropped, in this one transaction.
|
||||||
* The existing body is never rewritten, only appended to.
|
* The existing body is never rewritten, only appended to.
|
||||||
|
|||||||
@@ -83,8 +83,12 @@ fun BlockBody(
|
|||||||
onFocus(if (blocks[index].value.text.isBlank()) block.id else next)
|
onFocus(if (blocks[index].value.text.isBlank()) block.id else next)
|
||||||
},
|
},
|
||||||
onDelete = {
|
onDelete = {
|
||||||
onChange(blocks.withoutIndex(index))
|
val remaining = blocks.withoutIndex(index)
|
||||||
onFocus(blocks.getOrNull(index - 1)?.id)
|
onChange(remaining)
|
||||||
|
// The row above — or, for the FIRST row, whichever one takes
|
||||||
|
// its place. `index - 1` alone is -1 there, which left the
|
||||||
|
// keyboard up with nothing focused.
|
||||||
|
onFocus(remaining.getOrNull((index - 1).coerceAtLeast(0))?.id)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user