Mejoras al editor de texto TinyMCE
- Agregar los caracteres matemáticos más usados a la barra, como simple botones
- Sanitizar imput
crea un example plugin que puede servir para la explicacion de matefun
https://fiddle.tiny.cloud/ngdaab/0
<script type="text/javascript">
function getTexto(){
console.log(window.getSelection().toString());
return window.getSelection().toString();
}
tinymce.PluginManager.add('example', function(editor, url) {
// Add a button that opens a window
editor.addButton('example', {
text: 'My button',
icon: false,
onclick: function() {
// Open window
editor.windowManager.open({
title: 'Example plugin',
body: [
{type: 'textbox', name: 'title', label: 'Title', value: getTexto()}
],
onsubmit: function(e) {
// Insert content when the window form is submitted
editor.insertContent('Title: ' + e.data.title);
}
});
}
});
// Adds a menu item to the tools menu
editor.addMenuItem('example', {
text: 'Example plugin',
context: 'tools',
onclick: function() {
// Open window with a specific url
editor.windowManager.open({
title: 'TinyMCE site',
url: 'http://www.tinymce.com',
width: 400,
height: 300,
buttons: [{
text: 'Close',
onclick: 'close'
}]
});
}
});
});
tinymce.init({
selector: "textarea",
plugins: "example",
toolbar: "example undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
});
</script>
<form method="post" action="dump.php">
<textarea name="content">
Hola texto de prueba
lorem impsum dolorem siamet
</textarea>
</form>
precompilar assets https://github.com/spohlenz/tinymce-rails#asset-compilation
--Subir imag, doc locales
Edited by Veronica Dahiana Bentancor Cedrez