Skip to content

Commit b712905

Browse files
author
epriestley
committed
Add a "document" style to PHUIRemarkupPreviewPanel and use it in Legalpad and Phriction
Summary: Ref T3671. Depends on D6674. Continues work in D6673, D6674 and extends it into Legalpad and Phriction. Then deletes a bunch of dead code. Test Plan: Edited documents in Legalpad and Phriction, verified I got reasonable looking previews. Reviewers: btrahan, Firehed Reviewed By: btrahan CC: aran, chad Maniphest Tasks: T3671 Differential Revision: https://secure.phabricator.com/D6675
1 parent b2fa129 commit b712905

18 files changed

+86
-188
lines changed

src/__celerity_resource_map__.php

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,19 +1765,6 @@
17651765
),
17661766
'disk' => '/rsrc/js/core/behavior-konami.js',
17671767
),
1768-
'javelin-behavior-legalpad-document-preview' =>
1769-
array(
1770-
'uri' => '/res/d0ce5a8c/rsrc/js/application/legalpad/legalpad-document-preview.js',
1771-
'type' => 'js',
1772-
'requires' =>
1773-
array(
1774-
0 => 'javelin-behavior',
1775-
1 => 'javelin-dom',
1776-
2 => 'javelin-util',
1777-
3 => 'phabricator-shaped-request',
1778-
),
1779-
'disk' => '/rsrc/js/application/legalpad/legalpad-document-preview.js',
1780-
),
17811768
'javelin-behavior-lightbox-attachments' =>
17821769
array(
17831770
'uri' => '/res/72b4d3a8/rsrc/js/core/behavior-lightbox-attachments.js',
@@ -2255,19 +2242,6 @@
22552242
),
22562243
'disk' => '/rsrc/js/application/pholio/behavior-pholio-mock-view.js',
22572244
),
2258-
'javelin-behavior-phriction-document-preview' =>
2259-
array(
2260-
'uri' => '/res/e2fe02de/rsrc/js/application/phriction/phriction-document-preview.js',
2261-
'type' => 'js',
2262-
'requires' =>
2263-
array(
2264-
0 => 'javelin-behavior',
2265-
1 => 'javelin-dom',
2266-
2 => 'javelin-util',
2267-
3 => 'phabricator-shaped-request',
2268-
),
2269-
'disk' => '/rsrc/js/application/phriction/phriction-document-preview.js',
2270-
),
22712245
'javelin-behavior-ponder-votebox' =>
22722246
array(
22732247
'uri' => '/res/c28daa12/rsrc/js/application/ponder/behavior-votebox.js',
@@ -3781,7 +3755,7 @@
37813755
),
37823756
'phriction-document-css' =>
37833757
array(
3784-
'uri' => '/res/97a9ef40/rsrc/css/application/phriction/phriction-document-css.css',
3758+
'uri' => '/res/754f6b37/rsrc/css/application/phriction/phriction-document-css.css',
37853759
'type' => 'css',
37863760
'requires' =>
37873761
array(
@@ -3853,7 +3827,7 @@
38533827
),
38543828
'phui-remarkup-preview-css' =>
38553829
array(
3856-
'uri' => '/res/80d54c8c/rsrc/css/phui/phui-remarkup-preview.css',
3830+
'uri' => '/res/6c886e63/rsrc/css/phui/phui-remarkup-preview.css',
38573831
'type' => 'css',
38583832
'requires' =>
38593833
array(

src/__phutil_library_map__.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,6 @@
647647
'LegalpadDocumentEditController' => 'applications/legalpad/controller/LegalpadDocumentEditController.php',
648648
'LegalpadDocumentEditor' => 'applications/legalpad/editor/LegalpadDocumentEditor.php',
649649
'LegalpadDocumentListController' => 'applications/legalpad/controller/LegalpadDocumentListController.php',
650-
'LegalpadDocumentPreviewController' => 'applications/legalpad/controller/LegalpadDocumentPreviewController.php',
651650
'LegalpadDocumentQuery' => 'applications/legalpad/query/LegalpadDocumentQuery.php',
652651
'LegalpadDocumentSearchEngine' => 'applications/legalpad/query/LegalpadDocumentSearchEngine.php',
653652
'LegalpadDocumentSignController' => 'applications/legalpad/controller/LegalpadDocumentSignController.php',
@@ -2657,7 +2656,6 @@
26572656
0 => 'LegalpadController',
26582657
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
26592658
),
2660-
'LegalpadDocumentPreviewController' => 'LegalpadController',
26612659
'LegalpadDocumentQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
26622660
'LegalpadDocumentSearchEngine' => 'PhabricatorApplicationSearchEngine',
26632661
'LegalpadDocumentSignController' => 'LegalpadController',

src/applications/legalpad/application/PhabricatorApplicationLegalpad.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function getRoutes() {
4949
'comment/(?P<id>\d+)/' => 'LegalpadDocumentCommentController',
5050
'view/(?P<id>\d+)/' => 'LegalpadDocumentViewController',
5151
'document/' => array(
52-
'preview/' => 'LegalpadDocumentPreviewController'),
52+
'preview/' => 'PhabricatorMarkupPreviewController'),
5353
));
5454
}
5555

src/applications/legalpad/controller/LegalpadDocumentEditController.php

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -172,34 +172,19 @@ public function processRequest() {
172172
$crumbs->addCrumb(
173173
id(new PhabricatorCrumbView())->setName($short));
174174

175-
$preview_header = id(new PhabricatorHeaderView())
176-
->setHeader(pht('Document Preview'));
177-
$preview_view = phutil_tag(
178-
'div',
179-
array(
180-
'id' => 'document-preview'),
181-
phutil_tag(
182-
'div',
183-
array(
184-
'class' => 'aphront-panel-preview-loading-text'),
185-
pht('Loading preview...')));
186-
$preview_panel = id(new PHUIDocumentView())
187-
->appendChild($preview_header)
188-
->appendChild($preview_view);
189-
Javelin::initBehavior(
190-
'legalpad-document-preview',
191-
array(
192-
'preview' => 'document-preview',
193-
'title' => 'document-title',
194-
'text' => 'document-text',
195-
'uri' => $this->getApplicationURI('document/preview/')));
175+
176+
$preview = id(new PHUIRemarkupPreviewPanel())
177+
->setHeader(pht('Document Preview'))
178+
->setPreviewURI($this->getApplicationURI('document/preview/'))
179+
->setControlID('document-text')
180+
->setSkin('document');
196181

197182
return $this->buildApplicationPage(
198183
array(
199184
$crumbs,
200185
$error_view,
201186
$form,
202-
$preview_panel
187+
$preview
203188
),
204189
array(
205190
'title' => $title,

src/applications/legalpad/controller/LegalpadDocumentPreviewController.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/applications/phriction/application/PhabricatorApplicationPhriction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function getRoutes() {
5252
'new/' => 'PhrictionNewController',
5353
'move/(?:(?P<id>[1-9]\d*)/)?' => 'PhrictionMoveController',
5454

55-
'preview/' => 'PhrictionDocumentPreviewController',
55+
'preview/' => 'PhabricatorMarkupPreviewController',
5656
'diff/(?P<id>[1-9]\d*)/' => 'PhrictionDiffController',
5757
),
5858
);

src/applications/phriction/controller/PhrictionEditController.php

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -229,24 +229,11 @@ public function processRequest() {
229229
$header = id(new PhabricatorHeaderView())
230230
->setHeader($panel_header);
231231

232-
$preview_content = hsprintf(
233-
'<div class="phriction-document-preview-header plt pll">%s</div>
234-
<div id="document-preview">
235-
<div class="aphront-panel-preview-loading-text">%s</div>
236-
</div>',
237-
pht('Document Preview'),
238-
pht('Loading preview...'));
239-
240-
$preview_panel = id(new PHUIDocumentView())
241-
->appendChild($preview_content);
242-
243-
Javelin::initBehavior(
244-
'phriction-document-preview',
245-
array(
246-
'preview' => 'document-preview',
247-
'textarea' => 'document-textarea',
248-
'uri' => '/phriction/preview/?draftkey='.$draft_key,
249-
));
232+
$preview = id(new PHUIRemarkupPreviewPanel())
233+
->setHeader(pht('Document Preview'))
234+
->setPreviewURI('/phriction/preview/')
235+
->setControlID('document-textarea')
236+
->setSkin('document');
250237

251238
$crumbs = $this->buildApplicationCrumbs();
252239
if ($document->getID()) {
@@ -269,7 +256,7 @@ public function processRequest() {
269256
$draft_note,
270257
$error_view,
271258
$form,
272-
$preview_panel,
259+
$preview,
273260
),
274261
array(
275262
'title' => pht('Edit Document'),

src/applications/ponder/storage/PonderAnswer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function getMarkupText($field) {
100100
}
101101

102102
public function newMarkupEngine($field) {
103-
return PhabricatorMarkupEngine::newPonderMarkupEngine();
103+
return PhabricatorMarkupEngine::getEngine();
104104
}
105105

106106
public function didMarkupText(

src/applications/ponder/storage/PonderComment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function getMarkupText($field) {
2020
}
2121

2222
public function newMarkupEngine($field) {
23-
return PhabricatorMarkupEngine::newPonderMarkupEngine();
23+
return PhabricatorMarkupEngine::getEngine();
2424
}
2525

2626
public function didMarkupText(

src/applications/ponder/storage/PonderQuestion.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function getMarkupText($field) {
146146
}
147147

148148
public function newMarkupEngine($field) {
149-
return PhabricatorMarkupEngine::newPonderMarkupEngine();
149+
return PhabricatorMarkupEngine::getEngine();
150150
}
151151

152152
public function didMarkupText(

0 commit comments

Comments
 (0)