Commit 42dd5add1b2c74627fc77c9f3c810e558ca633c1

Authored by Georg Hopp
1 parent 7dd7a064

Progress on the way to have selectable versions

... ... @@ -120,7 +120,7 @@ pub(crate) fn get_markdowns(pool: Arc<Pool>) -> Result<Vec<Markdown>, Error>
120 120
121 121 pub(crate) fn get_markdown( pool: Arc<Pool>
122 122 , ident: &str
123   - , patch: Option<i32> ) -> Result<Vec<Markdown>, Error>
  123 + , patch: Option<i32> ) -> Result<Markdown, Error>
124 124 {
125 125 use crate::schema::markdowns::dsl::*;
126 126 use crate::schema::markdown_diffs::dsl::*;
... ... @@ -130,8 +130,6 @@ pub(crate) fn get_markdown( pool: Arc<Pool>
130 130 . filter(name.eq(ident))
131 131 . first::<Markdown>(&db_connection)?;
132 132
133   - let mut mds = vec![markdown.clone()];
134   -
135 133 if let Some(patch) = patch {
136 134 let result = markdown_diffs . filter(markdown_id.eq(markdown.id))
137 135 . filter(diff_id.ge(patch))
... ... @@ -146,11 +144,10 @@ pub(crate) fn get_markdown( pool: Arc<Pool>
146 144 std::str::from_utf8(decomp.as_ref()).unwrap()).unwrap();
147 145 markdown.content = apply(&markdown.content, &decomp).unwrap();
148 146 markdown.date_updated = patch.date_created;
149   - mds.push(markdown.clone());
150 147 }
151 148 };
152 149
153   - Ok(mds)
  150 + Ok(markdown)
154 151 }
155 152
156 153 pub(crate) fn delete_markdown( pool: Arc<Pool>
... ...
1   -pub(crate) const _MD_EXAMPLE :&str = r"# Ein sehr schöner Titel
2   -
3   -## Ein sinnloser Text
4   -
5   -Hier kommt ganz viel Text der irgendwie auch was machen soll, aber Zeilen
6   -sollen auch im &lt;pre&gt; Eingabefeld automatisch umbrechen.
7   -
8   -Ein neuner Paragraph beginnt nach einer Leerzeile.
9   -Ein Umbruch entsteht wie gewohnt durch 2 spaces am Ende einer
10   -Zeile.
11   -
12   -## Fußnoten
13   -
14   -Vllt. kann man sogar so was wie Fussnoten[^1] in den Markdown Text
15   -einbinden... diese kann man dann irgendwo einbauen...
16   -
17   ----
18   -
19   -[^1]: Zum Beispiel so...
20   -
21   -[^2]: Oder so...
22   -
23   -## inline html ist im Moment auch ok.
24   -
25   -<pre>Lustigerweise geht auch inline html</pre>
26   -
27   -## Listen for fun
28   -
29   -- ein Liste
30   - - mehr Liste
31   - - diesmal als Subliste.
32   -- und was auch immer...
33   - 1. und nun Verschachtelt.
34   - 1. Numeriert.
35   - 2. huhuhu
36   - 3. wie bitte.
37   - 2. juhu
38   -- noch mehr Liste
39   -
40   -## Preformated Text
41   -
42   -```Hier kommt der code```
43   -
44   -Und hier der Paragraph mit `inline code` der auch sehr schön aussehen kann.
45   -
46   -## Hervorhebungen
47   -
48   -Man kann Text auch sehr schön formatieren. So ist es z.B. möglich
49   -*Worte kursiv zu stellen* oder man kann **sie auch fett schreiben**.
50   -Als spezielles feature kann der von mir verwendete Parser auch
51   -~~Texte durchstreichen~~.
52   -
53   -Nur wenn man Text <u>unterstreichen</u> will muss man auf inline html
54   -zurückgreifen.
55   -
56   -## Blockquotes und horizontale Linie
57   -
58   -> Dies sollte jetzt als quote erkennbar sein.
59   ->
60   ->> Auch diese sind schachtelbar
61   ->
62   -> Und weiter gehts.
63   -
64   ----
65   -
66   -> Aber dies ist ein neuer quote.
67   -
68   -## Links
69   -
70   -Ein link kann inline geschrieben werden, so wie diese zu
71   -[Heise.de](https://heise.de/ 'Heise.de') oder als Referenz am Ende des Textes
72   -wie diese nach [Telepolis][lnk1].
73   -
74   -## Bilder koennte man auch einbinden.
75   -
76   -Wie Links lassen sich auch Bilder wie mein
77   -![Gravatar](https://www.gravatar.com/avatar/fd016c954ec4ed3a4315eeed6c8b97b8)
78   -in den Text ein.
79   -
80   -Im Fließtext sieht das allerdings ein bisschen dumm aus es sei denn man hat
81   -entsprechend angepasste styles. Besser scheint mir daher Bilder nur zwischen
82   -Paragraphen zu plazieren.
83   -
84   -![Gravatar](https://www.gravatar.com/avatar/fd016c954ec4ed3a4315eeed6c8b97b8)
85   -
86   -Etwas so wie hier.
87   -
88   -## Tabellen sollten auch gehen...
89   -
90   -Die folgenden Beispiele kommen von [markdown.land][lnk2]:
91   -
92   -| Item | Price | # In stock |
93   -|--------------|-----------|------------|
94   -| Juicy Apples | 1.99 | *8* |
95   -| Bananas | **1.89** | 5234 |
96   -
97   -Man braucht sie nicht schön zu formatieren.
98   -
99   -Item | Price | # In stock
100   ----|---|---
101   -Juicy Apples | 1.99 | 739
102   -Bananas | 1.89 | 6
103   -
104   -und die Spaltenausrichtung kann man auch einstellen:
105   -
106   -
107   -| Item | Price | # In stock |
108   -|--------------|:-----:|-----------:|
109   -| Juicy Apples | 1.99 | 739 |
110   -| Bananas | 1.8900 | 6 |
111   -
112   -
113   -[lnk1]: https://heise.de/tp/ 'Telepolis'
114   -[lnk2]: https://markdown.land/markdown-table 'markdown.land'";
115   -
116   -/*
117   -pub(crate) const PEN_ICON :&str = r#"<?xml version="1.0" encoding="iso-8859-1"?>
118   -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
119   - "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
120   -<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg"
121   - xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
122   - viewBox="0 0 220.001 220.001"
123   - style="enable-background:new 0 0 220.001 220.001;" xml:space="preserve">
124   - <g>
125   - <polygon points="0,220 59.34,213.86 6.143,160.661"/>
126   - <path d="M132.018,34.787l53.197,53.197L69.568,203.631L16.37,
127   - 150.434L132.018,34.787z M212.696,60.502c9.738-9.738,9.742-25.527,
128   - 0-35.268l-17.93-17.93c-9.738-9.74-25.529-9.738-35.268,0l-17.346,
129   - 17.347l53.199,53.196L212.696,60.502z"/>
130   - </g>
131   -</svg>"#;
132   -*/
  1 +use mogwai::prelude::*;
  2 +use super::NS;
  3 +
  4 +pub(crate) fn discard_icon() -> ViewBuilder<Dom> {
  5 + builder! {
  6 + <svg xmlns=NS viewBox="10.3 3.8 76.2 88.7"
  7 + style:width="1.5em" style:height="1.5em">
  8 + <g xmlns=NS id="_x37_0">
  9 + <polygon xmlns=NS
  10 + points="35.4,18.1 31.1,4.3 31.1,16.3
  11 + 24.5,16.3 24.5,10.9 18.3,18.9
  12 + 13.8,23.7 17,23.7 19.8,31.8
  13 + 27.9,34.1 27.9,37.8 38.7,41.8
  14 + 38.7,34.1 38.7,30.4 38.7,25.2
  15 + 46.8,25.2 "/>
  16 + <path xmlns=NS
  17 + d="M75.7,39.9 h-8.3 h-40.5 h-8.3 h-3 v9.5
  18 + v2 h4.7 c2.2,13.3,6.8,42.2,6.8,42.2 h40
  19 + c0,0,4.6-27.6,7-42.2 h4.7 v-2 v-9.5
  20 + H75.7z
  21 + M67.7,51.4 l-2.6,15.6 l-6.1-6.9 l8-8.7
  22 + H67.7z
  23 + M63.7,75.6 l-1.3,7.9 l-2.9-3.2
  24 + L63.7,75.6z
  25 + M56.6,77.2
  26 + L50,70 l6.2-6.7 l6.4,7.3
  27 + L56.6,77.2z
  28 + M52.4,51.4 h8.9 l-5.1,5.5 l-4.8-5.4
  29 + C51.8,51.4,52.1,51.4,52.4,51.4z
  30 + M53.3,60 l-6.2,6.8 l-6.6-7.2 l6.4-6.9
  31 + L53.3,60z
  32 + M30.5,74.9 l4.6,5 l-3.2,3.5
  33 + L30.5,74.9z
  34 + M31.4,69.6 l6.2-6.8 l6.6,7.2 l-6.2,6.8
  35 + L31.4,69.6z
  36 + M41.9,51.4 c0.1,0,0.2,0,0.3,0 l-4.7,5.1
  37 + l-4.7-5.1
  38 + H41.9z
  39 + M27.1,51.4 l7.6,8.3 l-5.7,6.2l-2.3-14.5
  40 + H27.1z
  41 + M34.6,86.7 l3.3-3.6 l3.3,3.6
  42 + H34.6z
  43 + M47.1,86.7 l-6.2-6.8 l6.2-6.8 l6.6,7.2
  44 + l-5.8,6.4
  45 + H47.1z
  46 + M53.7,86.7 l2.9-3.2 l3,3.2
  47 + H53.7z"/>
  48 + </g>
  49 + </svg>
  50 + }
  51 +}
... ...
  1 +use mogwai::prelude::*;
  2 +use super::NS;
  3 +
  4 +pub(crate) fn edit_icon() -> ViewBuilder<Dom> {
  5 + builder! {
  6 + <svg xmlns=NS viewBox="0 0 220.001 220.001"
  7 + style:width="1.5em" style:height="1.5em">
  8 + <g xmlns=NS>
  9 + <polygon xmlns=NS
  10 + points="0,220 59.34,213.86 6.143,160.661"/>
  11 + <path xmlns=NS
  12 + d="M132.018,34.787 l53.197,53.197
  13 + L69.568,203.631
  14 + L16.37,150.434
  15 + L132.018,34.787z
  16 + M212.696,60.502
  17 + c9.738,-9.738,9.742,-25.527,0,-35.268
  18 + l-17.93,-17.93
  19 + c-9.738,-9.74,-25.529,-9.738,-35.268,0
  20 + l-17.346,17.347 l53.199,53.196
  21 + L212.696,60.502z"/>
  22 + </g>
  23 + </svg>
  24 + }
  25 +}
... ...
  1 +const NS :&str = "http://www.w3.org/2000/svg";
  2 +
  3 +pub(crate) mod discard;
  4 +pub(crate) mod edit;
  5 +pub(crate) mod save;
  6 +pub(crate) mod select;
  7 +
  8 +pub(crate) use discard::discard_icon;
  9 +pub(crate) use edit::edit_icon;
  10 +pub(crate) use save::save_icon;
  11 +pub(crate) use select::select_icon;
... ...
  1 +use mogwai::prelude::*;
  2 +use super::NS;
  3 +
  4 +pub(crate) fn save_icon() -> ViewBuilder<Dom> {
  5 + builder! {
  6 + <svg xmlns=NS viewBox="0 -1 32 32"
  7 + style:width="1.5em" style:height="1.5em"
  8 + style:enable_background="new 0 0 32 32"
  9 + style:fill="none"
  10 + style:stroke="#000"
  11 + style:stroke_width="2"
  12 + style:stroke_linecap="round"
  13 + style:stroke_linejoin="round"
  14 + style:stroke_miterlimit="10">
  15 + <ellipse xmlns=NS
  16 + cx="14" cy="8" rx="10" ry="5"/>
  17 + <line xmlns=NS
  18 + x1="24" y1="16" x2="24" y2="8"/>
  19 + <path xmlns=NS
  20 + d="M4,8 v8 c0,2.8,4.5,5,10,5
  21 + c1.2,0,2.3-0.1,3.4-0.3"/>
  22 + <path xmlns=NS
  23 + d="M4,16 v8 c0,2.8,4.5,5,10,5
  24 + c2,0,3.8-0.3,5.3-0.8"/>
  25 + <circle xmlns=NS
  26 + cx="24" cy="23" r="7"/>
  27 + <line xmlns=NS
  28 + x1="24" y1="16" x2="24" y2="26"/>
  29 + <polyline xmlns=NS
  30 + points="21,23 24,26 27,23"/>
  31 + </svg>
  32 + }
  33 +}
... ...
  1 +use mogwai::prelude::*;
  2 +use super::NS;
  3 +
  4 +pub(crate) fn select_icon() -> ViewBuilder<Dom> {
  5 + builder! {
  6 + <svg xmlns=NS viewBox="0 -1 24 24"
  7 + style:width="1.5em" style:height="1.5em"
  8 + style:fill="none">
  9 + <path xmlns=NS
  10 + style:fill="black"
  11 + d="M9.17154 11.508
  12 + L7.75732 10.0938
  13 + L12 5.85113
  14 + L16.2426 10.0938
  15 + L14.8284 11.508
  16 + L12 8.67956
  17 + L9.17154 11.508Z"/>
  18 + <path xmlns=NS
  19 + style:fill="black"
  20 + d="M9.17154 12.492
  21 + L7.75732 13.9062
  22 + L12 18.1489
  23 + L16.2426 13.9062
  24 + L14.8284 12.492
  25 + L12 15.3204
  26 + L9.17154 12.492Z"/>
  27 + <path xmlns=NS
  28 + style:fill="black"
  29 + style:fill_rule="evenodd"
  30 + style:clip_rule="evenodd"
  31 + d="M1 5
  32 + C1 2.79086 2.79086 1 5 1
  33 + H19
  34 + C21.2091 1 23 2.79086 23 5
  35 + V19
  36 + C23 21.2091 21.2091 23 19 23
  37 + H5
  38 + C2.79086 23 1 21.2091 1 19
  39 + V5Z
  40 + M5 3
  41 + H19
  42 + C20.1046 3 21 3.89543 21 5
  43 + V19
  44 + C21 20.1046 20.1046 21 19 21
  45 + H5
  46 + C3.89543 21 3 20.1046 3 19
  47 + V5
  48 + C3 3.89543 3.89543 3 5 3Z"/>
  49 + </svg>
  50 + }
  51 +}
... ...
  1 +pub(crate) mod icons;
... ...
1 1 mod data;
2 2
3 3 use artshop_common::types::MarkdownJson;
  4 +use data::icons::*;
4 5 use js_sys::JsString;
5 6 use log::Level;
6 7 use mogwai::prelude::*;
7 8 use web_sys::{RequestInit, RequestMode, Request, Response, MouseEvent};
8   -use serde::{Deserialize, Serialize};
9 9 use std::panic;
10 10 use wasm_bindgen::prelude::*;
11 11
... ... @@ -26,14 +26,17 @@ fn md_to_html(source: &str) -> String {
26 26 html_output
27 27 }
28 28
29   -async fn md_from_db() -> Vec<MarkdownJson> {
  29 +async fn md_from_db(patch :Option<i32>) -> MarkdownJson {
30 30 let window = web_sys::window().unwrap();
31 31 let mut opts = RequestInit::new();
32 32 opts.method("GET").mode(RequestMode::Cors);
33 33
34   - let request = Request::new_with_str_and_init(
35   - "/api/v0/markdowns/md-example?patch=1" // patch=1 always gets all patches.
36   - , &opts ).unwrap();
  34 + let api_uri = match patch {
  35 + Some(i) => format!("/api/v0/markdowns/md-example?patch={}", i),
  36 + None => String::from("/api/v0/markdowns/md-example"),
  37 + };
  38 +
  39 + let request = Request::new_with_str_and_init(&api_uri, &opts).unwrap();
37 40 request.headers().set("Accept", "application/json").unwrap();
38 41
39 42 let response = JsFuture::from(window.fetch_with_request(&request))
... ... @@ -43,12 +46,12 @@ async fn md_from_db() -> Vec<MarkdownJson> {
43 46 . await.unwrap()
44 47 . dyn_into::<JsString>().unwrap()
45 48 );
46   - let data :Vec<MarkdownJson> = serde_json::from_str(data.as_str()).unwrap();
  49 + let data :MarkdownJson = serde_json::from_str(data.as_str()).unwrap();
47 50
48 51 data
49 52 }
50 53
51   -async fn md_to_db(md :MarkdownJson) {
  54 +async fn md_to_db(md :&MarkdownJson) {
52 55 let encoded = serde_json::to_string(&md).unwrap();
53 56
54 57 let window = web_sys::window().unwrap();
... ... @@ -71,34 +74,56 @@ async fn md_to_db(md :MarkdownJson) {
71 74
72 75 async fn editor_logic( mut rx_logic: broadcast::Receiver<AppLogic>
73 76 , tx_view: broadcast::Sender<String>
74   - , mut rx_dom: broadcast::Receiver<Dom>
75   - , md :Vec<MarkdownJson> ) {
  77 + , mut rx_dom: broadcast::Receiver<Dom> )
  78 +{
76 79 let dom = rx_dom.next().await.unwrap();
77 80 let mut show_edit = false;
  81 + let mut md = md_from_db(Some(2)).await;
  82 +
  83 + let container = match dom.inner_read() {
  84 + Either::Left(dom_js) =>
  85 + Some( ( dom_js
  86 + . to_owned()
  87 + . dyn_into::<Node>().unwrap()
  88 + . first_child().unwrap()
  89 + . first_child().unwrap()
  90 + . dyn_into::<HtmlElement>().unwrap()
  91 + , dom_js
  92 + . to_owned()
  93 + . dyn_into::<Node>().unwrap()
  94 + . child_nodes().get(1).unwrap()
  95 + . child_nodes().get(1).unwrap()
  96 + . dyn_into::<HtmlElement>().unwrap() )),
  97 + _ => None,
  98 + };
  99 +
  100 + let cont_ref = container.as_ref();
78 101
79   - fn get_md(dom: &Dom) -> String {
80   - match dom.inner_read() {
81   - Either::Left(dom_js) => dom_js . to_owned()
82   - . dyn_into::<Node>().unwrap()
83   - . first_child().unwrap()
84   - . dyn_into::<HtmlElement>().unwrap()
85   - . inner_text(),
86   - _ => String::from(""),
  102 + let get_md = move || {
  103 + match cont_ref {
  104 + Some((md_cont, _)) => md_cont.inner_text(),
  105 + None => String::from(""),
87 106 }
88   - }
  107 + };
89 108
90   - fn update(dom: &Dom) {
91   - if let Either::Left(dom_js) = dom.inner_read() {
92   - dom_js . to_owned()
93   - . dyn_into::<Node>().unwrap()
94   - . child_nodes().get(1).unwrap()
95   - . child_nodes().get(1).unwrap()
96   - . dyn_into::<HtmlElement>().unwrap()
97   - . set_inner_html(md_to_html(get_md(dom).as_str()).as_str())
98   - };
99   - }
  109 + let set_md = move |md :&str| {
  110 + match cont_ref {
  111 + Some((md_cont, _)) => md_cont.set_text_content(Some(md)),
  112 + None => (),
  113 + }
  114 + };
  115 +
  116 + let update = move || {
  117 + match cont_ref {
  118 + Some((md_cont, view_cont)) =>
  119 + view_cont.set_inner_html(
  120 + md_to_html(md_cont.inner_text().as_str()).as_str() ),
  121 + None => (),
  122 + }
  123 + };
100 124
101   - update(&dom);
  125 + set_md(md.content.as_str());
  126 + update();
102 127
103 128 /* play with katex ==== */
104 129 let opts = katex::Opts::builder()
... ... @@ -129,11 +154,10 @@ async fn editor_logic( mut rx_logic: broadcast::Receiver<AppLogic>
129 154 while let Some(msg) = rx_logic.next().await {
130 155 match msg {
131 156 AppLogic::Store => {
132   - let mut new_md = md[0].clone();
133   - new_md.content = get_md(&dom);
134   - md_to_db(new_md).await;
  157 + md.content = get_md();
  158 + md_to_db(&md).await;
135 159 },
136   - AppLogic::Update => update(&dom),
  160 + AppLogic::Update => update(),
137 161 AppLogic::Toggle => {
138 162 show_edit = ! show_edit;
139 163 match show_edit {
... ... @@ -150,8 +174,8 @@ async fn editor_logic( mut rx_logic: broadcast::Receiver<AppLogic>
150 174 fn editor_view( tx_logic: broadcast::Sender<AppLogic>
151 175 , rx_view: broadcast::Receiver<String>
152 176 , tx_dom: broadcast::Sender<Dom>
153   - , md: &Vec<MarkdownJson>
154   -) -> ViewBuilder<Dom> {
  177 + ) -> ViewBuilder<Dom>
  178 +{
155 179 let ns = "http://www.w3.org/2000/svg";
156 180
157 181 let input_filter = tx_logic
... ... @@ -182,150 +206,14 @@ fn editor_view( tx_logic: broadcast::Sender<AppLogic>
182 206 <div contenteditable="true"
183 207 style:cursor="text"
184 208 style:display=("none", rx_view)>
185   - <pre on:click=store_filter>{md[0].content.clone()}</pre>
  209 + <pre on:click=store_filter></pre>
186 210 </div>
187 211 <div>
188 212 <div>
189   - <button>
190   - <svg xmlns=ns viewBox="0 -1 24 24"
191   - style:width="1.5em" style:height="1.5em"
192   - style:fill="none">
193   - <path xmlns=ns
194   - style:fill="black"
195   - d="M9.17154 11.508
196   - L7.75732 10.0938
197   - L12 5.85113
198   - L16.2426 10.0938
199   - L14.8284 11.508
200   - L12 8.67956
201   - L9.17154 11.508Z"/>
202   - <path xmlns=ns
203   - style:fill="black"
204   - d="M9.17154 12.492
205   - L7.75732 13.9062
206   - L12 18.1489
207   - L16.2426 13.9062
208   - L14.8284 12.492
209   - L12 15.3204
210   - L9.17154 12.492Z"/>
211   - <path xmlns=ns
212   - style:fill="black"
213   - style:fill_rule="evenodd"
214   - style:clip_rule="evenodd"
215   - d="M1 5
216   - C1 2.79086 2.79086 1 5 1
217   - H19
218   - C21.2091 1 23 2.79086 23 5
219   - V19
220   - C23 21.2091 21.2091 23 19 23
221   - H5
222   - C2.79086 23 1 21.2091 1 19
223   - V5Z
224   - M5 3
225   - H19
226   - C20.1046 3 21 3.89543 21 5
227   - V19
228   - C21 20.1046 20.1046 21 19 21
229   - H5
230   - C3.89543 21 3 20.1046 3 19
231   - V5
232   - C3 3.89543 3.89543 3 5 3Z"/>
233   - </svg>
234   - </button>
235   - <button>
236   - <svg xmlns=ns viewBox="0 -1 32 32"
237   - style:width="1.5em" style:height="1.5em"
238   - style:enable_background="new 0 0 32 32"
239   - style:fill="none"
240   - style:stroke="#000"
241   - style:stroke_width="2"
242   - style:stroke_linecap="round"
243   - style:stroke_linejoin="round"
244   - style:stroke_miterlimit="10">
245   - <ellipse xmlns=ns
246   - cx="14" cy="8" rx="10" ry="5"/>
247   - <line xmlns=ns
248   - x1="24" y1="16" x2="24" y2="8"/>
249   - <path xmlns=ns
250   - d="M4,8 v8 c0,2.8,4.5,5,10,5
251   - c1.2,0,2.3-0.1,3.4-0.3"/>
252   - <path xmlns=ns
253   - d="M4,16 v8 c0,2.8,4.5,5,10,5
254   - c2,0,3.8-0.3,5.3-0.8"/>
255   - <circle xmlns=ns
256   - cx="24" cy="23" r="7"/>
257   - <line xmlns=ns
258   - x1="24" y1="16" x2="24" y2="26"/>
259   - <polyline xmlns=ns
260   - points="21,23 24,26 27,23"/>
261   - </svg>
262   - </button>
263   - <button>
264   - <svg xmlns=ns viewBox="10.3 3.8 76.2 88.7"
265   - style:width="1.5em" style:height="1.5em">
266   - <g xmlns=ns id="_x37_0">
267   - <polygon xmlns=ns
268   - points="35.4,18.1 31.1,4.3 31.1,16.3
269   - 24.5,16.3 24.5,10.9 18.3,18.9
270   - 13.8,23.7 17,23.7 19.8,31.8
271   - 27.9,34.1 27.9,37.8 38.7,41.8
272   - 38.7,34.1 38.7,30.4 38.7,25.2
273   - 46.8,25.2 "/>
274   - <path xmlns=ns
275   - d="M75.7,39.9 h-8.3 h-40.5 h-8.3 h-3 v9.5
276   - v2 h4.7 c2.2,13.3,6.8,42.2,6.8,42.2 h40
277   - c0,0,4.6-27.6,7-42.2 h4.7 v-2 v-9.5
278   - H75.7z
279   - M67.7,51.4 l-2.6,15.6 l-6.1-6.9 l8-8.7
280   - H67.7z
281   - M63.7,75.6 l-1.3,7.9 l-2.9-3.2
282   - L63.7,75.6z
283   - M56.6,77.2
284   - L50,70 l6.2-6.7 l6.4,7.3
285   - L56.6,77.2z
286   - M52.4,51.4 h8.9 l-5.1,5.5 l-4.8-5.4
287   - C51.8,51.4,52.1,51.4,52.4,51.4z
288   - M53.3,60 l-6.2,6.8 l-6.6-7.2 l6.4-6.9
289   - L53.3,60z
290   - M30.5,74.9 l4.6,5 l-3.2,3.5
291   - L30.5,74.9z
292   - M31.4,69.6 l6.2-6.8 l6.6,7.2 l-6.2,6.8
293   - L31.4,69.6z
294   - M41.9,51.4 c0.1,0,0.2,0,0.3,0 l-4.7,5.1
295   - l-4.7-5.1
296   - H41.9z
297   - M27.1,51.4 l7.6,8.3 l-5.7,6.2l-2.3-14.5
298   - H27.1z
299   - M34.6,86.7 l3.3-3.6 l3.3,3.6
300   - H34.6z
301   - M47.1,86.7 l-6.2-6.8 l6.2-6.8 l6.6,7.2
302   - l-5.8,6.4
303   - H47.1z
304   - M53.7,86.7 l2.9-3.2 l3,3.2
305   - H53.7z"/>
306   - </g>
307   - </svg>
308   - </button>
309   - <button on:click=toggle_filter>
310   - <svg xmlns=ns viewBox="0 0 220.001 220.001"
311   - style:width="1.5em" style:height="1.5em">
312   - <g xmlns=ns>
313   - <polygon xmlns=ns
314   - points="0,220 59.34,213.86 6.143,160.661"/>
315   - <path xmlns=ns
316   - d="M132.018,34.787 l53.197,53.197
317   - L69.568,203.631
318   - L16.37,150.434
319   - L132.018,34.787z
320   - M212.696,60.502
321   - c9.738,-9.738,9.742,-25.527,0,-35.268
322   - l-17.93,-17.93
323   - c-9.738,-9.74,-25.529,-9.738,-35.268,0
324   - l-17.346,17.347 l53.199,53.196
325   - L212.696,60.502z"/>
326   - </g>
327   - </svg>
328   - </button>
  213 + <button>{select_icon()}</button>
  214 + <button>{save_icon()}</button>
  215 + <button>{discard_icon()}</button>
  216 + <button on:click=toggle_filter>{edit_icon()}</button>
329 217 </div>
330 218 <div></div>
331 219 <div></div>
... ... @@ -340,13 +228,11 @@ pub async fn main() -> Result<(), JsValue> {
340 228 panic::set_hook(Box::new(console_error_panic_hook::hook));
341 229 console_log::init_with_level(Level::Trace).unwrap();
342 230
343   - let md = md_from_db().await;
344   -
345 231 let (tx_dom, rx_dom) = broadcast::bounded(1);
346 232 let (tx_logic, rx_logic) = broadcast::bounded(1);
347 233 let (tx_view, rx_view) = broadcast::bounded(1);
348   - let comp = Component::from( editor_view(tx_logic, rx_view, tx_dom, &md) )
349   - . with_logic( editor_logic(rx_logic, tx_view, rx_dom, md) );
  234 + let comp = Component::from( editor_view(tx_logic, rx_view, tx_dom) )
  235 + . with_logic( editor_logic(rx_logic, tx_view, rx_dom) );
350 236
351 237 let page = Component::from(builder! {{comp}});
352 238 page.build()?.run()
... ...
Please register or login to post a comment