#14311 closed defect (bug) (fixed)
No media insertion support using the the_editor() function
Reported by: | DreadLox | Owned by: | Gecka |
---|---|---|---|
Milestone: | 3.3 | Priority: | normal |
Severity: | major | Version: | 3.1 |
Component: | Editor | Keywords: | |
Focuses: | Cc: |
Description
Hello,
Making, for example, a custom PostType, I needed a rich text text-area in my meta-boxes.
I found the the_editor() function witch is pretty nice. It outputs a tinymce editor with a custom id. That is nice and ok.
Trouble comes when using the $media_buttons parameter to have for example images upload/insertion into the rich text text-area.
It partially works: the buttons get displayed and clicking on them shows up the media upload windows. The problem is that the media upload/insertion window is "tight" to a text-area witch ID is 'content'. (found one occurrence in media-upload.dev.js line 62)
It should be "tight" to the ID provided to the_editor() function.
regards.
Attachments (1)
Change History (13)
#2
@
14 years ago
- Keywords needs-patch added; editor meta-boxes wysiwyg the_editor removed
- Milestone changed from Awaiting Review to Future Release
- Type changed from defect (bug) to enhancement
#3
@
14 years ago
- Keywords has-patch added; needs-patch removed
- Owner set to Gecka
- Status changed from new to accepted
- Type changed from enhancement to defect (bug)
- Version changed from 3.0 to 3.1
#5
@
14 years ago
I have added the patch. It is small and reliable, thus I do not see any reason to not solve it for 3.1 release.
One issue to solve is the point 2: "the get_media_item function will not show an "insert into article" button unless the posttype has the "editor" capability"
#6
@
14 years ago
- Keywords needs-testing 3.2-early added
thus I do not see any reason to not solve it for 3.1 release.
3.1 is in RC status, new enhancements will not make it in, If it works, check back in a few weeks once we're working on 3.2 to remind someone to check it.
#7
@
14 years ago
Can you explain me how this is an 'enhancement' and not a bug?
Here is the function definition:
the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2)
So any developer using it with a custom $id and $media_buttons to true will expect the media buttons to work with that custom editor. Witch is not the case. Thus this is a bug to me....
Having a deep look to it, here is what to be changed to have it work:
1) media-upload.dev.js line 62:
'content' should be replaced with a variable sent when clicking the media upload button and should reflect the Id parameter of the_editor() function
2) by default the get_media_item function will not show an "insert into article" button unless the posttype has the "editor" capability (wp-admin/includes/media.php line 1166, it still can be overwritten using the $args argument) There should be a workaround to have it enabled even if editor capability is not set for a posttype (additional argument to the_editor function ?)