TinyMCE deux barres d'outils
This commit is contained in:
parent
fb18127346
commit
446ad40f96
146
core/vendor/tinymce/init.js
vendored
146
core/vendor/tinymce/init.js
vendored
@ -31,25 +31,39 @@ 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: {
|
||||
edit: {title: 'Edit', items: 'undo redo | selectall searchreplace | cut copy paste pastetext | style'},
|
||||
insert: {title: 'Insert', items: 'template | nonbreaking hr charmap anchor | abbr insertdatetime '},
|
||||
format: {title: 'Format', items: 'underline strikethrough superscript subscript | forecolor backcolor | formats | removeformat'},
|
||||
table: {title: 'Table', items: 'inserttable tableprops deletetable | cell row column'},
|
||||
|
||||
edit: {
|
||||
title: 'Edit',
|
||||
items: 'undo redo | selectall searchreplace | cut copy paste pastetext | style'
|
||||
},
|
||||
insert: {
|
||||
title: 'Insert',
|
||||
items: 'template | nonbreaking hr charmap anchor | abbr insertdatetime '
|
||||
},
|
||||
format: {
|
||||
title: 'Format',
|
||||
items: 'underline strikethrough superscript subscript | forecolor backcolor | formats | removeformat'
|
||||
},
|
||||
table: {
|
||||
title: 'Table',
|
||||
items: 'inserttable tableprops deletetable | cell row column'
|
||||
},
|
||||
},
|
||||
// Contenu de la barre d'outils
|
||||
toolbar: "ndo redo | bold italic strikethrough | h1 h2 h3 | alignleft aligncenter alignright alignjustify | link | bullist numlist | image media | fullscreen",
|
||||
toolbar: [
|
||||
"fontselect fontsizeselect formatselect | bold italic strikethrough forecolor backcolor",
|
||||
"link image ImgPen media | alignleft aligncenter alignright alignjustify | " +
|
||||
"numlist bullist | outdent indent removeformat"
|
||||
],
|
||||
toolbar_sticky: true,
|
||||
fontsize_formats:
|
||||
"8pt 9pt 10pt 11pt 12pt 14pt 18pt 24pt 30pt 36pt 48pt 60pt 72pt 96pt",
|
||||
fontsize_formats: "8pt 9pt 10pt 11pt 12pt 14pt 18pt 24pt 30pt 36pt 48pt 60pt 72pt 96pt",
|
||||
theme: "silver",
|
||||
max_height: 600,
|
||||
// CodeMirror
|
||||
codemirror: {
|
||||
indentOnInit: true, // Whether or not to indent code on init.
|
||||
path: 'codemirror', // Path to CodeMirror distribution
|
||||
saveCursorPosition: false, // Insert caret marker
|
||||
config: { // CodeMirror config object
|
||||
saveCursorPosition: false, // Insert caret marker
|
||||
config: { // CodeMirror config object
|
||||
fullscreen: true,
|
||||
/*mode: 'application/x-httpd-php',*/
|
||||
lineNumbers: true,
|
||||
@ -70,26 +84,39 @@ tinymce.init({
|
||||
cssFiles: [
|
||||
'theme/cobalt.css',
|
||||
],*/
|
||||
width: 800, // Default value is 800
|
||||
height: 500 // Default value is 550
|
||||
width: 800, // Default value is 800
|
||||
height: 500 // Default value is 550
|
||||
},
|
||||
// Cibles de la target
|
||||
target_list: [
|
||||
{ title: 'None', value: '' },
|
||||
{ title: 'Nouvel onglet', value: '_blank' }
|
||||
target_list: [{
|
||||
title: 'None',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
title: 'Nouvel onglet',
|
||||
value: '_blank'
|
||||
}
|
||||
],
|
||||
// Target pour lightbox
|
||||
rel_list: [
|
||||
{ title: 'None', value: '' },
|
||||
{ title: 'Une popup (Lity)', value: 'data-lity' },
|
||||
{ title: 'Une galerie d\'images (SimpleLightbox)', value: 'gallery' }
|
||||
rel_list: [{
|
||||
title: 'None',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
title: 'Une popup (Lity)',
|
||||
value: 'data-lity'
|
||||
},
|
||||
{
|
||||
title: 'Une galerie d\'images (SimpleLightbox)',
|
||||
value: 'gallery'
|
||||
}
|
||||
],
|
||||
// Titre des image
|
||||
image_title: true,
|
||||
// Pages internes
|
||||
link_list: baseUrl + "core/vendor/tinymce/links.php",
|
||||
// Contenu du menu contextuel
|
||||
contextmenu: "exelink | inserttable | cell row column deletetable",
|
||||
contextmenu: "inserttable cell row column deletetable",
|
||||
// Fichiers CSS à intégrer à l'éditeur
|
||||
content_css: [
|
||||
baseUrl + "core/layout/common.css",
|
||||
@ -138,29 +165,57 @@ tinymce.init({
|
||||
// Contenu du bouton insérer
|
||||
insert_button_items: "anchor hr table",
|
||||
// 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: "Header 5", format: "h5" },
|
||||
{ title: "Header 6", format: "h6" }
|
||||
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: "Header 5",
|
||||
format: "h5"
|
||||
},
|
||||
{
|
||||
title: "Header 6",
|
||||
format: "h6"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "Blocks", items: [
|
||||
{ title: "Paragraph", format: "p" },
|
||||
{ title: "Citation", format: "blockquote" },
|
||||
{ title: "Div", format: "div" },
|
||||
{ title: "Pre", format: "pre" }
|
||||
]
|
||||
title: "Blocks",
|
||||
items: [{
|
||||
title: "Paragraph",
|
||||
format: "p"
|
||||
},
|
||||
{
|
||||
title: "Citation",
|
||||
format: "blockquote"
|
||||
},
|
||||
{
|
||||
title: "Div",
|
||||
format: "div"
|
||||
},
|
||||
{
|
||||
title: "Pre",
|
||||
format: "pre"
|
||||
}
|
||||
],
|
||||
}
|
||||
],
|
||||
// Templates
|
||||
templates: [
|
||||
{
|
||||
templates: [{
|
||||
title: "Bloc de texte",
|
||||
url: baseUrl + "core/vendor/tinymce/templates/block.html",
|
||||
description: "Bloc de texte avec un titre."
|
||||
@ -225,7 +280,9 @@ tinymce.init({
|
||||
var id_alarm = "#blogArticleContentAlarm"
|
||||
var contentLength = 0;
|
||||
ed.on("keydown", function (e) {
|
||||
contentLength = ed.getContent({ format: 'text' }).length;
|
||||
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) {
|
||||
@ -233,19 +290,19 @@ tinymce.init({
|
||||
e.stopPropagation();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (maxlength - contentLength < alarmCaraMin) {
|
||||
$(id_alarm).html((maxlength - contentLength) + " caractères restants");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$(id_alarm).html(" ");
|
||||
}
|
||||
}
|
||||
});
|
||||
// Limitation y compris lors d'un copier/coller
|
||||
ed.on("paste", function (e) {
|
||||
contentLeng = ed.getContent({ format: 'text' }).length - 16;
|
||||
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 ! ");
|
||||
@ -253,8 +310,7 @@ tinymce.init({
|
||||
} else {
|
||||
if (maxlength - contentLeng < alarmCaraMin) {
|
||||
$(id_alarm).html((maxlength - contentLeng - data.length) + " caractères restants");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$(id_alarm).html(" ");
|
||||
}
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user