Dotclear


Ignore:
Timestamp:
05/04/14 18:03:29 (11 years ago)
Author:
Nicolas <nikrou77@…>
Branch:
default
Message:

Addresses #1896.
Save editor in post meta
Manage editor from preferences
If editor saved in meta post is not the ones chosen in preferences a simple textarea is displayed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/dcLegacyEditor/js/_post_editor.js

    r2614 r2705  
    11$(function() { 
    22     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     }; 
    311 
    412     // Get document format and prepare toolbars 
     
    614     var last_post_format = $(formatField).val(); 
    715     $(formatField).change(function() { 
     16          if (getPostEditor(this.value)!='dcLegacyEditor') { return;} 
     17 
     18          var post_format = getPostFormat(this.value); 
     19 
    820          // 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); 
    1224               last_post_format = $(this).val(); 
    13           }else{ 
     25          } else { 
    1426               // Restore last format if change cancelled 
    1527               $(this).val(last_post_format); 
     
    1729 
    1830          $('.format_control > *').addClass('hide'); 
    19           $('.format_control:not(.control_no_'+$(this).val()+') > *').removeClass('hide'); 
     31          $('.format_control:not(.control_no_'+post_format+') > *').removeClass('hide'); 
    2032     }); 
    2133 
     
    2537 
    2638     $('.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'); 
    2840 
    2941     if ($('#comment_content').length>0) { 
     
    4961                    excerpt: excerpt_content, 
    5062                    content: post_content, 
    51                     format: $('#post_format').get(0).value, 
     63                    format: getPostFormat($('#post_format').get(0).value), 
    5264                    lang: $('#post_lang').get(0).value 
    5365               }; 
     
    99111 
    100112          // Load toolbars 
    101           contentTb.switchMode(formatField.value); 
    102           excerptTb.switchMode(formatField.value); 
     113          contentTb.switchMode(getPostFormat(formatField.value)); 
     114          excerptTb.switchMode(getPostFormat(formatField.value)); 
    103115 
    104116          // Check unsaved changes before XHTML conversion 
Note: See TracChangeset for help on using the changeset viewer.

Sites map