SpecialistOff.NET / Вопросы / Статьи / Фрагменты кода / Резюме / Метки / Помощь / Файлы

Список вопросов Печать

Использование редактора TinyMCE


Метки: tinymce javascript vue.js wysiwyg 

Ответы

RemiZOffAlex  Создано: 2019-12-30 20:26:17.635506  Обновлено: 2019-12-30 20:26:17.635506

В коде страницы

<script type="text/javascript" src="/static/tinymce/tinymce.min.js"></script>

<textarea name="body" id="body"></textarea>

<script>
tinymce.init({
    selector: '#body',
    height: 400,
    language: 'ru',
    plugins: 'code importcss searchreplace autolink save directionality visualblocks visualchars fullscreen image link media table charmap hr pagebreak nonbreaking anchor toc advlist lists wordcount imagetools textpattern noneditable help charmap quickbars',
    toolbar: 'code | undo redo | bold italic underline strikethrough removeformat | formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | pagebreak | fullscreen | link image anchor charmap',

    formats: {
        img: { selector: 'img', classes: 'img-thumbnail', styles: {} },
        table: { selector: 'table', classes: 'table', styles: {} },
    },
    style_formats: [
        { title: 'Картинка', format: 'img' },
        { title: 'Таблица', format: 'table' },
    ],
    content_css: '/static/css/bootstrap.min.css',
    relative_urls: false,
    convert_urls: false,
    // Table
    table_default_attributes: {},
    table_default_styles: {},
    table_class_list: [
        {title: 'default', value: 'table'},
        {title: 'None', value: ''},
    ],
});
</script>

Vue

updated: function () {
    var vm = this;
    if (vm.message.mode==='full') {
tinymce.init({ selector: 'textarea#body',
height: 400, language: 'ru', plugins: "code link image table", toolbar: "table tabledelete | tableprops tablerowprops tablecellprops | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol" });     } }

Возможно будут интересны и другие вопросы