Advertisement
Guest User

Untitled

a guest
Aug 27th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. jQuery.mf_bind('add',function(){
  2. if('undefined' != typeof tinyMCEPreInit){
  3.  
  4. // this is for relative_urls when the main editor is on text mode
  5. if ( typeof tinymce !== 'undefined' ) {
  6. for ( id in tinyMCEPreInit.mceInit ) {
  7. init = tinyMCEPreInit.mceInit[id];
  8. init.selector = "";
  9. tinymce.init( init );
  10. }
  11. }
  12.  
  13. jQuery(".multiline_custom_field .add_editor_mf").each( function(index,value){
  14. var editor_text = jQuery(this).attr('id');
  15. tinyMCE.execCommand(mf_js.mf_mceAddString, false, editor_text);
  16. jQuery(this).removeClass('add_editor_mf');
  17. });
  18. }
  19. });
  20. jQuery.mf_bind('before_sort', function(){
  21. if('undefined' != typeof tinyMCEPreInit){
  22. jQuery("#"+sort_group_id+" .multiline_custom_field .pre_editor").each( function(){
  23. var editor_text = jQuery(this).attr('id');
  24. if(tinyMCE.get(editor_text)){
  25. tinyMCE.execCommand(mf_js.mf_mceRemoveString, false, editor_text);
  26. jQuery('#'+editor_text).addClass('temp_remove_editor');
  27. }
  28. });
  29. }
  30. });
  31. jQuery.mf_bind('after_sort', function(){
  32. if('undefined' != typeof tinyMCEPreInit){
  33. jQuery("#"+sort_group_id+" .multiline_custom_field .temp_remove_editor").each( function(){
  34. var editor_text = jQuery(this).attr('id');
  35. tinyMCE.execCommand(mf_js.mf_mceAddString, false, editor_text);
  36. jQuery('#'+editor_text).removeClass('temp_remove_editor');
  37. });
  38. }
  39. });
  40.  
  41. jQuery.mf_bind('before_save',function(){
  42. if('undefined' != typeof tinyMCEPreInit){
  43. jQuery(".multiline_custom_field .pre_editor").each(function(){
  44. var editor_text = jQuery(this).attr('id');
  45. jQuery(jQuery('#'+editor_text)).attr('value', tinyMCE.get(editor_text).getContent());
  46. });
  47. }
  48. });
  49.  
  50. // Add the editor (button)
  51. function add_editor(id){
  52. if('undefined' != typeof tinyMCEPreInit){
  53. new_valor = jQuery('#'+id).val();
  54. new_valor = switchEditors.wpautop(new_valor);
  55. jQuery('#'+id).val(new_valor);
  56. tinyMCE.execCommand(mf_js.mf_mceAddString, false, id);
  57. }
  58. }
  59. // Remove the editor (button)
  60. function del_editor(id){
  61. if('undefined' != typeof tinyMCEPreInit){
  62. tinyMCE.execCommand(mf_js.mf_mceRemoveString, false, id);
  63. }
  64. }
  65.  
  66. jQuery().ready(function($){
  67. $('.tab_multi_mf a.edButtonHTML_mf').click( function() {
  68. $(this).closest(".tab_multi_mf").find(".edButtonHTML_mf").removeClass("current");
  69. $(this).addClass("current");
  70. });
  71. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement