StevenDevooght / tinyMCE-mention

Mention/Autocomplete plugin for tinyMCE WYSIWYG editor.
http://stevendevooght.github.io/tinyMCE-mention/
220 stars 95 forks source link

Integration with Typescript #74

Open AhmedElbatt opened 5 years ago

AhmedElbatt commented 5 years ago

Hi Steven,

May I ask you if you can provide me with a demo on how I can use the tinyMCE-mention in TS file.That is a simple of my code :

import * as tinymce from 'tinymce'; import { getMainLayoutUrl } from '../getMainLayout'; var mentions = require('tinymce-mention');

export function loadCommentEditor(selector: string) { let mainCss = getMainLayoutUrl();

tinymce.init({
    selector: selector,
    entity_encoding: "raw",
    language: globalVar.language,
    language_url: globalVar.tinyMceSettings.languageUrl,
    mentions: {
        source: [
            { name: 'Tyra Porcelli' },
            { name: 'Brigid Reddish' },
            { name: 'Ashely Buckler' },
            { name: 'Teddy Whelan' }
        ]
    },
    menubar: false,
    statusbar: false,
    branding: false,
    plugins: [
        'autolink lists link charmap anchor textcolor',
        'visualblocks code',
        'paste'
    ],
    external_plugins: {
        'mention': 'http://stevendevooght.github.io/tinyMCE-mention/javascripts/tinymce/plugins/mention/plugin.js'
    },
    toolbar: 'bold italic underline forecolor bullist numlist | link | code |',
    content_css: mainCss,
});

I receive that error in webpack running TS2345: Argument of type '{ selector: string; entity_encoding: string; language: string; language_url: string; mentions: { source: { name: string; }[]; }; menubar: false; statusbar: false; branding: false; plugins: string[]; external_plugins: { ...; }; toolbar: string; content_css: string; }' is not assignable to parameter of type 'Settings'.Object literal may only specify known properties, and 'mentions' does not exist in type 'Settings'.