Changeset 2856:b9ae6bf9bd6e for plugins/dcLegacyEditor/js/_post_editor.js
- Timestamp:
- 12/17/14 11:40:49 (11 years ago)
- Branch:
- 2.7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/dcLegacyEditor/js/_post_editor.js
r2751 r2856 1 1 $(function() { 2 2 if ($('#edit-entry').length==0) {return;} 3 if (dotclear.legacy_editor_context===undefined 4 || dotclear.legacy_editor_tags_context[dotclear.legacy_editor_context]===undefined) { 5 return; 6 } 3 7 4 // Get document format and prepare toolbars 5 var formatField = $('#post_format').get(0); 6 var last_post_format = $(formatField).val(); 7 $(formatField).change(function() { 8 if (this.value!='dcLegacyEditor') { return;} 8 if ((dotclear.legacy_editor_tags_context[dotclear.legacy_editor_context].indexOf('#post_content')!==-1) 9 && (dotclear.legacy_editor_tags_context[dotclear.legacy_editor_context].indexOf('#post_excerpt')!==-1)) { 10 // Get document format and prepare toolbars 11 var formatField = $('#post_format').get(0); 12 var last_post_format = $(formatField).val(); 13 $(formatField).change(function() { 14 if (this.value!='dcLegacyEditor') { return;} 9 15 10 var post_format = this.value;16 var post_format = this.value; 11 17 12 // Confirm post format change13 if (window.confirm(dotclear.msg.confirm_change_post_format_noconvert)) {14 excerptTb.switchMode(post_format);15 contentTb.switchMode(post_format);16 last_post_format = $(this).val();17 } else {18 // Restore last format if change cancelled18 // Confirm post format change 19 if (window.confirm(dotclear.msg.confirm_change_post_format_noconvert)) { 20 excerptTb.switchMode(post_format); 21 contentTb.switchMode(post_format); 22 last_post_format = $(this).val(); 23 } else { 24 // Restore last format if change cancelled 19 25 $(this).val(last_post_format); 20 } 26 } 27 28 $('.format_control > *').addClass('hide'); 29 $('.format_control:not(.control_no_'+post_format+') > *').removeClass('hide'); 30 }); 31 32 var excerptTb = new jsToolBar(document.getElementById('post_excerpt')); 33 var contentTb = new jsToolBar(document.getElementById('post_content')); 34 excerptTb.context = contentTb.context = 'post'; 21 35 22 36 $('.format_control > *').addClass('hide'); 23 $('.format_control:not(.control_no_'+ post_format+') > *').removeClass('hide');24 } );37 $('.format_control:not(.control_no_'+last_post_format+') > *').removeClass('hide'); 38 } 25 39 26 var excerptTb = new jsToolBar(document.getElementById('post_excerpt')); 27 var contentTb = new jsToolBar(document.getElementById('post_content')); 28 excerptTb.context = contentTb.context = 'post'; 29 30 $('.format_control > *').addClass('hide'); 31 $('.format_control:not(.control_no_'+last_post_format+') > *').removeClass('hide'); 32 33 if ($('#comment_content').length>0) { 34 var commentTb = new jsToolBar(document.getElementById('comment_content')); 35 commentTb.draw('xhtml'); 40 if (dotclear.legacy_editor_tags_context[dotclear.legacy_editor_context].indexOf('#comment_content')!==-1) { 41 if ($('#comment_content').length>0) { 42 var commentTb = new jsToolBar(document.getElementById('comment_content')); 43 commentTb.draw('xhtml'); 44 } 36 45 } 37 46 … … 103 112 104 113 // Load toolbars 105 contentTb.switchMode(formatField.value); 106 excerptTb.switchMode(formatField.value); 114 if (contentTb!==undefined && excerptTb!==undefined) { 115 contentTb.switchMode(formatField.value); 116 excerptTb.switchMode(formatField.value); 117 } 107 118 108 119 // Check unsaved changes before XHTML conversion
Note: See TracChangeset
for help on using the changeset viewer.