Skip to content

Instantly share code, notes, and snippets.

Created May 17, 2014 00:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
EpicEditor reflowing
// Here's an example of using EpicEditor with something like Twitter Bootstrap tabs.
// Thing is that EpicEditor doesn't calculate its dimensions properly when it is nested in a hidden container.
// So, we just need to call 'reflow' method of the EpicEditor. Here is the simple solution:
// Tab link that's clicked
$('a[data-toggle="tab"]').on('', function (e) {
// EpicEditor instance recalculates its dimensions.
// Also remember to set different options to different EpicEditor instances.
// For example, if you want to provide a separate EpicEditor for each language
// that your system supports, you need to have some parameters to be different.
// Like so:
var editors = {};
var locale = $(this).data('locale');
var options = {
container: 'js-epiceditor-' + locale,
textarea: 'js-textarea-markdown-' + locale,
basePath: '/js/epiceditor',
localStorageName: 'epiceditor-' + locale,
file: {
name: 'epiceditor-' + locale
autogrow: true
editors[locale] = new EpicEditor(options).load();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment