CKEditor HTML parser typings (#11616)

* test(CKEditor): Add missing tests for htmlParser.basicWriter

* feat(CKEditor): Add typings for htmlWriter

See related documentation at:
http://docs.ckeditor.com/#!/api/CKEDITOR.htmlWriter

* feat(CKEditor): Add typings for htmlDataProcessor

See related documentation at:
http://docs.ckeditor.com/#!/api/CKEDITOR.htmlDataProcessor
This commit is contained in:
Adrien Vergé
2016-10-12 15:02:10 +02:00
committed by Masahiro Wakame
parent 00595a5ec7
commit c4e76e648f
2 changed files with 47 additions and 0 deletions

View File

@@ -336,3 +336,30 @@ function test_focusManager() {
var object: CKEDITOR.dom.domObject = focusManager.currentActive;
var bool: boolean = focusManager.hasFocus;
}
function test_basicWriter() {
var writer = new CKEDITOR.htmlParser.basicWriter();
writer.openTag('p', {});
writer.attribute('class', 'MyClass');
writer.openTagClose('p', false);
writer.text('Hello');
writer.closeTag('p');
alert(writer.getHtml(true)); // '<p class="MyClass">Hello</p>'
}
function test_htmlWriter() {
var writer = new CKEDITOR.htmlWriter();
writer.openTag('p', {});
writer.attribute('class', 'MyClass');
writer.openTagClose('p', false);
writer.text('Hello');
writer.closeTag('p');
alert(writer.getHtml(true)); // '<p class="MyClass">Hello</p>'
writer.indentationChars = '\t';
writer.lineBreakChars = '\r\n';
writer.selfClosingEnd = '>';
writer.indentation();
writer.lineBreak();
writer.setRules('img', {breakBeforeOpen: true, breakAfterOpen: true});
}

View File

@@ -1270,6 +1270,16 @@ declare namespace CKEDITOR {
toHtml(data: string, fixForBody?: string): void;
}
class htmlDataProcessor {
dataFilter: htmlParser.filter;
htmlFilter: htmlParser.filter;
writer: htmlParser.basicWriter;
constructor(editor: editor);
toDataFormat(html: string, options?: Object): string;
toHtml(data: string, options?: Object): string;
}
class event {
constructor();
@@ -1803,6 +1813,16 @@ declare namespace CKEDITOR {
}
class htmlWriter extends htmlParser.basicWriter {
indentationChars: string;
lineBreakChars: string;
selfClosingEnd: string;
indentation(): void;
lineBreak(): void;
setRules(tagName: string, rules: Object): void;
}
namespace tools {
var callFunction: Function;