Changeset 2705:bac24f5c42ae for plugins/dcLegacyEditor/js
- Timestamp:
- 05/04/14 18:03:29 (11 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/dcLegacyEditor/js/_post_editor.js
r2614 r2705 1 1 $(function() { 2 2 if ($('#edit-entry').length==0) {return;} 3 4 // remove editor prefix 5 var getPostFormat = function getPostFormat(post_format) { 6 return post_format.replace(/[^:]*:/,''); 7 }; 8 var getPostEditor = function getPostEditor(post_format) { 9 return post_format.replace(/:.*/,''); 10 }; 3 11 4 12 // Get document format and prepare toolbars … … 6 14 var last_post_format = $(formatField).val(); 7 15 $(formatField).change(function() { 16 if (getPostEditor(this.value)!='dcLegacyEditor') { return;} 17 18 var post_format = getPostFormat(this.value); 19 8 20 // Confirm post format change 9 if (window.confirm(dotclear.msg.confirm_change_post_format_noconvert)){10 excerptTb.switchMode( this.value);11 contentTb.switchMode( this.value);21 if (window.confirm(dotclear.msg.confirm_change_post_format_noconvert)) { 22 excerptTb.switchMode(post_format); 23 contentTb.switchMode(post_format); 12 24 last_post_format = $(this).val(); 13 } else{25 } else { 14 26 // Restore last format if change cancelled 15 27 $(this).val(last_post_format); … … 17 29 18 30 $('.format_control > *').addClass('hide'); 19 $('.format_control:not(.control_no_'+ $(this).val()+') > *').removeClass('hide');31 $('.format_control:not(.control_no_'+post_format+') > *').removeClass('hide'); 20 32 }); 21 33 … … 25 37 26 38 $('.format_control > *').addClass('hide'); 27 $('.format_control:not(.control_no_'+ last_post_format+') > *').removeClass('hide');39 $('.format_control:not(.control_no_'+getPostFormat(last_post_format)+') > *').removeClass('hide'); 28 40 29 41 if ($('#comment_content').length>0) { … … 49 61 excerpt: excerpt_content, 50 62 content: post_content, 51 format: $('#post_format').get(0).value,63 format: getPostFormat($('#post_format').get(0).value), 52 64 lang: $('#post_lang').get(0).value 53 65 }; … … 99 111 100 112 // Load toolbars 101 contentTb.switchMode( formatField.value);102 excerptTb.switchMode( formatField.value);113 contentTb.switchMode(getPostFormat(formatField.value)); 114 excerptTb.switchMode(getPostFormat(formatField.value)); 103 115 104 116 // Check unsaved changes before XHTML conversion
Note: See TracChangeset
for help on using the changeset viewer.