refactor: replace :block/left with :block/order

Finally no need to worry about parent-left conflicts and broken chain.
With :block/order, we only need to re-compute new orders for siblings
with same order (it can happens if there're bugs in our code, or
updates from rtc), but it doesn't break UI.

Another huge potential benefit after discussing with Zhiyuan is:
Ee might be able to simplify both RTC and undo/redo, currently, we
need to handle each new op for both of them, with recently
refactorings like properties being db attributes, :block/order
is a string instead of a ref, we can handle most property value
conflicts using last-write-wins, and others (e.g. :block/parent,
property with :default type) specifically.

I haven't fixed the issues of using :block/left in RTC and undo/redo,
because we might change both soon.
This commit is contained in:
Tienson Qin
2024-05-01 03:37:42 +08:00
parent 439d6e6da7
commit 1ec4796eff
65 changed files with 503 additions and 1412 deletions

View File

@@ -27,7 +27,7 @@
(mldoc/->edn text format)
text format
{:page-name (:block/name (db/entity page-id))})
blocks' (gp-block/with-parent-and-left page-id blocks)]
blocks' (gp-block/with-parent-and-order page-id blocks)]
(editor-handler/paste-blocks blocks' {:keep-uuid? true}))))
(defn- paste-segmented-text