aboutsummaryrefslogtreecommitdiff
path: root/resources/assets/javascripts/cke/wiki-link/wiki-link.js
blob: 1abf5bfe877575339c6f34890d4ba0a6c113e64f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { Plugin } from '@ckeditor/ckeditor5-core';
import WikiLinkUI from './ui.js';
import WikiLinkEditing from './editing.js';

export default class WikiLink extends Plugin {
    static get requires() {
        return [WikiLinkEditing, WikiLinkUI];
    }

    /**
     * @inheritDoc
     */
    static get pluginName() {
        return 'WikiLink';
    }

    /**
     * @inheritDoc
     */
    init() {
        const ui = this.editor.plugins.get('WikiLinkUI');

        ui.on('insert', (event, data) => {
            this.editor.execute('insertStudipWikiLink', data);
            ui.fire('close');
        });
    }
}