Start RTE

This commit is contained in:
Adrian Woźniak 2020-06-10 22:03:00 +02:00
parent 711a21f2b6
commit 2c173669d3
15 changed files with 1345 additions and 96 deletions

193
Cargo.lock generated
View File

@ -73,9 +73,9 @@ dependencies = [
[[package]]
name = "actix-files"
version = "0.2.1"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "301482841d3d74483a446ead63cb7d362e187d2c8b603f13d91995621ea53c46"
checksum = "193b22cb1f7b4ff12a4eb2415d6d19e47e44ea93e05930b30d05375ea29d3529"
dependencies = [
"actix-http",
"actix-service",
@ -83,7 +83,8 @@ dependencies = [
"bitflags",
"bytes",
"derive_more",
"futures 0.3.5",
"futures-core",
"futures-util",
"log",
"mime",
"mime_guess",
@ -396,9 +397,9 @@ dependencies = [
[[package]]
name = "arc-swap"
version = "0.4.6"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b585a98a234c46fc563103e9278c9391fde1f4e6850334da895d27edb9580f62"
checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034"
[[package]]
name = "arrayref"
@ -420,9 +421,9 @@ checksum = "71938f30533e4d95a6d17aa530939da3842c2ab6f4f84b9dae68447e4129f74a"
[[package]]
name = "async-trait"
version = "0.1.31"
version = "0.1.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26c4f3195085c36ea8d24d32b2f828d23296a9370a28aa39d111f6f16bef9f3b"
checksum = "89cb5d814ab2a47fd66d3266e9efccb53ca4c740b7451043b8ffcf9a6208f3f8"
dependencies = [
"proc-macro2",
"quote",
@ -612,9 +613,9 @@ checksum = "40e38929add23cdf8a366df9b0e088953150724bcbe5fc330b0d8eb3b328eec8"
[[package]]
name = "bumpalo"
version = "3.3.0"
version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5356f1d23ee24a1f785a56d1d1a5f0fd5b0f6a0c0fb2412ce11da71649ab78f6"
checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
[[package]]
name = "byte-tools"
@ -744,9 +745,9 @@ dependencies = [
[[package]]
name = "copyless"
version = "0.1.4"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ff9c56c9fb2a49c05ef0e431485a22400af20d33226dc0764d891d09e724127"
checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536"
[[package]]
name = "core-foundation"
@ -826,9 +827,9 @@ dependencies = [
[[package]]
name = "diesel"
version = "1.4.4"
version = "1.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33d7ca63eb2efea87a7f56a283acc49e2ce4b2bd54adf7465dc1d81fef13d8fc"
checksum = "3e2de9deab977a153492a1468d1b1c0662c1cf39e5ea87d0c060ecd59ef18d8c"
dependencies = [
"bigdecimal",
"bitflags",
@ -880,11 +881,10 @@ dependencies = [
[[package]]
name = "dirs-sys"
version = "0.3.4"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b"
checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a"
dependencies = [
"cfg-if",
"libc",
"redox_users",
"winapi 0.3.8",
@ -1462,9 +1462,9 @@ dependencies = [
[[package]]
name = "hyper"
version = "0.13.5"
version = "0.13.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96816e1d921eca64d208a85aab4f7798455a8e34229ee5a88c935bdee1b78b14"
checksum = "a6e7655b9594024ad0ee439f3b5a7299369dc2a3f459b47c696f9ff676f9aa1f"
dependencies = [
"bytes",
"futures-channel",
@ -1476,8 +1476,8 @@ dependencies = [
"httparse",
"itoa",
"log",
"net2",
"pin-project",
"socket2",
"time 0.1.43",
"tokio",
"tower-service",
@ -1510,18 +1510,18 @@ dependencies = [
[[package]]
name = "indexmap"
version = "1.3.2"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292"
checksum = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe"
dependencies = [
"autocfg 1.0.0",
]
[[package]]
name = "inotify"
version = "0.7.0"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24e40d6fd5d64e2082e0c796495c8ef5ad667a96d03e5aaa0becfd9d47bcbfb8"
checksum = "4816c66d2c8ae673df83366c18341538f234a26d65a9ecea5c348b453ac1d02f"
dependencies = [
"bitflags",
"inotify-sys",
@ -1678,9 +1678,9 @@ dependencies = [
[[package]]
name = "js-sys"
version = "0.3.39"
version = "0.3.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa5a448de267e7358beaf4a5d849518fe9a0c13fce7afd44b06e68550e5562a7"
checksum = "ce10c23ad2ea25ceca0093bd3192229da4c5b3c0f2de499c1ecac0d98d452177"
dependencies = [
"wasm-bindgen",
]
@ -1747,9 +1747,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.70"
version = "0.2.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3baa92041a6fec78c687fa0cc2b3fae8884f743d672cf551bed1d6dac6988d0f"
checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49"
[[package]]
name = "linked-hash-map"
@ -1838,9 +1838,9 @@ dependencies = [
[[package]]
name = "miniz_oxide"
version = "0.3.6"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa679ff6578b1cddee93d7e82e263b94a575e0bfced07284eb0c037c1d2416a5"
checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435"
dependencies = [
"adler32",
]
@ -1884,7 +1884,7 @@ checksum = "f5e374eff525ce1c5b7687c4cef63943e7686524a387933ad27ca7ec43779cb3"
dependencies = [
"log",
"mio",
"miow 0.3.4",
"miow 0.3.5",
"winapi 0.3.8",
]
@ -1913,9 +1913,9 @@ dependencies = [
[[package]]
name = "miow"
version = "0.3.4"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22dfdd1d51b2639a5abd17ed07005c3af05fb7a2a3b1a1d0d7af1000a520c1c7"
checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e"
dependencies = [
"socket2",
"winapi 0.3.8",
@ -2064,9 +2064,9 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
[[package]]
name = "openssl-sys"
version = "0.9.56"
version = "0.9.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f02309a7f127000ed50594f0b50ecc69e7c654e16d41b4e8156d1b3df8e0b52e"
checksum = "a842db4709b604f0fe5d1170ae3565899be2ad3d9cbc72dedc789ac0511f78de"
dependencies = [
"autocfg 1.0.0",
"cc",
@ -2150,18 +2150,18 @@ dependencies = [
[[package]]
name = "pin-project"
version = "0.4.17"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edc93aeee735e60ecb40cf740eb319ff23eab1c5748abfdb5c180e4ce49f7791"
checksum = "e75373ff9037d112bb19bc61333a06a159eaeb217660dcfbea7d88e1db823919"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "0.4.17"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e58db2081ba5b4c93bd6be09c40fd36cb9193a8336c384f3b40012e531aa7e40"
checksum = "10b4b44893d3c370407a1d6a5cfde7c41ae0478e31c516c85f67eb3adc51be6d"
dependencies = [
"proc-macro2",
"quote",
@ -2170,9 +2170,9 @@ dependencies = [
[[package]]
name = "pin-project-lite"
version = "0.1.5"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7505eeebd78492e0f6108f7171c4948dbb120ee8119d9d77d0afa5469bef67f"
checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715"
[[package]]
name = "pin-utils"
@ -2213,21 +2213,21 @@ dependencies = [
[[package]]
name = "proc-macro-hack"
version = "0.5.15"
version = "0.5.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d659fe7c6d27f25e9d80a1a094c223f5246f6a6596453e09d7229bf42750b63"
checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4"
[[package]]
name = "proc-macro-nested"
version = "0.1.4"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694"
checksum = "0afe1bd463b9e9ed51d0e0f0b50b6b146aec855c56fd182bb242388710a9b6de"
[[package]]
name = "proc-macro2"
version = "1.0.15"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70a50b9351bfa8d65a7d93ce712dc63d2fd15ddbf2c36990fc7cac344859c04f"
checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa"
dependencies = [
"unicode-xid",
]
@ -2252,9 +2252,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
[[package]]
name = "quote"
version = "1.0.6"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea"
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
dependencies = [
"proc-macro2",
]
@ -2477,9 +2477,9 @@ dependencies = [
[[package]]
name = "regex"
version = "1.3.7"
version = "1.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6020f034922e3194c711b82a627453881bc4682166cabb07134a10c26ba7692"
checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6"
dependencies = [
"aho-corasick",
"memchr",
@ -2489,9 +2489,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
version = "0.6.17"
version = "0.6.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae"
checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8"
[[package]]
name = "remove_dir_all"
@ -2628,9 +2628,9 @@ dependencies = [
[[package]]
name = "ryu"
version = "1.0.4"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1"
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
[[package]]
name = "safemem"
@ -2721,7 +2721,7 @@ dependencies = [
"serde",
"serde_json",
"uuid 0.8.1",
"version_check 0.9.1",
"version_check 0.9.2",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
@ -2744,18 +2744,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
version = "1.0.110"
version = "1.0.111"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99e7b308464d16b56eba9964e4972a3eee817760ab60d88c3f86e1fecb08204c"
checksum = "c9124df5b40cbd380080b2cc6ab894c040a3070d995f5c9dc77e18c34a8ae37d"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.110"
version = "1.0.111"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "818fbf6bfa9a42d3bfcaca148547aa00c7b915bec71d1757aa2d44ca68771984"
checksum = "3f2c3ac8e6ca1e9c80b8be1023940162bf81ae3cffbb1809474152f2ce1eb250"
dependencies = [
"proc-macro2",
"quote",
@ -2764,9 +2764,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.53"
version = "1.0.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "993948e75b189211a9b31a7528f950c6adc21f9720b6438ff80a7fa2f864cea2"
checksum = "ec2c5d7e739bc07a3e73381a39d61fdb5f671c60c1df26a130690665803d8226"
dependencies = [
"itoa",
"ryu",
@ -2805,9 +2805,9 @@ checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d"
[[package]]
name = "sha2"
version = "0.8.1"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27044adfd2e1f077f649f59deb9490d3941d674002f7d062870a60ebe9bd47a0"
checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69"
dependencies = [
"block-buffer",
"digest",
@ -2857,9 +2857,12 @@ dependencies = [
[[package]]
name = "standback"
version = "0.2.8"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47e4b8c631c998468961a9ea159f064c5c8499b95b5e4a34b77849d45949d540"
checksum = "b0437cfb83762844799a60e1e3b489d5ceb6a650fbacb86437badc1b6d87b246"
dependencies = [
"version_check 0.9.2",
]
[[package]]
name = "stdweb"
@ -2924,9 +2927,9 @@ checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee"
[[package]]
name = "syn"
version = "1.0.23"
version = "1.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95b5f192649e48a5302a13f2feb224df883b98933222369e4b3b0fe2a5447269"
checksum = "b5304cfdf27365b7585c25d4af91b35016ed21ef88f17ced89c7093b43dba8b6"
dependencies = [
"proc-macro2",
"quote",
@ -2935,9 +2938,9 @@ dependencies = [
[[package]]
name = "synstructure"
version = "0.12.3"
version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545"
checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701"
dependencies = [
"proc-macro2",
"quote",
@ -3028,7 +3031,7 @@ dependencies = [
"standback",
"stdweb",
"time-macros",
"version_check 0.9.1",
"version_check 0.9.2",
"winapi 0.3.8",
]
@ -3242,7 +3245,7 @@ version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
dependencies = [
"version_check 0.9.1",
"version_check 0.9.2",
]
[[package]]
@ -3360,9 +3363,9 @@ dependencies = [
[[package]]
name = "vcpkg"
version = "0.2.8"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168"
checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c"
[[package]]
name = "vec_map"
@ -3378,9 +3381,9 @@ checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
[[package]]
name = "version_check"
version = "0.9.1"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce"
checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
[[package]]
name = "walkdir"
@ -3411,9 +3414,9 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "wasm-bindgen"
version = "0.2.62"
version = "0.2.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3c7d40d09cdbf0f4895ae58cf57d92e1e57a9dd8ed2e8390514b54a47cc5551"
checksum = "4c2dc4aa152834bc334f506c1a06b866416a8b6697d5c9f75b9a689c8486def0"
dependencies = [
"cfg-if",
"serde",
@ -3423,9 +3426,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.62"
version = "0.2.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3972e137ebf830900db522d6c8fd74d1900dcfc733462e9a12e942b00b4ac94"
checksum = "ded84f06e0ed21499f6184df0e0cb3494727b0c5da89534e0fcc55c51d812101"
dependencies = [
"bumpalo",
"lazy_static",
@ -3438,9 +3441,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.12"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a369c5e1dfb7569e14d62af4da642a3cbc2f9a3652fe586e26ac22222aa4b04"
checksum = "64487204d863f109eb77e8462189d111f27cb5712cc9fdb3461297a76963a2f6"
dependencies = [
"cfg-if",
"js-sys",
@ -3450,9 +3453,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.62"
version = "0.2.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cd85aa2c579e8892442954685f0d801f9129de24fa2136b2c6a539c76b65776"
checksum = "838e423688dac18d73e31edce74ddfac468e37b1506ad163ffaf0a46f703ffe3"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@ -3460,9 +3463,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.62"
version = "0.2.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eb197bd3a47553334907ffd2f16507b4f4f01bbec3ac921a7719e0decdfe72a"
checksum = "3156052d8ec77142051a533cdd686cba889537b213f948cd1d20869926e68e92"
dependencies = [
"proc-macro2",
"quote",
@ -3473,15 +3476,15 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.62"
version = "0.2.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a91c2916119c17a8e316507afaaa2dd94b47646048014bbdf6bef098c1bb58ad"
checksum = "c9ba19973a58daf4db6f352eda73dc0e289493cd29fb2632eb172085b6521acd"
[[package]]
name = "wasm-bindgen-test"
version = "0.3.12"
version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd8e9dad8040e378f0696b017570c6bc929aac373180e06b3d67ac5059c52da3"
checksum = "0f0dfda4d3b3f8acbc3c291b09208081c203af457fb14a229783b06e2f128aa7"
dependencies = [
"console_error_panic_hook",
"js-sys",
@ -3493,9 +3496,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-test-macro"
version = "0.3.12"
version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c358c8d2507c1bae25efa069e62ea907aa28700b25c8c33dafb0b15ba4603627"
checksum = "2c2e18093f11c19ca4e188c177fecc7c372304c311189f12c2f9bea5b7324ac7"
dependencies = [
"proc-macro2",
"quote",
@ -3503,9 +3506,9 @@ dependencies = [
[[package]]
name = "web-sys"
version = "0.3.39"
version = "0.3.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8bc359e5dd3b46cb9687a051d50a2fdd228e4ba7cf6fcf861a5365c3d671a642"
checksum = "7b72fe77fd39e4bd3eaa4412fd299a0be6b3dfe9d2597e2f1c20beb968f41d17"
dependencies = [
"js-sys",
"wasm-bindgen",
@ -3513,9 +3516,9 @@ dependencies = [
[[package]]
name = "widestring"
version = "0.4.0"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "effc0e4ff8085673ea7b9b2e3c73f6bd4d118810c9009ed8f1e16bd96c331db6"
checksum = "a763e303c0e0f23b0da40888724762e802a8ffefbc22de4127ef42493c2ea68c"
[[package]]
name = "winapi"

View File

@ -1,10 +1,18 @@
server {
listen 80;
listen 443 ssl http2;
server_name jirs.lvh.me;
charset utf-8;
root /home/eraden/code/eraden/jirs/jirs-client/tmp;
ssl_certificate /home/eraden/code/eraden/jirs/jirs-client/js/nginx-selfsigned.crt;
ssl_certificate_key /home/eraden/code/eraden/jirs/jirs-client/js/nginx-selfsigned.key;
# if ($scheme != "https") {
# return 301 https://$host$request_uri;
# }
location ~ .wasm {
default_type application/wasm;
}

View File

@ -180,3 +180,195 @@ i.styledIcon.message:before {
i.styledIcon.check:before {
content: "\ec4b";
}
/********/
/* RTE */
/********/
i.styledIcon.align-center:before {
content: "\eddf";
}
i.styledIcon.align-left:before {
content: "\ede0";
}
i.styledIcon.align-right:before {
content: "\ede1";
}
i.styledIcon.all-caps:before {
content: "\ede2";
}
i.styledIcon.bold:before {
content: "\ede3";
}
i.styledIcon.brush:before {
content: "\ede4";
}
i.styledIcon.clip-board:before {
content: "\ede5";
}
i.styledIcon.code-alt:before {
content: "\ede6";
}
i.styledIcon.color-bucket:before {
content: "\ede7";
}
i.styledIcon.color-picker:before {
content: "\ede8";
}
i.styledIcon.copy-invert:before {
content: "\ede9";
}
i.styledIcon.copy:before {
content: "\edea";
}
i.styledIcon.cut:before {
content: "\edeb";
}
i.styledIcon.delete-alt:before {
content: "\edec";
}
i.styledIcon.edit-alt:before {
content: "\eded";
}
i.styledIcon.eraser-alt:before {
content: "\edee";
}
i.styledIcon.font:before {
content: "\edef";
}
i.styledIcon.heading:before {
content: "\edf0";
}
i.styledIcon.indent:before {
content: "\edf1";
}
i.styledIcon.italic-alt:before {
content: "\edf2";
}
i.styledIcon.italic:before {
content: "\edf3";
}
i.styledIcon.justify-all:before {
content: "\edf4";
}
i.styledIcon.justify-center:before {
content: "\edf5";
}
i.styledIcon.justify-left:before {
content: "\edf6";
}
i.styledIcon.justify-right:before {
content: "\edf7";
}
i.styledIcon.link-broken:before {
content: "\edf8";
}
i.styledIcon.outdent:before {
content: "\edf9";
}
i.styledIcon.paper-clip:before {
content: "\edfa";
}
i.styledIcon.paragraph:before {
content: "\edfb";
}
i.styledIcon.pin:before {
content: "\edfc";
}
i.styledIcon.printer:before {
content: "\edfd";
}
i.styledIcon.redo:before {
content: "\edfe";
}
i.styledIcon.rotation:before {
content: "\edff";
}
i.styledIcon.save:before {
content: "\ee00";
}
i.styledIcon.small-cap:before {
content: "\ee01";
}
i.styledIcon.strike-through:before {
content: "\ee02";
}
i.styledIcon.sub-listing:before {
content: "\ee03";
}
i.styledIcon.subscript:before {
content: "\ee04";
}
i.styledIcon.superscript:before {
content: "\ee05";
}
i.styledIcon.table:before {
content: "\ee06";
}
i.styledIcon.text-height:before {
content: "\ee07";
}
i.styledIcon.text-width:before {
content: "\ee08";
}
i.styledIcon.trash:before {
content: "\ee09";
}
i.styledIcon.underline:before {
content: "\ee0a";
}
i.styledIcon.undo:before {
content: "\ee0b";
}
i.styledIcon.listing-dots:before {
content: "\ef74";
}
i.styledIcon.listing-number:before {
content: "\ef76";
}

View File

@ -0,0 +1,103 @@
.styledRte {
display: block;
}
.styledRte > .bar {
display: block;
border-radius: 3px;
border: 1px solid var(--borderLightest);
background: var(--backgroundLightest);
font-family: var(--font-regular);
}
.styledRte > .bar > .row {
padding: 5px 0;
display: flex;
}
.styledRte > .bar > .row > .group {
padding: 0 5px 0 0;
}
.styledRte > .bar > .row > .group:first-child {
padding-left: 0;
}
.styledRte > .bar > .row > .group:last-child {
padding-right: 0;
}
.styledRte > .bar > .row > .group > .styledRteButton > .styledButton,
.styledRte > .bar > .row > .group > .styledButton,
.styledRte > .bar > .row > .group > span.headingList {
margin: 0 5px;
}
.styledRte > .bar > .row > .group > .headingList {
height: 32px;
min-width: 40px;
overflow-y: visible;
overflow-x: hidden;
}
.styledRte > .editorWrapper {
display: block;
width: 100%;
border-radius: 3px;
border: 1px solid var(--borderLightest);
background: var(--backgroundLightest);
font-family: var(--font-regular);
color: var(--textDarkest);
font-weight: normal;
font-size: 15px;
resize: vertical;
}
.styledRte > .editorWrapper > .editor {
display: block;
margin: 8px 12px 9px;
min-height: 60px;
}
.styledRte > .editorWrapper > .editor ul,
.styledRte > .editorWrapper > .editor ol {
margin-left: 25px;
}
/**********************************************************/
/* Table tooltip */
/**********************************************************/
.tableTooltip {
min-width: 120px;
padding: 15px;
position: absolute;
}
.tableTooltip > h2 {
display: flex;
justify-content: space-between;
margin-bottom: 15px;
}
.tableTooltip > table {
table-layout: fixed;
border-spacing: 0;
text-align: center;
}
.tableTooltip > table > tbody > tr > td {
width: 24px;
height: 24px;
text-align: center;
padding: 5px;
border-bottom: 1px solid var(--borderLight);
border-right: 1px solid var(--borderLight);
border-left: 1px solid var(--borderLight);
border-top: 1px solid var(--borderLight);
}
.tableTooltip > .inputs {
display: flex;
justify-content: space-between;
}

View File

@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDazCCAlOgAwIBAgIUDjHRR+doFMtPDDYS5nI8q7lcgwQwDQYJKoZIhvcNAQEL
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMDA2MTAwNzM2MTFaFw0yMTA2
MTAwNzM2MTFaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw
HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB
AQUAA4IBDwAwggEKAoIBAQC+8ugcWfHcH77/CF9ey0/qlwy6zQ0Vl/p9QC70NCFd
BiMnmh9jyglirSaSGuZOZedNhhg7n8JPJBk9435L0L2Ceuwa0RlzC3HUicSF61pZ
qQ3gnWu5S5deqGlP++QBWeRj6so3e6fIzc8jiarAKvB7iO5t6PvhAjvpDfWBhMUk
tnkHUnQx1dCZnYQxhbGPUNGgIy+8SkjE8JkURhQQviBONaCR6yjbh81ZF6mMjhUe
tdWJ0AIZ9FjPE+4jG/URGgXv78+gAFBav63wKOyrAVwn2S3m2xLZ76ErhUibQ5ie
M0r9hflpEjETc0xkwCBDKFLVfDOk9bzEeOwqMJf1qun/AgMBAAGjUzBRMB0GA1Ud
DgQWBBRoVikqYGbNf+avLLMUtih8z27PhDAfBgNVHSMEGDAWgBRoVikqYGbNf+av
LLMUtih8z27PhDAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAY
V4CQ3Xd7EIjHfZGVGoWMX7bhIBn6vzPNpUDV3NiCQfpgk/1BLRqiISx/4+40X4C0
xk6QHe+Fl6IRYd/4UT1ik43Vu2Q0ED7JlITHkPFdGsH1V8BiImx+b3+EGEBCGahm
UdMOhuyt3gkQRtz9Vvn4o+xLrP8YNLJ0qUchQNIsC7MTMZUpFJ+NJ3nHXOgdn2+s
3bNGDcHh+VVjF38DxHH66egdDUYZvL2DPJ5sCgz+q2D8tY7UUTviw4feGeOpU5ls
R9zVMhiQ38y/ERJvHn61XnyUP32kd+rRkn+iQRy4pDjX1FQte9vlSAlOfedhEwaY
g7qI9zFDYyGPX4g0A4j8
-----END CERTIFICATE-----

View File

@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC+8ugcWfHcH77/
CF9ey0/qlwy6zQ0Vl/p9QC70NCFdBiMnmh9jyglirSaSGuZOZedNhhg7n8JPJBk9
435L0L2Ceuwa0RlzC3HUicSF61pZqQ3gnWu5S5deqGlP++QBWeRj6so3e6fIzc8j
iarAKvB7iO5t6PvhAjvpDfWBhMUktnkHUnQx1dCZnYQxhbGPUNGgIy+8SkjE8JkU
RhQQviBONaCR6yjbh81ZF6mMjhUetdWJ0AIZ9FjPE+4jG/URGgXv78+gAFBav63w
KOyrAVwn2S3m2xLZ76ErhUibQ5ieM0r9hflpEjETc0xkwCBDKFLVfDOk9bzEeOwq
MJf1qun/AgMBAAECggEAXRhwseHoWTnhFNYwKTdWrzkVq71tM6n1Jju0qLsBySjE
2vn5c9181e81buZOgsqMCu/lwKwTQCKJa/MOEEilHIhxtGFd1wktZkIE3oXwduZF
Lc2SR7TjB/Nz5NsaPs5k25INJR/UncI5y0nDRg2pUZFhLZT5uKouK2Hy4EKrG0pB
8bYYlTq9Ra+CDBHlXQEGzzfFFGjAaHXc2uYcSn3bhBuUAzPW735CZZ0uCh/0d5Om
xp1vJpMIhr5YDymVHXS1WV1rqvfDeNQNZYOKv2NHbxa+dUbkGkVrgW4KD0mYucw0
JjyFWKLhetZM8f8k/9bC1dbss59CsHBfNRJ4Abv/gQKBgQD91jnKkk+PC1WDD6Oh
haa2ZSlixc9dUQVG/ve3dsGTll839qvqNCTdIMIXIJI/FYG2e0M3ITcW7Kc8MKJZ
MynlgUW7027vYW5m89JY/Ev+ymnh1/xHeoLVMHlr/ZPUxoBA22KiowsZTONMFPZT
7sJS7WxbiU5kMGE5og7sqC8JvQKBgQDAk3vNCqqkhE7dZvJ1s/sX5Tn9lAu9CZj6
hZQrPh6ZxynsyE7Nj8Hp6Fh9uW2NzahG16Zil0uvqrvtcshI3sGy1+NWxsWQyO3A
DP7kKerEJ/5AS9jSis5OCnsrOCEF1ZvabSAKlgSTf93AZ8qjs2xCdyyqxYpzwfX8
U6/8aiq4awKBgF31pXDBleeKN34LFPPeKCbN7XLda/PL4Ns11/Y2ZFNAT0DE8z//
S0H7NT0gVmI5kMk+eVP33I+EzCawjffcw35ryqdLDX5Yn2hGiq9bvLm0rVrm+0Bu
Le3CQr/hno4daC4ZxzoShjI4Ts7D16ab85yEvB5qBfV6HxMZVNLvMnI1AoGAF5S3
rybkOFr/MTs+60zLrWRjUnrDaTV4pwyeVSE5LAloR9dLVv6IdzT9SP/gu2F4fpw/
gokWOn+EnZHVlp64R0cKToDuhkkkW8T7nULIvZZMGuFuvnFCy+mapXMtEALVH80H
BGTUUJ9yrvHGrX71/bmMHaksx/nzPh+dSCJT8tsCgYEA7CvaE0Lsw8/ImkVNjKBj
+AprNB1s93/nrgO6Ql/O3Dv0/OUj6PscKYpgID29RpygoMqs4oZzNRQ72oRM5ijc
tOPrvfFINJ9JDAVrUMH5raadX8KJXtvoDzy6MSr8jvBbj6HeNDbyz/OnUd03fF72
z9B6af93B6IpwbRK7q6JFlc=
-----END PRIVATE KEY-----

View File

@ -21,6 +21,7 @@
@import "./css/styledComment.css";
@import "./css/styledPage.css";
@import "./css/styledLink.css";
@import "./css/styledRte.css";
@import "./css/app.css";
@import "./css/issue.css";
@import "./css/project.css";

View File

@ -6,8 +6,9 @@ pub use fields::*;
use jirs_data::*;
use crate::model::{ModalType, Model, Page};
use crate::shared::styled_rte::RteMsg;
use crate::shared::styled_select::StyledSelectChange;
use crate::shared::styled_tooltip::Variant as StyledTooltip;
use crate::shared::styled_tooltip::{Variant as StyledTooltip, Variant};
use crate::shared::{go_to_board, go_to_login, styled_tooltip};
use crate::ws::{flush_queue, open_socket, read_incoming, send_ws_msg};
@ -72,6 +73,7 @@ pub enum Msg {
StrInputChanged(FieldId, String),
U32InputChanged(FieldId, u32),
FileInputChanged(FieldId, Vec<File>),
Rte(RteMsg, FieldId),
// issues
AddIssue,
@ -180,6 +182,7 @@ fn update(msg: Msg, model: &mut model::Model, orders: &mut impl Orders<Msg>) {
styled_tooltip::Variant::Messages => {
model.messages_tooltip_visible = !model.messages_tooltip_visible;
}
Variant::TableBuilder => {}
},
_ => (),
}

View File

@ -13,6 +13,7 @@ use crate::shared::styled_checkbox::StyledCheckboxState;
use crate::shared::styled_editor::Mode;
use crate::shared::styled_image_input::StyledImageInputState;
use crate::shared::styled_input::StyledInputState;
use crate::shared::styled_rte::StyledRteState;
use crate::shared::styled_select::StyledSelectState;
use crate::{EditIssueModalSection, FieldId, ProjectFieldId /*HOST_URL*/};
@ -278,6 +279,7 @@ pub struct ProjectSettingsPage {
pub edit_column_id: Option<IssueStatusId>,
pub creating_issue_status: bool,
pub name: StyledInputState,
pub description_rte: StyledRteState,
}
impl ProjectSettingsPage {
@ -317,6 +319,9 @@ impl ProjectSettingsPage {
FieldId::ProjectSettings(ProjectFieldId::IssueStatusName),
"",
),
description_rte: StyledRteState::new(FieldId::ProjectSettings(
ProjectFieldId::Description,
)),
}
}

View File

@ -51,6 +51,7 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
page.project_category_state.update(&msg, orders);
page.time_tracking.update(&msg);
page.name.update(&msg);
page.description_rte.update(&msg);
match msg {
Msg::StrInputChanged(FieldId::ProjectSettings(ProjectFieldId::Name), text) => {

View File

@ -12,6 +12,7 @@ use crate::shared::styled_field::StyledField;
use crate::shared::styled_form::StyledForm;
use crate::shared::styled_icon::{Icon, StyledIcon};
use crate::shared::styled_input::StyledInput;
use crate::shared::styled_rte::StyledRte;
use crate::shared::styled_select::StyledSelect;
use crate::shared::styled_textarea::StyledTextarea;
use crate::shared::{inner_layout, ToChild, ToNode};
@ -31,6 +32,11 @@ pub fn view(model: &model::Model) -> Node<Msg> {
let description_field = description_field(page);
let desc_rte = StyledRte::build(FieldId::ProjectSettings(ProjectFieldId::Description))
.state(&page.description_rte)
.build()
.into_node();
let category_field = category_field(page);
let time_tracking =
@ -79,6 +85,7 @@ pub fn view(model: &model::Model) -> Node<Msg> {
}))
.add_field(name_field)
.add_field(url_field)
.add_field(desc_rte)
.add_field(description_field)
.add_field(category_field)
.add_field(time_tracking_field)

View File

@ -23,6 +23,7 @@ pub mod styled_image_input;
pub mod styled_input;
pub mod styled_link;
pub mod styled_modal;
pub mod styled_rte;
pub mod styled_select;
pub mod styled_select_child;
pub mod styled_textarea;

View File

@ -44,6 +44,53 @@ pub enum Icon {
Cop,
Message,
User,
AlignCenter,
AlignLeft,
AlignRight,
AllCaps,
Bold,
Brush,
ClipBoard,
CodeAlt,
ColorBucket,
ColorPicker,
CopyInvert,
Copy,
Cut,
DeleteAlt,
EditAlt,
EraserAlt,
Font,
Heading,
Indent,
ItalicAlt,
Italic,
JustifyAll,
JustifyCenter,
JustifyLeft,
JustifyRight,
LinkBroken,
ListingDots,
ListingNumber,
Outdent,
PaperClip,
Paragraph,
Pin,
Printer,
Redo,
Rotation,
Save,
SmallCap,
StrikeThrough,
SubListing,
Subscript,
Superscript,
Table,
TextHeight,
TextWidth,
Underline,
Undo,
}
impl Icon {
@ -98,6 +145,53 @@ impl std::fmt::Display for Icon {
Icon::Cop => "cop",
Icon::Message => "message",
Icon::User => "user",
// rte
Icon::AlignCenter => "align-center",
Icon::AlignLeft => "align-left",
Icon::AlignRight => "align-right",
Icon::AllCaps => "all-caps",
Icon::Bold => "bold",
Icon::Brush => "brush",
Icon::ClipBoard => "clip-board",
Icon::CodeAlt => "code-alt",
Icon::ColorBucket => "color-bucket",
Icon::ColorPicker => "color-picker",
Icon::CopyInvert => "copy-invert",
Icon::Copy => "copy",
Icon::Cut => "cut",
Icon::DeleteAlt => "delete-alt",
Icon::EditAlt => "edit-alt",
Icon::EraserAlt => "eraser-alt",
Icon::Font => "font",
Icon::Heading => "heading",
Icon::Indent => "indent",
Icon::ItalicAlt => "italic-alt",
Icon::Italic => "italic",
Icon::JustifyAll => "justify-all",
Icon::JustifyCenter => "justify-center",
Icon::JustifyLeft => "justify-left",
Icon::JustifyRight => "justify-right",
Icon::LinkBroken => "link-broken",
Icon::Outdent => "outdent",
Icon::PaperClip => "paper-clip",
Icon::Paragraph => "paragraph",
Icon::Pin => "pin",
Icon::Printer => "printer",
Icon::Redo => "redo",
Icon::Rotation => "rotation",
Icon::Save => "save",
Icon::SmallCap => "small-cap",
Icon::StrikeThrough => "strike-through",
Icon::SubListing => "sub-listing",
Icon::Subscript => "subscript",
Icon::Superscript => "superscript",
Icon::Table => "table",
Icon::TextHeight => "text-height",
Icon::TextWidth => "text-width",
Icon::Underline => "underline",
Icon::Undo => "undo",
Icon::ListingDots => "listing-dots",
Icon::ListingNumber => "listing-number",
};
f.write_str(code)
}

View File

@ -0,0 +1,775 @@
use crate::shared::styled_button::StyledButton;
use crate::shared::styled_icon::{Icon, StyledIcon};
use crate::shared::styled_tooltip::StyledTooltip;
use crate::shared::ToNode;
use crate::{FieldId, Msg};
use seed::{prelude::*, *};
#[derive(Debug, Clone, Copy)]
pub enum HeadingSize {
H1,
H2,
H3,
H4,
H5,
H6,
}
impl ToString for HeadingSize {
fn to_string(&self) -> String {
match self {
HeadingSize::H1 => "H1",
HeadingSize::H2 => "H2",
HeadingSize::H3 => "H3",
HeadingSize::H4 => "H4",
HeadingSize::H5 => "H5",
HeadingSize::H6 => "H6",
}
.to_string()
}
}
#[derive(Debug)]
pub enum RteMsg {
Bold,
Italic,
Underscore,
Undo,
Redo,
Strikethrough,
Copy,
Paste,
Cut,
JustifyFull,
JustifyCenter,
JustifyLeft,
JustifyRight,
InsertParagraph,
InsertHeading(HeadingSize),
InsertUnorderedList,
InsertOrderedList,
RemoveFormat,
Subscript,
Superscript,
TableSetRows(u16),
TableSetColumns(u16),
TableSetVisibility(bool),
}
#[derive(Debug)]
pub struct ExecCommand {
pub(crate) name: String,
pub(crate) param: String,
}
impl ExecCommand {
pub fn new<S>(name: S) -> Self
where
S: Into<String>,
{
Self::new_with_param(name, "")
}
pub fn new_with_param<S1, S2>(name: S1, param: S2) -> Self
where
S1: Into<String>,
S2: Into<String>,
{
Self {
name: name.into(),
param: param.into(),
}
}
}
impl RteMsg {
pub fn to_command(&self) -> Option<ExecCommand> {
match self {
RteMsg::Bold => Some(ExecCommand::new("bold")),
RteMsg::Italic => Some(ExecCommand::new("italic")),
RteMsg::Underscore => Some(ExecCommand::new("underline")),
RteMsg::Undo => Some(ExecCommand::new("undo")),
RteMsg::Redo => Some(ExecCommand::new("redo")),
RteMsg::Strikethrough => Some(ExecCommand::new("strikeThrough")),
RteMsg::Copy => Some(ExecCommand::new("copy")),
RteMsg::Paste => Some(ExecCommand::new("paste")),
RteMsg::Cut => Some(ExecCommand::new("cut")),
RteMsg::JustifyFull => Some(ExecCommand::new("justifyFull")),
RteMsg::JustifyCenter => Some(ExecCommand::new("justifyCenter")),
RteMsg::JustifyLeft => Some(ExecCommand::new("justifyLeft")),
RteMsg::JustifyRight => Some(ExecCommand::new("justifyRight")),
RteMsg::InsertParagraph => Some(ExecCommand::new("insertParagraph")),
RteMsg::InsertHeading(heading) => {
Some(ExecCommand::new_with_param("heading", heading.to_string()))
}
RteMsg::InsertUnorderedList => Some(ExecCommand::new("insertUnorderedList")),
RteMsg::InsertOrderedList => Some(ExecCommand::new("insertOrderedList")),
RteMsg::RemoveFormat => Some(ExecCommand::new("removeFormat")),
RteMsg::Subscript => Some(ExecCommand::new("subscript")),
RteMsg::Superscript => Some(ExecCommand::new("superscript")),
// outer
RteMsg::TableSetColumns(..)
| RteMsg::TableSetRows(..)
| RteMsg::TableSetVisibility(..) => None,
}
}
}
#[derive(Debug, Clone)]
pub struct StyledRteTableState {
pub visible: bool,
pub rows: u16,
pub cols: u16,
}
#[derive(Debug)]
pub struct StyledRteState {
pub value: String,
pub field_id: FieldId,
pub table_tooltip: StyledRteTableState,
}
impl StyledRteState {
pub fn new(field_id: FieldId) -> Self {
Self {
field_id,
value: String::new(),
table_tooltip: StyledRteTableState {
visible: false,
rows: 3,
cols: 3,
},
}
}
pub fn update(&mut self, msg: &Msg) {
let m = match msg {
Msg::Rte(m, field) if field == &self.field_id => m,
_ => return,
};
match m.to_command() {
Some(ExecCommand { name, param }) => {
match seed::html_document().exec_command_with_show_ui_and_value(
name.as_str(),
false,
param.as_str(),
) {
Ok(_) => {}
Err(e) => log!(e),
}
}
_ => match m {
RteMsg::TableSetRows(n) => {
self.table_tooltip.rows = *n;
}
RteMsg::TableSetColumns(n) => {
self.table_tooltip.cols = *n;
}
RteMsg::TableSetVisibility(b) => {
self.table_tooltip.visible = *b;
}
_ => log!(m),
},
};
}
}
pub struct StyledRte {
field_id: FieldId,
table_tooltip: StyledRteTableState,
// value: String,
}
impl StyledRte {
pub fn build(field_id: FieldId) -> StyledRteBuilder {
StyledRteBuilder {
field_id,
value: String::new(),
table_tooltip: StyledRteTableState {
visible: false,
rows: 0,
cols: 0,
},
}
}
}
impl ToNode for StyledRte {
fn into_node(self) -> Node<Msg> {
render(self)
}
}
pub struct StyledRteBuilder {
field_id: FieldId,
value: String,
table_tooltip: StyledRteTableState,
}
impl StyledRteBuilder {
pub fn state(mut self, state: &StyledRteState) -> Self {
self.value = state.value.clone();
self.table_tooltip = state.table_tooltip.clone();
self
}
pub fn build(self) -> StyledRte {
StyledRte {
field_id: self.field_id,
// value: self.value,
table_tooltip: self.table_tooltip,
}
}
}
pub fn render(values: StyledRte) -> Node<Msg> {
{
let _brush_button = styled_rte_button(
"Brush",
Icon::Brush,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
None as Option<Msg>
}),
);
let _color_bucket_button = styled_rte_button(
"Color bucket",
Icon::ColorBucket,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
None as Option<Msg>
}),
);
let _color_picker_button = styled_rte_button(
"Color picker",
Icon::ColorPicker,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
None as Option<Msg>
}),
);
let _link_broken_button = styled_rte_button(
"Link broken",
Icon::LinkBroken,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
None as Option<Msg>
}),
);
let _pin_button = styled_rte_button(
"Pin",
Icon::Pin,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
None as Option<Msg>
}),
);
let _rotation_button = styled_rte_button(
"Rotation",
Icon::Rotation,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
None as Option<Msg>
}),
);
let _save_button = styled_rte_button(
"Save",
Icon::Save,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
None as Option<Msg>
}),
);
let _text_height_button = styled_rte_button(
"Text height",
Icon::TextHeight,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
None as Option<Msg>
}),
);
let _text_width_button = styled_rte_button(
"Text width",
Icon::TextWidth,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
None as Option<Msg>
}),
);
}
div![
class!["styledRte"],
div![
class!["bar"],
first_row(&values),
second_row(&values),
// brush_button,
// color_bucket_button,
// color_picker_button,
// link_broken_button,
// pin_button,
// save_button,
// text_height_button,
// text_width_button,
],
div![
class!["editorWrapper"],
div![class!["editor"], attrs![At::ContentEditable => true]],
]
]
}
fn first_row(values: &StyledRte) -> Node<Msg> {
let justify = {
let field_id = values.field_id.clone();
let justify_all_button = styled_rte_button(
"Justify All",
Icon::JustifyAll,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::JustifyFull, field_id))
}),
);
let field_id = values.field_id.clone();
let justify_center_button = styled_rte_button(
"Justify Center",
Icon::JustifyCenter,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::JustifyCenter, field_id))
}),
);
let field_id = values.field_id.clone();
let justify_left_button = styled_rte_button(
"Justify Left",
Icon::JustifyLeft,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::JustifyLeft, field_id))
}),
);
let field_id = values.field_id.clone();
let justify_right_button = styled_rte_button(
"Justify Right",
Icon::JustifyRight,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::JustifyRight, field_id))
}),
);
div![
class!["group justify"],
justify_all_button,
justify_center_button,
justify_left_button,
justify_right_button
]
};
let system = {
let field_id = values.field_id.clone();
let redo_button = styled_rte_button(
"Redo",
Icon::Redo,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::Redo, field_id))
}),
);
let field_id = values.field_id.clone();
let undo_button = styled_rte_button(
"Undo",
Icon::Undo,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::Undo, field_id))
}),
);
/*let field_id = values.field_id.clone();
let clip_board_button = styled_rte_button(
"Paste",
Icon::ClipBoard,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::Paste, field_id))
}),
);
let field_id = values.field_id.clone();
let copy_button = styled_rte_button(
"Copy",
Icon::Copy,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::Copy, field_id))
}),
);
let field_id = values.field_id.clone();
let cut_button = styled_rte_button(
"Cut",
Icon::Cut,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::Cut, field_id))
}),
);*/
div![
class!["group system"],
// clip_board_button,
// copy_button,
// cut_button,
undo_button,
redo_button,
]
};
let formatting = {
let field_id = values.field_id.clone();
let remove_formatting = styled_rte_button(
"Remove format",
Icon::EraserAlt,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::RemoveFormat, field_id))
}),
);
let field_id = values.field_id.clone();
let bold_button = styled_rte_button(
"Bold",
Icon::Bold,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::Bold, field_id))
}),
);
let field_id = values.field_id.clone();
let italic_button = styled_rte_button(
"Italic",
Icon::Italic,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::Italic, field_id))
}),
);
let field_id = values.field_id.clone();
let underline_button = styled_rte_button(
"Underline",
Icon::Underline,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::Underscore, field_id))
}),
);
let field_id = values.field_id.clone();
let strike_through_button = styled_rte_button(
"StrikeThrough",
Icon::StrikeThrough,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::Strikethrough, field_id))
}),
);
let field_id = values.field_id.clone();
let subscript_button = styled_rte_button(
"Subscript",
Icon::Subscript,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::Subscript, field_id))
}),
);
let field_id = values.field_id.clone();
let superscript_button = styled_rte_button(
"Superscript",
Icon::Superscript,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::Superscript, field_id))
}),
);
div![
class!["group formatting"],
bold_button,
italic_button,
underline_button,
strike_through_button,
subscript_button,
superscript_button,
remove_formatting,
]
};
div![class!["row firstRow"], system, formatting, justify,]
}
fn second_row(values: &StyledRte) -> Node<Msg> {
/*let align_group = {
let field_id = values.field_id.clone();
let align_center_button = styled_rte_button(
"Align Center",
Icon::AlignCenter,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
None as Option<Msg>
}),
);
let field_id = values.field_id.clone();
let align_left_button = styled_rte_button(
"Align Left",
Icon::AlignLeft,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
None as Option<Msg>
}),
);
let field_id = values.field_id.clone();
let align_right_button = styled_rte_button(
"Align Right",
Icon::AlignRight,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
None as Option<Msg>
}),
);
div![
class!["group align"],
align_center_button,
align_left_button,
align_right_button,
]
};*/
let font_group = {
let _field_id = values.field_id.clone();
let _font_button = styled_rte_button(
"Font",
Icon::Font,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
None as Option<Msg>
}),
);
let options: Vec<Node<Msg>> = vec![
HeadingSize::H1,
HeadingSize::H2,
HeadingSize::H3,
HeadingSize::H4,
HeadingSize::H5,
HeadingSize::H6,
]
.into_iter()
.map(|h| {
let field_id = values.field_id.clone();
let button = StyledButton::build()
.text(h.to_string())
.on_click(mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::InsertHeading(h), field_id))
}))
.empty()
.build()
.into_node();
span![class!["headingOption"], button]
})
.collect();
let heading_button = span![class!["headingList"], options];
let _field_id = values.field_id.clone();
let _small_cap_button = styled_rte_button(
"Small Cap",
Icon::SmallCap,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
None as Option<Msg>
}),
);
let _field_id = values.field_id.clone();
let _all_caps_button = styled_rte_button(
"All caps",
Icon::AllCaps,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
None as Option<Msg>
}),
);
div![
class!["group font"],
// font_button,
heading_button,
// small_cap_button,
// all_caps_button
]
};
let insert_group = {
let table_tooltip = {
let StyledRteTableState {
visible,
rows,
cols,
} = values.table_tooltip;
let field_id = values.field_id.clone();
let on_rows_change = input_ev(Ev::Change, move |v| {
v.parse::<u16>()
.ok()
.map(|n| Msg::Rte(RteMsg::TableSetRows(n), field_id))
});
let field_id = values.field_id.clone();
let on_cols_change = input_ev(Ev::Change, move |v| {
v.parse::<u16>()
.ok()
.map(|n| Msg::Rte(RteMsg::TableSetColumns(n), field_id))
});
let field_id = values.field_id.clone();
let close_table_tooltip = StyledButton::build()
.empty()
.icon(Icon::Close)
.on_click(mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::TableSetVisibility(false), field_id))
}))
.build()
.into_node();
StyledTooltip::build()
.table_tooltip()
.visible(visible)
.add_child(h2![span!["Add table"], close_table_tooltip])
.add_child(div![class!["inputs"], span!["Rows"], seed::input![
attrs![At::Type => "range"; At::Step => "1"; At::Min => "1"; At::Max => "10"; At::Value => rows],
on_rows_change
]])
.add_child(div![class!["inputs"], span!["Columns"], seed::input![
attrs![At::Type => "range"; At::Step => "1"; At::Min => "1"; At::Max => "10"; At::Value => cols],
on_cols_change
]])
.add_child({
let body: Vec<Node<Msg>> = (0..rows)
.into_iter()
.map(|_row| {
let tds: Vec<Node<Msg>> = (0..cols)
.into_iter()
.map(|_col| td![format!(" ")])
.collect();
tr![tds]
})
.collect();
seed::table![tbody![body]]
})
.build()
.into_node()
};
let field_id = values.field_id.clone();
let listing_dots = styled_rte_button(
"Listing dots",
Icon::ListingDots,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::InsertUnorderedList, field_id))
}),
);
let field_id = values.field_id.clone();
let listing_number = styled_rte_button(
"Listing number",
Icon::ListingNumber,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::InsertOrderedList, field_id))
}),
);
/*let field_id = values.field_id.clone();
let sub_listing_button = styled_rte_button(
"Sub Listing",
Icon::SubListing,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
None as Option<Msg>
}),
);*/
let field_id = values.field_id.clone();
let mut table_button = styled_rte_button(
"Table",
Icon::Table,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::TableSetVisibility(true), field_id))
}),
);
table_button.add_child(table_tooltip);
let field_id = values.field_id.clone();
let paragraph_button = styled_rte_button(
"Paragraph",
Icon::Paragraph,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
Some(Msg::Rte(RteMsg::InsertParagraph, field_id))
}),
);
// let field_id = values.field_id.clone();
// let code_alt_button = styled_rte_button(
// "Insert code",
// Icon::CodeAlt,
// mouse_ev(Ev::Click, move |ev| {
// ev.prevent_default();
// None as Option<Msg>
// }),
// );
div![
class!["group insert"],
paragraph_button,
table_button,
// code_alt_button,
listing_dots,
listing_number,
// sub_listing_button,
]
};
let indent_outdent = {
let indent_button = styled_rte_button(
"Indent",
Icon::Indent,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
None as Option<Msg>
}),
);
let outdent_button = styled_rte_button(
"Outdent",
Icon::Outdent,
mouse_ev(Ev::Click, move |ev| {
ev.prevent_default();
None as Option<Msg>
}),
);
div![class!["group indentOutdent"], indent_button, outdent_button]
};
div![
class!["row secondRow"],
font_group,
// align_group,
insert_group,
indent_outdent
]
}
fn styled_rte_button(title: &str, icon: Icon, handler: EventHandler<Msg>) -> Node<Msg> {
let button = StyledButton::build()
.icon(StyledIcon::build(icon).build())
.on_click(handler)
.empty()
.build()
.into_node();
span![
class!["styledRteButton"],
attrs![At::Title => title],
button
]
}

View File

@ -7,6 +7,7 @@ use crate::Msg;
pub enum Variant {
About,
Messages,
TableBuilder,
}
impl Default for Variant {
@ -20,6 +21,7 @@ impl std::fmt::Display for Variant {
match self {
Variant::About => f.write_str("about"),
Variant::Messages => f.write_str("messages"),
Variant::TableBuilder => f.write_str("tableTooltip"),
}
}
}
@ -80,6 +82,11 @@ impl StyledTooltipBuilder {
self
}
pub fn table_tooltip(mut self) -> Self {
self.variant = Variant::TableBuilder;
self
}
pub fn build(self) -> StyledTooltip {
StyledTooltip {
visible: self.visible,