Browse Source

Fixing chat message formatting in #1315

pull/1342/head
Gabe Kangas 4 years ago
parent
commit
8907566ed1
  1. 2
      core/chat/events/events.go
  2. 1
      utils/utils.go
  3. 2
      webroot/js/components/chat/chat-message-view.js
  4. 13
      webroot/styles/chat.css

2
core/chat/events/events.go

@ -95,7 +95,7 @@ func RenderAndSanitize(raw string) string { @@ -95,7 +95,7 @@ func RenderAndSanitize(raw string) string {
func RenderMarkdown(raw string) string {
markdown := goldmark.New(
goldmark.WithRendererOptions(
html.WithUnsafe(),
html.WithHardWraps(),
),
goldmark.WithExtensions(
extension.NewLinkify(

1
utils/utils.go

@ -90,6 +90,7 @@ func RenderSimpleMarkdown(raw string) string { @@ -90,6 +90,7 @@ func RenderSimpleMarkdown(raw string) string {
markdown := goldmark.New(
goldmark.WithRendererOptions(
html.WithUnsafe(),
html.WithHardWraps(),
),
goldmark.WithExtensions(
extension.NewLinkify(

2
webroot/js/components/chat/chat-message-view.js

@ -183,7 +183,7 @@ function formatTimestamp(sentAt) { @@ -183,7 +183,7 @@ function formatTimestamp(sentAt) {
text into the `contenteditable` area on a page.
*/
function convertToMarkup(str = '') {
return convertToText(str).replace(/\n/g, '<br>');
return str;// convertToText(str).replace(/\n/g, '<br>');
}
function stripTags(str) {

13
webroot/styles/chat.css

@ -179,6 +179,19 @@ @@ -179,6 +179,19 @@
/* height: 15rem; */
}
.message-text ul li:before {
content: '» ';
}
.message-text p {
margin-bottom: 1.0em;
}
.message-text li {
margin: 0.3em;
margin-bottom: 1.0em;
}
/* MESSAGE TEXT CONTENT */
/* MESSAGE TEXT CONTENT */
/* MESSAGE TEXT CONTENT */

Loading…
Cancel
Save