SHOW:
|
|
- or go back to the newest paste.
| 1 | tinyMCE.init({
| |
| 2 | setup: function(ed) | |
| 3 | {
| |
| 4 | //console.log('entradilla deberia de estar desactivada');
| |
| 5 | ed.onKeyUp.add(function(ed, evt) | |
| 6 | {
| |
| 7 | if($('.entradilla_check').is(':checked')) {
| |
| 8 | // get html content of first paragraph in the editor | |
| 9 | var first_node_html = $(ed.getBody()).find('p:first').html();
| |
| 10 | ||
| 11 | // copythe html content into the textarea '.entradilla' | |
| 12 | $('.entradilla').text(first_node_html);
| |
| 13 | ||
| 14 | // if intro is a tinymce editor too you will need some other code | |
| 15 | // here it is | |
| 16 | tinymce.get('entradilla').setContent(first_node_html);
| |
| 17 | } | |
| 18 | }); | |
| 19 | }, | |
| 20 | ||
| 21 | language : 'es', | |
| 22 | mode: 'textareas', | |
| 23 | editor_selector : "tiny_editor", | |
| 24 | //valid_elements : "a[href|target=_blank],strong/b, u, i, p", | |
| 25 | cleanup: true, | |
| 26 | theme: 'advanced', | |
| 27 | ||
| 28 | theme_advanced_toolbar_align: 'left', | |
| 29 | theme_advanced_toolbar_location: 'top', | |
| 30 | theme_advanced_statusbar_location: 'bottom', | |
| 31 | ||
| 32 | plugins: 'table,advhr,advlink,preview,advimage,media,searchreplace,print,fullscreen,paste', | |
| 33 | ||
| 34 | theme_advanced_buttons1: 'bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,outdent,indent,|,fontselect,fontsizeselect,forecolor,backcolor', | |
| 35 | theme_advanced_buttons2: 'cut,copy,paste,pastetext,pasteword,|,search,replace,|,undo,redo,|,link,unlink,anchor,advhr,|,sub,sup,|,charmap,image,media,|,cleanup,removeformat,code,fullscreen', | |
| 36 | theme_advanced_buttons3: 'tablecontrols,|,preview,print,|,help', | |
| 37 | ||
| 38 | extended_valid_elements: 'iframe[align<bottom?left?middle?right?top|class|frameborder|height|id|longdesc|marginheight|marginwidth|name|scrolling<auto?no?yes|src|style|title|width]' | |
| 39 | }); | |
| 40 | ||
| 41 | ||
| 42 | if($('.entradilla_check').is(':checked')) {
| |
| 43 | - | tinyMCE.execCommand('mceRemoveControl', false, 'entradilla'); //This returns no error, but does nothing
|
| 43 | + | tinyMCE.execCommand('mceRemoveControl', false, 'entradilla');
|
| 44 | // | | |
| 45 | - | tinymce.get('entradilla').settings.readonly = false; // tinymce.get("entradilla") is undefined
|
| 45 | + | // |->//This returns no error, but does nothing |
| 46 | ||
| 47 | - | window.tinyMCE.get('entradilla').setAttribute('contenteditable', false); //window.tinyMCE.get("entradilla") is undefined
|
| 47 | + | tinymce.get('entradilla').settings.readonly = false;
|
| 48 | - | window.tinyMCE.activeEditor.getBody().setAttribute('contenteditable', false); //
|
| 48 | + | // | |
| 49 | // |->//tinymce.get("entradilla") is undefined
| |
| 50 | ||
| 51 | window.tinyMCE.get('entradilla').setAttribute('contenteditable', false);
| |
| 52 | // | | |
| 53 | // |->//window.tinyMCE.get("entradilla") is undefined
| |
| 54 | ||
| 55 | window.tinyMCE.activeEditor.getBody().setAttribute('contenteditable', false);
| |
| 56 | // | | |
| 57 | // |->//window.tinyMCE.activeEditor is null | |
| 58 | } |