/
bp-tinymce-js.js
36 lines (30 loc) · 973 Bytes
/
bp-tinymce-js.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
jQuery(document).ready( function($) {
var eid = '';
var thisarea = '';
$('textarea').each(function(i,v){
eid = $(v).attr('id');
$.ajax({
url: ajaxurl,
data: { action: 'bp_tinymce_editor', eid: eid, area_content: $(v).html() },
success: function(data){
$(v).replaceWith(data);
// For some reason we need to get a fresh id
var ps = $(data).attr('id').split('wp-').pop().split('-wrap');
var the_true_id = ps[0];
//var foo = tinyMCE.execCommand("mceAddControl", true, v);
// Switch to Visual
switchEditors.go( the_true_id, 'tmce' );
// Manually remove inline height. Groan.
$('iframe#' + the_true_id + '_ifr').css('height', '');
// Hack. If this is a message reply, keep it from submitting via
// AJAX
if ( the_true_id == 'message_content' ) {
var send_button = $('#send_reply_button');
if ( 0 != send_button.length ) {
$(send_button).unbind('click');
}
}
}
});
});
},jQuery);