Merge pull request #28851 from denisname/CKEditor-Linting

CKEditor linting
This commit is contained in:
Nathan Shively-Sanders
2018-09-18 10:51:54 -07:00
committed by GitHub
8 changed files with 414 additions and 722 deletions
+142 -146
View File
@@ -1,14 +1,12 @@
function test_CKEDITOR() {
CKEDITOR.basePath = 'test';
CKEDITOR.replaceClass = 'rich_editor';
CKEDITOR.skinName = 'moono';
CKEDITOR.skinName = 'myskin,/customstuff/myskin/';
var editor = new CKEDITOR.editor();
if (editor.getSelection(true).getType() == CKEDITOR.SELECTION_ELEMENT)
if (editor.getSelection(false).getType() == CKEDITOR.SELECTION_NONE)
if (editor.getSelection(true).getType() == CKEDITOR.SELECTION_TEXT)
var editor: CKEDITOR.editor = new CKEDITOR.editor();
if (editor.getSelection(true).getType() === CKEDITOR.SELECTION_ELEMENT)
if (editor.getSelection(false).getType() === CKEDITOR.SELECTION_NONE)
if (editor.getSelection(true).getType() === CKEDITOR.SELECTION_TEXT)
alert(CKEDITOR.basePath);
if (CKEDITOR.currentInstance)
alert(CKEDITOR.currentInstance.name);
@@ -17,7 +15,7 @@ function test_CKEDITOR() {
CKEDITOR.loadFullCoreTimeout = 5;
alert(CKEDITOR.revision);
alert(CKEDITOR.rnd);
if (CKEDITOR.status == 'loaded') {
if (CKEDITOR.status === 'loaded') {
CKEDITOR.loadFullCore();
}
alert(CKEDITOR.timestamp);
@@ -29,15 +27,16 @@ function test_CKEDITOR() {
CKEDITOR.inline('content');
if (CKEDITOR.loadFullCore)
CKEDITOR.loadFullCore();
CKEDITOR.replace('myfield');
var textarea = document.createElement('textarea');
CKEDITOR.replace('myfield');
CKEDITOR.replace(textarea);
CKEDITOR.replaceAll();
CKEDITOR.replaceAll('myClassName');
CKEDITOR.replaceAll((textarea, config) => false);
var editor: CKEDITOR.editor = CKEDITOR.appendTo('append here', CKEDITOR.config, 'data');
var editor: CKEDITOR.editor = CKEDITOR.appendTo(document.createElement('div'));
editor = CKEDITOR.appendTo('append here', CKEDITOR.config, 'data');
editor = CKEDITOR.appendTo(document.createElement('div'));
CKEDITOR.error('code');
CKEDITOR.error('500', { moreData: true });
CKEDITOR.warn('danger');
@@ -45,7 +44,7 @@ function test_CKEDITOR() {
}
function test_CKEDITOR_events() {
CKEDITOR.on('instanceCreated', function(event) {
CKEDITOR.on('instanceCreated', (event) => {
// $ExpectType editor
event.editor;
});
@@ -82,7 +81,7 @@ function test_config() {
{ name: 'styles', groups: [ 'styles' ] },
{ name: 'colors', groups: [ 'colors' ] },
],
}
};
}
function test_dom_comment() {
@@ -96,13 +95,13 @@ function test_dom_comment() {
function test_dom_document() {
var document = new CKEDITOR.dom.document(window.document);
var type = CKEDITOR.NODE_DOCUMENT;
var type: number = CKEDITOR.NODE_DOCUMENT;
CKEDITOR.document.appendStyleSheet('/mystyles.css');
var element = CKEDITOR.document.getBody();
var element: CKEDITOR.dom.element = CKEDITOR.document.getBody();
alert(element.getName());
var element2 = CKEDITOR.document.getById('myElement');
element = CKEDITOR.document.getById('myElement');
alert(element.getId());
var element3 = CKEDITOR.document.getHead();
element = CKEDITOR.document.getHead();
alert(element.getName());
var selection = CKEDITOR.instances[0].document.getSelection();
alert(selection.getType());
@@ -113,10 +112,10 @@ function test_dom_document() {
'</html>'
);
var styles: CSSStyleSheet = document.appendStyleText('some styles');
var element: CKEDITOR.dom.element = document.createElement('div');
var element2: CKEDITOR.dom.element = document.createElement('div', { styles: { height: '1234' } });
var element3: CKEDITOR.dom.element = document.createElement('div', { attributes: { id: '1234' } });
var element4: CKEDITOR.dom.element = document.createElement('div', { attributes: { tabIndex: '1234' }, styles: { width: '1234' } });
element = document.createElement('div');
element = document.createElement('div', { styles: { height: '1234' } });
element = document.createElement('div', { attributes: { id: '1234' } });
element = document.createElement('div', { attributes: { tabIndex: '1234' }, styles: { width: '1234' } });
}
function test_dom_documentFragment() {
@@ -130,7 +129,7 @@ function test_dom_domObject() {
var nativeElement = element.$;
var doc = new CKEDITOR.dom.document(document);
alert(doc.equals(CKEDITOR.document));
alert(doc == CKEDITOR.document);
alert(doc === CKEDITOR.document);
var element2 = new CKEDITOR.dom.element('span');
alert(element.getCustomData('hasCustomData'));
alert(element.getCustomData('nonExistingKey'));
@@ -153,7 +152,7 @@ function test_dom_element() {
var strong = new CKEDITOR.dom.element('strong');
p.append(strong);
var em = p.append('em');
var p = new CKEDITOR.dom.element('p');
p = new CKEDITOR.dom.element('p');
p.appendText('This is');
p.appendText(' some text');
element.breakParent(strong);
@@ -164,7 +163,7 @@ function test_dom_element() {
element.focus();
element.focusNext();
element.focusPrevious();
element.forEach(node=> {
element.forEach(node => {
console.log(node);
});
var element2 = CKEDITOR.dom.element.createFromHtml('<input type="text" />');
@@ -177,7 +176,7 @@ function test_dom_element() {
alert(element.getHtml());
alert(element.getId());
alert(element.getName());
alert('<b>' + element.getNameAtt() + '</b>');
alert(`<b>${element.getNameAtt()}</b>`);
alert(element.getOuterHtml());
alert(element.getTabIndex());
alert(element.getText());
@@ -198,7 +197,7 @@ function test_dom_element() {
element.setAttribute('class', 'myClass');
element.setAttribute('title', 'This is an example');
element.setAttributes({
'class': 'myClass',
class: 'myClass',
title: 'This is an example'
});
p.setHtml('<b>Inner</b> HTML');
@@ -214,20 +213,20 @@ function test_dom_element() {
element.show();
element.unselectable();
alert(element.getName());
alert(element == CKEDITOR.dom.element.get(element));
alert(element === CKEDITOR.dom.element.get(element));
var htmlElement = document.getElementById('myElement');
alert(CKEDITOR.dom.element.get(htmlElement).getName());
var dtd: CKEDITOR.dtdDefinition = element.getDtd();
var last: CKEDITOR.dom.node = element.getLast();
var last2: CKEDITOR.dom.node = element.getLast((node: CKEDITOR.dom.node) => node.equals(document.body));
if (element.isBlockBoundary({ 'div': 1, 'span': 1 })) {
if (element.isBlockBoundary({ div: 1, span: 1 })) {
element.setState(1, 'hex', false);
}
CKEDITOR.dom.element.clearMarkers({}, element, true);
var element1: CKEDITOR.dom.element = CKEDITOR.dom.element.get('div');
var element2: CKEDITOR.dom.element = CKEDITOR.dom.element.get(document.createElement('div'));
var element6: CKEDITOR.dom.element = CKEDITOR.dom.element.get(document.createElement('div'));
var element3: CKEDITOR.dom.element = CKEDITOR.dom.element.get(element2);
var markedElement: CKEDITOR.dom.element = CKEDITOR.dom.element.setMarker({}, element, 'key', 0);
}
@@ -242,20 +241,20 @@ function test_dom_elementPath() {
function test_dom_event() {
var event = new CKEDITOR.dom.event(new Event(""));
alert(event.getKey());
alert(event.getKeystroke() == 65);
alert(event.getKeystroke() == CKEDITOR.CTRL + 65);
alert(event.getKeystroke() == CKEDITOR.CTRL + CKEDITOR.SHIFT + 65);
alert(event.getKeystroke() === 65);
alert(event.getKeystroke() === CKEDITOR.CTRL + 65);
alert(event.getKeystroke() === CKEDITOR.CTRL + CKEDITOR.SHIFT + 65);
var element = new CKEDITOR.dom.element('div');
element.on('mousemouse', ev=> {
element.on('mousemouse', ev => {
var pageOffset = ev.data.getPageOffset();
alert(pageOffset.x);
alert(pageOffset.y);
});
element.on('click', ev=> {
element.on('click', ev => {
var domEvent = ev.data;
domEvent.getTarget().addClass('clicked');
});
element.on('click', ev=> {
element.on('click', ev => {
var domEvent = ev.data as CKEDITOR.dom.event;
domEvent.preventDefault();
});
@@ -266,7 +265,7 @@ function test_dom_iterator() {
var iterator = range.createIterator();
var paragrah1: CKEDITOR.dom.element = iterator.getNextParagraph();
var paragrah2: CKEDITOR.dom.element = iterator.getNextParagraph('div');
alert(iterator.forceBrBreak === false);
alert(!iterator.forceBrBreak);
var itRange: CKEDITOR.dom.range = iterator.range;
}
@@ -335,7 +334,7 @@ function test_dom_selection() {
element = selection.getSelectedElement();
var text: string = selection.getSelectedText();
element = selection.getStartElement();
var type: number = selection.getType();
var isSomething: boolean = selection.isCollapsed();
@@ -361,18 +360,18 @@ function test_dom_walker() {
var range: CKEDITOR.dom.range = new CKEDITOR.dom.range(element);
var walker: CKEDITOR.dom.walker = new CKEDITOR.dom.walker(range);
var isSomething: boolean = walker.checkBackward();
isSomething = walker.checkForward();
walker.end();
var node: CKEDITOR.dom.node = walker.lastBackward();
node = walker.lastForward();
node = walker.next();
node = walker.previous();
walker.reset();
isSomething = CKEDITOR.dom.walker.blockBoundary({ 'div': 1 })(node);
isSomething = CKEDITOR.dom.walker.blockBoundary({ div: 1 })(node);
isSomething = CKEDITOR.dom.walker.bogus()(node);
isSomething = CKEDITOR.dom.walker.bogus(isSomething)(node);
isSomething = CKEDITOR.dom.walker.bookmark()(node);
@@ -471,8 +470,8 @@ function test_dialog() {
dialog.showPage('1234');
dialog.updateStyle();
CKEDITOR.dialog.add( 'abbrDialog', this.path + 'dialogs/abbr.js' );
CKEDITOR.dialog.add( 'abbrDialog', function ( editor: CKEDITOR.editor ) {
CKEDITOR.dialog.add('abbrDialog', 'PATH/dialogs/abbr.js');
CKEDITOR.dialog.add('abbrDialog', (editor: CKEDITOR.editor) => {
return {
title: 'Abbreviation Properties',
minWidth: 400,
@@ -486,7 +485,7 @@ function test_dialog() {
{
id: 'tab-basic',
label: 'Basic Settings',
elements: <any[]>[]
elements: <any[]> []
},
{
id: 'tab-adv',
@@ -566,7 +565,7 @@ function test_fileTools_fileLoader() {
var loader: CKEDITOR.fileTools.fileLoader = new CKEDITOR.fileTools.fileLoader(editor, 'data');
loader = new CKEDITOR.fileTools.fileLoader(editor, blob);
loader = new CKEDITOR.fileTools.fileLoader(editor, blob, 'name');
loader.abort();
var finished: boolean = loader.isFinished();
loader.load();
@@ -582,7 +581,7 @@ function test_fileTools_uploadRepository() {
var editor: CKEDITOR.editor;
var blob: Blob;
var repo: CKEDITOR.fileTools.uploadRepository = new CKEDITOR.fileTools.uploadRepository(editor);
var loader: CKEDITOR.fileTools.fileLoader = repo.create('data', 'name');
loader = repo.create(blob, 'name', 'type');
@@ -603,7 +602,7 @@ function test_filter() {
filter.addElementCallback((el: CKEDITOR.htmlParser.element) => 4);
filter.addFeature({ allowedContent: style });
filter.addTransformations([ [ 'transform1', { right: (element: CKEDITOR.htmlParser.element, tools: string | CKEDITOR.filter.transformationTools) => true } ] ]);
var allowed: boolean = filter.allow(style);
allowed = filter.allow([style], 'name');
allowed = filter.allow('rule', 'name', false);
@@ -645,7 +644,6 @@ function test_focusManager() {
var bool: boolean = focusManager.hasFocus;
}
function test_htmlParser_basicWriter() {
var writer = new CKEDITOR.htmlParser.basicWriter();
writer.attribute('class', 'MyClass');
@@ -680,12 +678,12 @@ function test_htmlParser_cssStyle() {
style.populate(element);
style.populate(new CKEDITOR.dom.element('div'));
style.populate({ 'width': 1 });
style.populate({ width: 1 });
}
function test_htmlParser_element() {
var element: CKEDITOR.htmlParser.element = new CKEDITOR.htmlParser.element('el', { 'id': '1'});
var element: CKEDITOR.htmlParser.element = new CKEDITOR.htmlParser.element('el', { id: '1'});
var node: CKEDITOR.htmlParser.node;
element.add(node);
element.add(node, 5);
@@ -703,8 +701,8 @@ function test_htmlParser_element() {
element.forEach((el: CKEDITOR.htmlParser.node) => console.log('node'), 1);
element.forEach((el: CKEDITOR.htmlParser.node) => false, 2, true);
var node: CKEDITOR.htmlParser.node = element.getFirst('*');
node = element.getFirst({ 'id': '1' });
node = element.getFirst('*');
node = element.getFirst({ id: '1' });
node = element.getFirst((el: CKEDITOR.htmlParser.node) => true);
var html: string = element.getHtml();
@@ -728,7 +726,7 @@ function test_htmlParser_filter() {
filter = new CKEDITOR.htmlParser.filter();
filter.addRules({ text: 'text' });
filter.addRules({ attributes: { 'id': '1234' }}, 1);
filter.addRules({ attributes: { id: '1234' }}, 1);
filter.addRules({ comment: 'hey', text: 'text' }, { priority: 1 });
filter.addRules({ root: document.body }, { applyToAll: false });
@@ -736,7 +734,6 @@ function test_htmlParser_filter() {
filter.applyTo(node);
}
function test_htmlParser_filterRulesGroup() {
var rules: CKEDITOR.htmlParser.filterRulesGroup = new CKEDITOR.htmlParser.filterRulesGroup();
@@ -786,7 +783,7 @@ function test_htmlParser_node() {
var node: CKEDITOR.htmlParser.node = new CKEDITOR.htmlParser.node();
var el: CKEDITOR.htmlParser.element = node.getAscendant('condition');
el = node.getAscendant({ 'id': '1234' });
el = node.getAscendant({ id: '1234' });
el = node.getAscendant((node: CKEDITOR.htmlParser.element) => false);
var idx: number = node.getIndex();
@@ -795,7 +792,6 @@ function test_htmlParser_node() {
node.remove();
node.replaceWith(node);
el = node.wrapWith(el);
}
function test_htmlParser_text() {
@@ -825,9 +821,9 @@ function test_htmlWriter() {
function test_htmlParser() {
var html = '<div><span>text</span></div>';
var fragment = CKEDITOR.htmlParser.fragment.fromHtml(html);
fragment.forEach(function(node) {
fragment.forEach((node) => {
if (node instanceof CKEDITOR.htmlParser.element) {
node.forEach(function(node) {
node.forEach((node) => {
console.log(node);
});
}
@@ -836,13 +832,13 @@ function test_htmlParser() {
function test_keystrokeHandler() {
var handler: CKEDITOR.keystrokeHandler = new CKEDITOR.keystrokeHandler(CKEDITOR.instances[0]);
handler.attach(new CKEDITOR.dom.domObject(document.body));
handler.attach(new CKEDITOR.dom.domObject(document.body));
}
function test_lang() {
var lang: string = CKEDITOR.lang.detect('en');
lang = CKEDITOR.lang.detect('zh', 'sw');
CKEDITOR.lang.load('tk', 'pr', (code: string, entries: any) => console.log('loaded'));
}
@@ -869,8 +865,8 @@ function test_menu() {
}
function test_plugins() {
CKEDITOR.plugins.add( 'abbr', {
init: function( editor: CKEDITOR.editor ) {
CKEDITOR.plugins.add('abbr', {
init: (editor: CKEDITOR.editor) => {
// empty logic
}
});
@@ -921,7 +917,7 @@ function test_skin() {
}
function test_style() {
var style: CKEDITOR.style = new CKEDITOR.style({ element: 'div' }, { 'key': 'value '});
var style: CKEDITOR.style = new CKEDITOR.style({ element: 'div' }, { key: 'value '});
style.apply(CKEDITOR.instances[0]);
var el: CKEDITOR.dom.element;
@@ -945,7 +941,7 @@ function test_style() {
var def: CKEDITOR.style.definition = style.getDefintion();
style.remove(CKEDITOR.instances[0]);
style.removeFromRange(range, CKEDITOR.instances[0]);
var rules: CKEDITOR.filter.allowedContentRules;
rules = style.toAllowedContentRules();
rules = style.toAllowedContentRules(CKEDITOR.instances[0]);
@@ -955,14 +951,14 @@ function test_adding_command_and_buttons() {
var textarea = document.createElement('textarea');
var instance = CKEDITOR.replace(textarea);
instance.addCommand( 'aCommand', {
exec: function( editor: CKEDITOR.editor ) {
instance.addCommand('aCommand', {
exec: (editor: CKEDITOR.editor) => {
// empty logic
return true;
}
});
instance.ui.addButton( 'firstButton', {
instance.ui.addButton('firstButton', {
icon: 'http://www.example.com/assets/images/icons.png',
iconOffset: -32,
label: 'Label 1',
@@ -970,7 +966,7 @@ function test_adding_command_and_buttons() {
toolbar: 'tools'
});
instance.ui.addButton( 'secondButton', {
instance.ui.addButton('secondButton', {
label: 'Label 2',
command: 'aCommand',
toolbar: 'tools'
@@ -983,7 +979,7 @@ function test_adding_widget() {
button: "Activate widgetty",
template: "<imaginary-element>",
dialog: "widgetty",
init: function() {
init: () => {
// no logic
}
});
@@ -1012,80 +1008,80 @@ function test_editor_instance_event() {
var textarea = document.createElement('textarea');
var instance = CKEDITOR.replace(textarea, {
on: {
activeEnterModeChange: function() {},
activeFilterChange: function() {},
afterCommandExec: function() {},
afterInsertHtml: function() {},
afterPaste: function() {},
afterPasteFromWord: function() {},
afterSetData: function() {},
afterUndoImage: function() {},
ariaEditorHelpLabel: function() {},
ariaWidget: function() {},
autogrow: function() {},
beforeCommandExec: function() {},
beforeDestroy: function() {},
beforeModeUnload: function() {},
beforeSetMode: function() {},
beforeUndoImage: function() {},
blur: function() {},
change: function() {},
configLoaded: function() {},
contentDirChanged: function() {},
contentDom: function() {},
contentDomInvalidated: function() {},
contentDomUnload: function() {},
customConfigLoaded: function() {},
dataFiltered: function() {},
dataReady: function() {},
destroy: function() {},
dialogHide: function() {},
dialogShow: function() {},
dirChanged: function() {},
doubleclick: function() {},
dragend: function() {},
dragstart: function() {},
drop: function() {},
elementsPathUpdate: function() {},
fileUploadRequest: function() {},
fileUploadResponse: function() {},
floatingSpaceLayout: function() {},
focus: function() {},
getData: function() {},
getSnapshot: function() {},
insertElement: function() {},
insertHtml: function() {},
insertText: function() {},
instanceReady: function() {},
key: function() {},
langLoaded: function() {},
loadSnapshot: function() {},
loaded: function() {},
lockSnapshot: function() {},
maximize: function() {},
menuShow: function() {},
mode: function() {},
notificationHide: function() {},
notificationShow: function() {},
notificationUpdate: function() {},
paste: function() {},
pasteFromWord: function() {},
pluginsLoaded: function() {},
readOnly: function() {},
removeFormatCleanup: function() {},
required: function() {},
resize: function() {},
save: function() {},
saveSnapshot: function() {},
selectionChange: function() {},
setData: function() {},
stylesSet: function() {},
template: function() {},
toDataFormat: function() {},
toHtml: function() {},
unlockSnapshot: function() {},
updateSnapshot: function() {},
widgetDefinition: function() {}
activeEnterModeChange: () => {},
activeFilterChange: () => {},
afterCommandExec: () => {},
afterInsertHtml: () => {},
afterPaste: () => {},
afterPasteFromWord: () => {},
afterSetData: () => {},
afterUndoImage: () => {},
ariaEditorHelpLabel: () => {},
ariaWidget: () => {},
autogrow: () => {},
beforeCommandExec: () => {},
beforeDestroy: () => {},
beforeModeUnload: () => {},
beforeSetMode: () => {},
beforeUndoImage: () => {},
blur: () => {},
change: () => {},
configLoaded: () => {},
contentDirChanged: () => {},
contentDom: () => {},
contentDomInvalidated: () => {},
contentDomUnload: () => {},
customConfigLoaded: () => {},
dataFiltered: () => {},
dataReady: () => {},
destroy: () => {},
dialogHide: () => {},
dialogShow: () => {},
dirChanged: () => {},
doubleclick: () => {},
dragend: () => {},
dragstart: () => {},
drop: () => {},
elementsPathUpdate: () => {},
fileUploadRequest: () => {},
fileUploadResponse: () => {},
floatingSpaceLayout: () => {},
focus: () => {},
getData: () => {},
getSnapshot: () => {},
insertElement: () => {},
insertHtml: () => {},
insertText: () => {},
instanceReady: () => {},
key: () => {},
langLoaded: () => {},
loadSnapshot: () => {},
loaded: () => {},
lockSnapshot: () => {},
maximize: () => {},
menuShow: () => {},
mode: () => {},
notificationHide: () => {},
notificationShow: () => {},
notificationUpdate: () => {},
paste: () => {},
pasteFromWord: () => {},
pluginsLoaded: () => {},
readOnly: () => {},
removeFormatCleanup: () => {},
required: () => {},
resize: () => {},
save: () => {},
saveSnapshot: () => {},
selectionChange: () => {},
setData: () => {},
stylesSet: () => {},
template: () => {},
toDataFormat: () => {},
toHtml: () => {},
unlockSnapshot: () => {},
updateSnapshot: () => {},
widgetDefinition: () => {}
}
});
}
@@ -1151,7 +1147,7 @@ function test_tools() {
var str = CKEDITOR.tools.cssStyleToDomStyle('style');
var prefixes: { [cssClass: string]: string | number } = CKEDITOR.tools.cssVendorPrefix('prop', 'val');
prefixes = CKEDITOR.tools.cssVendorPrefix('prop', 'val', true);
var fn: (param: any) => boolean
var fn: (param: any) => boolean;
fn = CKEDITOR.tools.defer<(param: any) => boolean>(fn);
CKEDITOR.tools.enableHtml5Elements(document);
CKEDITOR.tools.enableHtml5Elements(document.createDocumentFragment(), true);
@@ -1172,7 +1168,7 @@ function test_tools() {
str = CKEDITOR.tools.htmlEncode(str);
str = CKEDITOR.tools.htmlEncodeAttr(str);
numb = CKEDITOR.tools.indexOf<string>(['string', 'array'], 'string');
numb = CKEDITOR.tools.indexOf<boolean>([true, false], (val: boolean) => false);
numb = CKEDITOR.tools.indexOf<boolean>([true, false], (val: boolean) => false);
console.log(CKEDITOR.tools.isArray([1])); // true
console.log(CKEDITOR.tools.isArray(obj)); // false
console.log(CKEDITOR.tools.isArray(null)); // false
@@ -1186,8 +1182,8 @@ function test_tools() {
bool = CKEDITOR.tools.objectCompare(obj, obj);
bool = CKEDITOR.tools.objectCompare(obj, obj, true);
var strArr: string[] = CKEDITOR.tools.objectKeys(obj);
CKEDITOR.tools.override(parseInt, function(_parseInt) {
return function(value: any, radix?: number) {
CKEDITOR.tools.override(parseInt, (_parseInt) => {
return (value: any, radix?: number) => {
return _parseInt(value, radix);
};
});
+54 -78
View File
@@ -6,12 +6,12 @@
// WORK-IN-PROGRESS: Any contribution support welcomed.
// See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/1827 for more informations.
interface Window {
CKEDITOR_BASEPATH: string;
}
declare namespace CKEDITOR {
// Config options
var disableAutoInline: boolean;
var replaceClass: string;
@@ -131,12 +131,11 @@ declare namespace CKEDITOR {
function removeAllListeners(): void;
function removeListener(eventName: string, listenerFunction: (eventInfo: eventInfo) => void): void;
type listenerRegistration = {
interface listenerRegistration {
removeListener: () => void;
}
namespace dom {
interface bookmark {
startNode: dom.node | string;
endNode: dom.node | string;
@@ -210,8 +209,7 @@ declare namespace CKEDITOR {
readonly $: HTMLElement;
readonly type: number;
constructor(element: string, ownerDocument?: document);
constructor(element: HTMLElement, ownerDocument?: document);
constructor(element: string | HTMLElement, ownerDocument?: document);
addClass(className: string): void;
append(node: node | string, toStart?: boolean): node;
appendBogus(force: boolean): void;
@@ -273,8 +271,7 @@ declare namespace CKEDITOR {
removeClass(className: string): void;
removeStyle(name: string): void;
renameNode(newTag: string): void;
scrollIntoParent(parent: element, alignToTop: boolean, hscroll: boolean): void;
scrollIntoParent(parent: window, alignToTop: boolean, hscroll: boolean): void;
scrollIntoParent(parent: element | window, alignToTop: boolean, hscroll: boolean): void;
scrollIntoView(alignToTop?: boolean): void;
setAttribute(name: string, value: string): element;
setAttributes(attributesPairs: { [key: string]: string }): element;
@@ -289,7 +286,7 @@ declare namespace CKEDITOR {
show(): void;
unselectable(): void;
//static method
// static method
static clearAllMarkers(database: any): any;
static clearMarkers(database: any, element: dom.element, removeFromDatabase: boolean): void;
static createFromHtml(html: string): element;
@@ -437,8 +434,8 @@ declare namespace CKEDITOR {
}
interface shrinkOptions {
shrinkOnBlockBoundary?: boolean,
skipBogus?: boolean
shrinkOnBlockBoundary?: boolean;
skipBogus?: boolean;
}
class rangeList {
@@ -449,7 +446,6 @@ declare namespace CKEDITOR {
moveToBookmarks(bookmarks: bookmark[]): void;
}
interface rangeListIterator {
getNextRange(mergeConsequent?: boolean): range;
}
@@ -481,7 +477,7 @@ declare namespace CKEDITOR {
removeAllRanges(): void;
reset(): void;
scrollIntoView(): void;
selectBookmarks(bookmarks: (bookmark | bookmark2)[]): selection;
selectBookmarks(bookmarks: Array<bookmark | bookmark2>): selection;
selectElement(element: element): void;
selectRanges(ranges: range[]): void;
unlock(restore: boolean): void;
@@ -547,14 +543,12 @@ declare namespace CKEDITOR {
}
}
namespace ajax {
function load(url: string, callback?: (data: any) => void): string;
function loadXml(url: string, callback?: (data: any) => void): xml;
function post(url: string, data: any, contentType?: string, callback?: (data: any) => void): void;
}
class command extends event implements commandDefinition {
fakeKeystroke: number;
previousState: number;
@@ -570,7 +564,6 @@ declare namespace CKEDITOR {
refresh(editor: editor, path: dom.elementPath): void;
setState(newState: number): boolean;
toggleState(): void;
}
interface commandDefinition {
@@ -737,7 +730,7 @@ declare namespace CKEDITOR {
jqueryOverrideVal?: boolean;
justifyClasses?: string[];
keystrokes?: [number, string][];
keystrokes?: Array<[number, string]>;
language?: string;
language_list?: string[];
@@ -745,7 +738,7 @@ declare namespace CKEDITOR {
linkShowAdvancedTab?: boolean;
linkShowTargetTab?: boolean;
magicline_color?: string
magicline_color?: string;
magicline_everywhere?: boolean;
magicline_holdDistance?: number;
magicline_keystrokeNext?: number;
@@ -822,7 +815,7 @@ declare namespace CKEDITOR {
smiley_images?: string[];
smiley_path?: string;
sourceAreaTabSize?: number;
specialChars?: (string | [string, string])[];
specialChars?: Array<string | [string, string]>;
startupFocus?: string | boolean;
startupMode?: string;
startupOutlineBlocks?: boolean;
@@ -837,10 +830,10 @@ declare namespace CKEDITOR {
templates_files?: { [key: string]: any };
templates_replaceContent?: boolean;
title?: string | boolean;
toolbar?: string | (string | string[] | { name: string, items?: string[], groups?: string[] })[] | null;
toolbar?: string | Array<string | string[] | { name: string, items?: string[], groups?: string[] }> | null;
toolbarCanCollapse?: boolean;
toolbarGroupCycling?: boolean;
toolbarGroups?: (toolbarGroups | string)[];
toolbarGroups?: Array<toolbarGroups | string>;
toolbarLocation?: string;
toolbarStartupExpanded?: boolean;
@@ -914,9 +907,7 @@ declare namespace CKEDITOR {
}
namespace dialog {
namespace definition {
interface button extends uiElement {
disabled?: boolean;
}
@@ -968,13 +959,13 @@ declare namespace CKEDITOR {
interface radio extends labeledElement {
default?: string;
items?: string[] | (string[])[];
items?: string[] | string[][];
validate?: () => boolean;
}
interface select extends labeledElement {
default?: string;
items?: string[] | (string[])[];
items?: string[] | string[][];
multiple?: boolean;
size?: number;
validate?: () => boolean;
@@ -1172,7 +1163,7 @@ declare namespace CKEDITOR {
setActiveFilter(filter: filter): void;
setData(data: string, options?: { internal?: boolean; callback?: () => void; noSnapshot?: boolean; }): void;
setKeystroke(keystroke: number, behavior: string | boolean): void;
setKeystroke(keystroke: [number, string | boolean][]): void;
setKeystroke(keystroke: Array<[number, string | boolean]>): void;
setMode(newMode: string, callback: () => void): void;
setReadOnly(isReadOnly?: boolean): void;
setUiColor(color: string): void;
@@ -1432,7 +1423,7 @@ declare namespace CKEDITOR {
readonly disabled: boolean;
readonly disallowedContent: any[];
readonly editor: editor;
readonly elementCallbacks: ((element: htmlParser.element) => number)[];
readonly elementCallbacks: Array<(element: htmlParser.element) => number>;
readonly id: number;
static instances: { [id: string]: filter };
@@ -1441,7 +1432,7 @@ declare namespace CKEDITOR {
addContentForms(forms: any[]): void;
addElementCallback(callback: (element: htmlParser.element) => number): void;
addFeature(feature: feature): boolean;
addTransformations(transformations: (string | filter.transformation)[][]): void;
addTransformations(transformations: Array<Array<string | filter.transformation>>): void;
allow(newRules: filter.allowedContentRules, featureName?: string, overrideCustom?: boolean): boolean;
applyTo(fragment: htmlParser.fragment | htmlParser.element, toHrml: boolean, transformOnly: boolean, enterMode: number): boolean;
check(test: filter.contentRule, applyTransformations?: boolean, strictCheck?: boolean): boolean;
@@ -1571,10 +1562,10 @@ declare namespace CKEDITOR {
}
class filterRulesGroup {
rules: { value: rule, priority: number, option: ruleOptions }[];
rules: Array<{ value: rule, priority: number, option: ruleOptions }>;
add(rule: rule, priority: number, options: ruleOptions): void;
addMany(rules: { [key: string]: any }[], priority: number, options: ruleOptions): void;
addMany(rules: Array<{ [key: string]: any }>, priority: number, options: ruleOptions): void;
exec(currentValue: htmlParser.node | htmlParser.fragment | string): htmlParser.node | htmlParser.fragment | string;
execOnName(currentName: string): string;
findIndex(priority: number): number;
@@ -1612,8 +1603,8 @@ declare namespace CKEDITOR {
type rule = ((value: htmlParser.node | htmlParser.fragment | string) => boolean) | [string, string];
interface ruleOptions {
applyToAll?: boolean,
excludeNestedEditable?: boolean
applyToAll?: boolean;
excludeNestedEditable?: boolean;
}
class text extends node {
@@ -1682,7 +1673,6 @@ declare namespace CKEDITOR {
}
namespace plugins {
namespace cloudservices {
class cloudServicesLoader extends fileTools.fileLoader {
customToken: string;
@@ -1778,7 +1768,7 @@ declare namespace CKEDITOR {
highlighter: (code: string, lang: string, callback: (highlightedCode: string) => void) => void;
init: (ready: () => void) => void;
languages: { [lang: string]: string };
readonly queue: ((code: string, lang: string, callback: (highlightedCode: string) => void) => void)[];
readonly queue: Array<(code: string, lang: string, callback: (highlightedCode: string) => void) => void>;
readonly ready: boolean;
highlight(code: string, lang: string, callback: (highlightedCode: string) => void): void;
@@ -1809,9 +1799,7 @@ declare namespace CKEDITOR {
}
}
namespace easyimage {
}
namespace easyimage {}
namespace embedBase {
function createWidgetBaseDefinition(editor: editor): baseDefinition;
@@ -1856,9 +1844,7 @@ declare namespace CKEDITOR {
class progressBar extends progressReporter {
bar: dom.element;
constructor();
}
class progressReporter {
@@ -1922,7 +1908,7 @@ declare namespace CKEDITOR {
const synAnchorSelector: boolean;
function getEditorAnchors(editor: editor): dom.element[];
function getLinkAttributes(editor: editor, data: { [key: string]: any }): { set: { [key: string]: string }, removed: string[] }
function getLinkAttributes(editor: editor, data: { [key: string]: any }): { set: { [key: string]: string }, removed: string[] };
function getSelectedLink(editor: editor, returnMultiple?: boolean): dom.element | dom.element[];
function parseLinkAttributes(editor: editor, element: dom.element): { [key: string]: any };
function showDisplayTextForElement(element: dom.element, editor: editor): boolean;
@@ -2057,7 +2043,6 @@ declare namespace CKEDITOR {
setData(data: string): void;
}
interface definition extends feature {
button?: string;
data?: (evt: eventInfo) => void;
@@ -2100,8 +2085,7 @@ declare namespace CKEDITOR {
destroyAll(offline?: boolean): void;
finalizeCreation(container: any): void;
getByElement(element: any, checkWrapperOnly: boolean): plugins.widget;
initOn(element: dom.element, widgetDef?: plugins.widget.definition, startupData?: { [key: string]: any }): plugins.widget;
initOn(element: dom.element, widgetDef?: string, startupData?: { [key: string]: any }): plugins.widget;
initOn(element: dom.element, widgetDef?: string | plugins.widget.definition, startupData?: { [key: string]: any }): plugins.widget;
initOnAll(container?: dom.element): plugins.widget[];
parseElementClasses(classes: string): any;
wrapElement(element: any, widgetName?: string): any;
@@ -2118,7 +2102,7 @@ declare namespace CKEDITOR {
readonly definition: plugins.widget.definition;
readonly editor: editor;
readonly element: dom.element;
readonly focusedEditable: plugins.widget.nestedEditable
readonly focusedEditable: plugins.widget.nestedEditable;
readonly id: number;
readonly inited: boolean;
readonly ready: boolean;
@@ -2147,8 +2131,7 @@ declare namespace CKEDITOR {
updateDragHandlerPosition(): void;
}
function add(name: string, definition: pluginDefinition): void;
function add(name: string): void;
function add(name: string, definition?: pluginDefinition): void;
function addExternal(name: string, path: string, fileName?: string): void;
function get(name: string): any;
function getFilePath(name: string): string;
@@ -2182,6 +2165,7 @@ declare namespace CKEDITOR {
namespace skin {
var icons: { [name: string]: { path: string } };
// tslint:disable-next-line:no-duplicate-variable
var name: string;
var ua: { [name: string]: any };
@@ -2209,11 +2193,11 @@ declare namespace CKEDITOR {
}
interface definition {
attributes?: { [att: string]: string },
element: string,
name?: string,
styles?: { [att: string]: string },
type?: string | number
attributes?: { [att: string]: string };
element: string;
name?: string;
styles?: { [att: string]: string };
type?: string | number;
}
interface customHandler {
@@ -2414,13 +2398,13 @@ declare namespace CKEDITOR {
interface radio {
default: any;
validate?: () => boolean;
items: ([string, string] | [string])[];
items: Array<[string, string] | [string]>;
}
interface select {
default: any;
validate?: () => boolean;
items: ([string, string] | [string])[];
items: Array<[string, string] | [string]>;
multiple?: boolean;
size?: number;
}
@@ -2462,7 +2446,6 @@ declare namespace CKEDITOR {
constructor(dialog: dialog, childObjList: any[], childHtmlList: any[], htmlList: any[], elementDefinition: definitions.fieldSet);
}
class file extends ui.dialog.labeledElement {
constructor(dialog: dialog, elementDefinition: definitions.file, htmlList: any[]);
@@ -2473,12 +2456,10 @@ declare namespace CKEDITOR {
submit(): file;
}
class fileButton extends button {
constructor(dialog: dialog, elementDefinition: definitions.fileButton, htmlList: any[]);
}
class hbox extends uiElement {
constructor(dialog: dialog, childObjList: any[], childHtmlList: any[], htmlList: any[], elementDefinition: definitions.hbox);
@@ -2486,17 +2467,11 @@ declare namespace CKEDITOR {
getChild(indices: number[]): ui.dialog.uiElement[];
}
class html extends uiElement {
constructor(dialog: dialog, elementDefinition: definitions.html, htmlList: any[]);
}
class iframeElement extends uiElement {
}
class iframeElement extends uiElement {}
class labeledElement extends uiElement {
constructor(dialog: dialog, elementDefinition: definitions.labeledElement, htmlList: any[], contentHtml: () => string);
@@ -2505,7 +2480,6 @@ declare namespace CKEDITOR {
setlabel(label: string): ui.dialog.labeledElement;
}
class radio extends ui.dialog.labeledElement {
constructor(dialog: dialog, elementDefinition: definitions.radio, htmlList: any[]);
@@ -2514,7 +2488,6 @@ declare namespace CKEDITOR {
setValue(value: string, noChangeEvent: boolean): undefined;
}
class select extends uiElement {
constructor(dialog: dialog, elementDefinition: definitions.select, htmlList: any[]);
@@ -2523,12 +2496,10 @@ declare namespace CKEDITOR {
remove(index: number): select;
}
class textarea extends labeledElement {
constructor(dialog: dialog, elementDefinition: definitions.textarea, htmlList: any[]);
}
class textInput extends ui.dialog.labeledElement {
constructor(dialog: dialog, elementDefinition: definitions.textInput, htmlList: any[]);
@@ -2544,7 +2515,16 @@ declare namespace CKEDITOR {
class uiElement {
eventProcessors: any;
constructor(dialog: dialog, elementDefinition: definitions.uiElement, htmlList: any[], nodeNameArg?: () => string | string, stylesArg?: () => { [key: string]: any } | { [key: string]: any }, attributesArg?: () => { [key: string]: any } | { [key: string]: any }, contentsArg?: () => { [key: string]: any } | string); // Not sure that the htmlList array type is right.
// Not sure that the htmlList array type is right.
constructor(
dialog: dialog,
elementDefinition: definitions.uiElement,
htmlList: any[],
nodeNameArg?: () => string | string,
stylesArg?: () => { [key: string]: any } | { [key: string]: any },
attributesArg?: () => { [key: string]: any } | { [key: string]: any },
contentsArg?: () => { [key: string]: any } | string
);
accessKeyDown(dialog: dialog, key: string): void;
accessKeyUp(dialog: dialog, key: string): void;
@@ -2692,9 +2672,7 @@ declare namespace CKEDITOR {
create(definition: { [key: string]: any }): T;
}
class menuButton extends button {
}
class menuButton extends button {}
class panel {
constructor(document: dom.document, definition: { [key: string]: any });
@@ -2713,9 +2691,7 @@ declare namespace CKEDITOR {
const handler: handlerDefinition<panel>;
}
class panelButton extends button {
}
class panelButton extends button {}
class richCombo {
static readonly handler: handlerDefinition<richCombo>;
@@ -2753,11 +2729,11 @@ declare namespace CKEDITOR {
}
interface IMenuItemDefinition {
label: string,
command: string,
icon: string
group: string,
order: number
label: string;
command: string;
icon: string;
group: string;
order: number;
}
interface buttonDefinition {
+1 -1
View File
@@ -6,7 +6,7 @@
"dom"
],
"noImplicitAny": true,
"noImplicitThis": false,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../",
+1 -66
View File
@@ -1,79 +1,14 @@
{
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"arrow-return-shorthand": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
"prefer-const": false
}
}
+106 -108
View File
@@ -1,14 +1,12 @@
function test_CKEDITOR() {
CKEDITOR.basePath = 'test';
CKEDITOR.replaceClass = 'rich_editor';
CKEDITOR.skinName = 'moono';
CKEDITOR.skinName = 'myskin,/customstuff/myskin/';
var editor = new CKEDITOR.editor();
if (editor.getSelection().getType() == CKEDITOR.SELECTION_ELEMENT)
if (editor.getSelection().getType() == CKEDITOR.SELECTION_NONE)
if (editor.getSelection().getType() == CKEDITOR.SELECTION_TEXT)
if (editor.getSelection().getType() === CKEDITOR.SELECTION_ELEMENT)
if (editor.getSelection().getType() === CKEDITOR.SELECTION_NONE)
if (editor.getSelection().getType() === CKEDITOR.SELECTION_TEXT)
alert(CKEDITOR.basePath);
if (CKEDITOR.currentInstance)
alert(CKEDITOR.currentInstance.name);
@@ -17,7 +15,7 @@ function test_CKEDITOR() {
CKEDITOR.loadFullCoreTimeout = 5;
alert(CKEDITOR.revision);
alert(CKEDITOR.rnd);
if (CKEDITOR.status == 'loaded') {
if (CKEDITOR.status === 'loaded') {
CKEDITOR.loadFullCore();
}
alert(CKEDITOR.timestamp);
@@ -38,7 +36,7 @@ function test_CKEDITOR() {
}
function test_CKEDITOR_events() {
CKEDITOR.on('instanceCreated', function(event) {
CKEDITOR.on('instanceCreated', (event) => {
// $ExpectType editor
event.editor;
});
@@ -75,7 +73,7 @@ function test_config() {
{ name: 'styles', groups: [ 'styles' ] },
{ name: 'colors', groups: [ 'colors' ] },
],
}
};
}
function test_dom_comment() {
@@ -115,7 +113,7 @@ function test_dom_domObject() {
var nativeElement = element.$;
var doc = new CKEDITOR.dom.document(document);
alert(doc.equals(CKEDITOR.document));
alert(doc == CKEDITOR.document);
alert(doc === CKEDITOR.document);
var element2 = new CKEDITOR.dom.element('span');
alert(element.getCustomData('hasCustomData'));
alert(element.getCustomData('nonExistingKey'));
@@ -136,7 +134,7 @@ function test_dom_element() {
var strong = new CKEDITOR.dom.element('strong');
p.append(strong);
var em = p.append('em');
var p = new CKEDITOR.dom.element('p');
p = new CKEDITOR.dom.element('p');
p.appendText('This is');
p.appendText(' some text');
element.breakParent(strong);
@@ -147,7 +145,7 @@ function test_dom_element() {
element.focus();
element.focusNext();
element.focusPrevious();
element.forEach(node=> {
element.forEach(node => {
console.log(node);
});
var element2 = CKEDITOR.dom.element.createFromHtml('<input type="text" />');
@@ -159,7 +157,7 @@ function test_dom_element() {
alert(element.getHtml());
alert(element.getId());
alert(element.getName());
alert('<b>' + element.getNameAtt() + '</b>');
alert(`<b>${element.getNameAtt()}</b>`);
alert(element.getOuterHtml());
alert(element.getTabIndex());
alert(element.getText());
@@ -180,7 +178,7 @@ function test_dom_element() {
element.setAttribute('class', 'myClass');
element.setAttribute('title', 'This is an example');
element.setAttributes({
'class': 'myClass',
class: 'myClass',
title: 'This is an example'
});
p.setHtml('<b>Inner</b> HTML');
@@ -196,7 +194,7 @@ function test_dom_element() {
element.show();
element.unselectable();
alert(element.getName());
alert(element == CKEDITOR.dom.element.get(element));
alert(element === CKEDITOR.dom.element.get(element));
var htmlElement = document.getElementById('myElement');
alert(CKEDITOR.dom.element.get(htmlElement).getName());
}
@@ -204,20 +202,20 @@ function test_dom_element() {
function test_dom_event() {
var event = new CKEDITOR.dom.event(new Event(""));
alert(event.getKey());
alert(event.getKeystroke() == 65);
alert(event.getKeystroke() == CKEDITOR.CTRL + 65);
alert(event.getKeystroke() == CKEDITOR.CTRL + CKEDITOR.SHIFT + 65);
alert(event.getKeystroke() === 65);
alert(event.getKeystroke() === CKEDITOR.CTRL + 65);
alert(event.getKeystroke() === CKEDITOR.CTRL + CKEDITOR.SHIFT + 65);
var element = new CKEDITOR.dom.element('div');
element.on('mousemouse', ev=> {
element.on('mousemouse', ev => {
var pageOffset = ev.data.getPageOffset();
alert(pageOffset.x);
alert(pageOffset.y);
});
element.on('click', ev=> {
element.on('click', ev => {
var domEvent = ev.data;
domEvent.getTarget().addClass('clicked');
});
element.on('click', ev=> {
element.on('click', ev => {
var domEvent = ev.data as CKEDITOR.dom.event;
domEvent.preventDefault();
});
@@ -298,14 +296,14 @@ function test_adding_command_and_buttons() {
var textarea = document.createElement('textarea');
var instance = CKEDITOR.replace(textarea);
instance.addCommand( 'aCommand', {
exec: function( editor: CKEDITOR.editor ) {
instance.addCommand('aCommand', {
exec: (editor: CKEDITOR.editor) => {
// empty logic
return true;
}
});
instance.ui.addButton( 'firstButton', {
instance.ui.addButton('firstButton', {
icon: 'http://www.example.com/assets/images/icons.png',
iconOffset: -32,
label: 'Label 1',
@@ -313,7 +311,7 @@ function test_adding_command_and_buttons() {
toolbar: 'tools'
});
instance.ui.addButton( 'secondButton', {
instance.ui.addButton('secondButton', {
label: 'Label 2',
command: 'aCommand',
toolbar: 'tools'
@@ -321,11 +319,11 @@ function test_adding_command_and_buttons() {
}
function test_adding_dialog_by_path() {
CKEDITOR.dialog.add( 'abbrDialog', this.path + 'dialogs/abbr.js' );
CKEDITOR.dialog.add('abbrDialog', 'PATH/dialogs/abbr.js');
}
function test_adding_dialog_by_definition() {
CKEDITOR.dialog.add( 'abbrDialog', function ( editor: CKEDITOR.editor ) {
CKEDITOR.dialog.add('abbrDialog', (editor: CKEDITOR.editor) => {
return {
title: 'Abbreviation Properties',
minWidth: 400,
@@ -339,7 +337,7 @@ function test_adding_dialog_by_definition() {
{
id: 'tab-basic',
label: 'Basic Settings',
elements: <any[]>[]
elements: <any[]> []
},
{
id: 'tab-adv',
@@ -352,8 +350,8 @@ function test_adding_dialog_by_definition() {
}
function test_plugins() {
CKEDITOR.plugins.add( 'abbr', {
init: function( editor: CKEDITOR.editor ) {
CKEDITOR.plugins.add('abbr', {
init: (editor: CKEDITOR.editor) => {
// empty logic
}
});
@@ -367,7 +365,7 @@ function test_adding_widget() {
button: "Activate widgetty",
template: "<imaginary-element>",
dialog: "widgetty",
init: function() {
init: () => {
// no logic
}
});
@@ -442,80 +440,80 @@ function test_editor_instance_event() {
var textarea = document.createElement('textarea');
var instance = CKEDITOR.replace(textarea, {
on: {
activeEnterModeChange: function() {},
activeFilterChange: function() {},
afterCommandExec: function() {},
afterInsertHtml: function() {},
afterPaste: function() {},
afterPasteFromWord: function() {},
afterSetData: function() {},
afterUndoImage: function() {},
ariaEditorHelpLabel: function() {},
ariaWidget: function() {},
autogrow: function() {},
beforeCommandExec: function() {},
beforeDestroy: function() {},
beforeModeUnload: function() {},
beforeSetMode: function() {},
beforeUndoImage: function() {},
blur: function() {},
change: function() {},
configLoaded: function() {},
contentDirChanged: function() {},
contentDom: function() {},
contentDomInvalidated: function() {},
contentDomUnload: function() {},
customConfigLoaded: function() {},
dataFiltered: function() {},
dataReady: function() {},
destroy: function() {},
dialogHide: function() {},
dialogShow: function() {},
dirChanged: function() {},
doubleclick: function() {},
dragend: function() {},
dragstart: function() {},
drop: function() {},
elementsPathUpdate: function() {},
fileUploadRequest: function() {},
fileUploadResponse: function() {},
floatingSpaceLayout: function() {},
focus: function() {},
getData: function() {},
getSnapshot: function() {},
insertElement: function() {},
insertHtml: function() {},
insertText: function() {},
instanceReady: function() {},
key: function() {},
langLoaded: function() {},
loadSnapshot: function() {},
loaded: function() {},
lockSnapshot: function() {},
maximize: function() {},
menuShow: function() {},
mode: function() {},
notificationHide: function() {},
notificationShow: function() {},
notificationUpdate: function() {},
paste: function() {},
pasteFromWord: function() {},
pluginsLoaded: function() {},
readOnly: function() {},
removeFormatCleanup: function() {},
required: function() {},
resize: function() {},
save: function() {},
saveSnapshot: function() {},
selectionChange: function() {},
setData: function() {},
stylesSet: function() {},
template: function() {},
toDataFormat: function() {},
toHtml: function() {},
unlockSnapshot: function() {},
updateSnapshot: function() {},
widgetDefinition: function() {}
activeEnterModeChange: () => {},
activeFilterChange: () => {},
afterCommandExec: () => {},
afterInsertHtml: () => {},
afterPaste: () => {},
afterPasteFromWord: () => {},
afterSetData: () => {},
afterUndoImage: () => {},
ariaEditorHelpLabel: () => {},
ariaWidget: () => {},
autogrow: () => {},
beforeCommandExec: () => {},
beforeDestroy: () => {},
beforeModeUnload: () => {},
beforeSetMode: () => {},
beforeUndoImage: () => {},
blur: () => {},
change: () => {},
configLoaded: () => {},
contentDirChanged: () => {},
contentDom: () => {},
contentDomInvalidated: () => {},
contentDomUnload: () => {},
customConfigLoaded: () => {},
dataFiltered: () => {},
dataReady: () => {},
destroy: () => {},
dialogHide: () => {},
dialogShow: () => {},
dirChanged: () => {},
doubleclick: () => {},
dragend: () => {},
dragstart: () => {},
drop: () => {},
elementsPathUpdate: () => {},
fileUploadRequest: () => {},
fileUploadResponse: () => {},
floatingSpaceLayout: () => {},
focus: () => {},
getData: () => {},
getSnapshot: () => {},
insertElement: () => {},
insertHtml: () => {},
insertText: () => {},
instanceReady: () => {},
key: () => {},
langLoaded: () => {},
loadSnapshot: () => {},
loaded: () => {},
lockSnapshot: () => {},
maximize: () => {},
menuShow: () => {},
mode: () => {},
notificationHide: () => {},
notificationShow: () => {},
notificationUpdate: () => {},
paste: () => {},
pasteFromWord: () => {},
pluginsLoaded: () => {},
readOnly: () => {},
removeFormatCleanup: () => {},
required: () => {},
resize: () => {},
save: () => {},
saveSnapshot: () => {},
selectionChange: () => {},
setData: () => {},
stylesSet: () => {},
template: () => {},
toDataFormat: () => {},
toHtml: () => {},
unlockSnapshot: () => {},
updateSnapshot: () => {},
widgetDefinition: () => {}
}
});
}
@@ -580,8 +578,8 @@ function test_tools() {
console.log(CKEDITOR.tools.isArray(null)); // false
console.log(CKEDITOR.tools.isArray(undefined)); // false
CKEDITOR.tools.override(parseInt, function(_parseInt) {
return function(value: any, radix?: number) {
CKEDITOR.tools.override(parseInt, (_parseInt) => {
return (value: any, radix?: number) => {
return _parseInt(value, radix);
};
});
@@ -590,9 +588,9 @@ function test_tools() {
function test_htmlParser() {
var html = '<div><span>text</span></div>';
var fragment = CKEDITOR.htmlParser.fragment.fromHtml(html);
fragment.forEach(function(node) {
fragment.forEach((node) => {
if (node instanceof CKEDITOR.htmlParser.element) {
node.forEach(function(node) {
node.forEach((node) => {
console.log(node);
});
}
+108 -256
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -6,7 +6,7 @@
"dom"
],
"noImplicitAny": true,
"noImplicitThis": false,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../../",
+1 -66
View File
@@ -1,79 +1,14 @@
{
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"arrow-return-shorthand": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
"prefer-const": false
}
}