Simplification TinyMCE

This commit is contained in:
Fred Tempez 2023-08-28 11:04:53 +02:00
parent c4a4aeb1f3
commit fa3cc1bfa3
16 changed files with 251 additions and 40 deletions

View File

@ -8,6 +8,7 @@
- L'ajout d'une langue de contenu initialise les données de la langue.
- Format d'image avif si supporté par la version installée de php.
- Remplacement du service ScreenShot API par un sélecteur manuel ; affiche les paramètres d'images recommandées et ceux de l'image sélectionnée.
- Nouveau module Navigation qui permet un déplacement latéral dans la hiérarchie du menu à l'aide de deux boutons.
# Corrections
- Correction de bugs mineurs dans la sauvegarde et la suppression des modules installés.
- Problèmes de mise à jour depuis les versions 11.

View File

@ -31,34 +31,14 @@ tinymce.init({
plugins: "advlist anchor autolink autoresize autosave codemirror contextmenu colorpicker fullscreen hr image imagetools link lists media paste searchreplace tabfocus table template textcolor visualblocks nonbreaking emoticons charmap",
// Contenu du menu
menu: {
file: { title: 'File', items: 'newdocument restoredraft | preview | export print | deleteallconversations' },
edit: { title: 'Edit', items: 'undo redo | cut copy paste pastetext | selectall | searchreplace' },
view: { title: 'View', items: 'code | visualaid visualchars visualblocks | spellchecker | preview fullscreen | showcomments' },
insert: { title: 'Insert', items: 'image link media addcomment pageembed template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime' },
//format: { title: 'Format', items: 'bold italic underline strikethrough superscript subscript codeformat | styles blocks fontfamily fontsize align lineheight | forecolor backcolor | removeformat' },
tools: { title: 'Tools', items: 'spellchecker spellcheckerlanguage | a11ycheck code wordcount' },
table: { title: 'Table', items: 'inserttable | cell row column | advtablesort | tableprops deletetable' },
help: { title: 'Help', items: 'help' }
edit: {title: 'Edit', items: 'undo redo | selectall searchreplace | cut copy paste pastetext | easyattributes style'},
insert: {title: 'Insert', items: 'template | nonbreaking hr charmap anchor | abbr insertdatetime | exegames_hangman'},
format: {title: 'Format', items: 'underline strikethrough superscript subscript | formats | removeformat'},
table: {title: 'Table', items: 'inserttable tableprops deletetable | cell row column'},
},
// Contenu de la barre d'outils
toolbar: "bold italic underline strikethrough formatgroup | h1 h2 h3 paragraphgroup | link image insertgroup| visualblocks code fullscreen",
toolbar_groups: {
formatgroup: {
icon: 'format',
tooltip: 'Format du texte',
items: 'forecolor backcolor | superscript subscript | removeformat'
},
paragraphgroup: {
icon: 'paragraph',
tooltip: 'Format des paragraphes',
items: 'bullist numlist | alignleft aligncenter alignright alignjustify | indent outdent'
},
insertgroup: {
icon: 'plus',
tooltip: 'Insérer',
items: 'emoticons charmap hr table template'
}
},
toolbar: "ndo redo | bold italic | formatselect | alignleft aligncenter alignright alignjustify | exelink unlink | bullist numlist | image media | fullscreen",
toolbar_sticky: true,
fontsize_formats:
"8pt 9pt 10pt 11pt 12pt 14pt 18pt 24pt 30pt 36pt 48pt 60pt 72pt 96pt",
@ -109,7 +89,7 @@ tinymce.init({
// Pages internes
link_list: baseUrl + "core/vendor/tinymce/links.php",
// Contenu du menu contextuel
contextmenu: "selectall searchreplace | hr | media image link anchor nonbreaking | insertable cell row column deletetable",
contextmenu: "exelink | inserttable | cell row column deletetable",
// Fichiers CSS à intégrer à l'éditeur
content_css: [
baseUrl + "core/layout/common.css",

View File

@ -41,6 +41,11 @@
.zwiico-search:before { content: '\e826'; } /* '' */
.zwiico-eye-1:before { content: '\e827'; } /* '' */
.zwiico-eq:before { content: '\e828'; } /* '' */
.zwiico-right-open:before { content: '\e829'; } /* '' */
.zwiico-left-big:before { content: '\e82a'; } /* '' */
.zwiico-right-big:before { content: '\e82b'; } /* '' */
.zwiico-up-dir:before { content: '\e82c'; } /* '' */
.zwiico-right-dir:before { content: '\e82d'; } /* '' */
.zwiico-spin:before { content: '\e831'; } /* '' */
.zwiico-twitter:before { content: '\f099'; } /* '' */
.zwiico-facebook:before { content: '\f09a'; } /* '' */

File diff suppressed because one or more lines are too long

View File

@ -41,6 +41,11 @@
.zwiico-search { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.zwiico-eye-1 { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.zwiico-eq { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.zwiico-right-open { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.zwiico-left-big { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.zwiico-right-big { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.zwiico-up-dir { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.zwiico-right-dir { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.zwiico-spin { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.zwiico-twitter { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.zwiico-facebook { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }

View File

@ -52,6 +52,11 @@
.zwiico-search { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.zwiico-eye-1 { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.zwiico-eq { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.zwiico-right-open { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.zwiico-left-big { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.zwiico-right-big { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.zwiico-up-dir { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.zwiico-right-dir { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.zwiico-spin { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.zwiico-twitter { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.zwiico-facebook { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }

View File

@ -1,11 +1,11 @@
@font-face {
font-family: 'zwiico';
src: url('../font/zwiico.eot?91953221');
src: url('../font/zwiico.eot?91953221#iefix') format('embedded-opentype'),
url('../font/zwiico.woff2?91953221') format('woff2'),
url('../font/zwiico.woff?91953221') format('woff'),
url('../font/zwiico.ttf?91953221') format('truetype'),
url('../font/zwiico.svg?91953221#zwiico') format('svg');
src: url('../font/zwiico.eot?3721857');
src: url('../font/zwiico.eot?3721857#iefix') format('embedded-opentype'),
url('../font/zwiico.woff2?3721857') format('woff2'),
url('../font/zwiico.woff?3721857') format('woff'),
url('../font/zwiico.ttf?3721857') format('truetype'),
url('../font/zwiico.svg?3721857#zwiico') format('svg');
font-weight: normal;
font-style: normal;
}
@ -15,7 +15,7 @@
@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: 'zwiico';
src: url('../font/zwiico.svg?91953221#zwiico') format('svg');
src: url('../font/zwiico.svg?3721857#zwiico') format('svg');
}
}
*/
@ -96,6 +96,11 @@
.zwiico-search:before { content: '\e826'; } /* '' */
.zwiico-eye-1:before { content: '\e827'; } /* '' */
.zwiico-eq:before { content: '\e828'; } /* '' */
.zwiico-right-open:before { content: '\e829'; } /* '' */
.zwiico-left-big:before { content: '\e82a'; } /* '' */
.zwiico-right-big:before { content: '\e82b'; } /* '' */
.zwiico-up-dir:before { content: '\e82c'; } /* '' */
.zwiico-right-dir:before { content: '\e82d'; } /* '' */
.zwiico-spin:before { content: '\e831'; } /* '' */
.zwiico-twitter:before { content: '\f099'; } /* '' */
.zwiico-facebook:before { content: '\f09a'; } /* '' */

Binary file not shown.

View File

@ -90,6 +90,16 @@
<glyph glyph-name="eq" unicode="&#xe828;" d="M729 637q44 0 74-31t31-73-31-73-74-31l-625 0q-44 0-74 30t-30 74 30 74 74 30l625 0z m0-364q44 0 74-31t31-74q0-43-31-73t-74-31l-625 0q-44 0-74 30t-30 74 31 74 73 31l625 0z" horiz-adv-x="834" />
<glyph glyph-name="right-open" unicode="&#xe829;" d="M618 361l-414-415q-11-10-25-10t-25 10l-93 93q-11 11-11 25t11 25l296 297-296 296q-11 11-11 25t11 25l93 93q10 11 25 11t25-11l414-414q10-11 10-25t-10-25z" horiz-adv-x="714.3" />
<glyph glyph-name="left-big" unicode="&#xe82a;" d="M857 350v-71q0-30-18-51t-47-21h-393l164-164q21-20 21-50t-21-50l-42-43q-21-20-51-20-29 0-50 20l-364 364q-20 21-20 50 0 29 20 51l364 363q21 21 50 21 29 0 51-21l42-41q21-22 21-51t-21-51l-164-164h393q29 0 47-20t18-51z" horiz-adv-x="857.1" />
<glyph glyph-name="right-big" unicode="&#xe82b;" d="M821 314q0-30-20-50l-363-364q-22-20-51-20-29 0-50 20l-42 42q-22 21-22 51t22 51l163 163h-393q-29 0-47 21t-18 51v71q0 30 18 51t47 20h393l-163 165q-22 20-22 50t22 50l42 42q21 21 50 21 29 0 51-21l363-363q20-20 20-51z" horiz-adv-x="857.1" />
<glyph glyph-name="up-dir" unicode="&#xe82c;" d="M571 171q0-14-10-25t-25-10h-500q-15 0-25 10t-11 25 11 26l250 250q10 10 25 10t25-10l250-250q10-11 10-26z" horiz-adv-x="571.4" />
<glyph glyph-name="right-dir" unicode="&#xe82d;" d="M321 350q0-14-10-25l-250-250q-11-11-25-11t-25 11-11 25v500q0 15 11 25t25 11 25-11l250-250q10-10 10-25z" horiz-adv-x="357.1" />
<glyph glyph-name="spin" unicode="&#xe831;" d="M46 144l0 0c0 0-1 0-1 0-8 18-15 37-21 55-6 19-11 38-15 58-19 99-8 203 35 298 3 6 10 8 15 5 1 0 2 0 2-1l0 0 80-59c5-3 6-9 4-14-5-12-9-25-12-37-4-13-7-26-9-40-11-67-3-137 23-201 2-5 0-10-4-13l0 0-80-56c-5-4-12-2-16 3-1 0-1 1-1 2l0 0z m120 574l0 0c0 1 0 1 0 1 15 13 30 25 46 37 16 11 33 22 51 31 89 50 192 72 297 60 6-1 10-6 10-13 0-1-1-1-1-2l0 0-31-94c-2-5-8-8-13-7-13 0-27 0-40 0-14-1-27-2-40-4-68-11-133-40-186-84-4-3-10-3-14 0l0 0-79 58c-5 3-6 11-2 16 0 0 1 1 2 1l0 0z m588 65l0 0c0 0 1 0 1 0 17-10 34-21 50-32 16-12 31-25 46-38 74-69 127-160 148-262 2-6-2-12-9-13-1 0-1 0-2 0l0 0-100 1c-5 0-10 4-11 9-3 13-8 26-12 38-5 12-10 25-17 36-31 61-78 113-137 150-5 3-6 8-5 13l0 0 31 92c2 6 9 9 15 7 1 0 2-1 2-1l0 0z m244-535l0 0c0 0 0 0 0 0-4-20-9-39-15-57-7-19-14-37-22-55-44-92-114-170-205-221-6-3-13-1-16 4 0 1-1 2-1 2l0 0-30 94c-2 6 1 12 6 14 11 7 22 15 32 23 11 9 21 18 30 27 49 48 84 109 101 176 2 5 6 8 11 8l0 0 98-1c6 0 11-5 11-11 0-1 0-2 0-3l0 0z m-438-395l0 0c0 0 0 0 0 0-20-2-40-3-60-3-20 0-40 1-59 4-102 12-198 54-276 125-5 4-5 11 0 16 0 0 1 1 1 1l0 0 81 58c5 3 12 2 16-2 10-8 20-16 32-23 11-7 22-14 34-20 62-31 131-45 200-41 6 0 10-3 12-8l0 0 29-92c2-6-1-12-7-14-1-1-2-1-3-1l0 0z" horiz-adv-x="1000" />
<glyph glyph-name="twitter" unicode="&#xf099;" d="M904 622q-37-54-90-93 0-8 0-23 0-73-21-145t-64-139-103-117-144-82-181-30q-151 0-276 81 19-2 43-2 126 0 224 77-59 1-105 36t-64 89q19-3 34-3 24 0 48 6-63 13-104 62t-41 115v2q38-21 82-23-37 25-59 64t-22 86q0 49 25 91 68-83 164-133t208-55q-5 21-5 41 0 75 53 127t127 53q79 0 132-57 61 12 115 44-21-64-80-100 52 6 104 28z" horiz-adv-x="928.6" />

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

128
module/nav/nav.php Normal file
View File

@ -0,0 +1,128 @@
<?php
/**
* This file is part of Zwii.
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
*
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2023, Frédéric Tempez
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
* @link http://zwiicms.fr/
*/
class nav extends common
{
const VERSION = '0.1';
const REALNAME = 'Navigation';
public static $actions = [
'index' => self::GROUP_VISITOR,
'config' => self::GROUP_EDITOR,
];
public static $previousPage = '';
public static $nextPage = '';
public static $iconTemplate = [
'open' => [
'left' => 'left-open',
'right' => 'right-open',
],
'dir' => [
'left' => 'left',
'right' => 'right-dir',
],
'big' => [
'left' => 'left-big',
'right' => 'right-big',
],
];
public static $iconTemplateName = [
'dir' => 'Triangle',
'open' => 'Ouverte',
'big' => 'Flèche',
];
public static $leftButton = 'left';
public static $rightButton = 'right-dir';
public function index()
{
$hierarchy = array();
foreach ($this->getHierarchy() as $parentKey => $parentValue) {
$hierarchy[] = $parentKey;
foreach ($parentValue as $childKey) {
$hierarchy[] = $childKey;
}
}
// Parcourir la hiérarchie et rechercher les éléments avant et après
$elementToFind = $this->getUrl(0);
// Trouver la clé de l'élément recherché
$key = array_search($elementToFind, $hierarchy);
if ($key !== false) {
// Trouver l'élément précédent
$previousKey = ($key > 0) ? $key - 1 : null;
$previousValue = ($previousKey !== null) ? $hierarchy[$previousKey] : null;
// Trouver l'élément suivant
$nextKey = ($key < count($hierarchy) - 1) ? $key + 1 : null;
$nextValue = ($nextKey !== null) ? $hierarchy[$nextKey] : null;
self::$previousPage = $previousValue;
self::$nextPage = $nextValue;
}
// Jeux d'icônes
if ($this->getData(['module', $this->getUrl(0), 'iconTemplate'])) {
self::$leftButton = self::$iconTemplate[$this->getData(['module', $this->getUrl(0), 'iconTemplate'])]['left'];
self::$rightButton = self::$iconTemplate[$this->getData(['module', $this->getUrl(0), 'iconTemplate'])]['right'];
}
// Valeurs en sortie
$this->addOutput([
'showBarEditButton' => true,
'showPageContent' => true,
'view' => 'index',
]);
}
public function config()
{
// Soumission du formulaire
if (
$this->getUser('permission', __CLASS__, __FUNCTION__) === true &&
$this->isPost()
) {
$this->setData([
'module',
$this->getUrl(0),
[
'iconTemplate' => $this->getInput('navConfigIconTemplate', null),
]
]);
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Modifications enregistrées',
'state' => true
]);
}
// Valeurs en sortie
$this->addOutput([
'title' => 'Configuration du module',
'view' => 'config'
]);
}
}

View File

@ -0,0 +1,15 @@
/**
* This file is part of Zwii.
*
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
*
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2023, Frédéric Tempez
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
* @link http://zwiicms.fr/
*/
/** NE PAS EFFACER
* admin.css
*/

View File

@ -0,0 +1,34 @@
<?php echo template::formOpen('navConfig'); ?>
<div class="row">
<div class="col1">
<?php echo template::button('navConfigBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
'value' => template::ico('left')
]); ?>
</div>
<div class="col2 offset9">
<?php echo template::submit('navConfigSubmit'); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>
<?php echo helper::translate('Thème'); ?>
</h4>
<div class="row">
<div class="col4 offset4 ">
<?php echo template::select('navConfigIconTemplate', $module::$iconTemplateName, [
'label' => 'Icônes',
'selected' => $this->getData(['module', $this->getUrl(0), 'iconTemplate'])
]); ?>
</div>
</div>
</div>
</div>
</div>
<?php echo template::formClose(); ?>
<div class="moduleVersion">Version
<?php echo $module::VERSION; ?>
</div>

View File

@ -0,0 +1,18 @@
<div class="row">
<div class="col1 textAlignCenter">
<?php if ($module::$previousPage !== null) {
echo template::button('navPreviousButton', [
'href' => helper::baseUrl() . $module::$previousPage,
'value' => template::ico($module::$leftButton)
]);
} ?>
</div>
<div class="col1 offset10 textAlignCenter">
<?php if ($module::$nextPage !== null) {
echo template::button('nabNextButton', [
'href' => helper::baseUrl() . $module::$nextPage,
'value' => template::ico($module::$rightButton)
]);
} ?>
</div>
</div>