From ec90dd05df1d446b6b903fc544c9dc0eb6957e03 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Thu, 14 Mar 2019 19:04:03 +0100 Subject: [PATCH] [9.0.05] TinyMCE internal links and lightbox --- CHANGES.md | 4 +++ core/core.js.php | 4 +++ core/core.php | 62 ++++++++++++++++++++----------------- core/vendor/tinymce/init.js | 25 ++++++++++----- 4 files changed, 58 insertions(+), 37 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index de331d39..3f2825d8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,10 @@ - nouvelle position du menu dans le site quand la bannière est au-dessus. - Simplification et ordre des libellés - Editeur de texte, scrolle lorsque l'éditeur est ouvert, la barre d'outil se colle sous la barre d'administration. + - TinyMCE : + - liste des pages dans la fenêtre des liens + - option lightbox pour l'affichage d'images ou de liens + usages : https://sorgalla.com/lity/ ## Version 9.0.04 - Corrections : diff --git a/core/core.js.php b/core/core.js.php index f0c0e01a..e9415340 100755 --- a/core/core.js.php +++ b/core/core.js.php @@ -327,6 +327,10 @@ core.start = function() { .height(width * _this.data("ratio")); }); }).trigger("resize"); + + // Ajouter l'attribut data-lity afin de faire la liaison avec lity + $("a[rel='data-lity']").attr("data-lity",""); + }; core.start(); diff --git a/core/core.php b/core/core.php index fb6ad887..ff408817 100644 --- a/core/core.php +++ b/core/core.php @@ -28,7 +28,7 @@ class common { const GROUP_ADMIN = 3; // Numéro de version de développement : // Désactive l'update auto - const ZWII_VERSION = '9.0.-dev.c'; + const ZWII_VERSION = '9.0.05.dev.d'; // Numéro de version stable // const ZWII_VERSION = '9.0.05'; @@ -878,7 +878,6 @@ class common { } } } - // Sinon retourne null return helper::filter(null, $filter); } @@ -959,34 +958,39 @@ class common { * Génére un fichier json avec la liste des */ public function linkList() { - // Sauve la liste des pages pour TinyMCE - $parents = []; - $children = []; - $rewrite = (helper::checkRewrite()) ? '' : '?'; - foreach($this->getHierarchy(null,false,false) as $parentId => $childIds) { - // Exclure les barres - if ($this->getData(['page', $parentId, 'block']) !== 'bar' ) { - $parents [] = ['title' => $this->getData(['page', $parentId, 'title']) , - 'value'=> $rewrite.$parentId - ]; - } - //if (!empty($childIds)) { - foreach($childIds as $childId) { - $parents [] = ['title' => '› ' . $this->getData(['page', $childId, 'title']) , - 'value'=> $rewrite.$childId - ]; - } - // $parents [] = [ 'menu' => $children]; - //} + // Sauve la liste des pages pour TinyMCE + $parents = []; + $rewrite = (helper::checkRewrite()) ? '' : '?'; + foreach($this->getHierarchy(null,false,false) as $parentId => $childIds) { + $children = []; + // Exclure les barres + if ($this->getData(['page', $parentId, 'block']) !== 'bar' ) { + foreach($childIds as $childId) { + $children [] = ['title' => $this->getData(['page', $childId, 'title']) , + 'value'=> $rewrite.$childId + ]; } - // 3 tentatives - for($i = 0; $i < 3; $i++) { - if (file_put_contents ('core/vendor/tinymce/link_list.json', json_encode($parents), LOCK_EX) !== false) { - break; - } - // Pause de 10 millisecondes - usleep(10000); - } + if (empty($childIds)) { + $parents [] = ['title' => $this->getData(['page', $parentId, 'title']) , + 'value'=> $rewrite.$parentId + ]; + } else { + $parents [] = ['title' => $this->getData(['page', $parentId, 'title']) , + 'value'=> $rewrite.$parentId , + 'menu' => $children + ]; + } + } + } + + // 3 tentatives + for($i = 0; $i < 3; $i++) { + if (file_put_contents ('core/vendor/tinymce/link_list.json', json_encode($parents), LOCK_EX) !== false) { + break; + } + // Pause de 10 millisecondes + usleep(10000); + } } diff --git a/core/vendor/tinymce/init.js b/core/vendor/tinymce/init.js index b21a6e13..4a81bdc3 100755 --- a/core/vendor/tinymce/init.js +++ b/core/vendor/tinymce/init.js @@ -20,12 +20,24 @@ tinymce.init({ lineNumbers: true }, width: 800, // Default value is 800 - height: 500 // Default value is 550 - //jsFiles: [ // Additional JS files to load - // 'mode/clike/clike.js', - // 'mode/php/php.js' - //] + height: 500, // Default value is 550 + jsFiles: [ // Additional JS files to load + 'mode/clike/clike.js', + 'mode/php/php.js' + ] }, + // Cibles de la target + target_list: [ + {title: 'None', value: ''}, + {title: 'Nouvel onglet', value: '_blank'} + ], + // Target pour lightbox + rel_list: [ + {title: 'None', value: ''}, + {title: 'Ouvrir dans une lightbox', value: 'data-lity'} + ], + // Pages internes + link_list: baseUrl + "core/vendor/tinymce/links.php", // Contenu du menu contextuel contextmenu: "cut copy paste pastetext | selectall searchreplace | link image inserttable | cell row column deletetable", // Fichiers CSS à intégrer à l'éditeur @@ -35,9 +47,6 @@ tinymce.init({ baseUrl + "site/data/theme.css", baseUrl + "site/data/custom.css" ], - // Pages internes - link_list: "core/vendor/tinymce/links.php", - // Thème mobile // Classe à ajouter à la balise body dans l'iframe body_class: "editorWysiwyg", // Cache les menus