diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php b/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php index f423860a3b..d494fa7a0b 100644 --- a/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php @@ -363,11 +363,7 @@ final class PhabricatorCalendarEventViewController ->getIconLabel($event->getIcon())); if (strlen($event->getDescription())) { - $description = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($event->getDescription()), - 'default', - $viewer); - + $description = new PHUIRemarkupView($viewer, $event->getDescription()); $properties->addSectionHeader( pht('Description'), PHUIPropertyListView::ICON_SUMMARY); diff --git a/src/applications/config/controller/PhabricatorConfigWelcomeController.php b/src/applications/config/controller/PhabricatorConfigWelcomeController.php index e2d868082a..e2d704e0b7 100644 --- a/src/applications/config/controller/PhabricatorConfigWelcomeController.php +++ b/src/applications/config/controller/PhabricatorConfigWelcomeController.php @@ -341,23 +341,14 @@ final class PhabricatorConfigWelcomeController $header = id(new PHUIHeaderView()) ->setHeader(pht('Welcome to Phabricator')); - $setup_header = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff()) - ->setContent(pht('=Setup and Configuration')), - 'default', - $viewer); + $setup_header = new PHUIRemarkupView( + $viewer, pht('=Setup and Configuration')); - $explore_header = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff()) - ->setContent(pht('=Explore Phabricator')), - 'default', - $viewer); + $explore_header = new PHUIRemarkupView( + $viewer, pht('=Explore Phabricator')); - $quick_header = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff()) - ->setContent(pht('=Quick Start Guides')), - 'default', - $viewer); + $quick_header = new PHUIRemarkupView( + $viewer, pht('=Quick Start Guide')); return id(new PHUIDocumentView()) ->setHeader($header) @@ -376,10 +367,7 @@ final class PhabricatorConfigWelcomeController $icon = id(new PHUIIconView()) ->setIcon($icon.' fa-2x'); - $content = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($content), - 'default', - $viewer); + $content = new PHUIRemarkupView($viewer, $content); $icon = phutil_tag( 'div', diff --git a/src/applications/countdown/controller/PhabricatorCountdownViewController.php b/src/applications/countdown/controller/PhabricatorCountdownViewController.php index 9cd0d982ff..401e159c5f 100644 --- a/src/applications/countdown/controller/PhabricatorCountdownViewController.php +++ b/src/applications/countdown/controller/PhabricatorCountdownViewController.php @@ -132,11 +132,7 @@ final class PhabricatorCountdownViewController $description = $countdown->getDescription(); if (strlen($description)) { - $description = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($description), - 'default', - $viewer); - + $description = new PHUIRemarkupView($viewer, $description); $view->addSectionHeader( pht('Description'), PHUIPropertyListView::ICON_SUMMARY); diff --git a/src/applications/differential/customfield/DifferentialRevertPlanField.php b/src/applications/differential/customfield/DifferentialRevertPlanField.php index 1d86a794a4..646116c74e 100644 --- a/src/applications/differential/customfield/DifferentialRevertPlanField.php +++ b/src/applications/differential/customfield/DifferentialRevertPlanField.php @@ -44,12 +44,7 @@ final class DifferentialRevertPlanField return null; } - return PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff()) - ->setPreserveLinebreaks(true) - ->setContent($this->getValue()), - 'default', - $this->getViewer()); + return new PHUIRemarkupView($this->getViewer(), $this->getValue()); } public function shouldAppearInGlobalSearch() { diff --git a/src/applications/differential/customfield/DifferentialSummaryField.php b/src/applications/differential/customfield/DifferentialSummaryField.php index 16a3f701c1..5052e238e0 100644 --- a/src/applications/differential/customfield/DifferentialSummaryField.php +++ b/src/applications/differential/customfield/DifferentialSummaryField.php @@ -122,12 +122,7 @@ final class DifferentialSummaryField return null; } - return PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff()) - ->setPreserveLinebreaks(true) - ->setContent($this->getValue()), - 'default', - $this->getViewer()); + return new PHUIRemarkupView($this->getViewer(), $this->getValue()); } public function getApplicationTransactionRemarkupBlocks( diff --git a/src/applications/differential/customfield/DifferentialTestPlanField.php b/src/applications/differential/customfield/DifferentialTestPlanField.php index 32d3c15c31..6a1029dba4 100644 --- a/src/applications/differential/customfield/DifferentialTestPlanField.php +++ b/src/applications/differential/customfield/DifferentialTestPlanField.php @@ -136,12 +136,7 @@ final class DifferentialTestPlanField return null; } - return PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff()) - ->setPreserveLinebreaks(true) - ->setContent($this->getValue()), - 'default', - $this->getViewer()); + return new PHUIRemarkupView($this->getViewer(), $this->getValue()); } public function getApplicationTransactionRemarkupBlocks( diff --git a/src/applications/diffusion/controller/DiffusionRepositoryController.php b/src/applications/diffusion/controller/DiffusionRepositoryController.php index 18989818b6..6504ee50e1 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryController.php @@ -290,10 +290,7 @@ final class DiffusionRepositoryController extends DiffusionController { $description = $repository->getDetail('description'); if (strlen($description)) { - $description = PhabricatorMarkupEngine::renderOneObject( - $repository, - 'description', - $user); + $description = new PHUIRemarkupView($user, $description); $view->addSectionHeader( pht('Description'), PHUIPropertyListView::ICON_SUMMARY); $view->addTextContent($description); diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php index 886809dedd..4efafc1a0e 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php @@ -309,10 +309,7 @@ final class DiffusionRepositoryEditMainController if (!strlen($description)) { $description = phutil_tag('em', array(), pht('No description provided.')); } else { - $description = PhabricatorMarkupEngine::renderOneObject( - $repository, - 'description', - $viewer); + $description = new PHUIRemarkupView($viewer, $description); } $view->addTextContent($description); diff --git a/src/applications/diviner/controller/DivinerBookController.php b/src/applications/diviner/controller/DivinerBookController.php index 0c84955b2f..11d6a5bbfc 100644 --- a/src/applications/diviner/controller/DivinerBookController.php +++ b/src/applications/diviner/controller/DivinerBookController.php @@ -94,11 +94,7 @@ final class DivinerBookController extends DivinerController { $preface = $book->getPreface(); $preface_view = null; if (strlen($preface)) { - $preface_view = - PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($preface), - 'default', - $viewer); + $preface_view = new PHUIRemarkupView($viewer, $preface); } $document->appendChild($preface_view); diff --git a/src/applications/diviner/controller/DivinerMainController.php b/src/applications/diviner/controller/DivinerMainController.php index 97149778c1..e85769060f 100644 --- a/src/applications/diviner/controller/DivinerMainController.php +++ b/src/applications/diviner/controller/DivinerMainController.php @@ -61,11 +61,7 @@ final class DivinerMainController extends DivinerController { " %s\n\n", 'phabricator/ $ ./bin/diviner generate'); - $text = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($text), - 'default', - $viewer); - + $text = new PHUIRemarkupView($viewer, $text); $document->appendChild($text); } diff --git a/src/applications/doorkeeper/option/PhabricatorAsanaConfigOptions.php b/src/applications/doorkeeper/option/PhabricatorAsanaConfigOptions.php index 991392f484..1771a6615e 100644 --- a/src/applications/doorkeeper/option/PhabricatorAsanaConfigOptions.php +++ b/src/applications/doorkeeper/option/PhabricatorAsanaConfigOptions.php @@ -111,10 +111,7 @@ final class PhabricatorAsanaConfigOptions "The Asana Workspaces your linked account has access to are:\n\n%s", $out); - return PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($out), - 'default', - $viewer); + return new PHUIRemarkupView($viewer, $out); } private function renderContextualProjectDescription( @@ -155,10 +152,7 @@ final class PhabricatorAsanaConfigOptions $out = implode("\n", $out); - return PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($out), - 'default', - $viewer); + return new PHUIRemarkupView($viewer, $out); } } diff --git a/src/applications/fund/controller/FundInitiativeViewController.php b/src/applications/fund/controller/FundInitiativeViewController.php index 71cebc842d..6f780e4e72 100644 --- a/src/applications/fund/controller/FundInitiativeViewController.php +++ b/src/applications/fund/controller/FundInitiativeViewController.php @@ -98,11 +98,7 @@ final class FundInitiativeViewController $description = $initiative->getDescription(); if (strlen($description)) { - $description = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($description), - 'default', - $viewer); - + $description = new PHUIRemarkupView($viewer, $description); $view->addSectionHeader( pht('Description'), PHUIPropertyListView::ICON_SUMMARY); $view->addTextContent($description); @@ -110,11 +106,7 @@ final class FundInitiativeViewController $risks = $initiative->getRisks(); if (strlen($risks)) { - $risks = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($risks), - 'default', - $viewer); - + $risks = new PHUIRemarkupView($viewer, $risks); $view->addSectionHeader( pht('Risks/Challenges'), 'fa-ambulance'); $view->addTextContent($risks); diff --git a/src/applications/harbormaster/controller/HarbormasterBuildViewController.php b/src/applications/harbormaster/controller/HarbormasterBuildViewController.php index d197174175..a9cbb43ccf 100644 --- a/src/applications/harbormaster/controller/HarbormasterBuildViewController.php +++ b/src/applications/harbormaster/controller/HarbormasterBuildViewController.php @@ -181,16 +181,10 @@ final class HarbormasterBuildViewController if ($step) { $description = $step->getDescription(); if ($description) { - $rendered = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff()) - ->setContent($description) - ->setPreserveLinebreaks(true), - 'default', - $viewer); - + $description = new PHUIRemarkupView($viewer, $description); $properties->addSectionHeader( pht('Description'), PHUIPropertyListView::ICON_SUMMARY); - $properties->addTextContent($rendered); + $properties->addTextContent($description); } } else { $target_box->setFormErrors( diff --git a/src/applications/legalpad/controller/LegalpadDocumentSignController.php b/src/applications/legalpad/controller/LegalpadDocumentSignController.php index 2221ae4499..00549c1adc 100644 --- a/src/applications/legalpad/controller/LegalpadDocumentSignController.php +++ b/src/applications/legalpad/controller/LegalpadDocumentSignController.php @@ -258,11 +258,7 @@ final class LegalpadDocumentSignController extends LegalpadController { $preamble_box = null; if (strlen($document->getPreamble())) { - $preamble_text = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent( - $document->getPreamble()), - 'default', - $viewer); + $preamble_text = new PHUIRemarkupView($viewer, $document->getPreamble()); // NOTE: We're avoiding `setObject()` here so we don't pick up extra UI // elements like "Subscribers". This information is available on the diff --git a/src/applications/meta/controller/PhabricatorApplicationDetailViewController.php b/src/applications/meta/controller/PhabricatorApplicationDetailViewController.php index 0ef4b83abd..19aad0e6a5 100644 --- a/src/applications/meta/controller/PhabricatorApplicationDetailViewController.php +++ b/src/applications/meta/controller/PhabricatorApplicationDetailViewController.php @@ -104,14 +104,11 @@ final class PhabricatorApplicationDetailViewController } $overview = $application->getOverview(); - if ($overview) { + if (strlen($overview)) { + $overview = new PHUIRemarkupView($viewer, $overview); $properties->addSectionHeader( pht('Overview'), PHUIPropertyListView::ICON_SUMMARY); - $properties->addTextContent( - PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($overview), - 'default', - $viewer)); + $properties->addTextContent($overview); } $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions( diff --git a/src/applications/meta/controller/PhabricatorApplicationEmailCommandsController.php b/src/applications/meta/controller/PhabricatorApplicationEmailCommandsController.php index 060ca951ba..08f8e450b5 100644 --- a/src/applications/meta/controller/PhabricatorApplicationEmailCommandsController.php +++ b/src/applications/meta/controller/PhabricatorApplicationEmailCommandsController.php @@ -117,10 +117,7 @@ final class PhabricatorApplicationEmailCommandsController $crumbs->addTextCrumb($title); $crumbs->setBorder(true); - $content_box = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($content), - 'default', - $viewer); + $content_box = new PHUIRemarkupView($viewer, $content); $info_view = null; if (!PhabricatorEnv::getEnvConfig('metamta.reply-handler-domain')) { diff --git a/src/applications/nuance/source/NuancePhabricatorFormSourceDefinition.php b/src/applications/nuance/source/NuancePhabricatorFormSourceDefinition.php index 675b2634a9..cca5a19cd9 100644 --- a/src/applications/nuance/source/NuancePhabricatorFormSourceDefinition.php +++ b/src/applications/nuance/source/NuancePhabricatorFormSourceDefinition.php @@ -120,11 +120,7 @@ final class NuancePhabricatorFormSourceDefinition PHUIPropertyListView $view) { $complaint = $item->getNuanceProperty('complaint'); - $complaint = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($complaint), - 'default', - $viewer); - + $complaint = new PHUIRemarkupView($viewer, $complaint); $view->addSectionHeader( pht('Complaint'), 'fa-exclamation-circle'); $view->addTextContent($complaint); diff --git a/src/applications/owners/controller/PhabricatorOwnersDetailController.php b/src/applications/owners/controller/PhabricatorOwnersDetailController.php index e361868ce3..fc09508bfe 100644 --- a/src/applications/owners/controller/PhabricatorOwnersDetailController.php +++ b/src/applications/owners/controller/PhabricatorOwnersDetailController.php @@ -189,13 +189,10 @@ final class PhabricatorOwnersDetailController $description = $package->getDescription(); if (strlen($description)) { + $description = new PHUIRemarkupView($viewer, $description); $view->addSectionHeader( pht('Description'), PHUIPropertyListView::ICON_SUMMARY); - $view->addTextContent( - $output = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($description), - 'default', - $viewer)); + $view->addTextContent($description); } $view->invokeWillRenderEvent(); diff --git a/src/applications/phame/controller/blog/PhameBlogManageController.php b/src/applications/phame/controller/blog/PhameBlogManageController.php index 0402245d41..14caafaab4 100644 --- a/src/applications/phame/controller/blog/PhameBlogManageController.php +++ b/src/applications/phame/controller/blog/PhameBlogManageController.php @@ -118,10 +118,7 @@ final class PhameBlogManageController extends PhameBlogController { $properties->invokeWillRenderEvent(); if (strlen($blog->getDescription())) { - $description = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($blog->getDescription()), - 'default', - $viewer); + $description = new PHUIRemarkupView($viewer, $description); $properties->addSectionHeader( pht('Description'), PHUIPropertyListView::ICON_SUMMARY); diff --git a/src/applications/pholio/controller/PholioInlineController.php b/src/applications/pholio/controller/PholioInlineController.php index 101ef9e758..ddced1f9eb 100644 --- a/src/applications/pholio/controller/PholioInlineController.php +++ b/src/applications/pholio/controller/PholioInlineController.php @@ -86,16 +86,13 @@ final class PholioInlineController extends PholioController { ), $author_handle->renderLink()); + $inline_content = new PHUIRemarkupView($viewer, $inline->getContent()); $comment_body = phutil_tag( 'div', array( 'class' => 'pholio-inline-comment-body', ), - PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff()) - ->setContent($inline->getContent()), - 'default', - $viewer)); + $inline_content); return $this->newDialog() ->setTitle(pht('Inline Comment')) diff --git a/src/applications/phortune/controller/PhortuneCartController.php b/src/applications/phortune/controller/PhortuneCartController.php index d3e19f52f1..9fefc7db6e 100644 --- a/src/applications/phortune/controller/PhortuneCartController.php +++ b/src/applications/phortune/controller/PhortuneCartController.php @@ -48,12 +48,7 @@ abstract class PhortuneCartController return null; } - $output = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff()) - ->setPreserveLinebreaks(true) - ->setContent($description), - 'default', - $this->getViewer()); + $output = new PHUIRemarkupView($this->getUser(), $description); $box = id(new PHUIBoxView()) ->addMargin(PHUI::MARGIN_LARGE) diff --git a/src/applications/phortune/controller/PhortuneMerchantViewController.php b/src/applications/phortune/controller/PhortuneMerchantViewController.php index 55bb136dab..1921f0c5a5 100644 --- a/src/applications/phortune/controller/PhortuneMerchantViewController.php +++ b/src/applications/phortune/controller/PhortuneMerchantViewController.php @@ -136,11 +136,7 @@ final class PhortuneMerchantViewController $description = $merchant->getDescription(); if (strlen($description)) { - $description = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($description), - 'default', - $viewer); - + $description = new PHUIRemarkupView($viewer, $description); $view->addSectionHeader( pht('Description'), PHUIPropertyListView::ICON_SUMMARY); $view->addTextContent($description); diff --git a/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php b/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php index 51abcd8059..dbc7fbcc79 100644 --- a/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php +++ b/src/applications/phurl/controller/PhabricatorPhurlURLViewController.php @@ -134,16 +134,12 @@ final class PhabricatorPhurlURLViewController $properties->invokeWillRenderEvent(); - if (strlen($url->getDescription())) { - $description = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($url->getDescription()), - 'default', - $viewer); - + $description = $url->getDescription(); + if (strlen($description)) { + $description = new PHUIRemarkupView($viewer, $description); $properties->addSectionHeader( pht('Description'), PHUIPropertyListView::ICON_SUMMARY); - $properties->addTextContent($description); } diff --git a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php index 87de1ff660..fd05afb057 100644 --- a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php +++ b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php @@ -122,13 +122,13 @@ final class PhabricatorSlowvotePollController $view->invokeWillRenderEvent(); - if (strlen($poll->getDescription())) { - $view->addTextContent( - $output = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent( - $poll->getDescription()), - 'default', - $viewer)); + $description = $poll->getDescription(); + if (strlen($description)) { + $description = new PHUIRemarkupView($viewer, $description); + $view->addSectionHeader( + pht('Description'), + PHUIPropertyListView::ICON_SUMMARY); + $view->addTextContent($description); } return $view; diff --git a/src/applications/slowvote/view/SlowvoteEmbedView.php b/src/applications/slowvote/view/SlowvoteEmbedView.php index 0270e82f00..3582ea45b3 100644 --- a/src/applications/slowvote/view/SlowvoteEmbedView.php +++ b/src/applications/slowvote/view/SlowvoteEmbedView.php @@ -74,13 +74,9 @@ final class SlowvoteEmbedView extends AphrontView { $header = id(new PHUIHeaderView()) ->setHeader($link_to_slowvote); - $description = null; - if ($poll->getDescription()) { - $description = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent( - $poll->getDescription()), - 'default', - $this->getUser()); + $description = $poll->getDescription(); + if (strlen($description)) { + $description = new PHUIRemarkupView($this->getUser(), $description); $description = phutil_tag( 'div', array( diff --git a/src/applications/spaces/controller/PhabricatorSpacesViewController.php b/src/applications/spaces/controller/PhabricatorSpacesViewController.php index 7515b4dcc2..25bb70f646 100644 --- a/src/applications/spaces/controller/PhabricatorSpacesViewController.php +++ b/src/applications/spaces/controller/PhabricatorSpacesViewController.php @@ -83,15 +83,10 @@ final class PhabricatorSpacesViewController $description = $space->getDescription(); if (strlen($description)) { - $description = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($description), - 'default', - $viewer); - + $description = new PHUIRemarkupView($viewer, $description); $list->addSectionHeader( pht('Description'), PHUIPropertyListView::ICON_SUMMARY); - $list->addTextContent($description); } diff --git a/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php b/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php index 6670c147fe..65b6282aa9 100644 --- a/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php +++ b/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php @@ -50,10 +50,7 @@ final class PhabricatorApplicationTransactionCommentRawController $details_text = pht( 'For full details, run `/bin/mail show-outbound --id %d`', $source_id); - $addendum = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($details_text), - 'default', - $viewer); + $addendum = new PHUIRemarkupView($viewer, $details_text); } } } diff --git a/src/applications/typeahead/controller/PhabricatorTypeaheadFunctionHelpController.php b/src/applications/typeahead/controller/PhabricatorTypeaheadFunctionHelpController.php index 0770bc6d3d..a771bf0747 100644 --- a/src/applications/typeahead/controller/PhabricatorTypeaheadFunctionHelpController.php +++ b/src/applications/typeahead/controller/PhabricatorTypeaheadFunctionHelpController.php @@ -121,11 +121,7 @@ final class PhabricatorTypeaheadFunctionHelpController } $content = implode("\n\n", $content); - - $content_box = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($content), - 'default', - $viewer); + $content_box = new PHUIRemarkupView($viewer, $content); $header = id(new PHUIHeaderView()) ->setHeader($title); diff --git a/src/applications/uiexample/examples/PhabricatorRemarkupUIExample.php b/src/applications/uiexample/examples/PhabricatorRemarkupUIExample.php index 3e338558fd..46f0262bbb 100644 --- a/src/applications/uiexample/examples/PhabricatorRemarkupUIExample.php +++ b/src/applications/uiexample/examples/PhabricatorRemarkupUIExample.php @@ -40,10 +40,7 @@ IMPORTANT: This is not really important. EOCONTENT ); - $remarkup = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($content), - 'default', - $viewer); + $remarkup = new PHUIRemarkupView($viewer, $content); $frame = id(new PHUIBoxView()) ->addPadding(PHUI::PADDING_LARGE) diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php index be7db42004..7709233454 100644 --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php @@ -39,12 +39,7 @@ final class PhabricatorStandardCustomFieldRemarkup // end of the world. $viewer = $this->getViewer(); - return PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff()) - ->setContent($value) - ->setPReserveLinebreaks(true), - 'default', - $viewer); + return new PHUIRemarkupView($viewer, $value); } public function getApplicationTransactionTitle( diff --git a/src/infrastructure/markup/view/PHUIRemarkupView.php b/src/infrastructure/markup/view/PHUIRemarkupView.php index 8a11653589..8a8d9ddf7f 100644 --- a/src/infrastructure/markup/view/PHUIRemarkupView.php +++ b/src/infrastructure/markup/view/PHUIRemarkupView.php @@ -12,22 +12,41 @@ final class PHUIRemarkupView extends AphrontView { private $corpus; + private $markupType; + + const DOCUMENT = 'document'; public function __construct(PhabricatorUser $viewer, $corpus) { $this->setUser($viewer); $this->corpus = $corpus; } + private function setMarkupType($type) { + $this->markupType($type); + return $this; + } + public function render() { $viewer = $this->getUser(); $corpus = $this->corpus; - return PhabricatorMarkupEngine::renderOneObject( + $content = PhabricatorMarkupEngine::renderOneObject( id(new PhabricatorMarkupOneOff()) ->setPreserveLinebreaks(true) ->setContent($corpus), 'default', $viewer); + + if ($this->markupType == self::DOCUMENT) { + return phutil_tag( + 'div', + array( + 'class' => 'phabricator-remarkup phui-document-view', + ), + $content); + } + + return $content; } } diff --git a/src/view/form/AphrontFormView.php b/src/view/form/AphrontFormView.php index f9f281ff20..810208ffae 100644 --- a/src/view/form/AphrontFormView.php +++ b/src/view/form/AphrontFormView.php @@ -85,10 +85,8 @@ final class AphrontFormView extends AphrontView { public function appendRemarkupInstructions($remarkup) { return $this->appendInstructions( - PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($remarkup), - 'default', - $this->getUser())); + new PHUIRemarkupView($this->getUser(), $remarkup)); + } public function buildLayoutView() { diff --git a/src/view/form/PHUIFormLayoutView.php b/src/view/form/PHUIFormLayoutView.php index 1c5ccbb7f2..ffc0eb31d5 100644 --- a/src/view/form/PHUIFormLayoutView.php +++ b/src/view/form/PHUIFormLayoutView.php @@ -35,11 +35,10 @@ final class PHUIFormLayoutView extends AphrontView { throw new PhutilInvalidStateException('setUser'); } - return $this->appendInstructions( - PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($remarkup), - 'default', - $this->getUser())); + $viewer = $this->getUser(); + $instructions = new PHUIRemarkupView($viewer, $remarkup); + + return $this->appendInstructions($instructions); } public function render() { diff --git a/src/view/form/PHUIFormPageView.php b/src/view/form/PHUIFormPageView.php index cb62d33127..aeff9e38f5 100644 --- a/src/view/form/PHUIFormPageView.php +++ b/src/view/form/PHUIFormPageView.php @@ -74,11 +74,8 @@ class PHUIFormPageView extends AphrontView { } public function addRemarkupInstructions($remarkup, $before = null) { - return $this->addInstructions( - PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($remarkup), - 'default', - $this->getUser()), $before); + $remarkup = new PHUIRemarkupView($this->getUser(), $remarkup); + return $this->addInstructions($remarkup, $before); } public function addControl(AphrontFormControl $control) {