Skip to content

Commit

Permalink
Use normal white-space break for HTML pages
Browse files Browse the repository at this point in the history
Fixes #41
  • Loading branch information
dsevillamartin committed Jul 2, 2023
1 parent 42785b4 commit e814c3f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 21 deletions.
3 changes: 2 additions & 1 deletion js/src/forum/components/PagePage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Page from 'flarum/common/components/Page';
import LoadingIndicator from 'flarum/common/components/LoadingIndicator';
import classList from 'flarum/common/utils/classList';

import PageHero from './PageHero';

Expand All @@ -23,7 +24,7 @@ export default class PagePage extends Page {
const page = this.page;

return (
<div className="Pages">
<div className={classList('Pages', page.isHtml() && 'Pages--isHtml')}>
<div className="Pages-page">
{page
? [
Expand Down
46 changes: 27 additions & 19 deletions resources/less/forum.less
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
.PageHero {
margin-bottom: 20px;
}
.PageHero-items {
padding: 0;
margin: 0;
list-style: none;
.Pages {
.PageHero {
margin-bottom: 20px;
}
.PageHero-items {
padding: 0;
margin: 0;
list-style: none;

& > li {
display: inline-block;
& > li {
display: inline-block;
}
}
}
.PageHero-title {
> a {
color: @hero-color;
.PageHero-title {
> a {
color: @hero-color;
}
display: inline;
vertical-align: middle;
}
display: inline;
vertical-align: middle;
}


.Pages-container {
max-width: 820px;
white-space: pre-wrap;
.Pages-container {
max-width: 820px;
white-space: pre-wrap;
}

&--isHtml {
.Post-body {
white-space: normal;
}
}
}
2 changes: 1 addition & 1 deletion src/Api/Serializer/PageSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ protected function getDefaultAttributes($page)
'time' => $page->time,
'editTime' => $page->edit_time,
'contentHtml' => Html::render($page->content_html, $page),
'isHtml' => $page->is_html,
];

if ($this->actor->isAdmin()) {
$attributes['content'] = $page->content;
$attributes['isHidden'] = $page->is_hidden;
$attributes['isRestricted'] = $page->is_restricted;
$attributes['isHtml'] = $page->is_html;
}

return $attributes;
Expand Down

0 comments on commit e814c3f

Please sign in to comment.