{"id":13394944,"url":"https://github.com/OscarGodson/EpicEditor","last_synced_at":"2025-03-13T20:31:48.140Z","repository":{"id":2316801,"uuid":"3277032","full_name":"OscarGodson/EpicEditor","owner":"OscarGodson","description":"EpicEditor is an embeddable JavaScript Markdown editor with split fullscreen editing, live previewing, automatic draft saving, offline support, and more. For developers, it offers a robust API, can be easily themed, and allows you to swap out the bundled Markdown parser with anything you throw at it.","archived":false,"fork":false,"pushed_at":"2020-04-13T20:28:38.000Z","size":1483,"stargazers_count":4239,"open_issues_count":88,"forks_count":333,"subscribers_count":112,"default_branch":"develop","last_synced_at":"2025-03-09T01:06:55.107Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://epiceditor.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OscarGodson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-01-26T20:11:47.000Z","updated_at":"2025-02-24T11:37:28.000Z","dependencies_parsed_at":"2022-08-03T04:45:11.626Z","dependency_job_id":null,"html_url":"https://github.com/OscarGodson/EpicEditor","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OscarGodson%2FEpicEditor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OscarGodson%2FEpicEditor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OscarGodson%2FEpicEditor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OscarGodson%2FEpicEditor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OscarGodson","download_url":"https://codeload.github.com/OscarGodson/EpicEditor/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243451575,"owners_count":20293160,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T17:01:36.951Z","updated_at":"2025-03-13T20:31:48.129Z","avatar_url":"https://github.com/OscarGodson.png","language":"JavaScript","readme":"# ⚠️ DEPRECATION WARNING\n\nThis repository is no longer actively maintained. \n\n# ![EpicEditor](http://epiceditor.com/docs/images/epiceditor-logo.png)\n\n## An Embeddable JavaScript Markdown Editor\n\nEpicEditor is an embeddable JavaScript [Markdown](http://daringfireball.net/projects/markdown/) editor with split fullscreen editing, live previewing, automatic draft saving, offline support, and more. For developers, it offers a robust API, can be easily themed, and allows you to swap out the bundled Markdown parser with anything you throw at it.\n\n## Why\n\nBecause, WYSIWYGs suck. Markdown is quickly becoming the replacement. [GitHub](http://github.com), [Stackoverflow](http://stackoverflow.com), and even blogging apps like [Posterous](http://posterous.com) are now supporting Markdown. EpicEditor allows you to create a Markdown editor with a single line of JavaScript:\n\n```javascript\nvar editor = new EpicEditor().load();\n```\n\n## Quick Start\n\nEpicEditor is easy to implement. Add the script and assets to your page, provide a target container and call `load()`.\n\n### Step 1: Download\n\n[Download the latest release](http://epiceditor.com) or clone the repo:\n\n```bash\n$ git clone git@github.com:OscarGodson/EpicEditor\n```\n\n### Step 2: Install\n\nCopy `EpicEditor/epiceditor/` onto your webserver, for example to `/static/lib/epiceditor`.\n\n```bash\n$ scp -r EpicEditor/epiceditor you@webserver:public_html/static/lib/\n```\n\nYou can of course customize this step for your directory layout.\n\n### Step 3: Create your container element\n\n```html\n\u003cdiv id=\"epiceditor\"\u003e\u003c/div\u003e\n```\n\nAlternately, wrap an existing textarea to load the contents into the EpicEditor instance.\n\n```html\n\u003cdiv id=\"epiceditor\"\u003e\u003ctextarea id=\"my-edit-area\"\u003e\u003c/textarea\u003e\u003c/div\u003e\n```\n\n### Step 4: Add the `epiceditor.js` file\n\n```html\n\u003cscript src=\"/static/lib/epiceditor/js/epiceditor.min.js\"\u003e\u003c/script\u003e\n```\n\n### Step 5: Init EpicEditor\n\nEpicEditor needs to know where to find its themes, so it needs to be told its install directory at init.\n```javascript\nvar editor = new EpicEditor({basePath: '/static/lib/epiceditor'}).load();\n```\n\n## API\n\n### EpicEditor([_options_])\n\nThe `EpicEditor` constructor creates a new editor instance. Customize the instance by passing the `options` parameter. The example below uses all options and their defaults:\n\n```javascript\nvar opts = {\n  container: 'epiceditor',\n  textarea: null,\n  basePath: 'epiceditor',\n  clientSideStorage: true,\n  localStorageName: 'epiceditor',\n  useNativeFullscreen: true,\n  parser: marked,\n  file: {\n    name: 'epiceditor',\n    defaultContent: '',\n    autoSave: 100\n  },\n  theme: {\n    base: '/themes/base/epiceditor.css',\n    preview: '/themes/preview/preview-dark.css',\n    editor: '/themes/editor/epic-dark.css'\n  },\n  button: {\n    preview: true,\n    fullscreen: true,\n    bar: \"auto\"\n  },\n  focusOnLoad: false,\n  shortcut: {\n    modifier: 18,\n    fullscreen: 70,\n    preview: 80\n  },\n  string: {\n    togglePreview: 'Toggle Preview Mode',\n    toggleEdit: 'Toggle Edit Mode',\n    toggleFullscreen: 'Enter Fullscreen'\n  },\n  autogrow: false\n}\nvar editor = new EpicEditor(opts);\n```\n\n### Options\n\u003ctable cellspacing=\"0\"\u003e\n  \u003ctr\u003e\n    \u003cth\u003eOption\u003c/th\u003e\n    \u003cth\u003eDescription\u003c/th\u003e\n    \u003cth\u003eDefault\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003econtainer\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eThe ID (string) or element (object) of the target container in which you want the editor to appear.\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003eepiceditor\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003etextarea\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eThe ID (string) or element (object) of a textarea you would like to sync the editor's content with. On page load if there is content in the textarea, the editor will use that as its content.\u003c/td\u003e\n    \u003ctd\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003ebasePath\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eThe base path of the directory containing the \u003ccode\u003e/themes\u003c/code\u003e.\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003eepiceditor\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003eclientSideStorage\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eSetting this to false will disable localStorage.\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003etrue\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003elocalStorageName\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eThe name to use for the localStorage object.\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003eepiceditor\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003euseNativeFullscreen\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eSet to false to always use faux fullscreen (the same as what is used for unsupported browsers).\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003etrue\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003eparser\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003e[Marked](https://github.com/chjj/marked) is the only parser built into EpicEditor, but you can customize or toggle this by passing a parsing function to this option. For example:\u003cbr\u003e\u003ccode\u003eparser: MyCustomParser.parse\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003emarked\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003efocusOnLoad\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eIf \u003ccode\u003etrue\u003c/code\u003e, editor will focus on load.\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003efalse\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003efile.name\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eIf no file exists with this name a new one will be made, otherwise the existing will be opened.\u003c/td\u003e\n    \u003ctd\u003econtainer ID\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003efile.defaultContent\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eThe content to show if no content exists for a file. NOTE: if the \u003ccode\u003etextarea\u003c/code\u003e option is used, the textarea's value will take precedence over \u003ccode\u003edefaultContent\u003c/code\u003e.\u003c/td\u003e\n    \u003ctd\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003efile.autoSave\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eHow often to auto save the file in milliseconds. Set to \u003ccode\u003efalse\u003c/code\u003e to turn it off.\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003e100\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003etheme.base\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eThe base styles such as the utility bar with the buttons.\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003ethemes/base/epiceditor.css\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003etheme.editor\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eThe theme for the editor which is the area you type into.\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003ethemes/editor/epic-dark.css\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003etheme.preview\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eThe theme for the previewer.\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003ethemes/preview/github.css\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003ebutton\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eIf set to \u003ccode\u003efalse\u003c/code\u003e will remove all buttons.\u003c/td\u003e\n    \u003ctd\u003eAll buttons set to \u003ccode\u003etrue\u003c/code\u003e.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003ebutton.preview\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eIf set to \u003ccode\u003efalse\u003c/code\u003e will remove the preview button.\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003etrue\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003ebutton.fullscreen\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eIf set to \u003ccode\u003efalse\u003c/code\u003e will remove the fullscreen button.\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003etrue\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003ebutton.bar\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eIf \u003ccode\u003etrue\u003c/code\u003e or \u003ccode\u003e\"show\"\u003c/code\u003e, any defined buttons will always be visible. If \u003ccode\u003efalse\u003c/code\u003e or \u003ccode\u003e\"hide\"\u003c/code\u003e, any defined buttons will never be visible. If \u003ccode\u003e\"auto\"\u003c/code\u003e, buttons will usually be hidden, but shown if whenever the mouse is moved.\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003e\"auto\"\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003eshortcut.modifier\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eThe key to hold while holding the other shortcut keys to trigger a key combo.\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003e18\u003c/code\u003e (\u003ccode\u003ealt\u003c/code\u003e key)\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003eshortcut.fullscreen\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eThe shortcut to open fullscreen.\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003e70\u003c/code\u003e (\u003ccode\u003ef\u003c/code\u003e key)\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003eshortcut.preview\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eThe shortcut to toggle the previewer.\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003e80\u003c/code\u003e (\u003ccode\u003ep\u003c/code\u003e key)\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003estring.togglePreview\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eThe tooltip text that appears when hovering the preview icon.\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003eToggle Preview Mode\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003estring.toggleEdit\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eThe tooltip text that appears when hovering the edit icon.\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003eToggle Edit Mode\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003estring.toggleFullscreen\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eThe tooltip text that appears when hovering the fullscreen icon.\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003eEnter Fullscreen\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003eautogrow\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eWhether to autogrow EpicEditor to fit its contents. If autogrow is desired one can either specify \u003ccode\u003etrue\u003c/code\u003e, meaning to use default autogrow settings, or an object to define custom settings\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003efalse\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003eautogrow.minHeight\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eThe minimum height (in pixels) that the editor should ever shrink to. This may also take a function that returns the desired minHeight if this is not a constant, or a falsey value if no minimum is desired\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003e80\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003eautogrow.maxHeight\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eThe maximum height (in pixels) that the editor should ever grow to. This may also take a function that returns the desired maxHeight if this is not a constant, or a falsey value if no maximum is desired\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003efalse\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003eautogrow.scroll\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eWhether the page should scroll to keep the caret in the same vertical place while autogrowing (recommended for mobile in particular)\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003etrue\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n### load([_callback_])\n\nLoads the editor by inserting it into the DOM by creating an `iframe`. Will trigger the `load` event, or you can provide a callback.\n\n```javascript\neditor.load(function () {\n  console.log(\"Editor loaded.\")\n});\n```\n\n### unload([_callback_])\n\nUnloads the editor by removing the `iframe`. Keeps any options and file contents so you can easily call `.load()` again. Will trigger the `unload` event, or you can provide a callback.\n\n```javascript\neditor.unload(function () {\n  console.log(\"Editor unloaded.\")\n});\n```\n\n### getElement(_element_)\n\nGrabs an editor element for easy DOM manipulation. See the Themes section below for more on the layout of EpicEditor elements.\n\n* `container`: The element given at setup in the options.\n* `wrapper`: The wrapping `\u003cdiv\u003e` containing the 2 editor and previewer iframes.\n* `wrapperIframe`: The iframe containing the `wrapper` element.\n* `editor`: The #document of the editor iframe (i.e. you could do `editor.getElement('editor').body`).\n* `editorIframe`: The iframe containing the `editor` element.\n* `previewer`: The #document of the previewer iframe (i.e. you could do `editor.getElement('previewer').body`).\n* `previewerIframe`: The iframe containing the `previewer` element.\n\n```javascript\nsomeBtn.onclick = function () {\n  console.log(editor.getElement('editor').body.innerHTML); // Returns the editor's content\n}\n```\n\n### is(_state_)\n\nReturns a boolean for the requested state. Useful when you need to know if the editor is loaded yet for example. Below is a list of supported states:\n\n* `loaded`\n* `unloaded`\n* `edit`\n* `preview`\n* `fullscreen`\n\n```javascript\nfullscreenBtn.onclick = function () {\n  if (!editor.is('loaded')) { return; }\n  editor.enterFullscreen();\n}\n```\n\n### open(_filename_)\n\nOpens a client side storage file into the editor.\n\n**Note:** This does _not_ open files on your server or machine (yet). This simply looks in localStorage where EpicEditor stores drafts.\n\n```javascript\nopenFileBtn.onclick = function () {\n  editor.open('some-file'); // Opens a file when the user clicks this button\n}\n```\n\n### importFile([_filename_],[_content_])\n\nImports a string of content into a client side storage file. If the file already exists, it will be overwritten. Useful if you want to inject a bunch of content via AJAX. Will also run `.open()` after import automatically.\n\n**Note:** This does _not_ import files on your server or machine (yet). This simply looks in localStorage where EpicEditor stores drafts.\n\n```javascript\nimportFileBtn.onclick = function () {\n  editor.importFile('some-file',\"#Imported markdown\\nFancy, huh?\"); //Imports a file when the user clicks this button\n}\n```\n\n### exportFile([_filename_],[_type_])\n\nReturns the plain text of the client side storage file, or if given a `type`, will return the content in the specified type. If you leave both parameters `null` it will return the current document's content in plain text. The supported export file types are:\n\n**Note:** This does _not_ export files to your server or machine (yet). This simply looks in localStorage where EpicEditor stores drafts.\n\n* text (default)\n* html\n* json (includes metadata)\n* raw (warning: this is browser specific!)\n\n```javascript\nsyncWithServerBtn.onclick = function () {\n  var theContent = editor.exportFile();\n  saveToServerAjaxCall('/save', {data:theContent}, function () {\n    console.log('Data was saved to the database.');\n  });\n}\n```\n\n### rename(_oldName_, _newName_)\n\nRenames a client side storage file.\n\n**Note:** This does _not_ rename files on your server or machine (yet). This simply looks in localStorage where EpicEditor stores drafts.\n\n```javascript\nrenameFileBtn.onclick = function () {\n  var newName = prompt('What do you want to rename this file to?');\n  editor.rename('old-filename.md', newName); //Prompts a user and renames a file on button click\n}\n```\n\n### save()\n\nManually saves a file to client side storage (localStorage by default). EpicEditor will save continuously every 100ms by default, but if you set `autoSave` in the options to `false` or to longer intervals it's useful to manually save.\n\n**Note:** This does _not_ save files to your server or machine (yet). This simply looks in localStorage where EpicEditor stores drafts.\n\n```javascript\nsaveFileBtn.onclick = function () {\n  editor.save();\n}\n```\n\n### remove(_name_)\n\nDeletes a client side storage file.\n\n**Note:** This does _not_ remove files from your server or machine (yet). This simply looks in localStorage where EpicEditor stores drafts.\n\n```javascript\nremoveFileBtn.onclick = function () {\n  editor.remove('example.md');\n}\n```\n\n### getFiles([_name_], [_excludeContent_])\n\nIf no `name` is given it returns an object containing the names and metadata of all client side storage file objects. If a `name` is specified it will return just the metadata of that single file object. If `excludeContent` is true, it will remove the content from the returned object. This is useful when you just want a list of files or get some meta data. If `excludeContent` is false (default), it'll return a `content` property per file in plain text format.\n\n**Note:** This does _not_ get files from your server or machine (yet). This simply looks in localStorage where EpicEditor stores drafts.\n\n```javascript\nvar files = editor.getFiles();\nfor (x in files) {\n  console.log('File: ' + x); //Returns the name of each file\n};\n```\n\n### on(_event_, _handler_)\n\nSets up an event handler (callback) for a specified event. For all event types, see the Events section below.\n\n```javascript\neditor.on('unload', function () {\n  console.log('Editor was removed');\n});\n```\n\n### emit(_event_)\n\nFires an event programatically. Similar to jQuery's `.trigger()`\n\n```javascript\neditor.emit('unload'); // Triggers the handler provided in the \"on\" method above\n```\n\n### removeListener(_event_, [_handler_])\n\nAllows you to remove all listeners for an event, or just the specified one.\n\n```javascript\neditor.removeListener('unload'); //The handler above would no longer fire\n```\n\n### preview()\n\nPuts the editor into preview mode.\n\n```javascript\npreviewBtn.onclick = function () {\n  editor.preview();\n}\n```\n\n### edit()\n\nPuts the editor into edit mode.\n\n```javascript\neditBtn.onclick = function () {\n  editor.edit();\n}\n```\n\n### focus()\n\nPuts focus on the editor or previewer (whichever is visible). Works just like\ndoing plain old JavaScript and input focus like `someInput.focus()`. The\nbenefit of using this method however, is that it handles cross browser issues\nand also will focus on the visible view (edit or preview).\n\n```\nshowEditorBtn.onclick = function () {\n  editorWrapper.style.display = 'block'; // switch from being hidden from the user\n  editor.focus(); // Focus and allow user to start editing right away\n}\n```\n\n### enterFullscreen([callback])\n\nPuts the editor into fullscreen mode. A callback will be fired after the entering fullscreen animation completes. Some browsers\nwill be nearly instant while others, mainly Chrome, take 750ms before this event is fired. If already in fullscreen, the\ncallback will fire immediately.\n\n**Note:** due to browser security restrictions, calling `enterFullscreen` programmatically\nlike this will not trigger native fullscreen. Native fullscreen can only be triggered by a user interaction like mousedown or keyup.\n\n```javascript\nenterFullscreenBtn.onclick = function () {\n  editor.enterFullscreen(function () {\n    console.log('Welcome to fullscreen mode!');\n  });\n}\n```\n### exitFullscreen([callback])\n\nCloses fullscreen mode. A callback will be fired after the exiting fullscreen animation completes. If already not in fullscreen, the\ncallback will fire immediately.\n\n\n```javascript\nexitFullscreenBtn.onclick = function () {\n  editor.exitFullscreen(function () {\n    console.log('Finished closing fullscreen!');\n  });\n}\n```\n\n### reflow([type], [callback])\n\n`reflow()` allows you to \"reflow\" the editor in it's container. For example, let's say you increased\nthe height of your wrapping element and want the editor to resize too. You could call `reflow`\nand the editor will resize to fit. You can pass it one of two strings as the first parameter to\nconstrain the reflow to either `width` or `height`.\n\nIt also provides you with a callback parameter if you'd like to do something after the resize is finished.\nThe callback will return the new width and/or height in an object. Additionally, you can also listen for\nthe `reflow` event. This will also give you back the new size.\n\n**Note:** If you call `reflow()` or `reflow('width')` and you have a fluid width container\nEpicEditor will no longer be fluid because doing a reflow on the width sets an inline style on the editor.\n\n```javascript\n// For an editor that takes up the whole browser window:\nwindow.onresize = function () {\n  editor.reflow();\n}\n\n// Constrain the reflow to just height:\nsomeDiv.resizeHeightHandle = function () {\n  editor.reflow('height');\n}\n\n// Same as the first example, but this has a callback\nwindow.onresize = function () {\n  editor.reflow(function (data) {\n    console.log('width: ', data.width, ' ', 'height: ', data.height);\n  });\n}\n```\n\n## Events\n\nYou can hook into specific events in EpicEditor with \u003ca href=\"#onevent-handler\"\u003e\u003ccode\u003eon()\u003c/code\u003e\u003c/a\u003e such as when a file is\ncreated, removed, or updated. Below is a complete list of currently supported events and their description.\n\n\u003ctable cellspacing=\"0\" class=\"event-table\"\u003e\n  \u003ctr\u003e\n    \u003cth\u003eEvent Name\u003c/th\u003e\n    \u003cth\u003eDescription\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003ecreate\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eFires whenever a new file is created.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003eread\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eFires whenever a file is read.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003eupdate\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eFires whenever a file is updated.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003eremove\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eFires whenever a file is deleted.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003eload\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eFires when the editor loads via \u003ccode\u003eload()\u003c/code\u003e.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003eunload\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eFires whenever the editor is unloaded via \u003ccode\u003eunload()\u003c/code\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003epreview\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eFires whenever the previewer is opened (excluding fullscreen) via \u003ccode\u003epreview()\u003c/code\u003e or the preview button.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003eedit\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eFires whenever the editor is opened (excluding fullscreen) via \u003ccode\u003eedit()\u003c/code\u003e or the edit button.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003efullscreenenter\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eFires whenever the editor opens in fullscreen via \u003ccode\u003efullscreen()\u003c/code\u003e or the fullscreen button.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003efullscreenexit\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eFires whenever the editor closes in fullscreen via \u003ccode\u003efullscreen()\u003c/code\u003e or the fullscreen button.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003esave\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eFires whenever \u003ccode\u003esave()\u003c/code\u003e is called manually, or implicitly by ```importFile``` or ```open```.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003eautosave\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eFires whenever the autoSave interval fires, and the file contents have been updated since the last save.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003eopen\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eFires whenever a file is opened or loads automatically by EpicEditor or when \u003ccode\u003eopen()\u003c/code\u003e is called.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ccode\u003ereflow\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003eFires whenever \u003ccode\u003ereflow()\u003c/code\u003e is called. Will return the new dimensions in the callback. Will also fire every time there is a resize from autogrow.\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n## Themes\n\nTheming is easy in EpicEditor. There are three different `\u003ciframe\u003e`s which means styles wont leak between the \"chrome\" of\nEpicEditor, previewer, or editor. Each one is like it's own web page. In the `themes` directory  you'll see `base`, `preview`,  and\n`editor`. The base styles are for the \"chrome\" of the editor which contains elements such as the utility bar containing the icons.\nThe editor is the styles for the contents of editor `\u003ciframe\u003e` and the preview styles are applied to the preview `\u003ciframe\u003e`.\n\nThe HTML of a generated editor (excluding contents) looks like this:\n\n```html\n\u003cdiv id=\"container\"\u003e\n  \u003ciframe id=\"epiceditor-instance-id\"\u003e\n    \u003chtml\u003e\n      \u003chead\u003e\n        \u003clink type=\"text/css\" id=\"\" rel=\"stylesheet\" href=\"epiceditor/themes/base/epiceditor.css\" media=\"screen\"\u003e\n      \u003c/head\u003e\n      \u003cbody\u003e\n        \u003cdiv id=\"epiceditor-wrapper\"\u003e\n          \u003ciframe id=\"epiceditor-editor-frame\"\u003e\n            \u003chtml\u003e\n              \u003chead\u003e\n                \u003clink type=\"text/css\" rel=\"stylesheet\" href=\"epiceditor/themes/editor/epic-dark.css\" media=\"screen\"\u003e\n              \u003c/head\u003e\n              \u003cbody contenteditable=\"true\"\u003e\n                \u003c!-- raw content --\u003e\n              \u003c/body\u003e\n            \u003c/html\u003e\n          \u003c/iframe\u003e\n          \u003ciframe id=\"epiceditor-previewer-frame\"\u003e\n            \u003chtml\u003e\n              \u003chead\u003e\n                \u003clink type=\"text/css\" rel=\"stylesheet\" href=\"epiceditor/themes/preview/github.css\" media=\"screen\"\u003e\n              \u003c/head\u003e\n              \u003cbody\u003e\n                \u003cdiv id=\"epiceditor-preview\" class=\"epiceditor-preview\"\u003e\n                  \u003c!-- rendered html --\u003e\n                \u003c/div\u003e\n              \u003c/body\u003e\n            \u003c/html\u003e\n          \u003c/iframe\u003e\n          \u003cdiv id=\"epiceditor-utilbar\"\u003e\n            \u003cspan title=\"Toggle Preview Mode\" class=\"epiceditor-toggle-btn epiceditor-toggle-preview-btn\"\u003e\u003c/span\u003e\n            \u003cspan title=\"Enter Fullscreen\" class=\"epiceditor-fullscreen-btn\"\u003e\u003c/span\u003e\n          \u003c/div\u003e\n        \u003c/div\u003e\n      \u003c/body\u003e\n    \u003c/html\u003e\n  \u003c/iframe\u003e\n\u003c/div\u003e\n```\n\nUnlike the \"chrome\" of `base` or `editor`, the theming of the `preview` is done by CSS class so that\nyou can reuse EpicEditor's theme to make your rendered page match your previewed.\n\nFirst, include your chosen theme on every page:\n```html\n\u003clink rel=\"stylesheet\" href=\"/epiceditor/themes/preview/github.css\"\u003e\n```\n(you may need to adjust the path)\n\nMark your rendered content with `.epiceditor-preview`:\n```html\n\u003cdiv id=\"my-content\" class=\"epiceditor-preview\"\u003e ... \u003c/div\u003e\n```\n\n\n## Custom Parsers\n\nEpicEditor is set up to allow you to use any parser that accepts and returns a string. This means you can use any flavor of Markdown, process Textile, or even create a simple HTML editor/previewer (`parser: false`). The possibilities are endless. Just make the parser available and pass its parsing function to the EpicEditor setting and you should be all set. You can output plain text or HTML. Here's an example of a parser that could remove \"bad words\" from the preview:\n\n```js\nvar editor = new EpicEditor({\n  parser: function (str) {\n    var blacklist = ['foo', 'bar', 'baz'];\n    return str.split(' ').map(function (word) {\n      // If the word exists, replace with asterisks\n      if (blacklist.indexOf(word) \u003e -1) {\n        return '****'\n      }\n      return word;\n    }).join(' ');\n  }\n}).load();\n```\n\nHere's a [Wiki to HTML](http://remysharp.com/2008/04/01/wiki-to-html-using-javascript/) parser by Remy Sharp used with EpicEditor:\n\n```js\nvar editor = new EpicEditor({\n  parser: function (str) {\n    return str.wiki2html();\n  }\n}).load();\n```\n\nFor even more customization and optimization you can replace the default built-in processor on build. Running `jake build parser=path/to/parser.js` will override the default Marked build and replace it with your custom script.\n\n## Support\n\nIf you're having any problems with EpicEditor feel free to open a [new ticket](http://github.com/OscarGodson/EpicEditor/issues/new). Go ahead and ask us anything and we'll try to help however we can. You can also see if there's someone available at the #epiceditor IRC channel on irc.freenode.net. If you need a little more help with implementing EpicEditor on your site we've teamed up with [CodersClan](http://codersclan.net) to offer support:\n\n\u003ca href=\"http://codersclan.net/support/step1.php?repo_id=2\"\u003e\u003cimg src=\"http://www.codersclan.net/graphics/getSupport_blue_big.png\" width=\"160\"\u003e\u003c/a\u003e\n\n## Contributing\n\nContributions are greatly encouraged and appreciated. For more on ways to contribute please check the wiki: [Contributing Guide](https://github.com/OscarGodson/EpicEditor/wiki/Contributing).\n\n## Credits\n\nEpicEditor relies on [Marked](https://github.com/chjj/marked) to parse markdown and is brought to you in part by [Oscar Godson](http://twitter.com/oscargodson) and [John Donahue](http://twitter.com/johnmdonahue). Special thanks to [Adam Bickford](http://twitter.com/adam_bickford) for the bug fixes and being the QA for pull requests. Lastly, huge thanks to [Sebastian Nitu](http://twitter.com/sebnitu) for the amazing logo and doc styles.\n","funding_links":[],"categories":["JavaScript","Markdown editor","Editors","Framework or Library","Editors [🔝](#readme)","编辑器"],"sub_categories":["Runner","Inline Editor","运行器","运行器e2e测试"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOscarGodson%2FEpicEditor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOscarGodson%2FEpicEditor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOscarGodson%2FEpicEditor/lists"}