Page MenuHomePhabricator

D19254.id.diff
No OneTemporary

D19254.id.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -9,7 +9,7 @@
'names' => array(
'conpherence.pkg.css' => 'e68cf1fa',
'conpherence.pkg.js' => '15191c65',
- 'core.pkg.css' => '7daac340',
+ 'core.pkg.css' => 'da541195',
'core.pkg.js' => 'b9b4a943',
'differential.pkg.css' => '113e692c',
'differential.pkg.js' => 'f6d809c0',
@@ -120,7 +120,7 @@
'rsrc/css/font/font-lato.css' => 'c7ccd872',
'rsrc/css/font/phui-font-icon-base.css' => '870a7360',
'rsrc/css/layout/phabricator-filetree-view.css' => 'b912ad97',
- 'rsrc/css/layout/phabricator-source-code-view.css' => '926ced2d',
+ 'rsrc/css/layout/phabricator-source-code-view.css' => '31ee3c83',
'rsrc/css/phui/button/phui-button-bar.css' => 'f1ff5494',
'rsrc/css/phui/button/phui-button-simple.css' => '8e1baf68',
'rsrc/css/phui/button/phui-button.css' => '1863cc6e',
@@ -168,7 +168,7 @@
'rsrc/css/phui/phui-object-box.css' => '9cff003c',
'rsrc/css/phui/phui-pager.css' => 'edcbc226',
'rsrc/css/phui/phui-pinboard-view.css' => '2495140e',
- 'rsrc/css/phui/phui-property-list-view.css' => '871f6815',
+ 'rsrc/css/phui/phui-property-list-view.css' => '54c071ed',
'rsrc/css/phui/phui-remarkup-preview.css' => '54a34863',
'rsrc/css/phui/phui-segment-bar-view.css' => 'b1d1b892',
'rsrc/css/phui/phui-spacing.css' => '042804d6',
@@ -784,7 +784,7 @@
'phabricator-search-results-css' => '505dd8cf',
'phabricator-shaped-request' => '7cbe244b',
'phabricator-slowvote-css' => 'a94b7230',
- 'phabricator-source-code-view-css' => '926ced2d',
+ 'phabricator-source-code-view-css' => '31ee3c83',
'phabricator-standard-page-view' => '34ee718b',
'phabricator-textareautils' => '320810c8',
'phabricator-title' => '485aaa6c',
@@ -850,7 +850,7 @@
'phui-oi-simple-ui-css' => 'a8beebea',
'phui-pager-css' => 'edcbc226',
'phui-pinboard-view-css' => '2495140e',
- 'phui-property-list-view-css' => '871f6815',
+ 'phui-property-list-view-css' => '54c071ed',
'phui-remarkup-preview-css' => '54a34863',
'phui-segment-bar-view-css' => 'b1d1b892',
'phui-spacing-css' => '042804d6',
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
@@ -4222,6 +4222,7 @@
'PhabricatorSlug' => 'infrastructure/util/PhabricatorSlug.php',
'PhabricatorSlugTestCase' => 'infrastructure/util/__tests__/PhabricatorSlugTestCase.php',
'PhabricatorSourceCodeView' => 'view/layout/PhabricatorSourceCodeView.php',
+ 'PhabricatorSourceDocumentEngine' => 'applications/files/document/PhabricatorSourceDocumentEngine.php',
'PhabricatorSpaceEditField' => 'applications/transactions/editfield/PhabricatorSpaceEditField.php',
'PhabricatorSpacesApplication' => 'applications/spaces/application/PhabricatorSpacesApplication.php',
'PhabricatorSpacesArchiveController' => 'applications/spaces/controller/PhabricatorSpacesArchiveController.php',
@@ -4363,6 +4364,7 @@
'PhabricatorTestWorker' => 'infrastructure/daemon/workers/__tests__/PhabricatorTestWorker.php',
'PhabricatorTextAreaEditField' => 'applications/transactions/editfield/PhabricatorTextAreaEditField.php',
'PhabricatorTextConfigType' => 'applications/config/type/PhabricatorTextConfigType.php',
+ 'PhabricatorTextDocumentEngine' => 'applications/files/document/PhabricatorTextDocumentEngine.php',
'PhabricatorTextEditField' => 'applications/transactions/editfield/PhabricatorTextEditField.php',
'PhabricatorTextExportFormat' => 'infrastructure/export/format/PhabricatorTextExportFormat.php',
'PhabricatorTextListConfigType' => 'applications/config/type/PhabricatorTextListConfigType.php',
@@ -10041,6 +10043,7 @@
'PhabricatorSlug' => 'Phobject',
'PhabricatorSlugTestCase' => 'PhabricatorTestCase',
'PhabricatorSourceCodeView' => 'AphrontView',
+ 'PhabricatorSourceDocumentEngine' => 'PhabricatorTextDocumentEngine',
'PhabricatorSpaceEditField' => 'PhabricatorEditField',
'PhabricatorSpacesApplication' => 'PhabricatorApplication',
'PhabricatorSpacesArchiveController' => 'PhabricatorSpacesController',
@@ -10188,6 +10191,7 @@
'PhabricatorTestWorker' => 'PhabricatorWorker',
'PhabricatorTextAreaEditField' => 'PhabricatorEditField',
'PhabricatorTextConfigType' => 'PhabricatorConfigType',
+ 'PhabricatorTextDocumentEngine' => 'PhabricatorDocumentEngine',
'PhabricatorTextEditField' => 'PhabricatorEditField',
'PhabricatorTextExportFormat' => 'PhabricatorExportFormat',
'PhabricatorTextListConfigType' => 'PhabricatorTextConfigType',
diff --git a/src/applications/files/document/PhabricatorSourceDocumentEngine.php b/src/applications/files/document/PhabricatorSourceDocumentEngine.php
new file mode 100644
--- /dev/null
+++ b/src/applications/files/document/PhabricatorSourceDocumentEngine.php
@@ -0,0 +1,30 @@
+<?php
+
+final class PhabricatorSourceDocumentEngine
+ extends PhabricatorTextDocumentEngine {
+
+ const ENGINEKEY = 'source';
+
+ public function getViewAsLabel(PhabricatorDocumentRef $ref) {
+ return pht('View as Source');
+ }
+
+ protected function getDocumentIconIcon(PhabricatorDocumentRef $ref) {
+ return 'fa-code';
+ }
+
+ protected function getContentScore(PhabricatorDocumentRef $ref) {
+ return 1500;
+ }
+
+ protected function newDocumentContent(PhabricatorDocumentRef $ref) {
+ $content = $this->loadTextData($ref);
+
+ $content = PhabricatorSyntaxHighlighter::highlightWithFilename(
+ $ref->getName(),
+ $content);
+
+ return $this->newTextDocumentContent($content);
+ }
+
+}
diff --git a/src/applications/files/document/PhabricatorTextDocumentEngine.php b/src/applications/files/document/PhabricatorTextDocumentEngine.php
new file mode 100644
--- /dev/null
+++ b/src/applications/files/document/PhabricatorTextDocumentEngine.php
@@ -0,0 +1,33 @@
+<?php
+
+abstract class PhabricatorTextDocumentEngine
+ extends PhabricatorDocumentEngine {
+
+ protected function canRenderDocumentType(PhabricatorDocumentRef $ref) {
+ return $ref->isProbablyText();
+ }
+
+ protected function newTextDocumentContent($content) {
+ $lines = phutil_split_lines($content);
+
+ $view = id(new PhabricatorSourceCodeView())
+ ->setLines($lines)
+ ->disableHighlightOnClick();
+
+ $container = phutil_tag(
+ 'div',
+ array(
+ 'class' => 'document-engine-text',
+ ),
+ $view);
+
+ return $container;
+ }
+
+ protected function loadTextData(PhabricatorDocumentRef $ref) {
+ $content = $ref->loadData();
+ $content = phutil_utf8ize($content);
+ return $content;
+ }
+
+}
diff --git a/webroot/rsrc/css/layout/phabricator-source-code-view.css b/webroot/rsrc/css/layout/phabricator-source-code-view.css
--- a/webroot/rsrc/css/layout/phabricator-source-code-view.css
+++ b/webroot/rsrc/css/layout/phabricator-source-code-view.css
@@ -14,14 +14,6 @@
margin-left: 8px;
}
-.phabricator-source-code-view tr:first-child * {
- padding-top: 8px;
-}
-
-.phabricator-source-code-view tr:last-child * {
- padding-bottom: 8px;
-}
-
.phabricator-source-code {
white-space: pre-wrap;
padding: 2px 8px 1px;
@@ -45,12 +37,16 @@
white-space: nowrap;
}
-th.phabricator-source-line a {
- color: {$darkbluetext};
+th.phabricator-source-line a,
+th.phabricator-source-line span {
display: block;
padding: 2px 6px 1px 12px;
}
+th.phabricator-source-line a {
+ color: {$darkbluetext};
+}
+
th.phabricator-source-line a:hover {
background: {$paste.border};
text-decoration: none;
@@ -60,10 +56,6 @@
background: {$paste.highlight};
}
-.phabricator-source-highlight th.phabricator-source-line {
- background: {$paste.border};
-}
-
.phabricator-source-code-summary {
padding-bottom: 8px;
}
diff --git a/webroot/rsrc/css/phui/phui-property-list-view.css b/webroot/rsrc/css/phui/phui-property-list-view.css
--- a/webroot/rsrc/css/phui/phui-property-list-view.css
+++ b/webroot/rsrc/css/phui/phui-property-list-view.css
@@ -258,6 +258,10 @@
text-align: left;
}
+.document-engine-text .phabricator-source-code-container {
+ border: none;
+}
+
.document-engine-jupyter {
overflow: hidden;
margin: 20px;

File Metadata

Mime Type
text/plain
Expires
Fri, Mar 14, 6:36 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7385838
Default Alt Text
D19254.id.diff (8 KB)

Event Timeline