Subversion Repositories wimsdev

Rev

Rev 13695 | Rev 13722 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
13602 obado 1
!! insert this before `!header` : `!read js/external/tinymce.phtml xxxx`
2
!!  with xxxx pointing to an existing DOM element (a textarea)
3
 
4
!if $wims_read_parm!=
5
 
13695 obado 6
  !let name_WYSIWYG_activate=Activate editor
7
  !let name_WYSIWYG_disable=Disable editor
13602 obado 8
  !if $lang=fr
13614 obado 9
    !set tiny_lang=language: 'fr_FR',
13695 obado 10
    !let name_WYSIWYG_activate=Activer l'éditeur
11
    !let name_WYSIWYG_disable=Désactiver l'éditeur
13602 obado 12
  !endif
13614 obado 13
  !if $lang=it
14
    !set tiny_lang=language: 'it',
13695 obado 15
    !let name_WYSIWYG_activate=Activate editor
16
    !let name_WYSIWYG_disable=Disable editor
13614 obado 17
  !endif
13602 obado 18
  !if $lang=cn
13648 obado 19
    !set tiny_lang=language: 'zh_CN',
13695 obado 20
    !let name_WYSIWYG_activate=Activate editor
21
    !let name_WYSIWYG_disable=Disable editor
13602 obado 22
  !endif
23
 
13606 obado 24
  !set wims_html_header= !append line <script src="scripts/js/external/tinymce/tinymce.min.js"></script>\
13695 obado 25
  <style>.hidden_btn{display:none}.wysiwyg_btns{text-align:right;font-size:.6em}</style>\
13602 obado 26
  <script>\
13695 obado 27
  document.addEventListener("DOMContentLoaded", function() {\
28
    /* Insert "enable/disable editor" buttons */\
29
    var ed_instances = document.querySelectorAll("$wims_read_parm");\
30
    ed_instances.forEach(function(ed) {\
31
      if(ed.id){\
32
        var div = document.createElement('div');\
33
        div.classList.add('wysiwyg_btns');\
34
        var a1 = document.createElement('a');\
35
        var linkText = document.createTextNode("$name_WYSIWYG_disable");\
36
        a1.appendChild(linkText);\
37
        a1.setAttribute("onclick","javascript:tinymce.execCommand('mceRemoveEditor',true,'"+ed.id+"');this.classList.add('hidden_btn');this.nextElementSibling.classList.remove('hidden_btn');");\
38
        div.appendChild(a1);\
39
        var a2 = document.createElement('a');\
40
        var linkText = document.createTextNode("$name_WYSIWYG_activate");\
41
        a2.appendChild(linkText);\
42
        a2.setAttribute("onclick","javascript:tinymce.execCommand('mceAddEditor',true,'"+ed.id+"');this.classList.add('hidden_btn');this.previousElementSibling.classList.remove('hidden_btn');");\
43
        a2.classList.add("hidden_btn");\
44
        div.appendChild(a2);\
45
        /* insert just after editor */\
46
        ed.parentNode.insertBefore(div, ed.nextSibling);\
47
      }\
48
    });\
49
    /* Initialize editors */\
13602 obado 50
    tinymce.init({\
51
      selector:'$wims_read_parm',\
52
      plugins: 'code help hr link lists',\
13721 obado 53
      block_formats : tinymce.translate('Paragraph')+'=p;' +tinymce.translate('Heading 2')+'=h2;'+tinymce.translate('Heading 3')+'=h3;' +tinymce.translate('Heading 4')+'=h4;' +tinymce.translate('Heading 5')+'=h5;' +tinymce.translate('Heading 6')+'=h6;' +tinymce.translate('Preformatted')+'=pre',\
13602 obado 54
      menubar: false,\
55
      branding: false,\
13604 obado 56
      toolbar: 'undo redo | formatselect | bold italic strikethrough | subscript superscript | hr link | bullist numlist | removeformat | code | help',\
13614 obado 57
      $tiny_lang\
13622 obado 58
      content_css : 'html/themes/$wims_theme/css.css',\
59
      body_class: 'main_body',\
60
      content_style : 'a, .ui-widget-content a{color:$wims_link_color;}a:hover, a:focus {color:$wims_hlink_color;}table.wimstable th{background-color: $wims_ref_bgcolor;color: $wims_ref_menucolor;}table.wimstable th a{color: $wims_ref_menucolor;}.wimstable caption a{color: $wims_ref_menucolor;}.wims_emph {color:$wims_ref_bgcolor;}input[type="submit"],input[type="button"],.main_body .wims_button{background-color:$wims_ref_button_bgcolor;color:$wims_ref_button_color;}.main_body .wims_button_help{background-color:$wims_ref_button_help_bgcolor;color:$wims_ref_button_help_color;}.property_fields{border-color:$wims_ref_bgcolor;}.property_fields legend{background-color: $wims_ref_bgcolor;}.property_fields legend,.property_fields legend>a{color:$wims_ref_menucolor;}.wims_color1 {background-color: $wims_ref_bgcolor;color:$wims_ref_menucolor;}.wims_color2 {background-color:$wims_ref_button_bgcolor;color:$wims_ref_button_color;}.wims_color3 {background-color:$wims_ref_button_help_bgcolor;color:$wims_ref_button_help_color;}'\
13602 obado 61
    });\
13695 obado 62
  });</script> to $wims_html_header
13602 obado 63
!endif