diff --git a/README.md b/README.md index d177de5ab..cf41e9acd 100644 --- a/README.md +++ b/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)) diff --git a/epiceditor/epiceditor-tests.ts b/epiceditor/epiceditor-tests.ts new file mode 100644 index 000000000..ed02371fa --- /dev/null +++ b/epiceditor/epiceditor-tests.ts @@ -0,0 +1,79 @@ +/// + +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); diff --git a/epiceditor/epiceditor.d.ts b/epiceditor/epiceditor.d.ts new file mode 100644 index 000000000..7030923f2 --- /dev/null +++ b/epiceditor/epiceditor.d.ts @@ -0,0 +1,61 @@ +// Type definitions for EpicEditor 0.2 +// Project: http://epiceditor.com/ +// Definitions by: Boris Yankov +// 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; +} \ No newline at end of file