use CSS to break long lines and keep links intact

This commit is contained in:
Ralf Becker 2018-10-11 09:35:38 +02:00
parent 5b14dc2f1a
commit 91a72c0120
3 changed files with 9 additions and 40 deletions

View File

@ -1939,48 +1939,9 @@ class infolog_ui
{
Framework::window_close(lang('Permission denied!'));
}
foreach(array('info_subject', 'info_des') as $key)
{
if(!isset($content[$key]) || strlen($content[$key]) < 75)
{
continue;
}
$contlines = explode("\n", $content[$key]);
$clarray = array();
foreach ($contlines as &$line)
{
if(strlen($line) < 75)
{
$clarray[] = $line;
continue;
}
$cont = explode(' ', $line);
$ckarray = array();
foreach($cont as &$word)
{
// set blank behind all , and . if words are too long, apply wordwrap afterwards to make sure we get
if (strlen($word)>75)
{
$buff = Api\Html::activate_links($word);
if (strlen($buff) == strlen($word)) // no links -> try to break overlong words
{
if (!(strpos($word,',')===false) && strpos($word,', ')===false) $word = str_replace(',',', ',$word);
if (!(strpos($word,'.')===false) && strpos($word,'. ')===false) $word = str_replace('.','. ',$word);
$word = wordwrap($word, 75, ' ', true);
}
}
$ckarray[] =$word;
}
$line = join(' ',$ckarray);
unset($ckarray);
$clarray[] = $line;
}
$content[$key] = join("\n",$clarray);
unset($clarray);
}
if (is_numeric($_REQUEST['cat_id']))
{
$content['info_cat'] = (int) $_REQUEST['cat_id'];
$content['info_cat'] = (int)$_REQUEST['cat_id'];
}
if (!$content)
{

View File

@ -47,6 +47,10 @@ tr.infolog_rowHasParent > td:first-child {
.et2_nextmatch .egwGridView_grid tr td div.et2_vbox .infoDes a{
display: inline-table;
}
/* break in words if necessary for description */
#infolog-index_nm div.infoDes > span{
overflow-wrap: break-word;
}
/* Put line break for the first column*/
#infolog-index .egwGridView_grid .et2_hbox.et2_box_widget.infolog_CompletedClmn {
white-space: normal;

View File

@ -115,6 +115,10 @@ tr.infolog_rowHasParent > td:first-child {
.et2_nextmatch .egwGridView_grid tr td div.et2_vbox .infoDes a {
display: inline-table;
}
/* break in words if necessary for description */
#infolog-index_nm div.infoDes > span {
overflow-wrap: break-word;
}
/* Put line break for the first column*/
#infolog-index .egwGridView_grid .et2_hbox.et2_box_widget.infolog_CompletedClmn {
white-space: normal;