FIX открытие ссылки на точку в окне редактирования статьи

This commit is contained in:
Krivchikov Dmitry 2016-03-21 00:36:46 +03:00
parent 4c3586b3ea
commit d61aa7897c
2 changed files with 10 additions and 2 deletions

View File

@ -9,7 +9,7 @@ class Helper
} }
/** /**
* TYPES: 'clear','html','js' * TYPES: 'clear','html', 'editor','js'
* @param type $string * @param type $string
* @param type $replaceType * @param type $replaceType
* @return type * @return type
@ -34,14 +34,22 @@ class Helper
switch ($replaceType) { switch ($replaceType) {
case 'html': case 'html':
// Используется при отображении страницы точки или статьи
$linkName = $linkName ? $linkName : '<span class="glyphicon glyphicon-link"></span>'; $linkName = $linkName ? $linkName : '<span class="glyphicon glyphicon-link"></span>';
$string = str_replace($link, '<a href="/point/' . $linkId . '" title="' . $linkTitle . '">' . $linkName . '</a>', $string); $string = str_replace($link, '<a href="/point/' . $linkId . '" title="' . $linkTitle . '">' . $linkName . '</a>', $string);
break; break;
case 'editor':
// Используется при редактировании статьи
$linkName = $linkName ? $linkName : '<span class="glyphicon glyphicon-link"></span>';
$string = str_replace($link, '<a href="/point/' . $linkId . '" title="' . $linkTitle . '" target="_blank">' . $linkName . '</a>', $string);
break;
case 'js': case 'js':
// Используется при показе описания описания точки НА КАРТЕ
$linkName = $linkName ? $linkName : '<span class="glyphicon glyphicon-link"></span>'; $linkName = $linkName ? $linkName : '<span class="glyphicon glyphicon-link"></span>';
$string = str_replace($link, '<a href="/?point=' . $linkId . '" title="' . $linkTitle . '">' . $linkName . '</a>', $string); $string = str_replace($link, '<a href="/?point=' . $linkId . '" title="' . $linkTitle . '">' . $linkName . '</a>', $string);
break; break;
default: default:
// Для OG и т.п. - без ссылок
$string = str_replace($link, $linkName, $string); $string = str_replace($link, $linkName, $string);
break; break;
} }

View File

@ -202,7 +202,7 @@ class ArticleController extends Controller
$html = str_replace(array('<','>',"'"), array('&lt;','&gt;','&prime;'), $html); $html = str_replace(array('<','>',"'"), array('&lt;','&gt;','&prime;'), $html);
$html = Markdown::processing($html); $html = Markdown::processing($html);
$html = nl2br($html); $html = nl2br($html);
$html = Helper::replaceLinks($html, 'html'); $html = Helper::replaceLinks($html, 'editor');
$html = Helper::replaceImgs($html, 'html', 'small'); $html = Helper::replaceImgs($html, 'html', 'small');
print $html; print $html;