From 877a2af148ad04675bb647e1a358be6d2b25b985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Verg=C3=A9?= Date: Thu, 6 Oct 2016 16:26:24 +0200 Subject: [PATCH] fix(CKEditor): Fix config.toolbar type (#11567) The type for toolbar is currently defined as `string | (string[])[]`, but it should be `string | (string | string[])[]`. The `toolbar` property is either: * a toolbar name (`string`) * or an array of elements, that can be `string`s (for instance a newline marker `'/'`) or `string[]`s (for instance a list of buttons). For example, this is a valid configuration: ```js CKEDITOR.config.toolbar = [ [ 'mode', 'document', 'doctools' ], [ 'clipboard', 'undo' ], '/', [ 'find', 'selection', 'spellchecker' ], [ 'basicstyles', 'cleanup' ], '/', [ 'list', 'indent', 'blocks', 'align', 'bidi' ], ]; ``` --- ckeditor/ckeditor-tests.ts | 17 +++++++++++++++++ ckeditor/ckeditor.d.ts | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ckeditor/ckeditor-tests.ts b/ckeditor/ckeditor-tests.ts index bcf2a7807b..97a5c73937 100644 --- a/ckeditor/ckeditor-tests.ts +++ b/ckeditor/ckeditor-tests.ts @@ -37,6 +37,23 @@ function test_CKEDITOR() { CKEDITOR.replaceAll((textarea, config) => false); } +function test_config() { + var config1: CKEDITOR.config = { + toolbar: 'basic', + }; + var config2: CKEDITOR.config = { + toolbar: [ + [ 'mode', 'document', 'doctools' ], + [ 'clipboard', 'undo' ], + '/', + [ 'find', 'selection', 'spellchecker' ], + [ 'basicstyles', 'cleanup' ], + '/', + [ 'list', 'indent', 'blocks', 'align', 'bidi' ], + ], + }; +} + function test_dom_comment() { var type = CKEDITOR.NODE_COMMENT; var nativeNode = document.createComment('Example'); diff --git a/ckeditor/ckeditor.d.ts b/ckeditor/ckeditor.d.ts index b5009fa031..d43446dd83 100644 --- a/ckeditor/ckeditor.d.ts +++ b/ckeditor/ckeditor.d.ts @@ -807,7 +807,7 @@ declare namespace CKEDITOR { templates_files?: Object; templates_replaceContent?: boolean; title?: string | boolean; - toolbar?: string | (string[])[]; + toolbar?: string | (string | string[])[]; toolbarCanCollapse?: boolean; toolbarGroupCycling?: boolean; toolbarGroups?: toolbarGroups[];