The helper function getFormat in ajax_markup.js relies on looking for the checked format in the Input Filter field set. This doesn't exist if better_formats has been configured not to display it.
I'm using ajax_markup with BUEditor to provide preview functionality - very good when it worked before I configured better_formats. BUEditor will be used for forum posts and comments.
I'm not sure whether there's any easy way for ajax_markup to work out which format is to be applied to a particular textarea for a particular node/comment type for a particular user, which is the level of granularity that better_formats provides.
There's nothing in my HTML that indicates the format to be used - no class or id on the textarea for example. Perhaps better_formats could be changed to provide the missing information.
For the meantime, I'm just going to changed the defaults formats used in the above javascript helper function to match the single formats I'll be allowing for forum posts and comments. I won't be using BUEditor's preview function anywhere else, so this should resolve the issue for me. Naturally hard-coding the formats isn't ideal and won't suit everybody!
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | ajax_markup.better_formats.patch | 707 bytes | ufku |
Comments
Comment #1
dunx commentedRaised twin issue with better_formats.
http://drupal.org/node/1148488
Comment #2
ufku commentedHere is patch that checks better-formats' default "node" format when the supplied format is set to site-default(0).
Note that it will use the node default even if the textarea is part of another site element such as a block or comment.
Comment #3
dunx commentedThat always returns 1. The format filter of the node type I'm editing would always be 3.
I had a quick look at the better_formats code, but couldn't spot anything obvious.
Comment #4
dunx commentedSee discussion here:
http://drupal.org/node/1148488
Maintainer is saying there's no better_formats function that can be used to determine the format when no filter field set is displayed, but that this can also happen in core when there's only one filter available in any given case. Not sure if there's a core function that can resolve the current issue.
For the moment, AM will not work if there is no filter field set, so it needs some way of determining what the single filter is for the current node type/user combo.
For the moment, I'm just going to leave my formats hard-coded in the .js file, but good luck with finding a proper solution.
Comment #5
dunx commentedJust a follow up to say this is still an issue. For the record my "forum replies" use format number 3, so in ajax_markup.js I just hardcode the following function to return 3!