mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20:56 +01:00
Use PHUIRemarkupPreviewView in Phame
Summary: Reuse PHUIMarkupPreviewView in Phame for consistency, less custom code. Also, doesn't work (JS issue). Test Plan: New Post, Edit Post, Save Post Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D14552
This commit is contained in:
parent
a58c5e10b8
commit
df7f21b4e8
7 changed files with 16 additions and 67 deletions
|
@ -402,7 +402,7 @@ return array(
|
|||
'rsrc/js/application/owners/OwnersPathEditor.js' => 'aa1733d0',
|
||||
'rsrc/js/application/owners/owners-path-editor.js' => '7a68dda3',
|
||||
'rsrc/js/application/passphrase/passphrase-credential-control.js' => '3cb0b2fc',
|
||||
'rsrc/js/application/phame/phame-post-preview.js' => 'be807912',
|
||||
'rsrc/js/application/phame/phame-post-preview.js' => 'd6bba572',
|
||||
'rsrc/js/application/pholio/behavior-pholio-mock-edit.js' => '246dc085',
|
||||
'rsrc/js/application/pholio/behavior-pholio-mock-view.js' => 'fbe497e7',
|
||||
'rsrc/js/application/phortune/behavior-stripe-payment-form.js' => '3f5d6dbf',
|
||||
|
@ -637,7 +637,7 @@ return array(
|
|||
'javelin-behavior-phabricator-transaction-comment-form' => 'b23b49e6',
|
||||
'javelin-behavior-phabricator-transaction-list' => '13c739ea',
|
||||
'javelin-behavior-phabricator-watch-anchor' => '9f36c42d',
|
||||
'javelin-behavior-phame-post-preview' => 'be807912',
|
||||
'javelin-behavior-phame-post-preview' => 'd6bba572',
|
||||
'javelin-behavior-pholio-mock-edit' => '246dc085',
|
||||
'javelin-behavior-pholio-mock-view' => 'fbe497e7',
|
||||
'javelin-behavior-phui-dropdown-menu' => '54733475',
|
||||
|
@ -1765,12 +1765,6 @@ return array(
|
|||
'javelin-util',
|
||||
'javelin-request',
|
||||
),
|
||||
'be807912' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
'javelin-util',
|
||||
'phabricator-shaped-request',
|
||||
),
|
||||
'c1700f6f' => array(
|
||||
'javelin-install',
|
||||
'javelin-util',
|
||||
|
@ -1851,6 +1845,12 @@ return array(
|
|||
'javelin-dom',
|
||||
'javelin-stratcom',
|
||||
),
|
||||
'd6bba572' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
'javelin-util',
|
||||
'phabricator-shaped-request',
|
||||
),
|
||||
'd75709e6' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-workflow',
|
||||
|
|
|
@ -3310,7 +3310,6 @@ phutil_register_library_map(array(
|
|||
'PhamePostMailReceiver' => 'applications/phame/mail/PhamePostMailReceiver.php',
|
||||
'PhamePostNewController' => 'applications/phame/controller/post/PhamePostNewController.php',
|
||||
'PhamePostNotLiveController' => 'applications/phame/controller/post/PhamePostNotLiveController.php',
|
||||
'PhamePostPreviewController' => 'applications/phame/controller/post/PhamePostPreviewController.php',
|
||||
'PhamePostPublishController' => 'applications/phame/controller/post/PhamePostPublishController.php',
|
||||
'PhamePostQuery' => 'applications/phame/query/PhamePostQuery.php',
|
||||
'PhamePostReplyHandler' => 'applications/phame/mail/PhamePostReplyHandler.php',
|
||||
|
@ -7627,7 +7626,6 @@ phutil_register_library_map(array(
|
|||
'PhamePostMailReceiver' => 'PhabricatorObjectMailReceiver',
|
||||
'PhamePostNewController' => 'PhamePostController',
|
||||
'PhamePostNotLiveController' => 'PhamePostController',
|
||||
'PhamePostPreviewController' => 'PhamePostController',
|
||||
'PhamePostPublishController' => 'PhamePostController',
|
||||
'PhamePostQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||
'PhamePostReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
|
||||
|
|
|
@ -50,7 +50,7 @@ final class PhabricatorPhameApplication extends PhabricatorApplication {
|
|||
'publish/(?P<id>\d+)/' => 'PhamePostPublishController',
|
||||
'unpublish/(?P<id>\d+)/' => 'PhamePostUnpublishController',
|
||||
'notlive/(?P<id>\d+)/' => 'PhamePostNotLiveController',
|
||||
'preview/' => 'PhamePostPreviewController',
|
||||
'preview/' => 'PhabricatorMarkupPreviewController',
|
||||
'framed/(?P<id>\d+)/' => 'PhamePostFramedController',
|
||||
'new/' => 'PhamePostNewController',
|
||||
'move/(?P<id>\d+)/' => 'PhamePostNewController',
|
||||
|
|
|
@ -175,27 +175,17 @@ final class PhamePostEditController extends PhamePostController {
|
|||
->addCancelButton($cancel_uri)
|
||||
->setValue($submit_button));
|
||||
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader(pht('%s (Post Preview)', $title));
|
||||
|
||||
$container = id(new PHUIBoxView())
|
||||
->setID('post-preview');
|
||||
|
||||
$document = id(new PHUIDocumentViewPro())
|
||||
->setHeader($header)
|
||||
->appendChild($container);
|
||||
|
||||
$preview_panel = id(new PHUIObjectBoxView())
|
||||
->appendChild($document);
|
||||
$preview = id(new PHUIRemarkupPreviewPanel())
|
||||
->setHeader($post->getTitle())
|
||||
->setPreviewURI($this->getApplicationURI('post/preview/'))
|
||||
->setControlID('post-body')
|
||||
->setPreviewType(PHUIRemarkupPreviewPanel::DOCUMENT);
|
||||
|
||||
Javelin::initBehavior(
|
||||
'phame-post-preview',
|
||||
array(
|
||||
'preview' => 'post-preview',
|
||||
'body' => 'post-body',
|
||||
'title' => 'post-title',
|
||||
'phame_title' => 'post-phame-title',
|
||||
'uri' => '/phame/post/preview/',
|
||||
));
|
||||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
|
@ -214,7 +204,7 @@ final class PhamePostEditController extends PhamePostController {
|
|||
->appendChild(
|
||||
array(
|
||||
$form_box,
|
||||
$preview_panel,
|
||||
$preview,
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
|
||||
final class PhamePostPreviewController extends PhamePostController {
|
||||
|
||||
protected function getSideNavFilter() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$body = $request->getStr('body');
|
||||
|
||||
$post = id(new PhamePost())
|
||||
->setBody($body);
|
||||
|
||||
$content = PhabricatorMarkupEngine::renderOneObject(
|
||||
$post,
|
||||
PhamePost::MARKUP_FIELD_BODY,
|
||||
$viewer);
|
||||
|
||||
$content = phutil_tag_div('phabricator-remarkup', $content);
|
||||
|
||||
return id(new AphrontAjaxResponse())->setContent($content);
|
||||
}
|
||||
|
||||
}
|
|
@ -103,7 +103,7 @@ final class PHUIRemarkupPreviewPanel extends AphrontTagView {
|
|||
|
||||
} else if ($this->previewType == self::DOCUMENT) {
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader(pht('%s (Document Preview)', $this->header));
|
||||
->setHeader(pht('%s (Preview)', $this->header));
|
||||
|
||||
$content = id(new PHUIDocumentViewPro())
|
||||
->setHeader($header)
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
JX.behavior('phame-post-preview', function(config) {
|
||||
|
||||
var body = JX.$(config.body);
|
||||
var title = JX.$(config.title);
|
||||
var phame_title = JX.$(config.phame_title);
|
||||
var sync_titles = true;
|
||||
|
@ -54,27 +53,15 @@ JX.behavior('phame-post-preview', function(config) {
|
|||
return s;
|
||||
};
|
||||
|
||||
var callback = function(r) {
|
||||
JX.DOM.setContent(JX.$(config.preview), JX.$H(r));
|
||||
};
|
||||
|
||||
var getdata = function() {
|
||||
return {
|
||||
body : body.value,
|
||||
title : title.value,
|
||||
phame_title : phame_title.value
|
||||
};
|
||||
};
|
||||
|
||||
var request = new JX.PhabricatorShapedRequest(config.uri, callback, getdata);
|
||||
var trigger = JX.bind(request, request.trigger);
|
||||
|
||||
JX.DOM.listen(body, 'keydown', null, trigger);
|
||||
JX.DOM.listen(title, 'keydown', null, trigger);
|
||||
JX.DOM.listen(title, 'keyup', null, titleCallback);
|
||||
JX.DOM.listen(phame_title, 'keydown', null, trigger);
|
||||
JX.DOM.listen(phame_title, 'keyup', null, phameTitleKeyupCallback);
|
||||
JX.DOM.listen(phame_title, 'blur', null, phameTitleBlurCallback);
|
||||
request.start();
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue