Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14034499
D14289.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D14289.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1459,6 +1459,7 @@
'PHUIPropertyListExample' => 'applications/uiexample/examples/PHUIPropertyListExample.php',
'PHUIPropertyListView' => 'view/phui/PHUIPropertyListView.php',
'PHUIRemarkupPreviewPanel' => 'view/phui/PHUIRemarkupPreviewPanel.php',
+ 'PHUIRemarkupView' => 'infrastructure/markup/view/PHUIRemarkupView.php',
'PHUISpacesNamespaceContextView' => 'applications/spaces/view/PHUISpacesNamespaceContextView.php',
'PHUIStatusItemView' => 'view/phui/PHUIStatusItemView.php',
'PHUIStatusListView' => 'view/phui/PHUIStatusListView.php',
@@ -5352,6 +5353,7 @@
'PHUIPropertyListExample' => 'PhabricatorUIExample',
'PHUIPropertyListView' => 'AphrontView',
'PHUIRemarkupPreviewPanel' => 'AphrontTagView',
+ 'PHUIRemarkupView' => 'AphrontView',
'PHUISpacesNamespaceContextView' => 'AphrontView',
'PHUIStatusItemView' => 'AphrontTagView',
'PHUIStatusListView' => 'AphrontTagView',
diff --git a/src/applications/badges/controller/PhabricatorBadgesViewController.php b/src/applications/badges/controller/PhabricatorBadgesViewController.php
--- a/src/applications/badges/controller/PhabricatorBadgesViewController.php
+++ b/src/applications/badges/controller/PhabricatorBadgesViewController.php
@@ -104,14 +104,10 @@
$description = $badge->getDescription();
if (strlen($description)) {
- $description = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($description),
- 'default',
- $viewer);
-
$view->addSectionHeader(
pht('Description'), PHUIPropertyListView::ICON_SUMMARY);
- $view->addTextContent($description);
+ $view->addTextContent(
+ new PHUIRemarkupView($viewer, $description));
}
$badge = id(new PHUIBadgeView())
diff --git a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php
--- a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php
+++ b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php
@@ -195,15 +195,10 @@
pht('Errors'),
$error_description);
-
- $description = $method->getMethodDescription();
- $description = PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())->setContent($description),
- 'default',
- $viewer);
$view->addSectionHeader(
pht('Description'), PHUIPropertyListView::ICON_SUMMARY);
- $view->addTextContent($description);
+ $view->addTextContent(
+ new PHUIRemarkupView($viewer, $method->getMethodDescription()));
return $view;
}
diff --git a/src/applications/passphrase/controller/PassphraseCredentialViewController.php b/src/applications/passphrase/controller/PassphraseCredentialViewController.php
--- a/src/applications/passphrase/controller/PassphraseCredentialViewController.php
+++ b/src/applications/passphrase/controller/PassphraseCredentialViewController.php
@@ -201,11 +201,7 @@
pht('Description'),
PHUIPropertyListView::ICON_SUMMARY);
$properties->addTextContent(
- PhabricatorMarkupEngine::renderOneObject(
- id(new PhabricatorMarkupOneOff())
- ->setContent($description),
- 'default',
- $viewer));
+ new PHUIRemarkupView($viewer, $description));
}
return $properties;
diff --git a/src/infrastructure/markup/PhabricatorMarkupOneOff.php b/src/infrastructure/markup/PhabricatorMarkupOneOff.php
--- a/src/infrastructure/markup/PhabricatorMarkupOneOff.php
+++ b/src/infrastructure/markup/PhabricatorMarkupOneOff.php
@@ -1,16 +1,7 @@
<?php
/**
- * Concrete object for accessing the markup engine with arbitrary blobs of
- * text, like form instructions. Usage:
- *
- * $output = PhabricatorMarkupEngine::renderOneObject(
- * id(new PhabricatorMarkupOneOff())->setContent($some_content),
- * 'default',
- * $viewer);
- *
- * This is less efficient than batching rendering, but appropriate for small
- * amounts of one-off text in form instructions.
+ * DEPRECATED. Use @{class:PHUIRemarkupView}.
*/
final class PhabricatorMarkupOneOff
extends Phobject
diff --git a/src/infrastructure/markup/view/PHUIRemarkupView.php b/src/infrastructure/markup/view/PHUIRemarkupView.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/markup/view/PHUIRemarkupView.php
@@ -0,0 +1,32 @@
+<?php
+
+/**
+ * Simple API for rendering blocks of Remarkup.
+ *
+ * Example usage:
+ *
+ * $fancy_text = new PHUIRemarkupView($viewer, $raw_remarkup);
+ * $view->appendChild($fancy_text);
+ *
+ */
+final class PHUIRemarkupView extends AphrontView {
+
+ private $corpus;
+
+ public function __construct(PhabricatorUser $viewer, $corpus) {
+ $this->setUser($viewer);
+ $this->corpus = $corpus;
+ }
+
+ public function render() {
+ $viewer = $this->getUser();
+ $corpus = $this->corpus;
+
+ return PhabricatorMarkupEngine::renderOneObject(
+ id(new PhabricatorMarkupOneOff())
+ ->setContent($corpus),
+ 'default',
+ $viewer);
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 11, 12:40 AM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6736821
Default Alt Text
D14289.diff (5 KB)
Attached To
Mode
D14289: Introduce PHUIRemarkupView, a sane way to work with Remarkup
Attached
Detach File
Event Timeline
Log In to Comment