Y
Y
Yuriyant2016-05-27 17:13:12
1C-Bitrix
Yuriyant, 2016-05-27 17:13:12

Bitrix visual editor - content wrapper?

It is necessary to wrap any content that is changed through the Bitrix visual editor in a kind of wrapper.
<div class="custom-content">....</div>
There is practically no description of the visual editor API.
The solution zombzone.ru/?p=82 based on the 'OnIncludeHTMLEditorScript' event does not work in the hermitage in the 16th version of Bitrix.
I tried this option. Event fulfills on opening of the editor. But I have not yet been able to find how to intercept the installation of content.

BX.addCustomEvent('OnEditorInitedBefore', function (toolbar) {
    console.log(this)
});

If anyone came across, then please tell me the solutions.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuriyant, 2016-05-27
@yuriyant

In general, I found the solution myself. If anyone needs it.

<script>
      BX.addCustomEvent('OnEditorInitedBefore', function () {
    if (this.config.content.indexOf('<div class="custom-contet">') == -1) {
        this.config.content = '<div class="custom-contet">' + this.config.content + '</div>';
    }		
      });
</script>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question