FAQ + TinyMCE globale
This commit is contained in:
46
js/tinyMce.js
Normal file
46
js/tinyMce.js
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
tinymce.init({
|
||||
selector: "textarea",
|
||||
height: 400,
|
||||
language: "fr-FR",
|
||||
branding: false,
|
||||
menubar: false,
|
||||
menu: {},
|
||||
plugins: "link, lists fullscreen",
|
||||
|
||||
toolbar: "h3 h4 h5 h6 | undo redo | link | bold | bullist numlist | outdent indent | fullscreen",
|
||||
license_key: 'gpl',
|
||||
setup: function (editor) {
|
||||
['h3', 'h4', 'h5', 'h6'].forEach(function (tag) {
|
||||
editor.ui.registry.addToggleButton(tag, {
|
||||
text: tag.toUpperCase(),
|
||||
tooltip: 'Titre ' + tag.substring(1),
|
||||
onAction: function () {
|
||||
try {
|
||||
if (editor.formatter && typeof editor.formatter.toggle === 'function') {
|
||||
editor.formatter.toggle(tag);
|
||||
} else {
|
||||
editor.execCommand('FormatBlock', false, tag);
|
||||
}
|
||||
} catch (e) {
|
||||
// fallback
|
||||
editor.execCommand('FormatBlock', false, tag);
|
||||
}
|
||||
},
|
||||
onSetup: function (api) {
|
||||
var nodeChangeHandler = function () {
|
||||
try {
|
||||
api.setActive(editor.formatter ? !!editor.formatter.match(tag) : false);
|
||||
} catch (e) {
|
||||
api.setActive(false);
|
||||
}
|
||||
};
|
||||
editor.on('NodeChange', nodeChangeHandler);
|
||||
return function () {
|
||||
editor.off('NodeChange', nodeChangeHandler);
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user