1
0
Fork 0
mirror of https://github.com/Nutomic/ibis.git synced 2024-11-22 08:11:08 +00:00

Disable markdown plugins for url shortening and smartquotes (fixes #53)

This commit is contained in:
Felix Ableitner 2024-10-14 12:42:41 +02:00
parent 572a0cb51c
commit 3050617005
3 changed files with 38 additions and 29 deletions

View file

@ -99,7 +99,7 @@ fn create_cookie(jwt: String, data: &Data<IbisData>) -> Cookie<'static> {
// Must not set cookie domain on localhost // Must not set cookie domain on localhost
// https://stackoverflow.com/a/1188145 // https://stackoverflow.com/a/1188145
let domain = data.domain().to_string(); let domain = data.domain().to_string();
if domain.starts_with("localhost") || domain.starts_with("127.0.0.1") { if !domain.starts_with("localhost") && !domain.starts_with("127.0.0.1") {
cookie = cookie.domain(domain); cookie = cookie.domain(domain);
} }
cookie cookie

View file

@ -9,7 +9,10 @@ use markdown_it::{
pub fn markdown_parser() -> MarkdownIt { pub fn markdown_parser() -> MarkdownIt {
let mut parser = MarkdownIt::new(); let mut parser = MarkdownIt::new();
markdown_it::plugins::cmark::add(&mut parser); markdown_it::plugins::cmark::add(&mut parser);
markdown_it::plugins::extra::add(&mut parser); markdown_it::plugins::extra::linkify::add(&mut parser);
markdown_it::plugins::extra::strikethrough::add(&mut parser);
markdown_it::plugins::extra::tables::add(&mut parser);
markdown_it::plugins::extra::typographer::add(&mut parser);
parser.inline.add_rule::<ArticleLinkScanner>(); parser.inline.add_rule::<ArticleLinkScanner>();
parser parser
} }

View file

@ -131,10 +131,16 @@ pub fn EditArticle() -> impl IntoView {
}) })
}} }}
<textarea id="edit-article-textarea" rows=rows on:keyup=move |ev| { <textarea
let val = event_target_value(&ev); id="edit-article-textarea"
set_text.update(|p| *p = val); rows=rows
}>{article.article.text.clone()}</textarea> on:keyup=move |ev| {
let val = event_target_value(&ev);
set_text.update(|p| *p = val);
}
>
{article.article.text.clone()}
</textarea>
<div> <div>
<a href="https://commonmark.org/help/" target="blank_"> <a href="https://commonmark.org/help/" target="blank_">
Markdown Markdown
@ -142,31 +148,31 @@ pub fn EditArticle() -> impl IntoView {
" formatting is supported" " formatting is supported"
</div> </div>
<div class="inputs"> <div class="inputs">
<input <input
type="text" type="text"
placeholder="Edit summary" placeholder="Edit summary"
value=summary.get_untracked() value=summary.get_untracked()
on:keyup=move |ev| { on:keyup=move |ev| {
let val = event_target_value(&ev); let val = event_target_value(&ev);
set_summary.update(|p| *p = val); set_summary.update(|p| *p = val);
} }
/> />
<button <button
prop:disabled=move || button_is_disabled.get() prop:disabled=move || button_is_disabled.get()
on:click=move |_| { on:click=move |_| {
submit_action submit_action
.dispatch(( .dispatch((
text.get(), text.get(),
summary.get(), summary.get(),
article_.clone(), article_.clone(),
edit_response.get(), edit_response.get(),
)) ))
} }
> >
Submit Submit
</button> </button>
</div> </div>
</div> </div>
} }