From 694b16f5b06c933a96346b814a11fc2f440ebaeb Mon Sep 17 00:00:00 2001 From: denisname Date: Thu, 5 Jan 2017 20:57:15 +0100 Subject: [PATCH] CKEditor: add properties in buttonDefinition (#13636) * CKEditor add icon in buttonDefinition Add icon and iconOffset optional properties in buttonDefinition interface * Test Add test * Confirm to style --- ckeditor/ckeditor-tests.ts | 26 ++++++++++++++++++++++++++ ckeditor/index.d.ts | 2 ++ 2 files changed, 28 insertions(+) diff --git a/ckeditor/ckeditor-tests.ts b/ckeditor/ckeditor-tests.ts index f0aa64cc07..3ec9b64fd5 100644 --- a/ckeditor/ckeditor-tests.ts +++ b/ckeditor/ckeditor-tests.ts @@ -270,6 +270,32 @@ function test_dom_window() { alert(size.height); } +function test_adding_command_and_buttons() { + var textarea = document.createElement('textarea'); + var instance = CKEDITOR.replace(textarea); + + instance.addCommand( 'aCommand', { + exec: function( editor: CKEDITOR.editor ) { + // empty logic + return true; + } + }); + + instance.ui.addButton( 'firstButton', { + icon: 'http://www.example.com/assets/images/icons.png', + iconOffset: -32, + label: 'Label 1', + command: 'aCommand', + toolbar: 'tools' + }); + + instance.ui.addButton( 'secondButton', { + label: 'Label 2', + command: 'aCommand', + toolbar: 'tools' + }); +} + function test_adding_dialog_by_path() { CKEDITOR.dialog.add( 'abbrDialog', this.path + 'dialogs/abbr.js' ); } diff --git a/ckeditor/index.d.ts b/ckeditor/index.d.ts index f95875501c..271ca0b678 100644 --- a/ckeditor/index.d.ts +++ b/ckeditor/index.d.ts @@ -1255,6 +1255,8 @@ declare namespace CKEDITOR { } interface buttonDefinition { + icon?: string; + iconOffset?: number; label : string; command : string; toolbar : string;