diff --git a/tinymce/index.d.ts b/tinymce/index.d.ts new file mode 100644 index 0000000000..f760671a8e --- /dev/null +++ b/tinymce/index.d.ts @@ -0,0 +1,44 @@ +// Type definitions for TinyMCE 4.5 +// Project: https://github.com/tinymce/tinymce +// Definitions by: Martin Duparc +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// Work In Progress + +declare namespace TinyMCE { + export interface Observable { + off: (name?: string, callback?: () => void) => any; + on: (name: string, callback: () => void) => any; + fire: (name: string, args?: any, bubble?: boolean) => Event; + } + + export interface Editor extends Observable { + destroy: (automatic: boolean) => void; + remove: () => void; + hide: () => void; + show: () => void; + getContent: (args?: any) => string; + setContent: (content: string, args?: any) => string; + focus: (skip_focus?: boolean) => void; + undoManager: UndoManager; + settings: any; + getDoc: () => Document; + editorUpload: any; + } + + export interface UndoManager { + undo: () => any; + clear: () => void; + hasUndo: () => boolean; + } + + export interface Static extends Observable { + init: (settings: any) => void; + execCommand: (c: string, u: boolean, v: string) => boolean; + activeEditor: Editor; + get: (id: string) => Editor; + triggerSave: () => void; + } +} + +declare var tinymce: TinyMCE.Static; diff --git a/tinymce/tinymce-tests.ts b/tinymce/tinymce-tests.ts new file mode 100644 index 0000000000..3b3f3386f1 --- /dev/null +++ b/tinymce/tinymce-tests.ts @@ -0,0 +1,12 @@ +tinymce.init( + { + selector: '.tinymce-editable', + height: 145, + plugins: [ + 'autolink table contextmenu paste code link textcolor colorpicker image imagetools' + ], + menubar: 'edit insert table tools', + toolbar: 'undo redo | styleselect bold italic forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist | link image', + content_css: 'page.css' + } +); \ No newline at end of file diff --git a/tinymce/tsconfig.json b/tinymce/tsconfig.json new file mode 100644 index 0000000000..313fa73f47 --- /dev/null +++ b/tinymce/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "noImplicitThis": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "tinymce-tests.ts" + ] +} diff --git a/tinymce/tslint.json b/tinymce/tslint.json new file mode 100644 index 0000000000..2221e40e4a --- /dev/null +++ b/tinymce/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } \ No newline at end of file