When using the patch at http://drupal.org/node/741606#comment-7404872 to add a WYSIWYG editor to the summary of a body, the tag to replace the media [[..]] code with an image tag is not added to Drupal.settings.tagmap , as media_pre_render_text_format is not called on the summary field.
Attached patch adds the function call to the #pre-render element for elements of type 'textarea' . This covers the summary field.
I also had to alter media_pre_render_text_format to work on $element['#value'] rather than $element['value'][#'value']. I hope this doesn't break anything - could maybe cause some duplication of tags in the tagmap?
Comment | File | Size | Author |
---|---|---|---|
#12 | wysiwyg_summary-1995030-12.patch | 753 bytes | junaidpv |
| |||
#11 | wysiwyg_summary-1995030-11.patch | 794 bytes | junaidpv |
| |||
#6 | media-7.x-2.x-wysiwyg-summary-support-1995030-6.patch | 884 bytes | Devin Carlson |
#4 | media-7.x-2.x-wysiwyg-summary-support-1995030-4.patch | 884 bytes | das-peter |
#3 | wysiwyg_summary-1995030-3.patch | 871 bytes | tripper54 |
Comments
Comment #1
TwoDThis looks a bit off to me, but I've only looked through Media's code briefly.
The value from "plain" textarea fields may not be processed with
check_markup()
, while text_format fields are pretty much guaranteed to be. Does it make sense to run this function if the field won't also be processed by Media's filter?Also, adding it to textarea means [unless I'm mistaken]
media_pre_render_text_format()
will run twice or maybe even three times per text_format field. The text_format fields will by default get changed to a main textarea field in addition to the summary field.I think an improved solution would be to only run
media_pre_render_text_format()
for text_format fields and call_media_generate_tagMap()
for both$element['value']['#value']
and$element['summary']['#value']
, if it exists.Comment #2
tripper54 CreditAttribution: tripper54 commentedYou're quite right, that would be a much better approach.
I'll rework the patch accordingly.
Comment #3
tripper54 CreditAttribution: tripper54 commentedRevised patch attached, now acts on $element['summary']['#value'] , as suggested by TwoD.
Comment #4
das-peter CreditAttribution: das-peter commentedWhile working on #2159403: Make CKEditor plugin system modular and clean I stumbled over this issue too. The attached patch is for media 7.x-2.x
Comment #6
Devin Carlson CreditAttribution: Devin Carlson commentedA reroll of #4.
Comment #9
das-peter CreditAttribution: das-peter commentedThat patch will not apply because the version for the issue is / was set to
7.x-1.x-dev
- but the updated patch is for7.x-2.x-dev
.I switch the version for now to test the latest patch.
Help me to not forget to switch back to
7.x-1.x-dev
again ;)Comment #10
das-peter CreditAttribution: das-peter commented6: media-7.x-2.x-wysiwyg-summary-support-1995030-6.patch queued for re-testing.
Comment #11
junaidpvUpdated for latest dev 7.x-2.x.
Comment #12
junaidpvMinor update and removed white space error on git apply.
Comment #14
joseph.olstadlooks good for 7.x-2.x dev , thanks