Skip to content
Extraits de code Groupes Projets
Valider bc006b86 rédigé par ARNO*'s avatar ARNO*
Parcourir les fichiers

Ajout, en interface complete, de boutons de raccourcis supplementaires

parent 770eb03f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -47,9 +47,12 @@ IMG/icones/xml-dist.png -text
IMG/icones/zip-dist.png -text
IMG/icones_barre/barre-a-grave.png -text
IMG/icones_barre/barre-bold.png -text
IMG/icones_barre/barre-cadre.png -text
IMG/icones_barre/barre-code.png -text
IMG/icones_barre/barre-e-aigu.png -text
IMG/icones_barre/barre-euro.png -text
IMG/icones_barre/barre-guillemets.png -text
IMG/icones_barre/barre-html.png -text
IMG/icones_barre/barre-intertitre.png -text
IMG/icones_barre/barre-italic.png -text
IMG/icones_barre/barre-lien.png -text
......@@ -57,6 +60,8 @@ IMG/icones_barre/barre-note.png -text
IMG/icones_barre/barre-oe-maj.png -text
IMG/icones_barre/barre-oe.png -text
IMG/icones_barre/barre-quote.png -text
IMG/icones_barre/barre-tableau.png -text
IMG/icones_barre/barre-wiki.png -text
IMG/test.gif -text
IMG/test.jpg -text
IMG/test.png -text
......
IMG/icones_barre/barre-cadre.png

397 octets

IMG/icones_barre/barre-code.png

392 octets

IMG/icones_barre/barre-html.png

364 octets

IMG/icones_barre/barre-tableau.png

394 octets

IMG/icones_barre/barre-wiki.png

450 octets

......@@ -45,7 +45,7 @@ function bouton_barre_racc($action, $img, $help, $formulaire, $texte) {
}
function afficher_barre($formulaire='',$texte='', $forum=false) {
global $spip_lang, $flag_ecrire;
global $spip_lang, $flag_ecrire, $options;
if (test_barre()) {
$ret = afficher_script_barre();
......@@ -54,6 +54,9 @@ function afficher_barre($formulaire='',$texte='', $forum=false) {
$ret .= "<tr width='100%'>";
$ret .= "<td align='left'>";
$col++;
$ret .= bouton_barre_racc ("javascript:barre_raccourci('{{','}}',$champ)", "barre-bold.png", "Mettre en {{gras}}", $formulaire, $texte);
$ret .= bouton_barre_racc ("javascript:barre_raccourci('{','}',$champ)", "barre-italic.png", "Mettre en {italique}", $formulaire, $texte);
if (!$forum) {
......@@ -64,11 +67,25 @@ function afficher_barre($formulaire='',$texte='', $forum=false) {
}
$ret .= "&nbsp;&nbsp;&nbsp;";
$ret .= bouton_barre_racc ("javascript:barre_demande('[','->',']','Veuillez indiquer l\'adresse de votre lien (vous pouvez indiquer une adresse Web sous la forme http://www.monsite/com ou simplement indiquer le num&eacute;ro d\'un article de ce site.',$champ)", "barre-lien.png", "Cr&eacute;er un [lien hypertexte->http://...]", $formulaire, $texte);
if ($options == "avancees") {
$ret .= bouton_barre_racc ("javascript:barre_raccourci('[?',']',$champ)", "barre-wiki.png", "Entr&eacute;e du [?glossaire] (Wikipedia)", $formulaire, $texte);
$ret .= "&nbsp;&nbsp;&nbsp;";
$ret .= bouton_barre_racc ("javascript:barre_tableau($champ)", "barre-tableau.png", "Ins&eacute;rer un tableau", $formulaire, $texte);
}
if ($forum) {
$ret .= "&nbsp;&nbsp;&nbsp;";
$ret .= bouton_barre_racc ("javascript:barre_raccourci('\n\n<quote>','</quote>\n\n',$champ)", "barre-quote.png", "<quote>Citer un message</quote>", $formulaire, $texte);
}
if ($options == "avancees") {
$ret .= "&nbsp;&nbsp;&nbsp;";
$ret .= bouton_barre_racc ("javascript:barre_raccourci('<html>','</html>',$champ)", "barre-html.png", "<html>Ne pas appliquer de correction typographique</html>", $formulaire, $texte);
$ret .= bouton_barre_racc ("javascript:barre_raccourci('<code>','</code>',$champ)", "barre-code.png", "Afficher du <code>code informatique</code>", $formulaire, $texte);
if (!$forum) $ret .= bouton_barre_racc ("javascript:barre_raccourci('\n\n<cadre>','</cadre>\n\n',$champ)", "barre-cadre.png", "<cadre>Afficher un pav&eacute; de code informatique</cadre>", $formulaire, $texte);
}
$ret .= "</td>";
$ret .= "<td align='center'>";
......@@ -90,6 +107,9 @@ function afficher_barre($formulaire='',$texte='', $forum=false) {
}
$ret .= "</td>";
$ret .= "<td> &nbsp; </td>";
$col++;
if ($flag_ecrire) {
$ret .= "<td align='right' onMouseOver=\"helpline('En savoir plus sur les raccourcis typographiques',helpbox$texte)\">";
$col++;
......
......@@ -69,6 +69,50 @@ function barre_inserer(text,champ) {
}
}
// Nicolas Hoizey
function barre_tableau(toolbarfield)
{
var txtarea = toolbarfield;
txtarea.focus();
var cols = prompt("Nombre de colonnes du tableau :", "");
var rows = prompt("Nombre de lignes du tableau :", "");
if (cols != null && rows != null) {
var tbl = '';
var ligne = '|';
var entete = '|';
for(i = 0; i < cols; i++) {
ligne = ligne + ' valeur |';
entete = entete + ' {{entete}} |';
}
for (i = 0; i < rows; i++) {
tbl = tbl + ligne + '\n';
}
if (confirm('Voulez vous ajouter une ligne d\'en-tte ?')) {
tbl = entete + '\n' + tbl;
}
if ((clientVer >= 4) && is_ie && is_win) {
var str = document.selection.createRange().text;
var sel = document.selection.createRange();
sel.text = str + '\n\n' + tbl + '\n\n';
} else {
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
if (selEnd == 1 || selEnd == 2) {
selEnd = selLength;
}
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd)
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + s2 + "\n\n" + tbl + "\n\n" + s3;
}
}
return;
}
// Shows the help messages in the helpline window
function helpline(help, champ) {
champ.value = help;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter