From 5305ebddda9c7ff4d7156a8eb7aec1c1085eebcc Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 21 May 2019 06:31:24 -0700 Subject: [PATCH] To improve wrapping behavior of rendered README files, don't use "PHUIDocumentView" in Diffusion Summary: See PHI1268. We currently do some weird width handling when rendering Diffusion readmes in a document directory view. I think this came from D12330, which used `PHUIDocumentViewPro` to change the font, but we later reverted the font and were left with the `DocumentView`. Other changes after that modified `DocumentView` to have fixed-width behavior, but it doesn't make much sense here since the content panel is clearly rendered full-width. Today, the `DocumentView` is a more structural element with methods like `setCurtain()`. Just get rid of it to simplify things, at least as a first step. Test Plan: Before: {F6463493} After: {F6463492} Reviewers: amckinley Reviewed By: amckinley Differential Revision: https://secure.phabricator.com/D20536 --- .../diffusion/view/DiffusionReadmeView.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/applications/diffusion/view/DiffusionReadmeView.php b/src/applications/diffusion/view/DiffusionReadmeView.php index 21e97f4718..2f65f5730f 100644 --- a/src/applications/diffusion/view/DiffusionReadmeView.php +++ b/src/applications/diffusion/view/DiffusionReadmeView.php @@ -75,7 +75,7 @@ final class DiffusionReadmeView extends DiffusionView { $engine = $markup_object->newMarkupEngine($markup_field); $readme_content = $content; - $class = null; + $class = 'ml'; break; case 'rainbow': $content = id(new PhutilRainbowSyntaxHighlighter()) @@ -93,10 +93,12 @@ final class DiffusionReadmeView extends DiffusionView { break; } - $readme_content = phutil_tag_div($class, $readme_content); - $document = id(new PHUIDocumentView()) - ->setFluid(true) - ->appendChild($readme_content); + $readme_content = phutil_tag( + 'div', + array( + 'class' => $class, + ), + $readme_content); $header = id(new PHUIHeaderView()) ->setHeader($readme_name) @@ -106,7 +108,7 @@ final class DiffusionReadmeView extends DiffusionView { ->setHeader($header) ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) ->addClass('diffusion-mobile-view') - ->appendChild($document) + ->appendChild($readme_content) ->addClass('diffusion-readme-view'); } -- 2.51.2