Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add defintions and tests for EpicEditor

  • Loading branch information...
commit 2d5a41f4d8c6fb8d160fb4ac5633977d600efa4a 1 parent c8ab7cd
@borisyankov authored
View
1  README.md
@@ -44,6 +44,7 @@ List of Definitions
* [domo](http://domo-js.com/) (by [Steve Fenton](https://github.com/Steve-Fenton))
* [EaselJS](http://www.createjs.com/#!/EaselJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
* [ember.js](http://emberjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
+* [EpicEditor](http://epiceditor.com/) (by [Boris Yankov](https://github.com/borisyankov))
* [Express](http://expressjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
* [Fabric.js](http://fabricjs.com/) (by [Oliver Klemencic](https://github.com/oklemencic/))
* [Fancybox](http://fancybox.net/) (by [Boris Yankov](https://github.com/borisyankov))
View
79 epiceditor/epiceditor-tests.ts
@@ -0,0 +1,79 @@
+/// <reference path="epiceditor.d.ts" />
+
+var editor = new EpicEditor().load();
+
+editor.load(function () {
+ console.log("Editor loaded.")
+});
+
+editor.unload(function () {
+ console.log("Editor unloaded.")
+});
+
+editor.getElement('editor').body.innerHTML;
+
+if (editor.is('loaded'))
+ editor.enterFullscreen();
+
+editor.open('some-file');
+editor.importFile('some-file', "#Imported markdown\nFancy, huh?");
+var theContent = editor.exportFile();
+
+var newName = prompt('What do you want to rename this file to?');
+editor.rename('old-filename.md', newName);
+
+editor.save();
+editor.remove('example.md');
+var files = editor.getFiles();
+
+editor.on('unload', function () {
+ console.log('Editor was removed');
+});
+
+editor.emit('unload');
+
+editor.removeListener('unload');
+
+editor.preview();
+
+editor.edit();
+
+editor.enterFullscreen();
+
+editor.exitFullscreen();
+
+editor.reflow();
+editor.reflow('height');
+
+var marked;
+var opts = {
+ container: 'epiceditor',
+ textarea: null,
+ basePath: 'epiceditor',
+ clientSideStorage: true,
+ localStorageName: 'epiceditor',
+ useNativeFullsreen: true,
+ parser: marked,
+ file: {
+ name: 'epiceditor',
+ defaultContent: '',
+ autoSave: 100
+ },
+ theme: {
+ base: '/themes/base/epiceditor.css',
+ preview: '/themes/preview/preview-dark.css',
+ editor: '/themes/editor/epic-dark.css'
+ },
+ focusOnLoad: false,
+ shortcut: {
+ modifier: 18,
+ fullscreen: 70,
+ preview: 80
+ },
+ string: {
+ togglePreview: 'Toggle Preview Mode',
+ toggleEdit: 'Toggle Edit Mode',
+ toggleFullscreen: 'Enter Fullscreen'
+ }
+}
+var editor2 = new EpicEditor(opts);
View
61 epiceditor/epiceditor.d.ts
@@ -0,0 +1,61 @@
+// Type definitions for EpicEditor 0.2
+// Project: http://epiceditor.com/
+// Definitions by: Boris Yankov <https://github.com/borisyankov>
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+
+interface EpicEditorOptions {
+ container?: any;
+ textarea?: any;
+ basePath?: string;
+ clientSideStorage?: bool;
+ localStorageName?: string;
+ useNativeFullsreen?: bool;
+ parser?: any;
+ file?: {
+ name: string;
+ defaultContent: string;
+ autoSave: any;
+ };
+ theme?: {
+ base: string;
+ preview: string;
+ editor: string;
+ };
+ focusOnLoad?: bool;
+ shortcut?: {
+ modifier: number;
+ fullscreen: number;
+ preview: number;
+ };
+ string?: {
+ togglePreview: string;
+ toggleEdit: string;
+ toggleFullscreen: string;
+ };
+}
+
+class EpicEditor {
+ constructor();
+ constructor(options: EpicEditorOptions);
+
+ load(callback?: Function): EpicEditor;
+ unload(callback?: Function): EpicEditor;
+ getElement(element: string): any;
+ is(state: string): bool;
+ open(filename: string);
+ importFile(filename?: string, content?: string): void;
+ exportFile(filename?: string, type?: string): any;
+ rename(oldName: string, newName: string): void;
+ save(): void;
+ remove(filename: string): void;
+ getFiles(filename?: string): any;
+ on(event: string, handler: Function): void;
+ emit(event: string): void;
+ removeListener(event: string, handler?: Function): void;
+ preview(): void;
+ edit(): void;
+ enterFullscreen(): void;
+ exitFullscreen(): void;
+ reflow(type?: string): void;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.