Fix escaping issue for Markdown editor

This commit is contained in:
Frédéric Guillot 2018-05-03 15:15:50 -07:00
parent 46cefbc2ba
commit c8df8a7c8c
3 changed files with 6 additions and 4 deletions

View File

@ -213,7 +213,6 @@ class FormHelper extends Base
{
$params = array(
'name' => $name,
'text' => isset($values[$name]) ? $values[$name] : '',
'css' => $this->errorClass($errors, $name),
'required' => isset($attributes['required']) && $attributes['required'],
'tabindex' => isset($attributes['tabindex']) ? $attributes['tabindex'] : '-1',
@ -232,7 +231,9 @@ class FormHelper extends Base
$params['suggestOptions']['triggers']['@'] = $this->helper->url->to('UserAjaxController', 'mention', array('project_id' => $values['project_id'], 'search' => 'SEARCH_TERM'));
}
$html = '<div class="js-text-editor" data-params=\''.json_encode($params, JSON_HEX_APOS).'\'></div>';
$html = '<div class="js-text-editor" data-params=\''.json_encode($params, JSON_HEX_APOS).'\'>';
$html .= '<script type="text/template">'.(isset($values[$name]) ? $values[$name] : '').'</script>';
$html .= '</div>';
$html .= $this->errorList($errors, $name);
return $html;

File diff suppressed because one or more lines are too long

View File

@ -62,7 +62,8 @@ KB.component('text-editor', function (containerElement, options) {
}
// Order is important for IE11 (especially for the placeholder)
textareaElement.text(options.text);
var textWrapper = KB.dom(containerElement).find('script');
textareaElement.text(textWrapper.innerText);
if (options.placeholder) {
textareaElement.attr('placeholder', options.placeholder);