@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Line count can be set for paste

Summary:
Probably not the ideal way to deal showing only certain amount of lines. Size vary by browsers,
zooming will mess it up albeit only a little and will definitely not work with IE.

Test Plan: {F35989}

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1770

Differential Revision: https://secure.phabricator.com/D5347

authored by

Lauri-Henrik Jalonen and committed by
epriestley
1e8d20d9 dcdf2072

+20 -9
+2 -2
src/applications/paste/remarkup/PhabricatorPasteRemarkupRule.php
··· 32 32 33 33 foreach ($opts as $key => $value) { 34 34 if ($key == 'lines') { 35 - // placeholder for now 35 + $embed_paste->setLines(preg_replace('/[^0-9]/', '', $value)); 36 36 } else if ($key == 'highlight') { 37 - $highlights = explode('&', preg_replace('/\s+/', '', $value)); 37 + $highlights = preg_split('/,|&/', preg_replace('/\s+/', '', $value)); 38 38 39 39 $to_highlight = array(); 40 40 foreach ($highlights as $highlight) {
+12 -4
src/applications/paste/view/PasteEmbedView.php
··· 5 5 private $paste; 6 6 private $handle; 7 7 private $highlights = array(); 8 + private $lines = 30; 8 9 9 10 public function setPaste(PhabricatorPaste $paste) { 10 11 $this->paste = $paste; ··· 19 20 public function setHighlights(array $highlights) { 20 21 $this->highlights = $highlights; 21 22 return $this; 23 + } 24 + 25 + public function setLines($lines) { 26 + $this->lines = $lines; 22 27 } 23 28 24 29 public function render() { ··· 43 48 ), 44 49 $link); 45 50 51 + $body_attributes = array('class' => 'paste-embed-body'); 52 + if ($this->lines != null) { 53 + $body_attributes['style'] = 'max-height: '.$this->lines * (1.15).'em;'; 54 + } 55 + 46 56 $body = phutil_tag( 47 57 'div', 48 - array(), 58 + $body_attributes, 49 59 id(new PhabricatorSourceCodeView()) 50 60 ->setLines($lines) 51 61 ->setHighlights($this->highlights)); 52 62 53 63 return phutil_tag( 54 64 'div', 55 - array( 56 - 'class' => 'paste-embed' 57 - ), 65 + array('class' => 'paste-embed'), 58 66 array($head, $body)); 59 67 60 68 }
+2 -3
src/view/layout/PhabricatorSourceCodeView.php
··· 17 17 } 18 18 19 19 public function setHighlights(array $highlights) { 20 - $this->highlights = $highlights; 20 + $this->highlights = array_fuse($highlights); 21 21 return $this; 22 22 } 23 23 ··· 31 31 32 32 $rows = array(); 33 33 foreach ($this->lines as $line) { 34 - 35 34 $hit_limit = $this->limit && 36 35 ($line_number == $this->limit) && 37 36 (count($this->lines) != $this->limit); ··· 50 49 } 51 50 52 51 $row_attributes = array(); 53 - if (in_array($line_number, $this->highlights)) { 52 + if (isset($this->highlights[$line_number])) { 54 53 $row_attributes['class'] = 'phabricator-source-highlight'; 55 54 } 56 55
+4
webroot/rsrc/css/application/paste/paste.css
··· 17 17 color: #282828; 18 18 font-weight: bold; 19 19 } 20 + 21 + .paste-embed-body { 22 + overflow-y: auto; 23 + }