mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-30 17:04:20 +08:00
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:
committed by
Masahiro Wakame
parent
00595a5ec7
commit
c4e76e648f
@@ -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});
|
||||
}
|
||||
|
||||
20
ckeditor/ckeditor.d.ts
vendored
20
ckeditor/ckeditor.d.ts
vendored
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user