From 1b450892d170e1b18380977915d881e90279e529 Mon Sep 17 00:00:00 2001 From: ipoul Date: Wed, 5 Apr 2017 14:02:34 +0200 Subject: [PATCH 1/4] Add types for tinymce autosave plugin --- types/tinymce/index.d.ts | 12 +++++++++++- types/tinymce/tinymce-tests.ts | 8 +++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/types/tinymce/index.d.ts b/types/tinymce/index.d.ts index 70d73315ea..cbb6f578b1 100644 --- a/types/tinymce/index.d.ts +++ b/types/tinymce/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for TinyMCE 4.5 // Project: https://github.com/tinymce/tinymce -// Definitions by: Martin Duparc +// Definitions by: Martin Duparc , Poul Poulsen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Work In Progress @@ -266,6 +266,16 @@ export namespace tinymce { object_resizing?: boolean | string; type_ahead_urls?: boolean; + + autosave_ask_before_unload?: boolean; + + autosave_interval?: string; + + autosave_prefix?: string; + + autosave_restore_when_empty? : boolean; + + autosave_retention?: string; } namespace settings { diff --git a/types/tinymce/tinymce-tests.ts b/types/tinymce/tinymce-tests.ts index 7165ab25a7..98703f070d 100644 --- a/types/tinymce/tinymce-tests.ts +++ b/types/tinymce/tinymce-tests.ts @@ -7,8 +7,14 @@ tinymce.init({ plugins: [ 'advlist autolink lists link image charmap print preview anchor', 'searchreplace visualblocks code fullscreen', - 'insertdatetime media table contextmenu paste code' + 'insertdatetime media table contextmenu paste code', + 'autosave' ], + autosave_ask_before_unload: false, + autosave_interval: "20s", + autosave_prefix: "tinymce-autosave-{path}{query}-{id}-", + autosave_restore_when_empty: false, + autosave_retention: "30m", toolbar: 'undo redo | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image', content_css: '//www.tinymce.com/css/codepen.min.css' }); From 7a5972244cf2cbf8b67b56b489b55e7f51543c08 Mon Sep 17 00:00:00 2001 From: ipoul Date: Wed, 5 Apr 2017 14:19:34 +0200 Subject: [PATCH 2/4] Removed space before colon in property-declaration --- types/tinymce/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/tinymce/index.d.ts b/types/tinymce/index.d.ts index cbb6f578b1..14817302a8 100644 --- a/types/tinymce/index.d.ts +++ b/types/tinymce/index.d.ts @@ -273,7 +273,7 @@ export namespace tinymce { autosave_prefix?: string; - autosave_restore_when_empty? : boolean; + autosave_restore_when_empty?: boolean; autosave_retention?: string; } From 65c19e45610e74adc6e3926cb5875174ecb62043 Mon Sep 17 00:00:00 2001 From: ipoul Date: Tue, 18 Apr 2017 07:58:47 +0200 Subject: [PATCH 3/4] Fixed indentation --- types/tinymce/tinymce-tests.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/tinymce/tinymce-tests.ts b/types/tinymce/tinymce-tests.ts index 98703f070d..d69a9c83c0 100644 --- a/types/tinymce/tinymce-tests.ts +++ b/types/tinymce/tinymce-tests.ts @@ -10,11 +10,11 @@ tinymce.init({ 'insertdatetime media table contextmenu paste code', 'autosave' ], - autosave_ask_before_unload: false, - autosave_interval: "20s", - autosave_prefix: "tinymce-autosave-{path}{query}-{id}-", - autosave_restore_when_empty: false, - autosave_retention: "30m", + autosave_ask_before_unload: false, + autosave_interval: "20s", + autosave_prefix: "tinymce-autosave-{path}{query}-{id}-", + autosave_restore_when_empty: false, + autosave_retention: "30m", toolbar: 'undo redo | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image', content_css: '//www.tinymce.com/css/codepen.min.css' }); From ac4da153e3ca01c5c47f041cccf47bd15b8f7851 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 18 Apr 2017 07:19:48 -0700 Subject: [PATCH 4/4] Fix lint --- types/tinymce/index.d.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/types/tinymce/index.d.ts b/types/tinymce/index.d.ts index 85084a848e..7cc40943e7 100644 --- a/types/tinymce/index.d.ts +++ b/types/tinymce/index.d.ts @@ -51,7 +51,7 @@ export function walk(o: {}, f: () => void, n?: string, s?: string): void; export function init(settings: Settings): void; -interface Settings { +export interface Settings { table_toolbar?: boolean; auto_focus?: string; @@ -434,7 +434,7 @@ export class Editor extends util.Observable { uploadImages(callback: () => void): Promise; } -interface EditorCommands { +export interface EditorCommands { addCommands(command_list: {}, type?: string): void; execCommand(command: string, ui?: boolean, value?: {}, args?: {}): boolean; @@ -446,7 +446,7 @@ interface EditorCommands { queryCommandValue(command: string): {}; } -interface EditorManager extends util.Observable { +export interface EditorManager extends util.Observable { $: dom.DomQuery; activeEditor: Editor; @@ -492,7 +492,7 @@ interface EditorManager extends util.Observable { triggerSave(): void; } -interface Env { +export interface Env { android: boolean; ceFalse: boolean; @@ -601,7 +601,7 @@ export class FocusManager { static isEditorUIElement(elm: Element): boolean; } -interface Formatter { +export interface Formatter { apply(name: string, vars?: {}, node?: html.Node): void; canApply(name: string): boolean; @@ -631,17 +631,17 @@ export class Formatter implements Formatter { constructor(ed: Editor); } -interface Shortcuts { +export interface Shortcuts { add(pattern: string, desc: string, cmdFunc: () => void | string, scope?: {}): boolean; remove(pattern: string): boolean; } -interface Theme { +export interface Theme { renderUI(obj: {}): {}; } -interface UndoManager { +export interface UndoManager { add(level?: {}, event?: DocumentEvent): {}; beforeChange(): void; @@ -661,7 +661,7 @@ interface UndoManager { undo(): {}; } -interface WindowManager { +export interface WindowManager { alert(message: string, callback: () => void, scope?: {}): void; close(): void; @@ -677,7 +677,7 @@ interface WindowManager { setParams(params: {}): void; } -interface notificationManager { +export interface notificationManager { close(): void; getNotifications(): Array<{}>;