A
A
Anna2020-10-30 20:17:54
1C-Bitrix
Anna, 2020-10-30 20:17:54

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'
                  ),
                ));?>


How can this be fixed? I couldn't find any information about this editor.

PS - as text, we pull up a detailed description from the product card. Changing the format didn't help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anna, 2020-11-02
@Anna_Belikova01

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 question

Ask a Question

731 491 924 answers to any question