Платформа ЦРНП "Мирокод" для разработки проектов
https://git.mirocod.ru
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
724 B
22 lines
724 B
3 years ago
|
import {initMarkupContent} from '../../markup/content.js';
|
||
|
|
||
|
const {csrf} = window.config;
|
||
|
|
||
|
export function initCompMarkupContentPreviewTab($form) {
|
||
|
const $tabMenu = $form.find('.tabular.menu');
|
||
|
$tabMenu.find('.item').tab();
|
||
|
$tabMenu.find(`.item[data-tab="${$tabMenu.data('preview')}"]`).on('click', function () {
|
||
|
const $this = $(this);
|
||
|
$.post($this.data('url'), {
|
||
|
_csrf: csrf,
|
||
|
mode: 'comment',
|
||
|
context: $this.data('context'),
|
||
|
text: $form.find(`.tab[data-tab="${$tabMenu.data('write')}"] textarea`).val()
|
||
|
}, (data) => {
|
||
|
const $previewPanel = $form.find(`.tab[data-tab="${$tabMenu.data('preview')}"]`);
|
||
|
$previewPanel.html(data);
|
||
|
initMarkupContent();
|
||
|
});
|
||
|
});
|
||
|
}
|