• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ckeditor / ckeditor5-vue2 / #248

pending completion
#248

travis-ci

19 of 19 branches covered (100.0%)

Branch coverage included in aggregate %.

45 of 45 relevant lines covered (100.0%)

28.07 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/plugin.js
1
/**
2
 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
 * For licensing, see LICENSE.md.
4
 */
5

6
/* eslint-env browser */
7

8
import * as Vue from 'vue';
9
import CKEditorComponent from './ckeditor.js';
10

11
const [ major ] = getVueVersion().split( '.' ).map( i => parseInt( i, 10 ) );
3✔
12

13
/* istanbul ignore if */
14
if ( major !== 2 ) {
1✔
15
        throw new Error(
16
                'The CKEditor plugin works only with Vue 2.x. ' +
17
                'For more information, please refer to ' +
18
                'https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/frameworks/vuejs-v2.html'
19
        );
20
}
21

22
const CKEditor = {
1✔
23
        /**
24
         * Installs the plugin, registering the `<ckeditor>` component.
25
         *
26
         * @param {Vue} app The Vue object.
27
         */
28
        install( app ) {
29
                app.component( 'ckeditor', CKEditorComponent );
1✔
30
        },
31
        component: CKEditorComponent
32
};
33

34
export default CKEditor;
35

36
/* istanbul ignore next */
37
function getVueVersion() {
38
        // Vue 3+.
39
        if ( Vue.version ) {
40
                return Vue.version;
41
        }
42

43
        // Webpack complains if the `Vue.default` does not exist. It is exported by Vue 2.
44
        // export 'default' (imported as 'Vue') was not found in 'vue'
45
        const DEFAULT_KEY = 'default';
46

47
        if ( Vue[ DEFAULT_KEY ] ) {
48
                return Vue[ DEFAULT_KEY ].version;
49
        }
50
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc