-
Notifications
You must be signed in to change notification settings - Fork 320
/
Copy pathplugin.js
39 lines (30 loc) · 1.17 KB
/
plugin.js
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
29
30
31
32
33
34
35
36
37
38
39
/**
* Copyright (c) 2014-2025, CKSource Holding sp. z o.o. All rights reserved.
* Licensed under the terms of the MIT License (see LICENSE.md).
*
* Basic sample plugin inserting abbreviation elements into the CKEditor editing area.
*
* Created out of the CKEditor Plugin SDK:
* https://ckeditor.com/docs/ckeditor4/latest/guide/plugin_sdk_sample_1.html
*/
// Register the plugin within the editor.
CKEDITOR.plugins.add( 'abbr', {
// Register the icons.
icons: 'abbr',
// The plugin initialization logic goes inside this method.
init: function( editor ) {
// Define an editor command that opens our dialog window.
editor.addCommand( 'abbr', new CKEDITOR.dialogCommand( 'abbrDialog' ) );
// Create a toolbar button that executes the above command.
editor.ui.addButton( 'Abbr', {
// The text part of the button (if available) and the tooltip.
label: 'Insert Abbreviation',
// The command to execute on click.
command: 'abbr',
// The button placement in the toolbar (toolbar group name).
toolbar: 'insert'
});
// Register our dialog file -- this.path is the plugin folder path.
CKEDITOR.dialog.add( 'abbrDialog', this.path + 'dialogs/abbr.js' );
}
});