R
R
Redrica2020-08-04 16:24:23
1C-Bitrix
Redrica, 2020-08-04 16:24:23

Why does the Bitrix visual editor break the Vue component?

If you use it in the admin panel in the markup editor <my-component> Some text </my-component>, and then switch to the visual editor, then the markup turns into <span> Some text </span>.
Is this behavior configurable somehow? It cannot be that custom tags are not accepted.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
h4mpy, 2020-08-04
@h4mpy

You can set the rules for processing specific tags, then the tag itself should not be cut.
in filebitrix/php_interface/admin_header.php

<script>
BX.addCustomEvent('OnEditorInitedBefore', function(toolbar) {
  var _this = this;
  BX.addCustomEvent(this, 'OnGetParseRules', BX.proxy(function() {
    this.rules.tags['my-component'] = {}; // с дефисом
    this.rules.tags.mycomponent = {}; // без дефиса
  }, this));
});
</script>

there seems to be no other option

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question