Skip to content

Completed fix for issue #17 #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 3, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/angular-markdown-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ angular
if (! element.hasClass('processed')) {
element.addClass('processed');

// Setup the markdown WYSIWYG.
element.markdown({
var markdownOptions = {
autofocus: options.autofocus || false,
saveable: options.saveable || false,
savable: options.savable || false,
Expand Down Expand Up @@ -63,7 +62,17 @@ angular
runScopeFunction(scope, attrs.onShow, e);
}
}
});
};

// Setup the markdown WYSIWYG.

// if the markdown editor was added dynamically the markdown function will be undefined
// so it has to be called explicitely
if (element.markdown === undefined){
element.data('markdown', (data = new $.fn.markdown.Constructor(element[0], markdownOptions)))
} else {
element.markdown(markdownOptions);
}
}
}
};
Expand Down