I’ve got a use case where the editor of a document can embed “redacted” blocks. These blocks are completely stripped out of the document when it’s delivered to a consumer, who views the document in a read-only mode. This works fine as long as the document can’t be changed in this state.
I’m wondering if there’s a way to allow editing in this state, as well. It seems like there might be a creative way to model this as a in-flight rebasing sort of problem, but it seems like it might get a little sticky.
I have a few ideas:
-
Treat editing like an inversion of the read. The user edits their redacted document, the changes are sent, the “unredaction” changes are treated like a transaction that comes just before the user changes, the user changes are rebased on top of these, and the results are saved.
-
Rather than literally removing redacted blocks and remapping the document, the redaction creates a node of size N, where N is the size of the actual node. The “fake” node takes up actual-space in the document without taking up visual space. Not sure if this is possible, and would have to somehow prevent this node from being deleted by those without permission.
Could also have a redacted node’s text content replaced with spoiler tags, but the presence of a secret is a secret itself, and this seems to run into the editable islands problem that Marijn advises against in another post.
Anyone have any ideas? Is there a simpler solution here that I’m totally missing?