Ajout de la classe editorWysiwygComment
This commit is contained in:
parent
249e173b3e
commit
ef141d72bf
153
core/vendor/tinymce/init.js
vendored
153
core/vendor/tinymce/init.js
vendored
@ -4,6 +4,13 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Quand tinyMCE est invoqué hors connexion, initialiser privateKey
|
||||||
|
*/
|
||||||
|
if ( typeof(privateKey) == 'undefined') {
|
||||||
|
var privateKey = null;
|
||||||
|
};
|
||||||
|
|
||||||
tinymce.init({
|
tinymce.init({
|
||||||
// Classe où appliquer l'éditeur
|
// Classe où appliquer l'éditeur
|
||||||
selector: ".editorWysiwyg",
|
selector: ".editorWysiwyg",
|
||||||
@ -118,12 +125,6 @@ tinymce.init({
|
|||||||
external_plugins: {
|
external_plugins: {
|
||||||
"filemanager": baseUrl + "core/vendor/filemanager/plugin.min.js"
|
"filemanager": baseUrl + "core/vendor/filemanager/plugin.min.js"
|
||||||
},
|
},
|
||||||
// Thème mobile
|
|
||||||
// mobile: {
|
|
||||||
// theme: "mobile",
|
|
||||||
// plugins: [ 'autosave', 'lists', 'autolink' ],
|
|
||||||
// toolbar: [ 'undo', 'bold', 'italic', 'styleselect' ]
|
|
||||||
//},
|
|
||||||
// Contenu du bouton insérer
|
// Contenu du bouton insérer
|
||||||
insert_button_items: "anchor hr table",
|
insert_button_items: "anchor hr table",
|
||||||
// Contenu du bouton formats
|
// Contenu du bouton formats
|
||||||
@ -206,6 +207,144 @@ tinymce.init({
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
tinymce.init({
|
||||||
|
// Classe où appliquer l'éditeur
|
||||||
|
selector: ".editorWysiwygComment",
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(maxlength - contentLength < alarmCaraMin){
|
||||||
|
$(id_alarm).html((maxlength - contentLength) + " caractères restants");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$(id_alarm).html(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 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");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$(id_alarm).html(" ");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// Langue
|
||||||
|
language: "fr_FR",
|
||||||
|
// Plugins
|
||||||
|
plugins: "advlist anchor autolink autoresize autosave colorpicker contextmenu fullscreen hr lists paste searchreplace stickytoolbar tabfocus template textcolor visualblocks emoticons",
|
||||||
|
// Contenu de la barre d'outils
|
||||||
|
toolbar: "restoredraft | undo redo | styleselect | bold italic forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist emoticons | visualblocks fullscreen",
|
||||||
|
// Emoticons
|
||||||
|
emoticons_append: {
|
||||||
|
custom_mind_explode: {
|
||||||
|
keywords: ["brain", "mind", "explode", "blown"],
|
||||||
|
char: "🤯"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Titre des images
|
||||||
|
image_title: true,
|
||||||
|
// Pages internes
|
||||||
|
link_list: baseUrl + "core/vendor/tinymce/links.php",
|
||||||
|
// Contenu du menu contextuel
|
||||||
|
contextmenu: "cut copy paste pastetext | selectall searchreplace ",
|
||||||
|
// 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"
|
||||||
|
],
|
||||||
|
// Classe à ajouter à la balise body dans l'iframe
|
||||||
|
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
|
||||||
|
paste_data_images: true,
|
||||||
|
// Autorise tous les éléments
|
||||||
|
//valid_elements :"*[*]",
|
||||||
|
//valid_children : "*[*]",
|
||||||
|
// Autorise l'ajout de script
|
||||||
|
// extended_valid_elements: "script[language|type|src]",
|
||||||
|
// 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
|
||||||
|
relative_urls: false,
|
||||||
|
// Url de base
|
||||||
|
document_base_url: baseUrl,
|
||||||
|
// 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"}
|
||||||
|
]}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tinymce.PluginManager.add('stickytoolbar', function(editor, url) {
|
tinymce.PluginManager.add('stickytoolbar', function(editor, url) {
|
||||||
editor.on('init', function() {
|
editor.on('init', function() {
|
||||||
setSticky();
|
setSticky();
|
||||||
@ -297,4 +436,4 @@ tinymce.PluginManager.add('stickytoolbar', function(editor, url) {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user