2018-04-02 08:29:19 +02:00
|
|
|
/**
|
2019-11-13 20:27:32 +01:00
|
|
|
|
2018-04-02 08:29:19 +02:00
|
|
|
* Initialisation de TinyMCE
|
2019-11-13 20:27:32 +01:00
|
|
|
|
2018-04-02 08:29:19 +02:00
|
|
|
*/
|
2019-11-13 20:27:32 +01:00
|
|
|
|
2022-11-07 17:44:38 +01:00
|
|
|
/**
|
|
|
|
* Quand tinyMCE est invoqué hors connexion, initialiser privateKey
|
|
|
|
*/
|
|
|
|
if (typeof (privateKey) == 'undefined') {
|
2020-07-06 11:46:34 +02:00
|
|
|
var privateKey = null;
|
|
|
|
};
|
2023-03-02 14:47:41 +01:00
|
|
|
console.log(getCookie('ZWII_UI'));
|
2018-04-02 08:29:19 +02:00
|
|
|
tinymce.init({
|
|
|
|
// Classe où appliquer l'éditeur
|
|
|
|
selector: ".editorWysiwyg",
|
2022-11-07 17:44:38 +01:00
|
|
|
// Aperçu dans le pied de page
|
|
|
|
setup: function (ed) {
|
|
|
|
ed.on('change', function (e) {
|
|
|
|
if (ed.id === 'themeFooterText') {
|
|
|
|
$("#footerText").html(tinyMCE.get('themeFooterText').getContent());
|
|
|
|
}
|
|
|
|
if (ed.id === 'themeHeaderText') {
|
|
|
|
$("#featureContent").html(tinyMCE.get('themeHeaderText').getContent());
|
|
|
|
}
|
2021-11-21 10:28:06 +01:00
|
|
|
|
2022-11-07 17:44:38 +01:00
|
|
|
});
|
|
|
|
},
|
2018-04-02 08:29:19 +02:00
|
|
|
// Langue
|
2023-02-16 16:03:14 +01:00
|
|
|
language: getCookie('ZWII_UI') === null ? "fr_FR" : getCookie('ZWII_UI'),
|
2018-04-02 08:29:19 +02:00
|
|
|
// Plugins
|
2022-11-29 15:07:37 +01:00
|
|
|
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",
|
2023-02-16 16:03:14 +01:00
|
|
|
// 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' }
|
|
|
|
},
|
2018-04-02 08:29:19 +02:00
|
|
|
// Contenu de la barre d'outils
|
2022-11-08 08:41:57 +01:00
|
|
|
toolbar: "bold italic underline strikethrough formatgroup | h1 h2 h3 paragraphgroup | link image insertgroup| visualblocks code fullscreen",
|
2022-11-07 17:44:38 +01:00
|
|
|
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'
|
|
|
|
}
|
|
|
|
},
|
2023-02-16 16:03:14 +01:00
|
|
|
toolbar_sticky: true,
|
2021-11-18 17:07:57 +01:00
|
|
|
fontsize_formats:
|
2022-11-07 17:44:38 +01:00
|
|
|
"8pt 9pt 10pt 11pt 12pt 14pt 18pt 24pt 30pt 36pt 48pt 60pt 72pt 96pt",
|
2022-03-27 19:06:00 +02:00
|
|
|
theme: "silver",
|
2022-11-29 15:07:37 +01:00
|
|
|
max_height: 600,
|
2019-01-22 21:09:09 +01:00
|
|
|
// CodeMirror
|
|
|
|
codemirror: {
|
|
|
|
indentOnInit: true, // Whether or not to indent code on init.
|
|
|
|
path: 'codemirror', // Path to CodeMirror distribution
|
2020-03-14 10:11:51 +01:00
|
|
|
saveCursorPosition: false, // Insert caret marker
|
2019-01-22 21:09:09 +01:00
|
|
|
config: { // CodeMirror config object
|
2020-06-12 17:15:55 +02:00
|
|
|
fullscreen: true,
|
2020-03-14 19:12:11 +01:00
|
|
|
/*mode: 'application/x-httpd-php',*/
|
2020-03-14 10:11:51 +01:00
|
|
|
lineNumbers: true,
|
2023-02-17 16:24:11 +01:00
|
|
|
indentUnit: 4,
|
|
|
|
mode: "htmlmixed"
|
2020-03-14 19:12:11 +01:00
|
|
|
},
|
2020-03-14 10:11:51 +01:00
|
|
|
jsFiles: [
|
|
|
|
'mode/php/php.js',
|
|
|
|
'mode/css/css.js',
|
|
|
|
'mode/htmlmixed/htmlmixed.js',
|
|
|
|
'mode/htmlembedded/htmlembedded.js',
|
|
|
|
'mode/javascript/javascript.js',
|
|
|
|
'mode/xml/xml.js',
|
|
|
|
'addon/search/searchcursor.js',
|
|
|
|
'addon/search/search.js',
|
|
|
|
],
|
2022-04-08 10:57:33 +02:00
|
|
|
/*
|
2020-03-14 10:11:51 +01:00
|
|
|
cssFiles: [
|
2022-04-08 10:57:33 +02:00
|
|
|
'theme/cobalt.css',
|
|
|
|
],*/
|
2020-03-22 16:38:03 +01:00
|
|
|
width: 800, // Default value is 800
|
2020-06-12 17:15:55 +02:00
|
|
|
height: 500 // Default value is 550
|
|
|
|
},
|
2019-03-14 19:04:03 +01:00
|
|
|
// Cibles de la target
|
|
|
|
target_list: [
|
2022-11-07 17:44:38 +01:00
|
|
|
{ title: 'None', value: '' },
|
|
|
|
{ title: 'Nouvel onglet', value: '_blank' }
|
|
|
|
],
|
2019-03-14 19:04:03 +01:00
|
|
|
// Target pour lightbox
|
|
|
|
rel_list: [
|
2022-11-07 17:44:38 +01:00
|
|
|
{ title: 'None', value: '' },
|
|
|
|
{ title: 'Une popup (Lity)', value: 'data-lity' },
|
|
|
|
{ title: 'Une galerie d\'images (SimpleLightbox)', value: 'gallery' }
|
2020-06-12 17:15:55 +02:00
|
|
|
],
|
2019-03-21 10:38:44 +01:00
|
|
|
// Titre des image
|
|
|
|
image_title: true,
|
2019-03-14 19:04:03 +01:00
|
|
|
// Pages internes
|
|
|
|
link_list: baseUrl + "core/vendor/tinymce/links.php",
|
2022-11-29 10:35:39 +01:00
|
|
|
// Contenu du menu contextuel
|
|
|
|
contextmenu: "selectall searchreplace | hr | media image link anchor nonbreaking | insertable cell row column deletetable",
|
2018-04-02 08:29:19 +02:00
|
|
|
// Fichiers CSS à intégrer à l'éditeur
|
|
|
|
content_css: [
|
|
|
|
baseUrl + "core/layout/common.css",
|
|
|
|
baseUrl + "core/vendor/tinymce/content.css",
|
|
|
|
baseUrl + "site/data/theme.css",
|
|
|
|
baseUrl + "site/data/custom.css"
|
|
|
|
],
|
2022-11-07 17:44:38 +01:00
|
|
|
// Classe à ajouter à la balise body dans l'iframe
|
2018-04-02 08:29:19 +02:00
|
|
|
body_class: "editorWysiwyg",
|
|
|
|
// Cache les menus
|
2020-03-15 08:44:46 +01:00
|
|
|
menubar: true,
|
2018-04-04 21:51:33 +02:00
|
|
|
// URL menu contextuel
|
2020-06-12 17:15:55 +02:00
|
|
|
link_context_toolbar: true,
|
2018-04-02 08:29:19 +02:00
|
|
|
// Cache la barre de statut
|
2023-02-16 16:03:14 +01:00
|
|
|
statusbar: true,
|
2021-06-24 07:09:14 +02:00
|
|
|
// Coller images blob
|
|
|
|
paste_data_images: true,
|
2020-06-10 12:21:42 +02:00
|
|
|
/* Eviter BLOB à tester
|
|
|
|
images_dataimg_filter: function(img) {
|
|
|
|
return img.hasAttribute('internal-blob');
|
|
|
|
},*/
|
2021-01-03 15:12:26 +01:00
|
|
|
// Autoriser tous les éléments
|
2022-11-07 17:44:38 +01:00
|
|
|
valid_elements: '*[*]',
|
2019-11-28 14:55:02 +01:00
|
|
|
// Autorise l'ajout de script
|
2021-01-03 15:12:26 +01:00
|
|
|
extended_valid_elements: "script[language|type|src]",
|
|
|
|
// Conserver les styles
|
|
|
|
keep_styles: false,
|
2019-11-26 15:14:11 +01:00
|
|
|
// Bloque le dimensionnement des médias (car automatiquement en fullsize avec fitvids pour le responsive)
|
2019-11-26 15:17:00 +01:00
|
|
|
media_dimensions: true,
|
2019-11-26 15:14:11 +01:00
|
|
|
// Désactiver la dimension des images
|
2019-11-26 15:17:00 +01:00
|
|
|
image_dimensions: true,
|
2018-04-02 08:29:19 +02:00
|
|
|
// Active l'onglet avancé lors de l'ajout d'une image
|
|
|
|
image_advtab: true,
|
|
|
|
// Urls absolues
|
2022-12-01 20:41:59 +01:00
|
|
|
relative_urls: true,
|
2022-11-17 17:50:13 +01:00
|
|
|
// Conversion des URLs
|
2023-02-16 16:03:14 +01:00
|
|
|
convert_urls: false,
|
2018-04-02 08:29:19 +02:00
|
|
|
// Url de base
|
|
|
|
document_base_url: baseUrl,
|
|
|
|
// Gestionnaire de fichiers
|
|
|
|
filemanager_access_key: privateKey,
|
|
|
|
external_filemanager_path: baseUrl + "core/vendor/filemanager/",
|
|
|
|
external_plugins: {
|
|
|
|
"filemanager": baseUrl + "core/vendor/filemanager/plugin.min.js"
|
|
|
|
},
|
|
|
|
// Contenu du bouton insérer
|
2020-03-15 08:44:46 +01:00
|
|
|
insert_button_items: "anchor hr table",
|
2018-04-02 08:29:19 +02:00
|
|
|
// Contenu du bouton formats
|
|
|
|
style_formats: [
|
2022-11-07 17:44:38 +01:00
|
|
|
{
|
|
|
|
title: "Headers", items: [
|
|
|
|
{ title: "Header 1", format: "h1" },
|
|
|
|
{ title: "Header 2", format: "h2" },
|
|
|
|
{ title: "Header 3", format: "h3" },
|
|
|
|
{ title: "Header 4", format: "h4" }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: "Blocks", items: [
|
|
|
|
{ title: "Paragraph", format: "p" },
|
|
|
|
{ title: "Blockquote", format: "blockquote" },
|
|
|
|
{ title: "Div", format: "div" },
|
|
|
|
{ title: "Pre", format: "pre" }
|
|
|
|
]
|
|
|
|
}
|
2018-04-02 08:29:19 +02:00
|
|
|
],
|
|
|
|
// Templates
|
|
|
|
templates: [
|
|
|
|
{
|
|
|
|
title: "Bloc de texte",
|
|
|
|
url: baseUrl + "core/vendor/tinymce/templates/block.html",
|
|
|
|
description: "Bloc de texte avec un titre."
|
|
|
|
},
|
2019-11-28 14:55:02 +01:00
|
|
|
{
|
|
|
|
title: "Effet accordéon",
|
|
|
|
url: baseUrl + "core/vendor/tinymce/templates/accordion.html",
|
|
|
|
description: "Bloc de texte avec effet accordéon."
|
|
|
|
},
|
2018-04-02 08:29:19 +02:00
|
|
|
{
|
2019-01-17 19:18:50 +01:00
|
|
|
title: "Grille symétrique : 6 - 6",
|
2018-04-02 08:29:19 +02:00
|
|
|
url: baseUrl + "core/vendor/tinymce/templates/col6.html",
|
|
|
|
description: "Grille adaptative sur 12 colonnes, sur mobile elles passent les unes en dessous des autres."
|
|
|
|
},
|
|
|
|
{
|
2019-01-17 19:18:50 +01:00
|
|
|
title: "Grille symétrique : 4 - 4 - 4",
|
2018-04-02 08:29:19 +02:00
|
|
|
url: baseUrl + "core/vendor/tinymce/templates/col4.html",
|
|
|
|
description: "Grille adaptative sur 12 colonnes, sur mobile elles passent les unes en dessous des autres."
|
|
|
|
},
|
|
|
|
{
|
2019-01-17 19:18:50 +01:00
|
|
|
title: "Grille symétrique : 3 - 3 - 3 - 3",
|
2018-04-02 08:29:19 +02:00
|
|
|
url: baseUrl + "core/vendor/tinymce/templates/col3.html",
|
|
|
|
description: "Grille adaptative sur 12 colonnes, sur mobile elles passent les unes en dessous des autres."
|
|
|
|
},
|
|
|
|
{
|
2019-01-17 19:18:50 +01:00
|
|
|
title: "Grille asymétrique : 4 - 8",
|
2018-04-02 08:29:19 +02:00
|
|
|
url: baseUrl + "core/vendor/tinymce/templates/col4-8.html",
|
|
|
|
description: "Grille adaptative sur 12 colonnes, sur mobile elles passent les unes en dessous des autres."
|
|
|
|
},
|
|
|
|
{
|
2019-01-17 19:19:47 +01:00
|
|
|
title: "Grille asymétrique : 8 - 4",
|
2018-04-02 08:29:19 +02:00
|
|
|
url: baseUrl + "core/vendor/tinymce/templates/col8-4.html",
|
|
|
|
description: "Grille adaptative sur 12 colonnes, sur mobile elles passent les unes en dessous des autres."
|
|
|
|
},
|
|
|
|
{
|
2019-01-17 19:18:50 +01:00
|
|
|
title: "Grille asymétrique : 2 - 10",
|
2018-04-02 08:29:19 +02:00
|
|
|
url: baseUrl + "core/vendor/tinymce/templates/col2-10.html",
|
|
|
|
description: "Grille adaptative sur 12 colonnes, sur mobile elles passent les unes en dessous des autres."
|
|
|
|
},
|
|
|
|
{
|
2019-01-17 19:18:50 +01:00
|
|
|
title: "Grille asymétrique : 10 - 2",
|
2018-04-02 08:29:19 +02:00
|
|
|
url: baseUrl + "core/vendor/tinymce/templates/col10-2.html",
|
|
|
|
description: "Grille adaptative sur 12 colonnes, sur mobile elles passent les unes en dessous des autres."
|
|
|
|
}
|
|
|
|
]
|
2019-03-11 16:56:56 +01:00
|
|
|
});
|
|
|
|
|
2020-07-06 11:46:34 +02:00
|
|
|
|
|
|
|
tinymce.init({
|
|
|
|
// Classe où appliquer l'éditeur
|
|
|
|
selector: ".editorWysiwygComment",
|
2022-11-07 17:44:38 +01:00
|
|
|
setup: function (ed) {
|
|
|
|
// Aperçu dans le pied de page
|
|
|
|
ed.on('change', function (e) {
|
|
|
|
if (ed.id === 'themeFooterText') {
|
|
|
|
$("#footerText").html(tinyMCE.get('themeFooterText').getContent());
|
|
|
|
}
|
|
|
|
});
|
|
|
|
// Limitation du nombre de caractères des commentaires à maxlength
|
|
|
|
var alarmCaraMin = 200; // alarme sur le nombre de caractères restants à partir de...
|
|
|
|
var maxlength = parseInt($("#" + (ed.id)).attr("maxlength"));
|
|
|
|
var id_alarm = "#blogArticleContentAlarm"
|
|
|
|
var contentLength = 0;
|
|
|
|
ed.on("keydown", function (e) {
|
|
|
|
contentLength = ed.getContent({ format: 'text' }).length;
|
|
|
|
if (contentLength > maxlength) {
|
|
|
|
$(id_alarm).html("Vous avez atteint le maximum de " + maxlength + " caractères ! ");
|
|
|
|
if (e.keyCode != 8 && e.keyCode != 46) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
|
|
|
return false;
|
2020-07-06 11:46:34 +02:00
|
|
|
}
|
2022-11-07 17:44:38 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (maxlength - contentLength < alarmCaraMin) {
|
|
|
|
$(id_alarm).html((maxlength - contentLength) + " caractères restants");
|
2020-07-06 11:46:34 +02:00
|
|
|
}
|
2022-11-07 17:44:38 +01:00
|
|
|
else {
|
|
|
|
$(id_alarm).html(" ");
|
2020-07-06 11:46:34 +02:00
|
|
|
}
|
2022-11-07 17:44:38 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
// Limitation y compris lors d'un copier/coller
|
|
|
|
ed.on("paste", function (e) {
|
|
|
|
contentLeng = ed.getContent({ format: 'text' }).length - 16;
|
|
|
|
var data = e.clipboardData.getData('Text');
|
|
|
|
if (data.length > (maxlength - contentLeng)) {
|
|
|
|
$(id_alarm).html("Vous alliez dépasser le maximum de " + maxlength + " caractères ! ");
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
if (maxlength - contentLeng < alarmCaraMin) {
|
|
|
|
$(id_alarm).html((maxlength - contentLeng - data.length) + " caractères restants");
|
2020-07-06 11:46:34 +02:00
|
|
|
}
|
2022-11-07 17:44:38 +01:00
|
|
|
else {
|
|
|
|
$(id_alarm).html(" ");
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
2020-07-06 11:46:34 +02:00
|
|
|
// Langue
|
2023-02-16 16:03:14 +01:00
|
|
|
language: getCookie('ZWII_UI') === null ? "fr_FR" : getCookie('ZWII_UI'),
|
2020-07-06 11:46:34 +02:00
|
|
|
// Plugins
|
2022-11-29 11:59:04 +01:00
|
|
|
plugins: "advlist anchor autolink autoresize autosave colorpicker contextmenu hr lists paste searchreplace tabfocus template textcolor",
|
2020-07-06 11:46:34 +02:00
|
|
|
// Contenu de la barre d'outils
|
2022-11-29 11:59:04 +01:00
|
|
|
toolbar: "bold italic forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist",
|
2020-07-06 11:46:34 +02:00
|
|
|
// Titre des images
|
|
|
|
image_title: true,
|
|
|
|
// Pages internes
|
|
|
|
link_list: baseUrl + "core/vendor/tinymce/links.php",
|
2022-11-29 10:35:39 +01:00
|
|
|
// Contenu du menu contextuel
|
|
|
|
contextmenu: "cut copy paste pastetext | selectall searchreplace ",
|
2020-07-06 11:46:34 +02:00
|
|
|
// Fichiers CSS à intégrer à l'éditeur
|
|
|
|
content_css: [
|
|
|
|
baseUrl + "core/layout/common.css",
|
|
|
|
baseUrl + "core/vendor/tinymce/content.css",
|
|
|
|
baseUrl + "site/data/theme.css",
|
|
|
|
baseUrl + "site/data/custom.css"
|
|
|
|
],
|
2022-11-07 17:44:38 +01:00
|
|
|
// Classe à ajouter à la balise body dans l'iframe
|
2020-07-06 11:46:34 +02:00
|
|
|
body_class: "editorWysiwyg",
|
|
|
|
// Cache les menus
|
|
|
|
menubar: false,
|
|
|
|
// URL menu contextuel
|
|
|
|
link_context_toolbar: true,
|
|
|
|
// Cache la barre de statut
|
|
|
|
statusbar: false,
|
|
|
|
// Autorise le copié collé à partir du web
|
2021-06-24 07:09:14 +02:00
|
|
|
paste_data_images: true,
|
2020-07-06 11:46:34 +02:00
|
|
|
// Bloque le dimensionnement des médias (car automatiquement en fullsize avec fitvids pour le responsive)
|
|
|
|
media_dimensions: true,
|
|
|
|
// Désactiver la dimension des images
|
|
|
|
image_dimensions: true,
|
|
|
|
// Active l'onglet avancé lors de l'ajout d'une image
|
|
|
|
image_advtab: true,
|
|
|
|
// Urls absolues
|
2022-12-01 20:41:59 +01:00
|
|
|
relative_urls: true,
|
2022-11-17 17:50:13 +01:00
|
|
|
// Conversion des URLs
|
2023-02-16 16:03:14 +01:00
|
|
|
convert_urls: false,
|
2020-07-06 11:46:34 +02:00
|
|
|
// Url de base
|
|
|
|
document_base_url: baseUrl,
|
2022-11-29 11:59:04 +01:00
|
|
|
max_height: 200,
|
2020-07-06 11:46:34 +02:00
|
|
|
});
|
|
|
|
|
2020-06-12 17:15:55 +02:00
|
|
|
|
2022-11-07 17:44:38 +01:00
|
|
|
function getCookie(name) {
|
|
|
|
var nameEQ = name + "=";
|
|
|
|
var ca = document.cookie.split(';');
|
|
|
|
for (var i = 0; i < ca.length; i++) {
|
|
|
|
var c = ca[i];
|
|
|
|
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
2023-03-02 14:47:41 +01:00
|
|
|
if (c.indexOf(nameEQ) == 0) console.log(c.substring(nameEQ.length, c.length));
|
2022-11-07 17:44:38 +01:00
|
|
|
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
2019-03-11 16:56:56 +01:00
|
|
|
}
|
2022-11-07 17:44:38 +01:00
|
|
|
return null;
|
|
|
|
}
|