Page MenuHomePhorge

No OneTemporary

diff --git a/src/applications/files/remarkup/PhabricatorRemarkupRuleEmbedFile.php b/src/applications/files/remarkup/PhabricatorRemarkupRuleEmbedFile.php
index fbf30d7cb9..c631d53fd4 100644
--- a/src/applications/files/remarkup/PhabricatorRemarkupRuleEmbedFile.php
+++ b/src/applications/files/remarkup/PhabricatorRemarkupRuleEmbedFile.php
@@ -1,218 +1,219 @@
<?php
final class PhabricatorRemarkupRuleEmbedFile
extends PhabricatorRemarkupRuleObject {
const KEY_EMBED_FILE_PHIDS = 'phabricator.embedded-file-phids';
protected function getObjectNamePrefix() {
return 'F';
}
protected function loadObjects(array $ids) {
$engine = $this->getEngine();
$viewer = $engine->getConfig('viewer');
$objects = id(new PhabricatorFileQuery())
->setViewer($viewer)
->withIDs($ids)
->execute();
$phids_key = self::KEY_EMBED_FILE_PHIDS;
$phids = $engine->getTextMetadata($phids_key, array());
foreach (mpull($objects, 'getPHID') as $phid) {
$phids[] = $phid;
}
$engine->setTextMetadata($phids_key, $phids);
return $objects;
}
protected function renderObjectEmbed($object, $handle, $options) {
$options = $this->getFileOptions($options) + array(
'name' => $object->getName(),
);
$is_viewable_image = $object->isViewableImage();
$is_audio = $object->isAudio();
$force_link = ($options['layout'] == 'link');
$options['viewable'] = ($is_viewable_image || $is_audio);
if ($is_viewable_image && !$force_link) {
return $this->renderImageFile($object, $handle, $options);
} else if ($is_audio && !$force_link) {
return $this->renderAudioFile($object, $handle, $options);
} else {
return $this->renderFileLink($object, $handle, $options);
}
}
private function getFileOptions($option_string) {
$options = array(
'size' => null,
'layout' => 'left',
'float' => false,
'width' => null,
'height' => null,
);
if ($option_string) {
$option_string = trim($option_string, ', ');
$parser = new PhutilSimpleOptions();
$options = $parser->parse($option_string) + $options;
}
return $options;
}
private function renderImageFile(
PhabricatorFile $file,
PhabricatorObjectHandle $handle,
array $options) {
require_celerity_resource('lightbox-attachment-css');
$attrs = array();
$image_class = null;
$use_size = true;
if (!$options['size']) {
$width = $this->parseDimension($options['width']);
$height = $this->parseDimension($options['height']);
if ($width || $height) {
$use_size = false;
$attrs += array(
'src' => $file->getBestURI(),
'width' => $width,
'height' => $height,
);
}
}
if ($use_size) {
switch ((string)$options['size']) {
case 'full':
$attrs += array(
'src' => $file->getBestURI(),
'width' => $file->getImageWidth(),
'height' => $file->getImageHeight(),
);
+ $image_class = 'phabricator-remarkup-embed-image-full';
break;
case 'thumb':
default:
$attrs['src'] = $file->getPreview220URI();
$dimensions =
PhabricatorImageTransformer::getPreviewDimensions($file, 220);
$attrs['width'] = $dimensions['sdx'];
$attrs['height'] = $dimensions['sdy'];
$image_class = 'phabricator-remarkup-embed-image';
break;
}
}
$img = phutil_tag('img', $attrs);
$embed = javelin_tag(
'a',
array(
'href' => $file->getBestURI(),
'class' => $image_class,
'sigil' => 'lightboxable',
'meta' => array(
'phid' => $file->getPHID(),
'uri' => $file->getBestURI(),
'dUri' => $file->getDownloadURI(),
'viewable' => true,
),
),
$img);
switch ($options['layout']) {
case 'right':
case 'center':
case 'inline':
case 'left':
$layout_class = 'phabricator-remarkup-embed-layout-'.$options['layout'];
break;
default:
$layout_class = 'phabricator-remarkup-embed-layout-left';
break;
}
if ($options['float']) {
switch ($options['layout']) {
case 'center':
case 'inline':
break;
case 'right':
$layout_class .= ' phabricator-remarkup-embed-float-right';
break;
case 'left':
default:
$layout_class .= ' phabricator-remarkup-embed-float-left';
break;
}
}
return phutil_tag(
'div',
array(
'class' => $layout_class,
),
$embed);
}
private function renderAudioFile(
PhabricatorFile $file,
PhabricatorObjectHandle $handle,
array $options) {
if (idx($options, 'autoplay')) {
$preload = 'auto';
$autoplay = 'autoplay';
} else {
$preload = 'none';
$autoplay = null;
}
return phutil_tag(
'audio',
array(
'controls' => 'controls',
'preload' => $preload,
'autoplay' => $autoplay,
'loop' => idx($options, 'loop') ? 'loop' : null,
),
phutil_tag(
'source',
array(
'src' => $file->getBestURI(),
'type' => $file->getMimeType(),
)));
}
private function renderFileLink(
PhabricatorFile $file,
PhabricatorObjectHandle $handle,
array $options) {
return id(new PhabricatorFileLinkView())
->setFilePHID($file->getPHID())
->setFileName($options['name'])
->setFileDownloadURI($file->getDownloadURI())
->setFileViewURI($file->getBestURI())
->setFileViewable($options['viewable']);
}
private function parseDimension($string) {
$string = trim($string);
if (preg_match('/^(?:\d*\\.)?\d+%?$/', $string)) {
return $string;
}
return null;
}
}
diff --git a/webroot/rsrc/css/core/remarkup.css b/webroot/rsrc/css/core/remarkup.css
index f95bcd43c1..3f65938b4a 100644
--- a/webroot/rsrc/css/core/remarkup.css
+++ b/webroot/rsrc/css/core/remarkup.css
@@ -1,417 +1,421 @@
/**
* @provides phabricator-remarkup-css
*/
.phabricator-remarkup {
line-height: 1.45em;
}
.phabricator-remarkup p {
margin: 0 0 12px;
}
.phabricator-remarkup p:last-child {
margin-bottom: 0;
}
.phabricator-remarkup .remarkup-code-block {
margin: 12px;
white-space: pre;
font-family: "Monaco", monospace;
font-size: 10px;
}
.phabricator-remarkup .remarkup-code-header {
padding: 6px 8px;
background: {$lightyellow};
color: rgba(0,0,0,.75);
font-weight: bold;
display: inline-block;
border-top: 1px solid {$yellow};
border-left: 1px solid {$yellow};
border-right: 1px solid {$yellow};
margin-bottom: -1px;
}
.phabricator-remarkup .remarkup-code-block pre {
background: {$lightyellow};
border: 1px solid {$yellow};
display: block;
color: #000000;
overflow: auto;
padding: 8px;
font-family: "Monaco", monospace;
}
.phabricator-remarkup pre.remarkup-counterexample {
border: 1px solid {$red};
background-color: {$lightred};
}
.phabricator-remarkup tt {
color: #333333;
background: #ebebeb;
padding: 0 4px;
white-space: pre-wrap;
}
/* NOTE: You can currently produce this with [[link | `name`]]. Restore the
link color. */
.phabricator-remarkup a tt {
color: #18559d;
}
.phabricator-remarkup ul {
list-style: disc;
margin: 12px 0 12px 30px;
}
.phabricator-remarkup ol {
list-style: decimal;
margin: 12px 0 12px 30px;
}
.phabricator-remarkup ul ol,
.phabricator-remarkup ul ul,
.phabricator-remarkup ol ol,
.phabricator-remarkup ol ul {
margin: 4px 0 4px 24px;
}
.phabricator-remarkup li.phantom-item,
.phabricator-remarkup li.phantom-item {
list-style-type: none;
}
.phabricator-remarkup h1:first-child,
.phabricator-remarkup h2:first-child,
.phabricator-remarkup h3:first-child,
.phabricator-remarkup h4:first-child,
.phabricator-remarkup h5:first-child,
.phabricator-remarkup h6:first-child {
margin-top: 0;
}
.phabricator-remarkup h1:last-child,
.phabricator-remarkup h2:last-child,
.phabricator-remarkup h3:last-child,
.phabricator-remarkup h4:last-child,
.phabricator-remarkup h5:last-child,
.phabricator-remarkup h6:last-child {
margin-bottom: 0;
}
.phabricator-remarkup h1 {
font-size: 1.625em;
line-height: 1.625em;
margin: 8px 0;
}
.phabricator-remarkup h2 {
font-size: 1.5em;
line-height: 1.5em;
margin: 8px 0;
}
.phabricator-remarkup h3 {
font-size: 1.375em;
line-height: 1.375em;
margin: 8px 0;
}
.phabricator-remarkup h4 {
font-size: 1.25em;
line-height: 1.25em;
margin: 8px 0;
}
.phabricator-remarkup h5 {
font-size: 1.125em;
line-height: 1.125em;
margin: 4px 0;
}
.phabricator-remarkup h6 {
font-size: 1em;
line-height: 1em;
margin: 4px 0;
}
.phabricator-remarkup blockquote {
border-left: 3px solid {$lightbluetext};
color: {$bluetext};
font-style: italic;
margin: 4px 20px 12px 0;
padding: 8px 12px;
background-color: #F8F9FC;
}
.phabricator-remarkup blockquote em {
font-style: normal;
}
.phabricator-remarkup img.remarkup-proxy-image {
max-width: 640px;
max-height: 640px;
}
.phabricator-remarkup audio {
display: block;
margin: 16px auto;
min-width: 240px;
width: 50%;
}
.phabricator-remarkup-mention-exists {
font-weight: bold;
background: #e6f3ff;
}
.phabricator-remarkup-mention-disabled {
font-weight: bold;
background: #dddddd;
}
.phui-remarkup-preview .phabricator-remarkup-mention-unknown,
.aphront-panel-preview .phabricator-remarkup-mention-unknown {
font-weight: bold;
background: #ffaaaa;
}
.phabricator-remarkup .remarkup-note {
margin: 16px 0;
padding: 12px;
border-left: 3px solid {$blue};
background: {$lightblue};
}
.phabricator-remarkup .remarkup-warning {
margin: 16px 0;
padding: 12px;
border-left: 3px solid {$yellow};
background: {$lightyellow};
}
.phabricator-remarkup .remarkup-important {
margin: 16px 0;
padding: 12px;
border-left: 3px solid {$red};
background: {$lightred};
}
.phabricator-remarkup .remarkup-note-word {
font-weight: bold;
color: {$darkbluetext};
}
.phabricator-remarkup-toc {
float: right;
border: 1px solid {$lightblueborder};
background: {$lightgreybackground};
padding: 8px;
width: 180px;
margin: 0 0 4px 8px;
}
.phabricator-remarkup-toc-header {
font-size: 12px;
line-height: 12px;
color: {$darkbluetext};
font-weight: bold;
margin-bottom: 4px;
}
.phabricator-remarkup-toc ul {
padding: 0;
margin: 0;
list-style: none;
overflow: hidden;
}
.phabricator-remarkup-toc ul ul {
margin: 0 0 0 10px;
}
.phabricator-remarkup-toc ul li {
padding: 0;
margin: 0;
font-size: 11px;
}
.phabricator-remarkup-embed-layout-right {
text-align: right;
}
.phabricator-remarkup-embed-layout-center {
text-align: center;
}
.phabricator-remarkup-embed-layout-inline {
display: inline;
}
.phabricator-remarkup-embed-float-right {
float: right;
margin: .5em 1em 0;
}
.phabricator-remarkup-embed-layout-link {
padding-left: 20px;
background: url(/rsrc/image/icon/fatcow/page_white_put.png) 0 0 no-repeat;
}
.phabricator-remarkup-embed-float-left {
float: left;
margin: .5em 1em 0;
}
.phabricator-remarkup-embed-image {
display: inline-block;
border: 3px solid white;
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.20);
}
+.phabricator-remarkup-embed-image-full {
+ display: inline-block;
+}
+
.phabricator-remarkup table.remarkup-table {
border-collapse: separate;
border-spacing: 1px;
background: #d3d3d3;
margin: 12px 0;
}
.phabricator-remarkup table.remarkup-table th {
font-weight: bold;
padding: 3px 6px;
background: #e3e3e3;
}
.phabricator-remarkup table.remarkup-table td {
background: #ffffff;
padding: 3px 6px;
}
.remarkup-assist-textarea {
border-left-color: {$blueborder};
border-right-color: {$blueborder};
border-bottom-color: {$blueborder};
border-top-color: {$lightblueborder};
border-radius: 0;
/* Prevent Safari and Chrome users from dragging the textarea any wider,
because the top bar won't resize along with it. */
resize: vertical;
}
.remarkup-assist-textarea:focus {
border: 1px solid rgba(82, 168, 236, 0.8);
}
.remarkup-assist-bar {
height: 27px;
padding: 0 2px;
border-width: 1px 1px 0;
border-style: solid;
border-top-color: {$blueborder};
border-left-color: {$blueborder};
border-right-color: {$blueborder};
background: {$lightbluebackground};
overflow: hidden;
}
.remarkup-assist-button {
display: block;
padding: 3px;
margin: 2px 1px;
float: left;
border: 1px solid transparent;
border-radius: 2px;
}
.remarkup-assist-button:hover {
background: #f7f7f7;
border-color: #c6c6c6;
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.10);
}
.remarkup-assist-button:active {
outline: none;
background: #f3f3f3;
box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.10);
}
.remarkup-assist-button:focus {
outline: none;
}
.remarkup-assist-separator {
display: block;
float: left;
margin: 7px 4px;
height: 14px;
width: 0px;
border-right: 1px solid #cccccc;
}
.remarkup-interpreter-error {
padding: 8px;
border: 1px solid {$red};
background-color: {$lightred};
}
.remarkup-cowsay {
white-space: pre-wrap;
}
.remarkup-figlet {
white-space: pre-wrap;
}
.remarkup-assist {
display: block;
width: 14px;
height: 14px;
overflow: hidden;
}
.remarkup-assist-right {
float: right;
}
.jx-order-mask {
background: #ffffff;
opacity: 1.0;
}
.remarkup-assist-textarea {
box-shadow: none;
-webkit-box-shadow: none;
}
.remarkup-control-fullscreen-mode {
position: fixed;
top: -1px;
bottom: -1px;
left: -1px;
right: -1px;
}
.remarkup-control-fullscreen-mode textarea.remarkup-assist-textarea {
position: absolute;
top: 26px;
left: 0;
right: 0;
bottom: 0;
/* NOTE: This doesn't work in Firefox, there's a JS behavior to correct it. */
height: auto;
border-width: 1px 0 0 0;
outline: none;
}
.phabricator-image-macro-hero {
margin: auto;
max-width: 95%;
}

File Metadata

Mime Type
text/x-diff
Expires
Jan 19 2025, 21:06 (6 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1128752
Default Alt Text
(14 KB)

Event Timeline