Changed Markdown.Editor.js to be friendly with Rails id-based parameter paradigm. #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PageDown utilizes the ID attribute for particular elements in order to setup various "panels". One of these panels is the input panel. It grabs the id for a text area element and uses that as the markdown input.
The library expects a text area with the id of
wmd-input
to be the element which receives the markdown input from the user. This is problematic, especially if you want a particular model's field to be the markdown input (since it already has it's id assigned by Rails naming convention).To fix this, I modified the PanelCollection function within Markdown.Editor. I changed the DOM element being searched for the input to match a particular class name rather than a particular id. This eliminates the id conflict with Rails' naming conventions.
Here's the Stack Overflow conversation where the fork and change originated from http://stackoverflow.com/questions/13792956/change-existing-javascript-object-functions-with-prototype