Dotclear

source: plugins/dcLegacyEditor/js/_post_editor.js @ 3016:37646518675d

Revision 3016:37646518675d, 2.2 KB checked in by franck <carnet.franck.paul@…>, 10 years ago (diff)

Remove XHTML Markup validator from dcLegacyEditor, dirty way to fix #1936

Line 
1$(function() {
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     }
7
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;}
15
16               var post_format = this.value;
17
18               // 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
25               $(this).val(last_post_format);
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';
35
36          $('.format_control > *').addClass('hide');
37          $('.format_control:not(.control_no_'+last_post_format+') > *').removeClass('hide');
38     }
39
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          }
45     }
46
47     $('#edit-entry').onetabload(function() {
48
49          // Load toolbars
50          if (contentTb!==undefined && excerptTb!==undefined) {
51               contentTb.switchMode(formatField.value);
52               excerptTb.switchMode(formatField.value);
53          }
54
55          // Check unsaved changes before XHTML conversion
56          var excerpt = $('#post_excerpt').val();
57          var content = $('#post_content').val();
58          $('#convert-xhtml').click(function() {
59               if (excerpt != $('#post_excerpt').val() || content != $('#post_content').val()) {
60                    return window.confirm(dotclear.msg.confirm_change_post_format);
61               }
62          });
63     });
64});
Note: See TracBrowser for help on using the repository browser.

Sites map