<!-- $Id: toolbar.txt v7.0 16/06/2019 00:03:14 $ -->
<script><!--
function insertTags (tagOpen, tagClose, sampleText) {
  var t = document.getElementById("notes_comments")

  // IE
  if(document.selection) {
    var theSelection = document.selection.createRange().text;
    if(!theSelection) { theSelection=sampleText;}
    t.focus();
    if(theSelection.charAt(theSelection.length - 1) == " "){// exclude ending space char, if any
      theSelection = theSelection.substring(0, theSelection.length - 1);
      document.selection.createRange().text = tagOpen + theSelection + tagClose + " ";
    } 
    else {
      document.selection.createRange().text = tagOpen + theSelection + tagClose;
    }
  }
  else 
    if(t.selectionStart || t.selectionStart == '0') {
      var replaced = false;
      var startPos = t.selectionStart;
      var endPos = t.selectionEnd;
      if(endPos-startPos) replaced=true;
      var scrollTop=t.scrollTop;
      var myText = (t.value).substring(startPos, endPos);
      if(!myText) { myText=sampleText;}
      if(myText.charAt(myText.length - 1) == " "){ // exclude ending space char, if any
        subst = tagOpen + myText.substring(0, (myText.length - 1)) + tagClose + " ";
      } 
      else {
        subst = tagOpen + myText + tagClose;
      }
      t.value = t.value.substring(0, startPos) + subst +
                t.value.substring(endPos, t.value.length);
      t.focus();
      //set new selection
      if(replaced){
        var cPos=startPos+(tagOpen.length+myText.length+tagClose.length);
        t.selectionStart=cPos;
        t.selectionEnd=cPos;
      }
      else {
        t.selectionStart=startPos+tagOpen.length;
        t.selectionEnd=startPos+tagOpen.length+myText.length;
      }
      t.scrollTop=scrollTop;
    }

  if (t.createTextRange) t.caretPos = document.selection.createRange().duplicate();
  return false;
}
--></script>
%( TODO: add translations of buttons %)
<a onclick="return insertTags('\'\'\'','\'\'\'','Texte gras')" href="javascript:;">
<i class="fas fa-bold fa-fw" title="Texte gras"></i></a>%nn;
<a onclick="return insertTags('\'\'','\'\'','Texte italique');" href="javascript:;">
<i class="fas fa-italic fa-fw" title="Texte italique"></i></a>%nn;
<a onclick="return insertTags('<u>','</u>','Souligné');" href="javascript:;">
<i class="fas fa-underline fa-fw" title="Souligné"></i></a>%nn;
%( Liste à puce peu utile en l'état, intrusif et ne s’intègre pas au texte existant
<a onclick="return insertTags('\n*Element 1\n*Element 2\n*Element 3','','Liste a puces');" href="javascript:;">
<i class="fas fa-list-ul fa-fw" title="Liste a puces"></i></a>%nn;%)
<a onclick="return insertTags('\n== ',' ==\n','Titre de rubrique');" href="javascript:;">
<i class="fas fa-heading fa-fw" title="Titre de rubrique"></i></a>%nn;
<a onclick="return insertTags('\n<hr>\n','','');" href="javascript:;">
<i class="far fa-window-minimize fa-fw" title="Ligne horizontale"></i></a>
<a onclick="return insertTags('<sup>','</sup>','Mise en exposant');" href="javascript:;">
<i class="fas fa-superscript fa-fw" title="Mise en exposant"></i></a>%nn;
<a onclick="return insertTags('\[\[\[','\]\]\]','Lien_interne/Nom du lien');" href="javascript:;">
<i class="fas fa-link fa-fw" title="Lien_interne/Nom du lien"></i></a>%nn;
<a onclick="return insertTags('<div style=\'text-align:center\'>','</div>','Centrer');" href="javascript:;">
<i class="fas fa-align-center fa-fw" title="Centrer"></i></a>%nn;
<a onclick="return insertTags(':','','Indenter');" href="javascript:;">
<i class="fas fa-indent fa-fw" title="Indenter"></i></a>%nn;