Yes, you are probably right that it will never be as “solid” as simply having contenteditable turned off if one simply wants to prevent editing. It’s for situations when it gets into more complicated areas – allow text input but no new line breaks, adding but not deletion, generally allowing editing but prohibiting the deletion of certain items, etc. that it would be good to have such an alternative. Thanks so much for considering this!
You said this before and I feel I am missing something. It seems to me that if I just have ranges, and my saving consists of saving a full version every few minutes and in-between that diffs, for ranges, I will need to save the serialized version of these ranges with every full version. For everything beyond that, I will need to record the version of the doc that the range applies to. To be sure the range was actually applied with the correct version, I will probably want the range addition to have its own version number.
My document A was last sent to the server in a full version 1:50 minutes ago at version 200. Since then 50 more steps have been applied, but we only have them in the form of diffs that were sent around. If a new client connects, that client will first take the entire document at version 200 and will additionally receive the diffs which he applies to get version 250, which is what everyone else has.
Now we add ranges to the mix. At version 200, the document already had 10 different ranges. When one of the clients sent in the full version 200 to the server, the client also sent the placement of those 10 ranges in. These ten ranges can be restores easily by adding them right after loading version 200 and before applying the other 50 steps. Three more ranges were added between 200 and 250: at 211, 231 and 241. For each of these it was recorded what number they were at the time. To add these, after loading version 200 and adding the 10 ranges, we add diffs corresponding to 11 steps, then add the first new range, then 20 more steps, then add another range, then 10 more, then the last range, then 9 more steps. Ten seconds later, another client sends in the full version of the document - at this stage with all 13 ranges and their placement at version 280 (or wherever the document is at).
This is how you are thinking?
I guess this is possible, but it requires for the server to have quite complex logic running. And I am not sure what would happen if a client doesn’t receive the addition of a specific range. If the range addition doesn’t add an extra step, then the client won’t get any notice about the missing range-addition and the diff he sends in will still be accepted…