Page MenuHomePhabricator

D16062.id.diff
No OneTemporary

D16062.id.diff

diff --git a/src/applications/phriction/controller/PhrictionDiffController.php b/src/applications/phriction/controller/PhrictionDiffController.php
--- a/src/applications/phriction/controller/PhrictionDiffController.php
+++ b/src/applications/phriction/controller/PhrictionDiffController.php
@@ -45,61 +45,20 @@
$text_l = $content_l->getContent();
$text_r = $content_r->getContent();
- $text_l = phutil_utf8_hard_wrap($text_l, 80);
- $text_l = implode("\n", $text_l);
- $text_r = phutil_utf8_hard_wrap($text_r, 80);
- $text_r = implode("\n", $text_r);
+ $diff_view = id(new PhabricatorApplicationTransactionTextDiffDetailView())
+ ->setOldText($text_l)
+ ->setNewText($text_r);
- $engine = new PhabricatorDifferenceEngine();
- $changeset = $engine->generateChangesetFromFileContent($text_l, $text_r);
-
- $changeset->setFilename($content_r->getTitle());
-
- $changeset->setOldProperties(
- array(
- 'Title' => $content_l->getTitle(),
- ));
- $changeset->setNewProperties(
- array(
- 'Title' => $content_r->getTitle(),
- ));
-
- $whitespace_mode = DifferentialChangesetParser::WHITESPACE_SHOW_ALL;
-
- $parser = id(new DifferentialChangesetParser())
- ->setUser($viewer)
- ->setChangeset($changeset)
- ->setRenderingReference("{$l},{$r}");
-
- $parser->readParametersFromRequest($request);
- $parser->setWhitespaceMode($whitespace_mode);
-
- $engine = new PhabricatorMarkupEngine();
- $engine->setViewer($viewer);
- $engine->process();
- $parser->setMarkupEngine($engine);
-
- $spec = $request->getStr('range');
- list($range_s, $range_e, $mask) =
- DifferentialChangesetParser::parseRangeSpecification($spec);
-
- $parser->setRange($range_s, $range_e);
- $parser->setMask($mask);
-
- if ($request->isAjax()) {
- return id(new PhabricatorChangesetResponse())
- ->setRenderedChangeset($parser->renderChangeset());
- }
-
- $changes = id(new DifferentialChangesetListView())
- ->setUser($this->getViewer())
- ->setChangesets(array($changeset))
- ->setVisibleChangesets(array($changeset))
- ->setRenderingReferences(array("{$l},{$r}"))
- ->setRenderURI('/phriction/diff/'.$document->getID().'/')
- ->setTitle(pht('Changes'))
+ $changes = id(new PHUIObjectBoxView())
+ ->setHeaderText(pht('Content Changes'))
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
- ->setParser($parser);
+ ->appendChild(
+ phutil_tag(
+ 'div',
+ array(
+ 'class' => 'prose-diff-frame',
+ ),
+ $diff_view));
require_celerity_resource('phriction-document-css');
diff --git a/webroot/rsrc/css/application/differential/changeset-view.css b/webroot/rsrc/css/application/differential/changeset-view.css
--- a/webroot/rsrc/css/application/differential/changeset-view.css
+++ b/webroot/rsrc/css/application/differential/changeset-view.css
@@ -93,6 +93,14 @@
user-select: none;
}
+.prose-diff {
+ white-space: pre-wrap;
+}
+
+.prose-diff-frame {
+ padding: 12px;
+}
+
.prose-diff span.old,
.prose-diff span.new {
padding: 0 2px;

File Metadata

Mime Type
text/plain
Expires
Oct 19 2024, 8:49 PM (4 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6713259
Default Alt Text
D16062.id.diff (3 KB)

Event Timeline