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
|
|
|
|
2018-04-02 08:29:19 +02:00
|
|
|
tinymce.init({
|
|
|
|
// Classe où appliquer l'éditeur
|
|
|
|
selector: ".editorWysiwyg",
|
2019-11-13 20:27:32 +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());
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
2018-04-02 08:29:19 +02:00
|
|
|
// Langue
|
|
|
|
language: "fr_FR",
|
|
|
|
// Plugins
|
2020-03-15 08:44:46 +01:00
|
|
|
plugins: "advlist anchor autolink autoresize autosave codemirror colorpicker contextmenu fullscreen hr image imagetools link lists media paste searchreplace stickytoolbar tabfocus table template textcolor codesample",
|
2018-04-02 08:29:19 +02:00
|
|
|
// Contenu de la barre d'outils
|
2020-03-15 17:09:56 +01:00
|
|
|
toolbar: "restoredraft | undo redo | bold italic underline forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist | template code | image media link | fullscreen",
|
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-03-14 10:32:17 +01:00
|
|
|
/*theme: 'ambiance',*/
|
2020-03-14 19:12:11 +01:00
|
|
|
fullscreen: true,
|
|
|
|
/*mode: 'application/x-httpd-php',*/
|
2020-03-14 10:11:51 +01:00
|
|
|
indentUnit: 4,
|
|
|
|
lineNumbers: true,
|
|
|
|
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',
|
|
|
|
],
|
|
|
|
cssFiles: [
|
2020-03-14 10:32:17 +01:00
|
|
|
/*'theme/ambiance.css',*/
|
2020-03-14 10:11:51 +01:00
|
|
|
],
|
|
|
|
width: 1000, // Default value is 800
|
2020-03-14 19:12:11 +01:00
|
|
|
height: 600 // Default value is 550
|
2019-01-22 21:09:09 +01:00
|
|
|
},
|
2019-03-14 19:04:03 +01:00
|
|
|
// Cibles de la target
|
|
|
|
target_list: [
|
|
|
|
{title: 'None', value: ''},
|
|
|
|
{title: 'Nouvel onglet', value: '_blank'}
|
|
|
|
],
|
|
|
|
// Target pour lightbox
|
|
|
|
rel_list: [
|
|
|
|
{title: 'None', value: ''},
|
2020-02-26 23:45:49 +01:00
|
|
|
{title: 'Une popup (Lity)', value: 'data-lity'},
|
|
|
|
{title: 'Une galerie d\'images (SimpleLightbox)', value: 'gallery'}
|
2019-03-14 19:04:03 +01: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",
|
2018-04-02 08:29:19 +02:00
|
|
|
// Contenu du menu contextuel
|
2020-03-15 08:44:46 +01:00
|
|
|
contextmenu: "selectall searchreplace | hr | media image link anchor | inserttable 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"
|
|
|
|
],
|
2019-11-13 20:27:32 +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
|
|
|
|
link_context_toolbar: true,
|
2018-04-02 08:29:19 +02:00
|
|
|
// Cache la barre de statut
|
|
|
|
statusbar: false,
|
2019-11-26 11:00:19 +01:00
|
|
|
// Autorise tous les éléments
|
|
|
|
valid_elements :"*[*]",
|
|
|
|
valid_children : "*[*]",
|
2019-11-28 14:55:02 +01:00
|
|
|
// Autorise l'ajout de script
|
|
|
|
// extended_valid_elements: "script[language|type|src]",
|
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
|
|
|
|
relative_urls: false,
|
|
|
|
// 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"
|
|
|
|
},
|
|
|
|
// Thème mobile
|
2019-03-18 16:13:53 +01:00
|
|
|
// mobile: {
|
|
|
|
// theme: "mobile",
|
|
|
|
// plugins: [ 'autosave', 'lists', 'autolink' ],
|
|
|
|
// toolbar: [ 'undo', 'bold', 'italic', 'styleselect' ]
|
|
|
|
//},
|
2018-04-02 08:29:19 +02:00
|
|
|
// 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: [
|
|
|
|
{title: "Headers", items: [
|
|
|
|
{title: "Header 1", format: "h1"},
|
|
|
|
{title: "Header 2", format: "h2"},
|
|
|
|
{title: "Header 3", format: "h3"},
|
|
|
|
{title: "Header 4", format: "h4"}
|
|
|
|
]},
|
|
|
|
{title: "Inline", items: [
|
|
|
|
{title: "Bold", icon: "bold", format: "bold"},
|
|
|
|
{title: "Italic", icon: "italic", format: "italic"},
|
|
|
|
{title: "Underline", icon: "underline", format: "underline"},
|
|
|
|
{title: "Strikethrough", icon: "strikethrough", format: "strikethrough"},
|
|
|
|
{title: "Superscript", icon: "superscript", format: "superscript"},
|
|
|
|
{title: "Subscript", icon: "subscript", format: "subscript"},
|
|
|
|
{title: "Code", icon: "code", format: "code"}
|
|
|
|
]},
|
|
|
|
{title: "Blocks", items: [
|
|
|
|
{title: "Paragraph", format: "p"},
|
|
|
|
{title: "Blockquote", format: "blockquote"},
|
|
|
|
{title: "Div", format: "div"},
|
|
|
|
{title: "Pre", format: "pre"}
|
|
|
|
]},
|
|
|
|
{title: "Alignment", items: [
|
|
|
|
{title: "Left", icon: "alignleft", format: "alignleft"},
|
|
|
|
{title: "Center", icon: "aligncenter", format: "aligncenter"},
|
|
|
|
{title: "Right", icon: "alignright", format: "alignright"},
|
|
|
|
{title: "Justify", icon: "alignjustify", format: "alignjustify"}
|
|
|
|
]}
|
|
|
|
],
|
|
|
|
// 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
|
|
|
});
|
|
|
|
|
|
|
|
|
2019-03-13 17:11:04 +01:00
|
|
|
|
2019-03-11 16:56:56 +01:00
|
|
|
tinymce.PluginManager.add('stickytoolbar', function(editor, url) {
|
|
|
|
editor.on('init', function() {
|
|
|
|
setSticky();
|
|
|
|
});
|
|
|
|
|
|
|
|
$(window).on('scroll', function() {
|
|
|
|
setSticky();
|
|
|
|
});
|
2019-11-13 20:27:32 +01:00
|
|
|
|
2019-03-11 16:56:56 +01:00
|
|
|
function setSticky() {
|
|
|
|
var container = editor.editorContainer;
|
|
|
|
var toolbars = $(container).find('.mce-toolbar-grp');
|
|
|
|
var statusbar = $(container).find('.mce-statusbar');
|
|
|
|
|
|
|
|
if (isSticky()) {
|
|
|
|
$(container).css({
|
|
|
|
paddingTop: toolbars.outerHeight()
|
|
|
|
});
|
|
|
|
|
|
|
|
if (isAtBottom()) {
|
|
|
|
toolbars.css({
|
|
|
|
top: 'auto',
|
|
|
|
bottom: statusbar.outerHeight(),
|
|
|
|
position: 'absolute',
|
|
|
|
width: '100%',
|
|
|
|
borderBottom: 'none'
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
toolbars.css({
|
2019-03-12 09:11:39 +01:00
|
|
|
top: 45,
|
2019-03-11 16:56:56 +01:00
|
|
|
bottom: 'auto',
|
|
|
|
position: 'fixed',
|
|
|
|
width: $(container).width(),
|
|
|
|
borderBottom: '1px solid rgba(0,0,0,0.2)'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$(container).css({
|
|
|
|
paddingTop: 0
|
|
|
|
});
|
|
|
|
|
|
|
|
toolbars.css({
|
2019-11-13 20:27:32 +01:00
|
|
|
top:0,
|
2019-03-11 16:56:56 +01:00
|
|
|
position: 'relative',
|
|
|
|
width: 'auto',
|
|
|
|
borderBottom: 'none'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function isSticky() {
|
|
|
|
var container = editor.editorContainer,
|
|
|
|
editorTop = container.getBoundingClientRect().top;
|
|
|
|
|
|
|
|
if (editorTop < 0) {
|
|
|
|
return true;
|
|
|
|
}
|
2019-11-13 20:27:32 +01:00
|
|
|
|
2019-03-11 16:56:56 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function isAtBottom() {
|
|
|
|
var container = editor.editorContainer,
|
|
|
|
editorTop = container.getBoundingClientRect().top;
|
|
|
|
|
|
|
|
var toolbarHeight = $(container).find('.mce-toolbar-grp').outerHeight();
|
|
|
|
var footerHeight = $(container).find('.mce-statusbar').outerHeight();
|
|
|
|
|
|
|
|
var hiddenHeight = -($(container).outerHeight() - toolbarHeight - footerHeight);
|
2019-11-13 20:27:32 +01:00
|
|
|
|
|
|
|
if (editorTop < hiddenHeight) {
|
2019-03-11 16:56:56 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2019-03-15 12:18:08 +01:00
|
|
|
});
|