Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

chore: create redo/undo bridge (#2760)

Kilu.He95f8b2e9a4b8
diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.lock b/frontend/appflowy_tauri/src-tauri/Cargo.lock
index 5d0d094eac..74f9243974 100644
--- a/frontend/appflowy_tauri/src-tauri/Cargo.lock
+++ b/frontend/appflowy_tauri/src-tauri/Cargo.lock
@@ -23,7 +23,7 @@ version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
dependencies = [
- "getrandom 0.2.9",
+ "getrandom 0.2.10",
"once_cell",
"version_check",
]
@@ -50,9 +50,9 @@ dependencies = [
[[package]]
name = "aho-corasick"
-version = "1.0.1"
+version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04"
+checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41"
dependencies = [
"memchr",
]
@@ -72,6 +72,12 @@ dependencies = [
"alloc-no-stdlib",
]
+[[package]]
+name = "android-tzdata"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
+
[[package]]
name = "android_system_properties"
version = "0.1.5"
@@ -139,9 +145,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]]
name = "arrayvec"
-version = "0.7.2"
+version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
+checksum = "8868f09ff8cea88b079da74ae569d9b8c62a23c68c746240b704ee6f7525c89c"
[[package]]
name = "async-stream"
@@ -162,7 +168,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.16",
+ "syn 2.0.18",
]
[[package]]
@@ -173,7 +179,7 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.16",
+ "syn 2.0.18",
]
[[package]]
@@ -214,9 +220,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "aws-config"
-version = "0.55.2"
+version = "0.55.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc00553f5f3c06ffd4510a9d576f92143618706c45ea6ff81e84ad9be9588abd"
+checksum = "bcdcf0d683fe9c23d32cf5b53c9918ea0a500375a9fb20109802552658e576c9"
dependencies = [
"aws-credential-types",
"aws-http",
@@ -235,7 +241,7 @@ dependencies = [
"http",
"hyper",
"ring",
- "time 0.3.15",
+ "time 0.3.22",
"tokio",
"tower",
"tracing",
@@ -244,9 +250,9 @@ dependencies = [
[[package]]
name = "aws-credential-types"
-version = "0.55.2"
+version = "0.55.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4cb57ac6088805821f78d282c0ba8aec809f11cbee10dda19a97b03ab040ccc2"
+checksum = "1fcdb2f7acbc076ff5ad05e7864bdb191ca70a6fd07668dc3a1a8bcd051de5ae"
dependencies = [
"aws-smithy-async",
"aws-smithy-types",
@@ -258,9 +264,9 @@ dependencies = [
[[package]]
name = "aws-endpoint"
-version = "0.55.2"
+version = "0.55.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c5f6f84a4f46f95a9bb71d9300b73cd67eb868bc43ae84f66ad34752299f4ac"
+checksum = "8cce1c41a6cfaa726adee9ebb9a56fcd2bbfd8be49fd8a04c5e20fd968330b04"
dependencies = [
"aws-smithy-http",
"aws-smithy-types",
@@ -272,9 +278,9 @@ dependencies = [
[[package]]
name = "aws-http"
-version = "0.55.2"
+version = "0.55.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a754683c322f7dc5167484266489fdebdcd04d26e53c162cad1f3f949f2c5671"
+checksum = "aadbc44e7a8f3e71c8b374e03ecd972869eb91dd2bc89ed018954a52ba84bc44"
dependencies = [
"aws-credential-types",
"aws-smithy-http",
@@ -317,9 +323,9 @@ dependencies = [
[[package]]
name = "aws-sdk-sso"
-version = "0.27.0"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "babfd626348836a31785775e3c08a4c345a5ab4c6e06dfd9167f2bee0e6295d6"
+checksum = "c8b812340d86d4a766b2ca73f740dfd47a97c2dff0c06c8517a16d88241957e4"
dependencies = [
"aws-credential-types",
"aws-endpoint",
@@ -342,9 +348,9 @@ dependencies = [
[[package]]
name = "aws-sdk-sts"
-version = "0.27.0"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d0fbe3c2c342bc8dfea4bb43937405a8ec06f99140a0dcb9c7b59e54dfa93a1"
+checksum = "265fac131fbfc188e5c3d96652ea90ecc676a934e3174eaaee523c6cec040b3b"
dependencies = [
"aws-credential-types",
"aws-endpoint",
@@ -368,9 +374,9 @@ dependencies = [
[[package]]
name = "aws-sig-auth"
-version = "0.55.2"
+version = "0.55.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "84dc92a63ede3c2cbe43529cb87ffa58763520c96c6a46ca1ced80417afba845"
+checksum = "3b94acb10af0c879ecd5c7bdf51cda6679a0a4f4643ce630905a77673bfa3c61"
dependencies = [
"aws-credential-types",
"aws-sigv4",
@@ -382,9 +388,9 @@ dependencies = [
[[package]]
name = "aws-sigv4"
-version = "0.55.2"
+version = "0.55.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "392fefab9d6fcbd76d518eb3b1c040b84728ab50f58df0c3c53ada4bea9d327e"
+checksum = "9d2ce6f507be68e968a33485ced670111d1cbad161ddbbab1e313c03d37d8f4c"
dependencies = [
"aws-smithy-http",
"form_urlencoded",
@@ -395,15 +401,15 @@ dependencies = [
"percent-encoding",
"regex",
"sha2",
- "time 0.3.15",
+ "time 0.3.22",
"tracing",
]
[[package]]
name = "aws-smithy-async"
-version = "0.55.2"
+version = "0.55.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ae23b9fe7a07d0919000116c4c5c0578303fbce6fc8d32efca1f7759d4c20faf"
+checksum = "13bda3996044c202d75b91afeb11a9afae9db9a721c6a7a427410018e286b880"
dependencies = [
"futures-util",
"pin-project-lite",
@@ -413,9 +419,9 @@ dependencies = [
[[package]]
name = "aws-smithy-client"
-version = "0.55.2"
+version = "0.55.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5230d25d244a51339273b8870f0f77874cd4449fb4f8f629b21188ae10cfc0ba"
+checksum = "0a86aa6e21e86c4252ad6a0e3e74da9617295d8d6e374d552be7d3059c41cedd"
dependencies = [
"aws-smithy-async",
"aws-smithy-http",
@@ -437,9 +443,9 @@ dependencies = [
[[package]]
name = "aws-smithy-http"
-version = "0.55.2"
+version = "0.55.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b60e2133beb9fe6ffe0b70deca57aaeff0a35ad24a9c6fab2fd3b4f45b99fdb5"
+checksum = "2b3b693869133551f135e1f2c77cb0b8277d9e3e17feaf2213f735857c4f0d28"
dependencies = [
"aws-smithy-types",
"bytes",
@@ -459,9 +465,9 @@ dependencies = [
[[package]]
name = "aws-smithy-http-tower"
-version = "0.55.2"
+version = "0.55.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3a4d94f556c86a0dd916a5d7c39747157ea8cb909ca469703e20fee33e448b67"
+checksum = "3ae4f6c5798a247fac98a867698197d9ac22643596dc3777f0c76b91917616b9"
dependencies = [
"aws-smithy-http",
"aws-smithy-types",
@@ -475,18 +481,18 @@ dependencies = [
[[package]]
name = "aws-smithy-json"
-version = "0.55.2"
+version = "0.55.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ce3d6e6ebb00b2cce379f079ad5ec508f9bcc3a9510d9b9c1840ed1d6f8af39"
+checksum = "23f9f42fbfa96d095194a632fbac19f60077748eba536eb0b9fecc28659807f8"
dependencies = [
"aws-smithy-types",
]
[[package]]
name = "aws-smithy-query"
-version = "0.55.2"
+version = "0.55.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d58edfca32ef9bfbc1ca394599e17ea329cb52d6a07359827be74235b64b3298"
+checksum = "98819eb0b04020a1c791903533b638534ae6c12e2aceda3e6e6fba015608d51d"
dependencies = [
"aws-smithy-types",
"urlencoding",
@@ -494,31 +500,31 @@ dependencies = [
[[package]]
name = "aws-smithy-types"
-version = "0.55.2"
+version = "0.55.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "58db46fc1f4f26be01ebdb821751b4e2482cd43aa2b64a0348fb89762defaffa"
+checksum = "16a3d0bf4f324f4ef9793b86a1701d9700fbcdbd12a846da45eed104c634c6e8"
dependencies = [
"base64-simd",
"itoa 1.0.6",
"num-integer",
"ryu",
- "time 0.3.15",
+ "time 0.3.22",
]
[[package]]
name = "aws-smithy-xml"
-version = "0.55.2"
+version = "0.55.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb557fe4995bd9ec87fb244bbb254666a971dc902a783e9da8b7711610e9664c"
+checksum = "b1b9d12875731bd07e767be7baad95700c3137b56730ec9ddeedb52a5e5ca63b"
dependencies = [
"xmlparser",
]
[[package]]
name = "aws-types"
-version = "0.55.2"
+version = "0.55.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de0869598bfe46ec44ffe17e063ed33336e59df90356ca8ff0e8da6f7c1d994b"
+checksum = "6dd209616cc8d7bfb82f87811a5c655dc97537f592689b18743bddf5dc5c4829"
dependencies = [
"aws-credential-types",
"aws-smithy-async",
@@ -553,9 +559,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]]
name = "base64"
-version = "0.21.0"
+version = "0.21.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a"
+checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d"
[[package]]
name = "base64-simd"
@@ -594,7 +600,7 @@ dependencies = [
"regex",
"rustc-hash",
"shlex",
- "syn 2.0.16",
+ "syn 2.0.18",
]
[[package]]
@@ -722,9 +728,9 @@ dependencies = [
[[package]]
name = "bstr"
-version = "1.4.0"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09"
+checksum = "a246e68bb43f6cd9db24bea052a53e40405417c5fb372e3d1a8a7f770a564ef5"
dependencies = [
"memchr",
"serde",
@@ -732,9 +738,9 @@ dependencies = [
[[package]]
name = "bumpalo"
-version = "3.12.2"
+version = "3.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c6ed94e98ecff0c12dd1b04c15ec0d7d9458ca8fe806cea6f12954efe74c63b"
+checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"
[[package]]
name = "bytecheck"
@@ -826,12 +832,12 @@ dependencies = [
[[package]]
name = "cargo_toml"
-version = "0.15.2"
+version = "0.15.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f83bc2e401ed041b7057345ebc488c005efa0341d5541ce7004d30458d0090b"
+checksum = "599aa35200ffff8f04c1925aa1acc92fa2e08874379ef42e210a80e527e60838"
dependencies = [
"serde",
- "toml 0.7.3",
+ "toml 0.7.4",
]
[[package]]
@@ -880,9 +886,9 @@ dependencies = [
[[package]]
name = "cfg-expr"
-version = "0.15.1"
+version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c8790cf1286da485c72cf5fc7aeba308438800036ec67d89425924c4807268c9"
+checksum = "e70d3ad08698a0568b0562f22710fe6bfc1f4a61a367c77d0398c562eadd453a"
dependencies = [
"smallvec",
"target-lexicon",
@@ -896,13 +902,13 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
-version = "0.4.24"
+version = "0.4.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b"
+checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5"
dependencies = [
+ "android-tzdata",
"iana-time-zone",
"js-sys",
- "num-integer",
"num-traits",
"serde",
"time 0.1.45",
@@ -1064,7 +1070,7 @@ source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e9f7fc#e9f7fc76
dependencies = [
"anyhow",
"async-trait",
- "base64 0.21.0",
+ "base64 0.21.2",
"chrono",
"collab",
"collab-derive",
@@ -1163,7 +1169,7 @@ dependencies = [
"aws-config",
"aws-credential-types",
"aws-sdk-dynamodb",
- "base64 0.21.0",
+ "base64 0.21.2",
"collab",
"collab-client-ws",
"collab-persistence",
@@ -1337,9 +1343,9 @@ dependencies = [
[[package]]
name = "crossbeam-epoch"
-version = "0.9.14"
+version = "0.9.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695"
+checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7"
dependencies = [
"autocfg",
"cfg-if",
@@ -1350,9 +1356,9 @@ dependencies = [
[[package]]
name = "crossbeam-utils"
-version = "0.8.15"
+version = "0.8.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b"
+checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
dependencies = [
"cfg-if",
]
@@ -1386,19 +1392,19 @@ dependencies = [
[[package]]
name = "cssparser-macros"
-version = "0.6.0"
+version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dfae75de57f2b2e85e8768c3ea840fd159c8f33e2b6522c7835b7abac81be16e"
+checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331"
dependencies = [
"quote",
- "syn 1.0.109",
+ "syn 2.0.18",
]
[[package]]
name = "csv"
-version = "1.2.1"
+version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b015497079b9a9d69c02ad25de6c0a6edef051ea6360a327d0bd05802ef64ad"
+checksum = "626ae34994d3d8d668f4269922248239db4ae42d538b14c398b74a52208e8086"
dependencies = [
"csv-core",
"itoa 1.0.6",
@@ -1425,12 +1431,6 @@ dependencies = [
"syn 1.0.109",
]
-[[package]]
-name = "cty"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
-
[[package]]
name = "darling"
version = "0.20.1"
@@ -1452,7 +1452,7 @@ dependencies = [
"proc-macro2",
"quote",
"strsim",
- "syn 2.0.16",
+ "syn 2.0.18",
]
[[package]]
@@ -1463,7 +1463,7 @@ checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a"
dependencies = [
"darling_core",
"quote",
- "syn 2.0.16",
+ "syn 2.0.18",
]
[[package]]
@@ -1476,7 +1476,7 @@ dependencies = [
"hashbrown 0.12.3",
"lock_api",
"once_cell",
- "parking_lot_core 0.9.7",
+ "parking_lot_core 0.9.8",
]
[[package]]
@@ -1552,9 +1552,9 @@ dependencies = [
[[package]]
name = "digest"
-version = "0.10.6"
+version = "0.10.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f"
+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
"block-buffer 0.10.4",
"crypto-common",
@@ -1590,15 +1590,15 @@ checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"
[[package]]
name = "dtoa"
-version = "0.4.8"
+version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0"
+checksum = "65d09067bfacaa79114679b279d7f5885b53295b1e2cfb4e79c8e4bd3d633169"
[[package]]
name = "dtoa-short"
-version = "0.3.3"
+version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bde03329ae10e79ede66c9ce4dc930aa8599043b0743008548680f25b91502d6"
+checksum = "dbaceec3c6e4211c79e7b1800fb9680527106beb2f9c51904a3210c03a448c74"
dependencies = [
"dtoa",
]
@@ -1629,7 +1629,7 @@ checksum = "80663502655af01a2902dff3f06869330782267924bf1788410b74edcd93770a"
dependencies = [
"cc",
"rustc_version",
- "toml 0.7.3",
+ "toml 0.7.4",
"vswhom",
"winreg 0.11.0",
]
@@ -1736,9 +1736,9 @@ dependencies = [
[[package]]
name = "field-offset"
-version = "0.3.5"
+version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a3cf3a800ff6e860c863ca6d4b16fd999db8b752819c1606884047b73e468535"
+checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f"
dependencies = [
"memoffset",
"rustc_version",
@@ -1927,6 +1927,7 @@ dependencies = [
"strum_macros",
"tokio",
"tracing",
+ "uuid",
]
[[package]]
@@ -2123,9 +2124,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]]
name = "form_urlencoded"
-version = "1.1.0"
+version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8"
+checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652"
dependencies = [
"percent-encoding",
]
@@ -2212,7 +2213,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.16",
+ "syn 2.0.18",
]
[[package]]
@@ -2388,9 +2389,9 @@ dependencies = [
[[package]]
name = "getrandom"
-version = "0.2.9"
+version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4"
+checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
dependencies = [
"cfg-if",
"libc",
@@ -2653,7 +2654,7 @@ version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
dependencies = [
- "digest 0.10.6",
+ "digest 0.10.7",
]
[[package]]
@@ -2776,9 +2777,9 @@ checksum = "0646026eb1b3eea4cd9ba47912ea5ce9cc07713d105b1a14698f4e6433d348b7"
dependencies = [
"http",
"hyper",
- "rustls 0.21.1",
+ "rustls 0.21.2",
"tokio",
- "tokio-rustls 0.24.0",
+ "tokio-rustls 0.24.1",
]
[[package]]
@@ -2796,9 +2797,9 @@ dependencies = [
[[package]]
name = "iana-time-zone"
-version = "0.1.56"
+version = "0.1.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c"
+checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613"
dependencies = [
"android_system_properties",
"core-foundation-sys",
@@ -2846,9 +2847,9 @@ dependencies = [
[[package]]
name = "idna"
-version = "0.3.0"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6"
+checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
dependencies = [
"unicode-bidi",
"unicode-normalization",
@@ -2856,11 +2857,10 @@ dependencies = [
[[package]]
name = "ignore"
-version = "0.4.18"
+version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "713f1b139373f96a2e0ce3ac931cd01ee973c3c5dd7c40c0c2efe96ad2b6751d"
+checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492"
dependencies = [
- "crossbeam-utils",
"globset",
"lazy_static",
"log",
@@ -2916,9 +2916,9 @@ dependencies = [
[[package]]
name = "io-lifetimes"
-version = "1.0.10"
+version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220"
+checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
dependencies = [
"hermit-abi 0.3.1",
"libc",
@@ -3006,9 +3006,9 @@ dependencies = [
[[package]]
name = "js-sys"
-version = "0.3.63"
+version = "0.3.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790"
+checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a"
dependencies = [
"wasm-bindgen",
]
@@ -3156,9 +3156,9 @@ dependencies = [
[[package]]
name = "libc"
-version = "0.2.144"
+version = "0.2.146"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"
+checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b"
[[package]]
name = "libloading"
@@ -3230,15 +3230,15 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "linux-raw-sys"
-version = "0.3.7"
+version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ece97ea872ece730aed82664c424eb4c8291e1ff2480247ccf7409044bc6479f"
+checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
[[package]]
name = "lock_api"
-version = "0.4.9"
+version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"
+checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16"
dependencies = [
"autocfg",
"scopeguard",
@@ -3246,12 +3246,9 @@ dependencies = [
[[package]]
name = "log"
-version = "0.4.17"
+version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
-dependencies = [
- "cfg-if",
-]
+checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
[[package]]
name = "loom"
@@ -3344,9 +3341,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "memoffset"
-version = "0.8.0"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1"
+checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
dependencies = [
"autocfg",
]
@@ -3405,14 +3402,13 @@ dependencies = [
[[package]]
name = "mio"
-version = "0.8.6"
+version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9"
+checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2"
dependencies = [
"libc",
- "log",
"wasi 0.11.0+wasi-snapshot-preview1",
- "windows-sys 0.45.0",
+ "windows-sys 0.48.0",
]
[[package]]
@@ -3574,15 +3570,6 @@ dependencies = [
"syn 1.0.109",
]
-[[package]]
-name = "num_threads"
-version = "0.1.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44"
-dependencies = [
- "libc",
-]
-
[[package]]
name = "objc"
version = "0.2.7"
@@ -3613,18 +3600,18 @@ dependencies = [
[[package]]
name = "object"
-version = "0.30.3"
+version = "0.30.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439"
+checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385"
dependencies = [
"memchr",
]
[[package]]
name = "once_cell"
-version = "1.17.1"
+version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
+checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
[[package]]
name = "opaque-debug"
@@ -3644,9 +3631,9 @@ dependencies = [
[[package]]
name = "openssl"
-version = "0.10.52"
+version = "0.10.54"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "01b8574602df80f7b85fdfc5392fa884a4e3b3f4f35402c070ab34c3d3f78d56"
+checksum = "69b3f656a17a6cbc115b5c7a40c616947d213ba182135b014d6051b73ab6f019"
dependencies = [
"bitflags",
"cfg-if",
@@ -3665,7 +3652,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.16",
+ "syn 2.0.18",
]
[[package]]
@@ -3676,9 +3663,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-sys"
-version = "0.9.87"
+version = "0.9.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e17f59264b2809d77ae94f0e1ebabc434773f370d6ca667bd223ea10e06cc7e"
+checksum = "c2ce0f250f34a308dcfdbb351f511359857d4ed2134ba715a4eadd46e1ffd617"
dependencies = [
"cc",
"libc",
@@ -3751,7 +3738,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
- "parking_lot_core 0.9.7",
+ "parking_lot_core 0.9.8",
]
[[package]]
@@ -3770,15 +3757,15 @@ dependencies = [
[[package]]
name = "parking_lot_core"
-version = "0.9.7"
+version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521"
+checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447"
dependencies = [
"cfg-if",
"libc",
- "redox_syscall 0.2.16",
+ "redox_syscall 0.3.5",
"smallvec",
- "windows-sys 0.45.0",
+ "windows-targets",
]
[[package]]
@@ -3804,9 +3791,9 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]]
name = "percent-encoding"
-version = "2.2.0"
+version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
+checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
[[package]]
name = "pest"
@@ -3838,7 +3825,7 @@ dependencies = [
"pest_meta",
"proc-macro2",
"quote",
- "syn 2.0.16",
+ "syn 2.0.18",
]
[[package]]
@@ -4016,7 +4003,7 @@ checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.16",
+ "syn 2.0.18",
]
[[package]]
@@ -4043,19 +4030,19 @@ version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bd9647b268a3d3e14ff09c23201133a62589c658db02bb7388c7246aafe0590"
dependencies = [
- "base64 0.21.0",
+ "base64 0.21.2",
"indexmap",
"line-wrap",
"quick-xml",
"serde",
- "time 0.3.15",
+ "time 0.3.22",
]
[[package]]
name = "png"
-version = "0.17.8"
+version = "0.17.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aaeebc51f9e7d2c150d3f3bfeb667f2aa985db5ef1e3d212847bdedb488beeaa"
+checksum = "59871cc5b6cce7eaccca5a802b4173377a1c2ba90654246789a8fa2334426d11"
dependencies = [
"bitflags",
"crc32fast",
@@ -4087,12 +4074,12 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
[[package]]
name = "prettyplease"
-version = "0.2.5"
+version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "617feabb81566b593beb4886fb8c1f38064169dae4dccad0e3220160c3b37203"
+checksum = "3b69d39aab54d069e7f2fe8cb970493e7834601ca2d8c65fd7bbd183578080d1"
dependencies = [
"proc-macro2",
- "syn 2.0.16",
+ "syn 2.0.18",
]
[[package]]
@@ -4146,9 +4133,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"
[[package]]
name = "proc-macro2"
-version = "1.0.58"
+version = "1.0.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa1fb82fc0c281dd9671101b66b771ebbe1eaf967b96ac8740dcba4b70005ca8"
+checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406"
dependencies = [
"unicode-ident",
]
@@ -4271,9 +4258,9 @@ dependencies = [
[[package]]
name = "quote"
-version = "1.0.27"
+version = "1.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500"
+checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
dependencies = [
"proc-macro2",
]
@@ -4355,7 +4342,7 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
- "getrandom 0.2.9",
+ "getrandom 0.2.10",
]
[[package]]
@@ -4378,12 +4365,9 @@ dependencies = [
[[package]]
name = "raw-window-handle"
-version = "0.5.0"
+version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed7e3d950b66e19e0c372f3fa3fbbcf85b1746b571f74e0c2af6042a5c93420a"
-dependencies = [
- "cty",
-]
+checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9"
[[package]]
name = "rayon"
@@ -4437,20 +4421,20 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
dependencies = [
- "getrandom 0.2.9",
+ "getrandom 0.2.10",
"redox_syscall 0.2.16",
"thiserror",
]
[[package]]
name = "regex"
-version = "1.8.1"
+version = "1.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370"
+checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f"
dependencies = [
- "aho-corasick 1.0.1",
+ "aho-corasick 1.0.2",
"memchr",
- "regex-syntax 0.7.1",
+ "regex-syntax 0.7.2",
]
[[package]]
@@ -4470,9 +4454,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
[[package]]
name = "regex-syntax"
-version = "0.7.1"
+version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c"
+checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78"
[[package]]
name = "rend"
@@ -4489,7 +4473,7 @@ version = "0.11.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55"
dependencies = [
- "base64 0.21.0",
+ "base64 0.21.2",
"bytes",
"encoding_rs",
"futures-core",
@@ -4508,14 +4492,14 @@ dependencies = [
"once_cell",
"percent-encoding",
"pin-project-lite",
- "rustls 0.21.1",
+ "rustls 0.21.2",
"rustls-pemfile",
"serde",
"serde_json",
"serde_urlencoded",
"tokio",
"tokio-native-tls",
- "tokio-rustls 0.24.0",
+ "tokio-rustls 0.24.1",
"tower-service",
"url",
"wasm-bindgen",
@@ -4602,7 +4586,7 @@ version = "1.29.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26bd36b60561ee1fb5ec2817f198b6fd09fa571c897a5e86d1487cfc2b096dfc"
dependencies = [
- "arrayvec 0.7.2",
+ "arrayvec 0.7.3",
"borsh",
"bytecheck",
"byteorder",
@@ -4647,9 +4631,9 @@ dependencies = [
[[package]]
name = "rustix"
-version = "0.37.19"
+version = "0.37.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d"
+checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0"
dependencies = [
"bitflags",
"errno",
@@ -4673,9 +4657,9 @@ dependencies = [
[[package]]
name = "rustls"
-version = "0.21.1"
+version = "0.21.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c911ba11bc8433e811ce56fde130ccf32f5127cab0e0194e9c68c5a5b671791e"
+checksum = "e32ca28af694bc1bbf399c33a516dbdf1c90090b8ab23c2bc24f834aa2247f5f"
dependencies = [
"log",
"ring",
@@ -4685,9 +4669,9 @@ dependencies = [
[[package]]
name = "rustls-native-certs"
-version = "0.6.2"
+version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50"
+checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00"
dependencies = [
"openssl-probe",
"rustls-pemfile",
@@ -4701,7 +4685,7 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b"
dependencies = [
- "base64 0.21.0",
+ "base64 0.21.2",
]
[[package]]
@@ -4799,9 +4783,9 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
[[package]]
name = "security-framework"
-version = "2.9.0"
+version = "2.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca2855b3715770894e67cbfa3df957790aa0c9edc3bf06efa1a84d77fa0839d1"
+checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8"
dependencies = [
"bitflags",
"core-foundation",
@@ -4851,9 +4835,9 @@ dependencies = [
[[package]]
name = "serde"
-version = "1.0.163"
+version = "1.0.164"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2"
+checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d"
dependencies = [
"serde_derive",
]
@@ -4871,13 +4855,13 @@ dependencies = [
[[package]]
name = "serde_derive"
-version = "1.0.163"
+version = "1.0.164"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e"
+checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.16",
+ "syn 2.0.18",
]
[[package]]
@@ -4899,14 +4883,14 @@ checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.16",
+ "syn 2.0.18",
]
[[package]]
name = "serde_spanned"
-version = "0.6.1"
+version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4"
+checksum = "93107647184f6027e3b7dcb2e11034cf95ffa1e3a682c67951963ac69c1c007d"
dependencies = [
"serde",
]
@@ -4925,30 +4909,30 @@ dependencies = [
[[package]]
name = "serde_with"
-version = "2.3.3"
+version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe"
+checksum = "9f02d8aa6e3c385bf084924f660ce2a3a6bd333ba55b35e8590b321f35d88513"
dependencies = [
- "base64 0.13.1",
+ "base64 0.21.2",
"chrono",
"hex",
"indexmap",
"serde",
"serde_json",
"serde_with_macros",
- "time 0.3.15",
+ "time 0.3.22",
]
[[package]]
name = "serde_with_macros"
-version = "2.3.3"
+version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f"
+checksum = "edc7d5d3932fb12ce722ee5e64dd38c504efba37567f0c402f6ca728c3b8b070"
dependencies = [
"darling",
"proc-macro2",
"quote",
- "syn 2.0.16",
+ "syn 2.0.18",
]
[[package]]
@@ -5004,7 +4988,7 @@ checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3"
dependencies = [
"cfg-if",
"cpufeatures",
- "digest 0.10.6",
+ "digest 0.10.7",
]
[[package]]
@@ -5021,7 +5005,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0"
dependencies = [
"cfg-if",
"cpufeatures",
- "digest 0.10.6",
+ "digest 0.10.7",
]
[[package]]
@@ -5244,9 +5228,9 @@ dependencies = [
[[package]]
name = "subtle"
-version = "2.4.1"
+version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
+checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
[[package]]
name = "syn"
@@ -5261,9 +5245,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "2.0.16"
+version = "2.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a6f671d4b5ffdb8eadec19c0ae67fe2639df8684bd7bc4b83d986b8db549cf01"
+checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e"
dependencies = [
"proc-macro2",
"quote",
@@ -5289,18 +5273,18 @@ version = "6.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5fa6fb9ee296c0dc2df41a656ca7948546d061958115ddb0bcaae43ad0d17d2"
dependencies = [
- "cfg-expr 0.15.1",
+ "cfg-expr 0.15.2",
"heck 0.4.1",
"pkg-config",
- "toml 0.7.3",
+ "toml 0.7.4",
"version-compare 0.1.1",
]
[[package]]
name = "tao"
-version = "0.16.1"
+version = "0.16.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dd3cde9c0cd2b872616bba26b818e0d6469330196869d7e5000dba96ce9431df"
+checksum = "6a6d198e01085564cea63e976ad1566c1ba2c2e4cc79578e35d9f05521505e31"
dependencies = [
"bitflags",
"cairo-rs",
@@ -5379,9 +5363,9 @@ checksum = "fd1ba337640d60c3e96bc6f0638a939b9c9a7f2c316a1598c279828b3d1dc8c5"
[[package]]
name = "tauri"
-version = "1.3.0"
+version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d42ba3a2e8556722f31336a0750c10dbb6a81396a1c452977f515da83f69f842"
+checksum = "cc35893c7e08d9564a9206bd52182dce031b0d5132dc946b3e166e00d03f8cfe"
dependencies = [
"anyhow",
"cocoa",
@@ -5426,9 +5410,9 @@ dependencies = [
[[package]]
name = "tauri-build"
-version = "1.3.0"
+version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "929b3bd1248afc07b63e33a6a53c3f82c32d0b0a5e216e4530e94c467e019389"
+checksum = "7d2edd6a259b5591c8efdeb9d5702cb53515b82a6affebd55c7fd6d3a27b7d1b"
dependencies = [
"anyhow",
"cargo_toml",
@@ -5439,16 +5423,15 @@ dependencies = [
"serde_json",
"tauri-utils",
"tauri-winres",
- "winnow",
]
[[package]]
name = "tauri-codegen"
-version = "1.3.0"
+version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5a2105f807c6f50b2fa2ce5abd62ef207bc6f14c9fcc6b8caec437f6fb13bde"
+checksum = "54ad2d49fdeab4a08717f5b49a163bdc72efc3b1950b6758245fcde79b645e1a"
dependencies = [
- "base64 0.21.0",
+ "base64 0.21.2",
"brotli",
"ico",
"json-patch",
@@ -5463,16 +5446,16 @@ dependencies = [
"sha2",
"tauri-utils",
"thiserror",
- "time 0.3.15",
+ "time 0.3.22",
"uuid",
"walkdir",
]
[[package]]
name = "tauri-macros"
-version = "1.3.0"
+version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8784cfe6f5444097e93c69107d1ac5e8f13d02850efa8d8f2a40fe79674cef46"
+checksum = "8eb12a2454e747896929338d93b0642144bb51e0dddbb36e579035731f0d76b7"
dependencies = [
"heck 0.4.1",
"proc-macro2",
@@ -5484,9 +5467,9 @@ dependencies = [
[[package]]
name = "tauri-runtime"
-version = "0.13.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b3b80ea3fcd5fefb60739a3b577b277e8fc30434538a2f5bba82ad7d4368c422"
+checksum = "108683199cb18f96d2d4134187bb789964143c845d2d154848dda209191fd769"
dependencies = [
"gtk",
"http",
@@ -5505,9 +5488,9 @@ dependencies = [
[[package]]
name = "tauri-runtime-wry"
-version = "0.13.0"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d1c396950b1ba06aee1b4ffe6c7cd305ff433ca0e30acbc5fa1a2f92a4ce70f1"
+checksum = "0b7aa256a1407a3a091b5d843eccc1a5042289baf0a43d1179d9f0fcfea37c1b"
dependencies = [
"cocoa",
"gtk",
@@ -5525,12 +5508,13 @@ dependencies = [
[[package]]
name = "tauri-utils"
-version = "1.3.0"
+version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a6f9c2dafef5cbcf52926af57ce9561bd33bb41d7394f8bb849c0330260d864"
+checksum = "03fc02bb6072bb397e1d473c6f76c953cda48b4a2d0cce605df284aa74a12e84"
dependencies = [
"brotli",
"ctor",
+ "dunce",
"glob",
"heck 0.4.1",
"html5ever",
@@ -5558,20 +5542,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5993dc129e544393574288923d1ec447c857f3f644187f4fbf7d9a875fbfc4fb"
dependencies = [
"embed-resource",
- "toml 0.7.3",
+ "toml 0.7.4",
]
[[package]]
name = "tempfile"
-version = "3.5.0"
+version = "3.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998"
+checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6"
dependencies = [
+ "autocfg",
"cfg-if",
"fastrand",
"redox_syscall 0.3.5",
"rustix",
- "windows-sys 0.45.0",
+ "windows-sys 0.48.0",
]
[[package]]
@@ -5587,9 +5572,9 @@ dependencies = [
[[package]]
name = "tera"
-version = "1.18.1"
+version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95a665751302f22a03c56721e23094e4dc22b04a80f381e6737a07bf7a7c70c0"
+checksum = "a5ab29bb4f3e256ae6ad5c3e2775aa1f8829f2c0c101fc407bfd3a6df15c60c5"
dependencies = [
"chrono",
"chrono-tz 0.6.1",
@@ -5641,7 +5626,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.16",
+ "syn 2.0.18",
]
[[package]]
@@ -5677,14 +5662,29 @@ dependencies = [
[[package]]
name = "time"
-version = "0.3.15"
+version = "0.3.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d634a985c4d4238ec39cacaed2e7ae552fbd3c476b552c1deac3021b7d7eaf0c"
+checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd"
dependencies = [
"itoa 1.0.6",
- "libc",
- "num_threads",
"serde",
+ "time-core",
+ "time-macros",
+]
+
+[[package]]
+name = "time-core"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb"
+
+[[package]]
+name = "time-macros"
+version = "0.2.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b"
+dependencies = [
+ "time-core",
]
[[package]]
@@ -5704,9 +5704,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
-version = "1.28.1"
+version = "1.28.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0aa32867d44e6f2ce3385e89dceb990188b8bb0fb25b0cf576647a6f98ac5105"
+checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2"
dependencies = [
"autocfg",
"bytes",
@@ -5729,7 +5729,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.16",
+ "syn 2.0.18",
]
[[package]]
@@ -5766,11 +5766,11 @@ dependencies = [
[[package]]
name = "tokio-rustls"
-version = "0.24.0"
+version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e0d409377ff5b1e3ca6437aa86c1eb7d40c134bfec254e44c830defa92669db5"
+checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081"
dependencies = [
- "rustls 0.21.1",
+ "rustls 0.21.2",
"tokio",
]
@@ -5836,9 +5836,9 @@ dependencies = [
[[package]]
name = "toml"
-version = "0.7.3"
+version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21"
+checksum = "d6135d499e69981f9ff0ef2167955a5333c35e36f6937d382974566b3d5b94ec"
dependencies = [
"serde",
"serde_spanned",
@@ -5848,18 +5848,18 @@ dependencies = [
[[package]]
name = "toml_datetime"
-version = "0.6.1"
+version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622"
+checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f"
dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
-version = "0.19.8"
+version = "0.19.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13"
+checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739"
dependencies = [
"indexmap",
"serde",
@@ -5928,7 +5928,7 @@ checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.16",
+ "syn 2.0.18",
]
[[package]]
@@ -6151,9 +6151,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
[[package]]
name = "unicode-ident"
-version = "1.0.8"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
+checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0"
[[package]]
name = "unicode-normalization"
@@ -6184,12 +6184,12 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]]
name = "url"
-version = "2.3.1"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643"
+checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb"
dependencies = [
"form_urlencoded",
- "idna 0.3.0",
+ "idna 0.4.0",
"percent-encoding",
"serde",
]
@@ -6208,11 +6208,11 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
[[package]]
name = "uuid"
-version = "1.3.3"
+version = "1.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "345444e32442451b267fc254ae85a209c64be56d2890e601a0c37ff0c3c5ecd2"
+checksum = "0fa2982af2eec27de306107c027578ff7f423d65f7250e40ce0fea8f45248b81"
dependencies = [
- "getrandom 0.2.9",
+ "getrandom 0.2.10",
"sha1_smol",
]
@@ -6299,11 +6299,10 @@ dependencies = [
[[package]]
name = "want"
-version = "0.3.0"
+version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0"
+checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
dependencies = [
- "log",
"try-lock",
]
@@ -6327,9 +6326,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
-version = "0.2.86"
+version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73"
+checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
@@ -6337,24 +6336,24 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
-version = "0.2.86"
+version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb"
+checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd"
dependencies = [
"bumpalo",
"log",
"once_cell",
"proc-macro2",
"quote",
- "syn 2.0.16",
+ "syn 2.0.18",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
-version = "0.4.36"
+version = "0.4.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e"
+checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03"
dependencies = [
"cfg-if",
"js-sys",
@@ -6364,9 +6363,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.86"
+version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258"
+checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -6374,28 +6373,28 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.86"
+version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8"
+checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.16",
+ "syn 2.0.18",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.86"
+version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93"
+checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
[[package]]
name = "web-sys"
-version = "0.3.63"
+version = "0.3.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2"
+checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -6567,7 +6566,7 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
dependencies = [
- "windows-targets 0.48.0",
+ "windows-targets",
]
[[package]]
@@ -6611,37 +6610,13 @@ dependencies = [
"windows_x86_64_msvc 0.42.2",
]
-[[package]]
-name = "windows-sys"
-version = "0.45.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
-dependencies = [
- "windows-targets 0.42.2",
-]
-
[[package]]
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
- "windows-targets 0.48.0",
-]
-
-[[package]]
-name = "windows-targets"
-version = "0.42.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
-dependencies = [
- "windows_aarch64_gnullvm 0.42.2",
- "windows_aarch64_msvc 0.42.2",
- "windows_i686_gnu 0.42.2",
- "windows_i686_msvc 0.42.2",
- "windows_x86_64_gnu 0.42.2",
- "windows_x86_64_gnullvm 0.42.2",
- "windows_x86_64_msvc 0.42.2",
+ "windows-targets",
]
[[package]]
@@ -6781,9 +6756,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
[[package]]
name = "winnow"
-version = "0.4.1"
+version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28"
+checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448"
dependencies = [
"memchr",
]
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/Overlay/index.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/document/Overlay/index.tsx
index ea38d29c92..1b93cda6e2 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/Overlay/index.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/Overlay/index.tsx
@@ -6,10 +6,12 @@ import BlockSlash from '$app/components/document/BlockSlash';
import { useCopy } from '$app/components/document/_shared/CopyPasteHooks/useCopy';
import { usePaste } from '$app/components/document/_shared/CopyPasteHooks/usePaste';
import LinkEditPopover from '$app/components/document/_shared/TextLink/LinkEditPopover';
+import { useUndoRedo } from '$app/components/document/_shared/UndoHooks/useUndoRedo';
export default function Overlay({ container }: { container: HTMLDivElement }) {
useCopy(container);
usePaste(container);
+ useUndoRedo(container);
return (
<>
<BlockSideToolbar container={container} />
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/TextBlock/useKeyDown.ts b/frontend/appflowy_tauri/src/appflowy_app/components/document/TextBlock/useKeyDown.ts
index cf94a19494..c0c968497a 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/TextBlock/useKeyDown.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/TextBlock/useKeyDown.ts
@@ -88,9 +88,11 @@ export function useKeyDown(id: string) {
const onKeyDown = useCallback(
(e: React.KeyboardEvent<HTMLDivElement>) => {
- e.stopPropagation();
const filteredEvents = interceptEvents.filter((event) => event.canHandle(e));
- filteredEvents.forEach((event) => event.handler(e));
+ filteredEvents.forEach((event) => {
+ e.stopPropagation();
+ event.handler(e);
+ });
},
[interceptEvents]
);
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SlateEditor/useSlateYjs.ts b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SlateEditor/useSlateYjs.ts
index 8bf42dcf05..68d06db45c 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SlateEditor/useSlateYjs.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SlateEditor/useSlateYjs.ts
@@ -19,7 +19,7 @@ export function useSlateYjs({ delta }: { delta?: Delta }) {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
- const editor = useMemo(() => withYjs(withReact(createEditor()), sharedType), []);
+ const editor = useMemo(() => withReact(withYjs(createEditor(), sharedType)), []);
// Connect editor in useEffect to comply with concurrent mode requirements.
useEffect(() => {
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/UndoHooks/useUndoRedo.ts b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/UndoHooks/useUndoRedo.ts
new file mode 100644
index 0000000000..f2a9944438
--- /dev/null
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/UndoHooks/useUndoRedo.ts
@@ -0,0 +1,39 @@
+import { useCallback, useContext, useEffect } from 'react';
+import { DocumentControllerContext } from '$app/stores/effects/document/document_controller';
+import isHotkey from 'is-hotkey';
+import { Keyboard } from '@/appflowy_app/constants/document/keyboard';
+
+export function useUndoRedo(container: HTMLDivElement) {
+ const controller = useContext(DocumentControllerContext);
+
+ const onUndo = useCallback(() => {
+ if (!controller) return;
+ controller.undo();
+ }, [controller]);
+
+ const onRedo = useCallback(() => {
+ if (!controller) return;
+ controller.redo();
+ }, [controller]);
+
+ const handleKeyDownCapture = useCallback(
+ (e: KeyboardEvent) => {
+ if (isHotkey(Keyboard.keys.UNDO, e)) {
+ e.stopPropagation();
+ onUndo();
+ }
+ if (isHotkey(Keyboard.keys.REDO, e)) {
+ e.stopPropagation();
+ onRedo();
+ }
+ },
+ [onRedo, onUndo]
+ );
+
+ useEffect(() => {
+ container.addEventListener('keydown', handleKeyDownCapture, true);
+ return () => {
+ container.removeEventListener('keydown', handleKeyDownCapture, true);
+ };
+ }, [container, handleKeyDownCapture]);
+}
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/FolderItem.hooks.ts b/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/FolderItem.hooks.ts
index 9a89c9f79a..c08e4d3691 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/FolderItem.hooks.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/FolderItem.hooks.ts
@@ -10,8 +10,6 @@ import { AppObserver } from '$app/stores/effects/folder/app/app_observer';
import { useNavigate } from 'react-router-dom';
import { INITIAL_FOLDER_HEIGHT, PAGE_ITEM_HEIGHT } from '../../_shared/constants';
-import { DocumentController } from '$app/stores/effects/document/document_controller';
-
export const useFolderEvents = (folder: IFolder, pages: IPage[]) => {
const appDispatch = useAppDispatch();
const workspace = useAppSelector((state) => state.workspace);
@@ -118,9 +116,6 @@ export const useFolderEvents = (folder: IFolder, pages: IPage[]) => {
layoutType: ViewLayoutPB.Document,
});
try {
- const c = new DocumentController(newView.id);
- await c.create();
- await c.dispose();
appDispatch(
pagesActions.addPage({
folderId: folder.id,
diff --git a/frontend/appflowy_tauri/src/appflowy_app/constants/document/keyboard.ts b/frontend/appflowy_tauri/src/appflowy_app/constants/document/keyboard.ts
index 2b1c8011ce..8c7da65393 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/constants/document/keyboard.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/constants/document/keyboard.ts
@@ -38,5 +38,7 @@ export const Keyboard = {
COPY: 'Mod+c',
CUT: 'Mod+x',
PASTE: 'Mod+v',
+ REDO: 'Mod+Shift+z',
+ UNDO: 'Mod+z',
},
};
diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/document/document_bd_svc.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/document/document_bd_svc.ts
index 6669c485fd..eeb115c5ee 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/document/document_bd_svc.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/document/document_bd_svc.ts
@@ -6,6 +6,8 @@ import {
ApplyActionPayloadPB,
BlockActionPB,
CloseDocumentPayloadPB,
+ DocumentRedoUndoPayloadPB,
+ DocumentRedoUndoResponsePB,
} from '@/services/backend';
import { Result } from 'ts-results';
import {
@@ -13,18 +15,14 @@ import {
DocumentEventCloseDocument,
DocumentEventOpenDocument,
DocumentEventCreateDocument,
+ DocumentEventCanUndoRedo,
+ DocumentEventRedo,
+ DocumentEventUndo,
} from '@/services/backend/events/flowy-document2';
export class DocumentBackendService {
constructor(public readonly viewId: string) {}
- create = (): Promise<Result<void, FlowyError>> => {
- const payload = CreateDocumentPayloadPB.fromObject({
- document_id: this.viewId,
- });
- return DocumentEventCreateDocument(payload);
- };
-
open = (): Promise<Result<DocumentDataPB, FlowyError>> => {
const payload = OpenDocumentPayloadPB.fromObject({
document_id: this.viewId,
@@ -46,4 +44,25 @@ export class DocumentBackendService {
});
return DocumentEventCloseDocument(payload);
};
+
+ canUndoRedo = (): Promise<Result<DocumentRedoUndoResponsePB, FlowyError>> => {
+ const payload = DocumentRedoUndoPayloadPB.fromObject({
+ document_id: this.viewId,
+ });
+ return DocumentEventCanUndoRedo(payload);
+ };
+
+ undo = (): Promise<Result<DocumentRedoUndoResponsePB, FlowyError>> => {
+ const payload = DocumentRedoUndoPayloadPB.fromObject({
+ document_id: this.viewId,
+ });
+ return DocumentEventUndo(payload);
+ };
+
+ redo = (): Promise<Result<DocumentRedoUndoResponsePB, FlowyError>> => {
+ const payload = DocumentRedoUndoPayloadPB.fromObject({
+ document_id: this.viewId,
+ });
+ return DocumentEventRedo(payload);
+ };
}
diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/document/document_controller.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/document/document_controller.ts
index dedef13044..2edde6eb20 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/document/document_controller.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/document/document_controller.ts
@@ -31,13 +31,6 @@ export class DocumentController {
this.observer = new DocumentObserver(documentId);
}
- create = async (): Promise<FlowyError | void> => {
- const result = await this.backendService.create();
- if (result.ok) {
- return;
- }
- return result.val;
- };
open = async (): Promise<DocumentData> => {
await this.observer.subscribe({
didReceiveUpdate: this.updated,
@@ -114,6 +107,26 @@ export class DocumentController {
};
};
+ canUndo = async () => {
+ const result = await this.backendService.canUndoRedo();
+ return result.ok && result.val.can_undo;
+ };
+
+ canRedo = async () => {
+ const result = await this.backendService.canUndoRedo();
+ return result.ok && result.val.can_redo;
+ };
+
+ undo = async () => {
+ const result = await this.backendService.undo();
+ return result.ok && result.val.is_success;
+ };
+
+ redo = async () => {
+ const result = await this.backendService.redo();
+ return result.ok && result.val.is_success;
+ };
+
dispose = async () => {
this.onDocChange = undefined;
await this.backendService.close();
diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock
index 0c9064f4fa..2ff8ad18a4 100644
--- a/frontend/rust-lib/Cargo.lock
+++ b/frontend/rust-lib/Cargo.lock
@@ -1710,6 +1710,7 @@ dependencies = [
"tokio",
"tracing",
"tracing-subscriber 0.3.16",
+ "uuid",
]
[[package]]
@@ -1867,6 +1868,7 @@ dependencies = [
"dotenv",
"flowy-core",
"flowy-database2",
+ "flowy-document2",
"flowy-folder2",
"flowy-net",
"flowy-notification",
diff --git a/frontend/rust-lib/flowy-core/src/deps_resolve/folder2_deps.rs b/frontend/rust-lib/flowy-core/src/deps_resolve/folder2_deps.rs
index abe6df895e..78c6efb568 100644
--- a/frontend/rust-lib/flowy-core/src/deps_resolve/folder2_deps.rs
+++ b/frontend/rust-lib/flowy-core/src/deps_resolve/folder2_deps.rs
@@ -143,7 +143,7 @@ impl FolderOperationHandler for DocumentFolderOperation {
let manager = self.0.clone();
let view_id = view_id.to_string();
FutureResult::new(async move {
- let document = manager.get_document(view_id)?;
+ let document = manager.get_document_from_disk(view_id)?;
let data: DocumentDataPB = document.lock().get_document()?.into();
let data_bytes = data.into_bytes().map_err(|_| FlowyError::invalid_data())?;
Ok(data_bytes)
diff --git a/frontend/rust-lib/flowy-document2/Cargo.toml b/frontend/rust-lib/flowy-document2/Cargo.toml
index 6f8fa74dbb..25cd8d5d58 100644
--- a/frontend/rust-lib/flowy-document2/Cargo.toml
+++ b/frontend/rust-lib/flowy-document2/Cargo.toml
@@ -27,6 +27,7 @@ tracing = { version = "0.1", features = ["log"] }
tokio = { version = "1.26", features = ["full"] }
anyhow = "1.0"
indexmap = {version = "1.9.2", features = ["serde"]}
+uuid = { version = "1.3.3", features = ["v4"] }
[dev-dependencies]
tempfile = "3.4.0"
diff --git a/frontend/rust-lib/flowy-document2/src/entities.rs b/frontend/rust-lib/flowy-document2/src/entities.rs
index 0749d15fd3..97d397dce2 100644
--- a/frontend/rust-lib/flowy-document2/src/entities.rs
+++ b/frontend/rust-lib/flowy-document2/src/entities.rs
@@ -1,6 +1,9 @@
+use collab_document::blocks::{BlockAction, DocumentData};
use std::collections::HashMap;
+use crate::parse::{NotEmptyStr, NotEmptyVec};
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
+use flowy_error::ErrorCode;
#[derive(Default, ProtoBuf)]
pub struct OpenDocumentPayloadPB {
@@ -8,6 +11,54 @@ pub struct OpenDocumentPayloadPB {
pub document_id: String,
}
+pub struct OpenDocumentParams {
+ pub document_id: String,
+}
+
+impl TryInto<OpenDocumentParams> for OpenDocumentPayloadPB {
+ type Error = ErrorCode;
+ fn try_into(self) -> Result<OpenDocumentParams, Self::Error> {
+ let document_id =
+ NotEmptyStr::parse(self.document_id).map_err(|_| ErrorCode::DocumentIdIsEmpty)?;
+ Ok(OpenDocumentParams {
+ document_id: document_id.0,
+ })
+ }
+}
+
+#[derive(Default, ProtoBuf)]
+pub struct DocumentRedoUndoPayloadPB {
+ #[pb(index = 1)]
+ pub document_id: String,
+}
+
+pub struct DocumentRedoUndoParams {
+ pub document_id: String,
+}
+
+impl TryInto<DocumentRedoUndoParams> for DocumentRedoUndoPayloadPB {
+ type Error = ErrorCode;
+ fn try_into(self) -> Result<DocumentRedoUndoParams, Self::Error> {
+ let document_id =
+ NotEmptyStr::parse(self.document_id).map_err(|_| ErrorCode::DocumentIdIsEmpty)?;
+ Ok(DocumentRedoUndoParams {
+ document_id: document_id.0,
+ })
+ }
+}
+
+#[derive(Default, Debug, ProtoBuf)]
+pub struct DocumentRedoUndoResponsePB {
+ #[pb(index = 1)]
+ pub can_undo: bool,
+
+ #[pb(index = 2)]
+ pub can_redo: bool,
+
+ #[pb(index = 3)]
+ pub is_success: bool,
+}
+
#[derive(Default, ProtoBuf)]
pub struct CreateDocumentPayloadPB {
#[pb(index = 1)]
@@ -17,12 +68,45 @@ pub struct CreateDocumentPayloadPB {
pub initial_data: Option<DocumentDataPB>,
}
+pub struct CreateDocumentParams {
+ pub document_id: String,
+ pub initial_data: Option<DocumentData>,
+}
+
+impl TryInto<CreateDocumentParams> for CreateDocumentPayloadPB {
+ type Error = ErrorCode;
+ fn try_into(self) -> Result<CreateDocumentParams, Self::Error> {
+ let document_id =
+ NotEmptyStr::parse(self.document_id).map_err(|_| ErrorCode::DocumentIdIsEmpty)?;
+ let initial_data = self.initial_data.map(|data| data.into());
+ Ok(CreateDocumentParams {
+ document_id: document_id.0,
+ initial_data,
+ })
+ }
+}
+
#[derive(Default, ProtoBuf)]
pub struct CloseDocumentPayloadPB {
#[pb(index = 1)]
pub document_id: String,
}
+pub struct CloseDocumentParams {
+ pub document_id: String,
+}
+
+impl TryInto<CloseDocumentParams> for CloseDocumentPayloadPB {
+ type Error = ErrorCode;
+ fn try_into(self) -> Result<CloseDocumentParams, Self::Error> {
+ let document_id =
+ NotEmptyStr::parse(self.document_id).map_err(|_| ErrorCode::DocumentIdIsEmpty)?;
+ Ok(CloseDocumentParams {
+ document_id: document_id.0,
+ })
+ }
+}
+
#[derive(Default, ProtoBuf, Debug)]
pub struct ApplyActionPayloadPB {
#[pb(index = 1)]
@@ -32,11 +116,23 @@ pub struct ApplyActionPayloadPB {
pub actions: Vec<BlockActionPB>,
}
-#[derive(Default, ProtoBuf)]
-pub struct GetDocumentDataPayloadPB {
- #[pb(index = 1)]
+pub struct ApplyActionParams {
pub document_id: String,
- // Support customize initial data
+ pub actions: Vec<BlockAction>,
+}
+
+impl TryInto<ApplyActionParams> for ApplyActionPayloadPB {
+ type Error = ErrorCode;
+ fn try_into(self) -> Result<ApplyActionParams, Self::Error> {
+ let document_id =
+ NotEmptyStr::parse(self.document_id).map_err(|_| ErrorCode::DocumentIdIsEmpty)?;
+ let actions = NotEmptyVec::parse(self.actions).map_err(|_| ErrorCode::ApplyActionsIsEmpty)?;
+ let actions = actions.0.into_iter().map(BlockAction::from).collect();
+ Ok(ApplyActionParams {
+ document_id: document_id.0,
+ actions,
+ })
+ }
}
#[derive(Default, Debug, ProtoBuf)]
@@ -226,3 +322,17 @@ pub struct ConvertDataPayloadPB {
#[pb(index = 2)]
pub data: Vec<u8>,
}
+
+pub struct ConvertDataParams {
+ pub convert_type: ConvertType,
+ pub data: Vec<u8>,
+}
+
+impl TryInto<ConvertDataParams> for ConvertDataPayloadPB {
+ type Error = ErrorCode;
+ fn try_into(self) -> Result<ConvertDataParams, Self::Error> {
+ let convert_type = self.convert_type;
+ let data = self.data;
+ Ok(ConvertDataParams { convert_type, data })
+ }
+}
diff --git a/frontend/rust-lib/flowy-document2/src/event_handler.rs b/frontend/rust-lib/flowy-document2/src/event_handler.rs
index 909f398e91..36306f6cde 100644
--- a/frontend/rust-lib/flowy-document2/src/event_handler.rs
+++ b/frontend/rust-lib/flowy-document2/src/event_handler.rs
@@ -14,11 +14,16 @@ use collab_document::blocks::{
use flowy_error::{FlowyError, FlowyResult};
use lib_dispatch::prelude::{data_result_ok, AFPluginData, AFPluginState, DataResult};
+use crate::entities::{
+ ApplyActionParams, CloseDocumentParams, ConvertDataParams, CreateDocumentParams,
+ DocumentRedoUndoParams, OpenDocumentParams,
+};
use crate::{
entities::{
ApplyActionPayloadPB, BlockActionPB, BlockActionPayloadPB, BlockActionTypePB, BlockEventPB,
BlockEventPayloadPB, BlockPB, CloseDocumentPayloadPB, ConvertDataPayloadPB, ConvertType,
- CreateDocumentPayloadPB, DeltaTypePB, DocEventPB, DocumentDataPB, OpenDocumentPayloadPB,
+ CreateDocumentPayloadPB, DeltaTypePB, DocEventPB, DocumentDataPB, DocumentRedoUndoPayloadPB,
+ DocumentRedoUndoResponsePB, OpenDocumentPayloadPB,
},
manager::DocumentManager,
parser::json::parser::JsonToDocumentParser,
@@ -29,9 +34,8 @@ pub(crate) async fn create_document_handler(
data: AFPluginData<CreateDocumentPayloadPB>,
manager: AFPluginState<Arc<DocumentManager>>,
) -> FlowyResult<()> {
- let data = data.into_inner();
- let initial_data = data.initial_data.map(|data| data.into());
- manager.create_document(data.document_id, initial_data)?;
+ let params: CreateDocumentParams = data.into_inner().try_into()?;
+ manager.create_document(params.document_id, params.initial_data)?;
Ok(())
}
@@ -40,8 +44,9 @@ pub(crate) async fn open_document_handler(
data: AFPluginData<OpenDocumentPayloadPB>,
manager: AFPluginState<Arc<DocumentManager>>,
) -> DataResult<DocumentDataPB, FlowyError> {
- let context = data.into_inner();
- let document = manager.open_document(context.document_id)?;
+ let params: OpenDocumentParams = data.into_inner().try_into()?;
+ let doc_id = params.document_id;
+ let document = manager.get_or_open_document(doc_id)?;
let document_data = document.lock().get_document()?;
data_result_ok(DocumentDataPB::from(document_data))
}
@@ -50,8 +55,9 @@ pub(crate) async fn close_document_handler(
data: AFPluginData<CloseDocumentPayloadPB>,
manager: AFPluginState<Arc<DocumentManager>>,
) -> FlowyResult<()> {
- let context = data.into_inner();
- manager.close_document(&context.document_id)?;
+ let params: CloseDocumentParams = data.into_inner().try_into()?;
+ let doc_id = params.document_id;
+ manager.close_document(&doc_id)?;
Ok(())
}
@@ -61,8 +67,9 @@ pub(crate) async fn get_document_data_handler(
data: AFPluginData<OpenDocumentPayloadPB>,
manager: AFPluginState<Arc<DocumentManager>>,
) -> DataResult<DocumentDataPB, FlowyError> {
- let context = data.into_inner();
- let document = manager.get_document(context.document_id)?;
+ let params: OpenDocumentParams = data.into_inner().try_into()?;
+ let doc_id = params.document_id;
+ let document = manager.get_document_from_disk(doc_id)?;
let document_data = document.lock().get_document()?;
data_result_ok(DocumentDataPB::from(document_data))
}
@@ -72,10 +79,10 @@ pub(crate) async fn apply_action_handler(
data: AFPluginData<ApplyActionPayloadPB>,
manager: AFPluginState<Arc<DocumentManager>>,
) -> FlowyResult<()> {
- let context = data.into_inner();
- let doc_id = context.document_id;
- let document = manager.open_document(doc_id)?;
- let actions = context.actions.into_iter().map(BlockAction::from).collect();
+ let params: ApplyActionParams = data.into_inner().try_into()?;
+ let doc_id = params.document_id;
+ let document = manager.get_or_open_document(doc_id)?;
+ let actions = params.actions;
document.lock().apply_action(actions);
Ok(())
}
@@ -92,8 +99,9 @@ pub(crate) async fn convert_data_to_document(
pub fn convert_data_to_document_internal(
payload: ConvertDataPayloadPB,
) -> Result<DocumentDataPB, FlowyError> {
- let convert_type = payload.convert_type;
- let data = payload.data;
+ let params: ConvertDataParams = payload.try_into()?;
+ let convert_type = params.convert_type;
+ let data = params.data;
match convert_type {
ConvertType::Json => {
let json_str = String::from_utf8(data).map_err(|_| FlowyError::invalid_data())?;
@@ -103,6 +111,60 @@ pub fn convert_data_to_document_internal(
}
}
+pub(crate) async fn redo_handler(
+ data: AFPluginData<DocumentRedoUndoPayloadPB>,
+ manager: AFPluginState<Arc<DocumentManager>>,
+) -> DataResult<DocumentRedoUndoResponsePB, FlowyError> {
+ let params: DocumentRedoUndoParams = data.into_inner().try_into()?;
+ let doc_id = params.document_id;
+ let document = manager.get_or_open_document(doc_id)?;
+ let document = document.lock();
+ let redo = document.redo();
+ let can_redo = document.can_redo();
+ let can_undo = document.can_undo();
+ data_result_ok(DocumentRedoUndoResponsePB {
+ can_redo,
+ can_undo,
+ is_success: redo,
+ })
+}
+
+pub(crate) async fn undo_handler(
+ data: AFPluginData<DocumentRedoUndoPayloadPB>,
+ manager: AFPluginState<Arc<DocumentManager>>,
+) -> DataResult<DocumentRedoUndoResponsePB, FlowyError> {
+ let params: DocumentRedoUndoParams = data.into_inner().try_into()?;
+ let doc_id = params.document_id;
+ let document = manager.get_or_open_document(doc_id)?;
+ let document = document.lock();
+ let undo = document.undo();
+ let can_redo = document.can_redo();
+ let can_undo = document.can_undo();
+ data_result_ok(DocumentRedoUndoResponsePB {
+ can_redo,
+ can_undo,
+ is_success: undo,
+ })
+}
+
+pub(crate) async fn can_undo_redo_handler(
+ data: AFPluginData<DocumentRedoUndoPayloadPB>,
+ manager: AFPluginState<Arc<DocumentManager>>,
+) -> DataResult<DocumentRedoUndoResponsePB, FlowyError> {
+ let params: DocumentRedoUndoParams = data.into_inner().try_into()?;
+ let doc_id = params.document_id;
+ let document = manager.get_or_open_document(doc_id)?;
+ let document = document.lock();
+ let can_redo = document.can_redo();
+ let can_undo = document.can_undo();
+ drop(document);
+ data_result_ok(DocumentRedoUndoResponsePB {
+ can_redo,
+ can_undo,
+ is_success: true,
+ })
+}
+
impl From<BlockActionPB> for BlockAction {
fn from(pb: BlockActionPB) -> Self {
Self {
diff --git a/frontend/rust-lib/flowy-document2/src/event_map.rs b/frontend/rust-lib/flowy-document2/src/event_map.rs
index f5af77503f..2a3c398f92 100644
--- a/frontend/rust-lib/flowy-document2/src/event_map.rs
+++ b/frontend/rust-lib/flowy-document2/src/event_map.rs
@@ -6,8 +6,9 @@ use lib_dispatch::prelude::AFPlugin;
use crate::{
event_handler::{
- apply_action_handler, close_document_handler, convert_data_to_document,
- create_document_handler, get_document_data_handler, open_document_handler,
+ apply_action_handler, can_undo_redo_handler, close_document_handler, convert_data_to_document,
+ create_document_handler, get_document_data_handler, open_document_handler, redo_handler,
+ undo_handler,
},
manager::DocumentManager,
};
@@ -26,6 +27,9 @@ pub fn init(document_manager: Arc<DocumentManager>) -> AFPlugin {
DocumentEvent::ConvertDataToDocument,
convert_data_to_document,
);
+ plugin = plugin.event(DocumentEvent::Redo, redo_handler);
+ plugin = plugin.event(DocumentEvent::Undo, undo_handler);
+ plugin = plugin.event(DocumentEvent::CanUndoRedo, can_undo_redo_handler);
plugin
}
@@ -45,9 +49,27 @@ pub enum DocumentEvent {
#[event(input = "ApplyActionPayloadPB")]
ApplyAction = 3,
- #[event(input = "GetDocumentDataPayloadPB")]
+ #[event(input = "OpenDocumentPayloadPB")]
GetDocumentData = 4,
#[event(input = "ConvertDataPayloadPB", output = "DocumentDataPB")]
ConvertDataToDocument = 5,
+
+ #[event(
+ input = "DocumentRedoUndoPayloadPB",
+ output = "DocumentRedoUndoResponsePB"
+ )]
+ Redo = 6,
+
+ #[event(
+ input = "DocumentRedoUndoPayloadPB",
+ output = "DocumentRedoUndoResponsePB"
+ )]
+ Undo = 7,
+
+ #[event(
+ input = "DocumentRedoUndoPayloadPB",
+ output = "DocumentRedoUndoResponsePB"
+ )]
+ CanUndoRedo = 8,
}
diff --git a/frontend/rust-lib/flowy-document2/src/lib.rs b/frontend/rust-lib/flowy-document2/src/lib.rs
index a79379801e..602fd8da8a 100644
--- a/frontend/rust-lib/flowy-document2/src/lib.rs
+++ b/frontend/rust-lib/flowy-document2/src/lib.rs
@@ -9,3 +9,4 @@ pub mod parser;
pub mod protobuf;
mod notification;
+mod parse;
diff --git a/frontend/rust-lib/flowy-document2/src/manager.rs b/frontend/rust-lib/flowy-document2/src/manager.rs
index ddac87b5d1..8475ac317a 100644
--- a/frontend/rust-lib/flowy-document2/src/manager.rs
+++ b/frontend/rust-lib/flowy-document2/src/manager.rs
@@ -54,16 +54,15 @@ impl DocumentManager {
Ok(document)
}
- pub fn open_document(&self, doc_id: String) -> FlowyResult<Arc<Document>> {
+ /// get document
+ /// read the existing document from the map if it exists, otherwise read it from the disk and write it to the map.
+ pub fn get_or_open_document(&self, doc_id: String) -> FlowyResult<Arc<Document>> {
if let Some(doc) = self.documents.read().get(&doc_id) {
return Ok(doc.clone());
}
tracing::debug!("open_document: {:?}", &doc_id);
- let uid = self.user.user_id()?;
- let db = self.user.collab_db()?;
- let collab = self.collab_builder.build(uid, &doc_id, "document", db);
// read the existing document from the disk.
- let document = Arc::new(Document::new(collab)?);
+ let document = self.get_document_from_disk(doc_id.clone())?;
// save the document to the memory and read it from the memory if we open the same document again.
// and we don't want to subscribe to the document changes if we open the same document again.
self
@@ -87,7 +86,9 @@ impl DocumentManager {
Ok(document)
}
- pub fn get_document(&self, doc_id: String) -> FlowyResult<Arc<Document>> {
+ /// get document
+ /// read the existing document from the disk.
+ pub fn get_document_from_disk(&self, doc_id: String) -> FlowyResult<Arc<Document>> {
let uid = self.user.user_id()?;
let db = self.user.collab_db()?;
let collab = self.collab_builder.build(uid, &doc_id, "document", db);
diff --git a/frontend/rust-lib/flowy-document2/src/parse.rs b/frontend/rust-lib/flowy-document2/src/parse.rs
new file mode 100644
index 0000000000..6ed50754ca
--- /dev/null
+++ b/frontend/rust-lib/flowy-document2/src/parse.rs
@@ -0,0 +1,23 @@
+#[derive(Debug)]
+pub struct NotEmptyStr(pub String);
+
+impl NotEmptyStr {
+ pub fn parse(s: String) -> Result<Self, String> {
+ if s.trim().is_empty() {
+ return Err("Input string is empty".to_owned());
+ }
+ Ok(Self(s))
+ }
+}
+
+#[derive(Debug)]
+pub struct NotEmptyVec<T>(pub Vec<T>);
+
+impl<T> NotEmptyVec<T> {
+ pub fn parse(v: Vec<T>) -> Result<Self, String> {
+ if v.is_empty() {
+ return Err("Input vector is empty".to_owned());
+ }
+ Ok(Self(v))
+ }
+}
diff --git a/frontend/rust-lib/flowy-document2/tests/document/document_insert_test.rs b/frontend/rust-lib/flowy-document2/tests/document/document_insert_test.rs
index 4b7da9efbe..96eea2f372 100644
--- a/frontend/rust-lib/flowy-document2/tests/document/document_insert_test.rs
+++ b/frontend/rust-lib/flowy-document2/tests/document/document_insert_test.rs
@@ -1,25 +1,21 @@
-use std::{collections::HashMap, sync::Arc, vec};
+use std::{collections::HashMap, vec};
-use crate::document::util::default_collab_builder;
+use crate::document::util;
+use crate::document::util::gen_id;
use collab_document::blocks::{Block, BlockAction, BlockActionPayload, BlockActionType};
use flowy_document2::document_block_keys::PARAGRAPH_BLOCK_TYPE;
-use flowy_document2::document_data::default_document_data;
-use flowy_document2::{document::Document, manager::DocumentManager};
-use nanoid::nanoid;
-
-use super::util::FakeUser;
#[test]
fn document_apply_insert_block_with_empty_parent_id() {
- let (_, document, page_id) = create_and_open_empty_document();
+ let (_, document, page_id) = util::create_and_open_empty_document();
// create a text block with no parent
- let text_block_id = nanoid!(10);
+ let text_block_id = gen_id();
let text_block = Block {
id: text_block_id.clone(),
ty: PARAGRAPH_BLOCK_TYPE.to_string(),
parent: "".to_string(),
- children: nanoid!(10),
+ children: gen_id(),
external_id: None,
external_type: None,
data: HashMap::new(),
@@ -38,20 +34,3 @@ fn document_apply_insert_block_with_empty_parent_id() {
let block = document.lock().get_block(&text_block_id).unwrap();
assert_eq!(block.parent, page_id);
}
-
-fn create_and_open_empty_document() -> (DocumentManager, Arc<Document>, String) {
- let user = FakeUser::new();
- let manager = DocumentManager::new(Arc::new(user), default_collab_builder());
-
- let doc_id: String = nanoid!(10);
- let data = default_document_data();
-
- // create a document
- _ = manager
- .create_document(doc_id.clone(), Some(data.clone()))
- .unwrap();
-
- let document = manager.open_document(doc_id).unwrap();
-
- (manager, document, data.page_id)
-}
diff --git a/frontend/rust-lib/flowy-document2/tests/document/document_redo_undo_test.rs b/frontend/rust-lib/flowy-document2/tests/document/document_redo_undo_test.rs
new file mode 100644
index 0000000000..77e530051c
--- /dev/null
+++ b/frontend/rust-lib/flowy-document2/tests/document/document_redo_undo_test.rs
@@ -0,0 +1,59 @@
+use crate::document::util::{default_collab_builder, gen_document_id, gen_id, FakeUser};
+use collab_document::blocks::{Block, BlockAction, BlockActionPayload, BlockActionType};
+use flowy_document2::document_block_keys::PARAGRAPH_BLOCK_TYPE;
+use flowy_document2::document_data::default_document_data;
+use flowy_document2::manager::DocumentManager;
+use std::collections::HashMap;
+use std::sync::Arc;
+
+#[tokio::test]
+async fn undo_redo_test() {
+ let user = FakeUser::new();
+ let manager = DocumentManager::new(Arc::new(user), default_collab_builder());
+
+ let doc_id: String = gen_document_id();
+ let data = default_document_data();
+
+ // create a document
+ _ = manager.create_document(doc_id.clone(), Some(data.clone()));
+
+ // open a document
+ let document = manager.get_or_open_document(doc_id.clone()).unwrap();
+ let document = document.lock();
+ let page_block = document.get_block(&data.page_id).unwrap();
+ let page_id = page_block.id;
+ let text_block_id = gen_id();
+
+ // insert a text block
+ let text_block = Block {
+ id: text_block_id.clone(),
+ ty: PARAGRAPH_BLOCK_TYPE.to_string(),
+ parent: page_id.clone(),
+ children: gen_id(),
+ external_id: None,
+ external_type: None,
+ data: HashMap::new(),
+ };
+ let insert_text_action = BlockAction {
+ action: BlockActionType::Insert,
+ payload: BlockActionPayload {
+ block: text_block,
+ parent_id: Some(page_id.clone()),
+ prev_id: None,
+ },
+ };
+ document.apply_action(vec![insert_text_action]);
+
+ let can_undo = document.can_undo();
+ assert_eq!(can_undo, true);
+ // undo the insert
+ let undo = document.undo();
+ assert_eq!(undo, true);
+ assert_eq!(document.get_block(&text_block_id), None);
+
+ let can_redo = document.can_redo();
+ assert!(can_redo);
+ // redo the insert
+ let redo = document.redo();
+ assert_eq!(redo, true);
+}
diff --git a/frontend/rust-lib/flowy-document2/tests/document/document_test.rs b/frontend/rust-lib/flowy-document2/tests/document/document_test.rs
index 3550110185..107af263d6 100644
--- a/frontend/rust-lib/flowy-document2/tests/document/document_test.rs
+++ b/frontend/rust-lib/flowy-document2/tests/document/document_test.rs
@@ -1,14 +1,13 @@
use std::{collections::HashMap, sync::Arc, vec};
use collab_document::blocks::{Block, BlockAction, BlockActionPayload, BlockActionType};
-use nanoid::nanoid;
use serde_json::{json, to_value, Value};
use flowy_document2::document_block_keys::PARAGRAPH_BLOCK_TYPE;
use flowy_document2::document_data::default_document_data;
use flowy_document2::manager::DocumentManager;
-use crate::document::util::default_collab_builder;
+use crate::document::util::{default_collab_builder, gen_document_id, gen_id};
use super::util::FakeUser;
@@ -18,7 +17,7 @@ fn restore_document() {
let manager = DocumentManager::new(Arc::new(user), default_collab_builder());
// create a document
- let doc_id: String = nanoid!(10);
+ let doc_id: String = gen_document_id();
let data = default_document_data();
let document_a = manager
.create_document(doc_id.clone(), Some(data.clone()))
@@ -28,7 +27,7 @@ fn restore_document() {
// open a document
let data_b = manager
- .open_document(doc_id.clone())
+ .get_or_open_document(doc_id.clone())
.unwrap()
.lock()
.get_document()
@@ -41,7 +40,7 @@ fn restore_document() {
_ = manager.create_document(doc_id.clone(), Some(data.clone()));
// open a document
let data_b = manager
- .open_document(doc_id.clone())
+ .get_or_open_document(doc_id.clone())
.unwrap()
.lock()
.get_document()
@@ -57,22 +56,22 @@ fn document_apply_insert_action() {
let user = FakeUser::new();
let manager = DocumentManager::new(Arc::new(user), default_collab_builder());
- let doc_id: String = nanoid!(10);
+ let doc_id: String = gen_document_id();
let data = default_document_data();
// create a document
_ = manager.create_document(doc_id.clone(), Some(data.clone()));
// open a document
- let document = manager.open_document(doc_id.clone()).unwrap();
+ let document = manager.get_or_open_document(doc_id.clone()).unwrap();
let page_block = document.lock().get_block(&data.page_id).unwrap();
// insert a text block
let text_block = Block {
- id: nanoid!(10),
+ id: gen_id(),
ty: PARAGRAPH_BLOCK_TYPE.to_string(),
parent: page_block.id,
- children: nanoid!(10),
+ children: gen_id(),
external_id: None,
external_type: None,
data: HashMap::new(),
@@ -92,7 +91,7 @@ fn document_apply_insert_action() {
// re-open the document
let data_b = manager
- .open_document(doc_id.clone())
+ .get_or_open_document(doc_id.clone())
.unwrap()
.lock()
.get_document()
@@ -108,14 +107,14 @@ fn document_apply_update_page_action() {
let user = FakeUser::new();
let manager = DocumentManager::new(Arc::new(user), default_collab_builder());
- let doc_id: String = nanoid!(10);
+ let doc_id: String = gen_document_id();
let data = default_document_data();
// create a document
_ = manager.create_document(doc_id.clone(), Some(data.clone()));
// open a document
- let document = manager.open_document(doc_id.clone()).unwrap();
+ let document = manager.get_or_open_document(doc_id.clone()).unwrap();
let page_block = document.lock().get_block(&data.page_id).unwrap();
let mut page_block_clone = page_block;
@@ -139,7 +138,7 @@ fn document_apply_update_page_action() {
_ = manager.close_document(&doc_id);
// re-open the document
- let document = manager.open_document(doc_id).unwrap();
+ let document = manager.get_or_open_document(doc_id).unwrap();
let page_block_new = document.lock().get_block(&data.page_id).unwrap();
assert_eq!(page_block_old, page_block_new);
assert!(page_block_new.data.contains_key("delta"));
@@ -150,23 +149,23 @@ fn document_apply_update_action() {
let user = FakeUser::new();
let manager = DocumentManager::new(Arc::new(user), default_collab_builder());
- let doc_id: String = nanoid!(10);
+ let doc_id: String = gen_document_id();
let data = default_document_data();
// create a document
_ = manager.create_document(doc_id.clone(), Some(data.clone()));
// open a document
- let document = manager.open_document(doc_id.clone()).unwrap();
+ let document = manager.get_or_open_document(doc_id.clone()).unwrap();
let page_block = document.lock().get_block(&data.page_id).unwrap();
// insert a text block
- let text_block_id = nanoid!(10);
+ let text_block_id = gen_id();
let text_block = Block {
id: text_block_id.clone(),
ty: PARAGRAPH_BLOCK_TYPE.to_string(),
parent: page_block.id,
- children: nanoid!(10),
+ children: gen_id(),
external_id: None,
external_type: None,
data: HashMap::new(),
@@ -207,7 +206,7 @@ fn document_apply_update_action() {
_ = manager.close_document(&doc_id);
// re-open the document
- let document = manager.open_document(doc_id.clone()).unwrap();
+ let document = manager.get_or_open_document(doc_id.clone()).unwrap();
let block = document.lock().get_block(&text_block_id).unwrap();
assert_eq!(block.data, updated_text_block_data);
// close a document
diff --git a/frontend/rust-lib/flowy-document2/tests/document/mod.rs b/frontend/rust-lib/flowy-document2/tests/document/mod.rs
index 5cf915fa51..e975a80c55 100644
--- a/frontend/rust-lib/flowy-document2/tests/document/mod.rs
+++ b/frontend/rust-lib/flowy-document2/tests/document/mod.rs
@@ -1,4 +1,5 @@
mod document_insert_test;
+mod document_redo_undo_test;
mod document_test;
mod event_handler_test;
mod util;
diff --git a/frontend/rust-lib/flowy-document2/tests/document/util.rs b/frontend/rust-lib/flowy-document2/tests/document/util.rs
index 2c8024b4b9..e9adf434f2 100644
--- a/frontend/rust-lib/flowy-document2/tests/document/util.rs
+++ b/frontend/rust-lib/flowy-document2/tests/document/util.rs
@@ -3,11 +3,14 @@ use appflowy_integrate::collab_builder::{AppFlowyCollabBuilder, CloudStorageType
use std::sync::Arc;
use appflowy_integrate::RocksCollabDB;
+use flowy_document2::document::Document;
use parking_lot::Once;
use tempfile::TempDir;
use tracing_subscriber::{fmt::Subscriber, util::SubscriberInitExt, EnvFilter};
-use flowy_document2::manager::DocumentUser;
+use flowy_document2::document_data::default_document_data;
+use flowy_document2::manager::{DocumentManager, DocumentUser};
+use nanoid::nanoid;
pub struct FakeUser {
kv: Arc<RocksCollabDB>,
@@ -53,3 +56,29 @@ pub fn default_collab_builder() -> Arc<AppFlowyCollabBuilder> {
let builder = AppFlowyCollabBuilder::new(CloudStorageType::Local, None);
Arc::new(builder)
}
+
+pub fn create_and_open_empty_document() -> (DocumentManager, Arc<Document>, String) {
+ let user = FakeUser::new();
+ let manager = DocumentManager::new(Arc::new(user), default_collab_builder());
+
+ let doc_id: String = gen_document_id();
+ let data = default_document_data();
+
+ // create a document
+ _ = manager
+ .create_document(doc_id.clone(), Some(data.clone()))
+ .unwrap();
+
+ let document = manager.get_or_open_document(doc_id).unwrap();
+
+ (manager, document, data.page_id)
+}
+
+pub fn gen_document_id() -> String {
+ let uuid = uuid::Uuid::new_v4();
+ uuid.to_string()
+}
+
+pub fn gen_id() -> String {
+ nanoid!(10)
+}
diff --git a/frontend/rust-lib/flowy-error/src/code.rs b/frontend/rust-lib/flowy-error/src/code.rs
index 316c61a324..4ecc2f492b 100644
--- a/frontend/rust-lib/flowy-error/src/code.rs
+++ b/frontend/rust-lib/flowy-error/src/code.rs
@@ -202,6 +202,12 @@ pub enum ErrorCode {
#[error("Only one application can access the database")]
MultipleDBInstance = 66,
+
+ #[error("Document id is empty")]
+ DocumentIdIsEmpty = 67,
+
+ #[error("Apply actions is empty")]
+ ApplyActionsIsEmpty = 68,
}
impl ErrorCode {
diff --git a/frontend/rust-lib/flowy-test/Cargo.toml b/frontend/rust-lib/flowy-test/Cargo.toml
index f0e94b0ba2..b3a05f2926 100644
--- a/frontend/rust-lib/flowy-test/Cargo.toml
+++ b/frontend/rust-lib/flowy-test/Cargo.toml
@@ -11,6 +11,7 @@ flowy-user = { path = "../flowy-user"}
flowy-net = { path = "../flowy-net"}
flowy-folder2 = { path = "../flowy-folder2", features = ["test_helper"] }
flowy-database2 = { path = "../flowy-database2" }
+flowy-document2 = { path = "../flowy-document2" }
lib-dispatch = { path = "../lib-dispatch" }
lib-ot = { path = "../../../shared-lib/lib-ot" }
lib-infra = { path = "../../../shared-lib/lib-infra" }
diff --git a/frontend/rust-lib/flowy-test/src/document_event.rs b/frontend/rust-lib/flowy-test/src/document_event.rs
new file mode 100644
index 0000000000..e332515891
--- /dev/null
+++ b/frontend/rust-lib/flowy-test/src/document_event.rs
@@ -0,0 +1,107 @@
+use crate::event_builder::EventBuilder;
+use crate::FlowyCoreTest;
+use flowy_document2::entities::*;
+use flowy_document2::event_map::DocumentEvent;
+use flowy_folder2::entities::{CreateViewPayloadPB, ViewLayoutPB, ViewPB};
+use flowy_folder2::event_map::FolderEvent;
+
+pub struct DocumentEventTest {
+ inner: FlowyCoreTest,
+}
+
+pub struct OpenDocumentData {
+ pub id: String,
+ pub data: DocumentDataPB,
+}
+
+impl DocumentEventTest {
+ pub async fn new() -> Self {
+ let sdk = FlowyCoreTest::new_with_user().await;
+ Self { inner: sdk }
+ }
+
+ pub async fn create_document(&self) -> ViewPB {
+ let core = &self.inner;
+ let current_workspace = core.get_current_workspace().await.workspace;
+ let parent_id = current_workspace.id.clone();
+
+ let payload = CreateViewPayloadPB {
+ parent_view_id: parent_id.to_string(),
+ name: "document".to_string(),
+ desc: "".to_string(),
+ thumbnail: None,
+ layout: ViewLayoutPB::Document,
+ initial_data: vec![],
+ meta: Default::default(),
+ set_as_current: true,
+ };
+ EventBuilder::new(core.clone())
+ .event(FolderEvent::CreateView)
+ .payload(payload)
+ .async_send()
+ .await
+ .parse::<ViewPB>()
+ }
+
+ pub async fn open_document(&self, doc_id: String) -> OpenDocumentData {
+ let core = &self.inner;
+ let payload = OpenDocumentPayloadPB {
+ document_id: doc_id.clone(),
+ };
+ let data = EventBuilder::new(core.clone())
+ .event(DocumentEvent::OpenDocument)
+ .payload(payload)
+ .async_send()
+ .await
+ .parse::<DocumentDataPB>();
+ OpenDocumentData { id: doc_id, data }
+ }
+
+ pub async fn apply_actions(&self, payload: ApplyActionPayloadPB) {
+ let core = &self.inner;
+ EventBuilder::new(core.clone())
+ .event(DocumentEvent::ApplyAction)
+ .payload(payload)
+ .async_send()
+ .await;
+ }
+
+ pub async fn undo(&self, doc_id: String) -> DocumentRedoUndoResponsePB {
+ let core = &self.inner;
+ let payload = DocumentRedoUndoPayloadPB {
+ document_id: doc_id.clone(),
+ };
+ EventBuilder::new(core.clone())
+ .event(DocumentEvent::Undo)
+ .payload(payload)
+ .async_send()
+ .await
+ .parse::<DocumentRedoUndoResponsePB>()
+ }
+
+ pub async fn redo(&self, doc_id: String) -> DocumentRedoUndoResponsePB {
+ let core = &self.inner;
+ let payload = DocumentRedoUndoPayloadPB {
+ document_id: doc_id.clone(),
+ };
+ EventBuilder::new(core.clone())
+ .event(DocumentEvent::Redo)
+ .payload(payload)
+ .async_send()
+ .await
+ .parse::<DocumentRedoUndoResponsePB>()
+ }
+
+ pub async fn can_undo_redo(&self, doc_id: String) -> DocumentRedoUndoResponsePB {
+ let core = &self.inner;
+ let payload = DocumentRedoUndoPayloadPB {
+ document_id: doc_id.clone(),
+ };
+ EventBuilder::new(core.clone())
+ .event(DocumentEvent::CanUndoRedo)
+ .payload(payload)
+ .async_send()
+ .await
+ .parse::<DocumentRedoUndoResponsePB>()
+ }
+}
diff --git a/frontend/rust-lib/flowy-test/src/lib.rs b/frontend/rust-lib/flowy-test/src/lib.rs
index 31b1731a1e..fd60017728 100644
--- a/frontend/rust-lib/flowy-test/src/lib.rs
+++ b/frontend/rust-lib/flowy-test/src/lib.rs
@@ -15,6 +15,7 @@ use flowy_user::errors::FlowyError;
use crate::event_builder::EventBuilder;
use crate::user_event::{async_sign_up, init_user_setting, SignUpContext};
+pub mod document_event;
pub mod event_builder;
pub mod folder_event;
pub mod user_event;
diff --git a/frontend/rust-lib/flowy-test/tests/document/mod.rs b/frontend/rust-lib/flowy-test/tests/document/mod.rs
new file mode 100644
index 0000000000..60914e9678
--- /dev/null
+++ b/frontend/rust-lib/flowy-test/tests/document/mod.rs
@@ -0,0 +1,2 @@
+mod test;
+mod utils;
diff --git a/frontend/rust-lib/flowy-test/tests/document/test.rs b/frontend/rust-lib/flowy-test/tests/document/test.rs
new file mode 100644
index 0000000000..a7a7944fdb
--- /dev/null
+++ b/frontend/rust-lib/flowy-test/tests/document/test.rs
@@ -0,0 +1,62 @@
+use crate::document::utils::*;
+use flowy_document2::entities::*;
+use flowy_test::document_event::DocumentEventTest;
+
+#[tokio::test]
+async fn get_document_event_test() {
+ let test = DocumentEventTest::new().await;
+ let view = test.create_document().await;
+ let document = test.open_document(view.id).await;
+ let document_data = document.data;
+ assert!(!document_data.page_id.is_empty());
+ assert!(document_data.blocks.len() > 1);
+}
+
+#[tokio::test]
+async fn apply_document_event_test() {
+ let test = DocumentEventTest::new().await;
+ let view = test.create_document().await;
+ let doc_id = view.id.clone();
+ let document = test.open_document(doc_id.clone()).await;
+ let block_count = document.data.blocks.len();
+ let insert_action = gen_insert_block_action(document);
+ let payload = ApplyActionPayloadPB {
+ document_id: doc_id.clone(),
+ actions: vec![insert_action],
+ };
+ test.apply_actions(payload).await;
+ let document = test.open_document(doc_id).await;
+ let document_data = document.data;
+ let block_count_after = document_data.blocks.len();
+ assert_eq!(block_count_after, block_count + 1);
+}
+
+#[tokio::test]
+async fn undo_redo_event_test() {
+ let test = DocumentEventTest::new().await;
+ let view = test.create_document().await;
+ let doc_id = view.id.clone();
+
+ let document = test.open_document(doc_id.clone()).await;
+ let insert_action = gen_insert_block_action(document);
+ let payload = ApplyActionPayloadPB {
+ document_id: doc_id.clone(),
+ actions: vec![insert_action],
+ };
+ test.apply_actions(payload).await;
+ let block_count_after_insert = test.open_document(doc_id.clone()).await.data.blocks.len();
+
+ // undo insert action
+ let can_undo = test.can_undo_redo(doc_id.clone()).await.can_undo;
+ assert!(can_undo);
+ test.undo(doc_id.clone()).await;
+ let block_count_after_undo = test.open_document(doc_id.clone()).await.data.blocks.len();
+ assert_eq!(block_count_after_undo, block_count_after_insert - 1);
+
+ // redo insert action
+ let can_redo = test.can_undo_redo(doc_id.clone()).await.can_redo;
+ assert!(can_redo);
+ test.redo(doc_id.clone()).await;
+ let block_count_after_redo = test.open_document(doc_id.clone()).await.data.blocks.len();
+ assert_eq!(block_count_after_redo, block_count_after_insert);
+}
diff --git a/frontend/rust-lib/flowy-test/tests/document/utils.rs b/frontend/rust-lib/flowy-test/tests/document/utils.rs
new file mode 100644
index 0000000000..d6bc95a4d7
--- /dev/null
+++ b/frontend/rust-lib/flowy-test/tests/document/utils.rs
@@ -0,0 +1,58 @@
+use flowy_document2::entities::*;
+use flowy_test::document_event::OpenDocumentData;
+use nanoid::nanoid;
+use std::collections::HashMap;
+
+pub fn gen_id() -> String {
+ nanoid!(10)
+}
+
+pub struct ParseDocumentData {
+ pub doc_id: String,
+ pub page_id: String,
+ pub blocks: HashMap<String, BlockPB>,
+ pub children_map: HashMap<String, ChildrenPB>,
+ pub first_block_id: String,
+}
+pub fn parse_document_data(document: OpenDocumentData) -> ParseDocumentData {
+ let doc_id = document.id.clone();
+ let data = document.data;
+ let page_id = data.page_id;
+ let blocks = data.blocks;
+ let children_map = data.meta.children_map;
+ let page_block = blocks.get(&page_id).unwrap();
+ let children_id = page_block.children_id.clone();
+ let children = children_map.get(&children_id).unwrap();
+ let block_id = children.children.get(0).unwrap().to_string();
+ ParseDocumentData {
+ doc_id,
+ page_id,
+ blocks,
+ children_map,
+ first_block_id: block_id,
+ }
+}
+
+pub fn gen_insert_block_action(document: OpenDocumentData) -> BlockActionPB {
+ let parse_data = parse_document_data(document);
+ let first_block_id = parse_data.first_block_id;
+ let block = parse_data.blocks.get(&first_block_id).unwrap();
+ let page_id = parse_data.page_id;
+ let data = block.data.clone();
+ let new_block_id = gen_id();
+ let new_block = BlockPB {
+ id: new_block_id.clone(),
+ ty: block.ty.clone(),
+ data,
+ parent_id: page_id.clone(),
+ children_id: gen_id(),
+ };
+ BlockActionPB {
+ action: BlockActionTypePB::Insert,
+ payload: BlockActionPayloadPB {
+ block: new_block,
+ prev_id: Some(first_block_id),
+ parent_id: Some(page_id),
+ },
+ }
+}
diff --git a/frontend/rust-lib/flowy-test/tests/main.rs b/frontend/rust-lib/flowy-test/tests/main.rs
index 6f5773f6ff..ae80f04a9e 100644
--- a/frontend/rust-lib/flowy-test/tests/main.rs
+++ b/frontend/rust-lib/flowy-test/tests/main.rs
@@ -1,3 +1,4 @@
mod database;
+mod document;
mod folder;
mod user;