Answer the question
In order to leave comments, you need to log in
CLightHTMLEditor - how to get text if html comes as input?
Good afternoon!
I came across this editor from Bitrix.
The crux of the matter is when the editor is empty and we simply enter text there and format it, everything is correctly saved and displayed on the site.
BUT! if we want to edit the already written text, then it comes to us in the form of html. If you save text with tags, the tags will appear in the markup as part of the text.
It is necessary that the text not come to the editor in html markup, but simply formatted, so that it is easier to edit and there is no need to remove tags.
Below is the code.
$LHE->Show(array(
'id' => preg_replace("/[^a-z0-9]/i", '', "PROPERTY[".$propertyID."][0]"),
'width' => '100%',
'height' => '200px',
'inputName' => "PROPERTY[".$propertyID."][0]",
'content' => $INPUT_TYPE == "HTML" ? $arResult["ELEMENT"][$propertyID] : $arResult["ELEMENT_PROPERTIES"][$propertyID][0]["~VALUE"]["TEXT"],
'bUseFileDialogs' => false,
'bFloatingToolbar' => false,
'bArisingToolbar' => false,
'toolbarConfig' => array(
'Bold', 'CreateLink', 'DeleteLink',
'InsertOrderedList', 'InsertUnorderedList', 'Outdent', 'Indent'
),
));?>
Answer the question
In order to leave comments, you need to log in
Problem solved. I received an object by id via GetById (documentation https://dev.1c-bitrix.ru/api_help/iblock/classes/c ...). After receiving the object, it pulled the correct ['DETAIL_TEXT'] property. It stored already formatted text with headings and lists, and in this form I substituted it into the editor.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question