4 * Déclarations de fonctions servant à la construction du javascript
6 * @plugin Porte Plume pour SPIP
8 * @package SPIP\PortePlume\Javascript
10 if (!defined("_ECRIRE_INC_VERSION")) return;
13 * Retourne la définition de la barre markitup désignée.
14 * (cette déclaration est au format json)
16 * Deux pipelines 'porte_plume_pre_charger' et 'porte_plume_charger'
17 * permettent de récuperer l'objet de classe Barre_outil
18 * avant son export en json pour modifier des elements.
20 * @pipeline_appel porte_plume_barre_pre_charger
21 * Charge des nouveaux boutons au besoin
22 * @pipeline_appel porte_plume_barre_charger
23 * Affiche ou cache certains boutons
25 * @return string Déclaration json
27 function porte_plume_creer_json_markitup(){
28 // on recupere l'ensemble des barres d'outils connues
29 include_spip('porte_plume_fonctions');
30 if (!$sets = barre_outils_liste()) {
34 // 1) On initialise tous les jeux de barres
36 foreach($sets as $set) {
37 if (($barre = barre_outils_initialiser($set)) AND is_object($barre))
38 $barres[$set] = $barre;
44 * Charger des nouveaux boutons au besoin
47 * $barre = &$flux['spip'];
48 * $barre->ajouterApres('bold',array(params));
49 * $barre->ajouterAvant('bold',array(params));
51 * $bold = $barre->get('bold');
52 * $bold['id'] = 'bold2';
53 * $barre->ajouterApres('italic',$bold);
54 * @pipeline_appel porte_plume_barre_pre_charger
56 $barres = pipeline('porte_plume_barre_pre_charger', $barres);
62 * Cacher ou afficher certains boutons au besoin
65 * $barre = &$flux['spip'];
66 * $barre->afficher('bold');
67 * $barre->cacher('bold');
69 * $barre->cacherTout();
70 * $barre->afficher(array('bold','italic','header1'));
71 * @pipeline_appel porte_plume_barre_charger
73 $barres = pipeline('porte_plume_barre_charger', $barres);
76 // 4 On crée les jsons
78 foreach($barres as $set=>$barre) {
79 $json .= $barre->creer_json();