Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/icewind1991/files_markdown.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2017-09-13 17:04:12 +0300
committerRobin Appelman <robin@icewind.nl>2017-09-13 17:04:12 +0300
commite47806d468ca5e153a22800a08063b4a3ddb1444 (patch)
tree24ebbfe43cfd54c3f0203890d53df2080f991fb2
parentb70490f0f20f9eb5616a682e3e43aa1ce66c6639 (diff)
Some more typings
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r--js/Nextcloud.d.ts33
-rw-r--r--js/PreviewPlugin.ts3
2 files changed, 34 insertions, 2 deletions
diff --git a/js/Nextcloud.d.ts b/js/Nextcloud.d.ts
index b5da79c..36128f5 100644
--- a/js/Nextcloud.d.ts
+++ b/js/Nextcloud.d.ts
@@ -1,3 +1,5 @@
+import Thenable = JQuery.Thenable;
+
interface EscapeOptions {
escape?: boolean;
}
@@ -14,7 +16,36 @@ interface SidebarPreviewPlugin extends BasePlugin {
}) => void;
}
-declare const OCA: { [appname: string]: any };
+declare namespace OCA {
+ namespace Files_Texteditor {
+ interface TextEditorPreviewPlugin {
+ init: () => (void | Thenable<void> | Promise<void>);
+ preview: (text: string, $preview: JQuery) => void;
+ }
+
+ function registerPreviewPlugin(mimetype: string, plugin: TextEditorPreviewPlugin);
+
+ const file: {
+ dir: string,
+ edited: boolean,
+ mime: string,
+ mtime: number,
+ name: string,
+ size: number | null,
+ writeable: boolean
+ };
+ }
+
+ namespace Files {
+ interface FileList {
+ _currentDirectory: string
+ }
+
+ namespace App {
+ const fileList: FileList;
+ }
+ }
+}
declare namespace OC {
namespace Util {
diff --git a/js/PreviewPlugin.ts b/js/PreviewPlugin.ts
index b4e5aec..e381364 100644
--- a/js/PreviewPlugin.ts
+++ b/js/PreviewPlugin.ts
@@ -2,6 +2,7 @@ import {Renderer} from './Renderer';
import {UnderscoreStatic} from "underscore";
import {PasteImage} from './PasteImage';
import Thenable = JQuery.Thenable;
+import TextEditorPreviewPlugin = OCA.Files_Texteditor.TextEditorPreviewPlugin;
declare const _: UnderscoreStatic;
@@ -11,7 +12,7 @@ type onPopstate = (this: Window, ev: PopStateEvent) => any;
const scrollOffsetLines = 3;
-export class PreviewPlugin {
+export class PreviewPlugin implements TextEditorPreviewPlugin {
private renderer: Renderer;
private rangeConstructor: new (startRow: number, startColumn: number, endRow: number, endColumn: number) => AceAjax.Range;