Estoy usando tinymce, ¿Es posible solicitar un solo textarea
Estoy usando tinymce, tengo varias áreas de texto en mi página. Es posible solicitar un textarea,
1 el área de texto es para la descripción la validación es como abajo
var text = tinyMCE.get('txtdesc').getContent();
Pero tengo más 3 áreas de texto más en mi página, por lo que tineMCE no debería aplicarse a todas estas áreas de texto
¿Cómo puedo aplicar solo para un área de texto
// this is my tinyMCE code tinyMCE.init({ mode : "textareas", theme : "advanced" }); // /tinyMCE
6 answers
Para la propiedad textarea
assign a class=""
to textarea, esto soportará para usted
<script type="text/javascript">
tinyMCE.init({
//mode : "textareas",
mode : "specific_textareas",
editor_selector : "myTextEditor",
theme : "simple"
});
</script>
<textarea id="txtdesc" name="txtdesc" class="myTextEditor" rows="6" cols="96" ></textarea>
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-03-16 16:21:44
En el TinyMCE 3.x config puede poner selectores o deselectores de clase para habilitar o deshabilitar específicamente TinyMCE en áreas de texto con ciertas clases, simplemente coloque el atributo class=""
en su área de texto.
editor_deselector : "mceNoEditor" // class="mceNoEditor" will not have tinyMCE
editor_selector : "mceEditor", // class="mceEditor" will.
Source .
A partir de TinyMCE 4.0.x
selector: "textarea", // Select all textarea
selector: "textarea.editme", // Select all textarea with the class editme
selector : "textarea:not(.mceNoEditor)", // Select all textarea exluding the mceNoEditor class
Source .
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-08-06 08:44:34
En TinyMCE 4.x no hay deselector, por lo que puede usar css normal para determinar qué áreas de texto están seleccionadas y cuáles no.
<script type="text/javascript">
tinymce.init({
selector: "textarea:not(.textarea-no-styles)",
});
</script>
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-10-08 08:40:53
En TinyMCE 4.x, puede usar la opción editor_selector, pero antes de eso asegúrese de que debe actualizar el modo a 'specific_textareas'
<script type="text/javascript">
tinymce.init({
mode : "specific_textareas",
editor_selector : "mceEditor",
});
</script>
También agregue la clase css igual que el valor editor_selector en su área de texto, según el ejemplo anterior debería verse así:
<textarea id='textarea1' class='mceEditor'>first text area</textarea>
Ahora, el editor se agregará en aquellas áreas de texto que tengan una clase llamada 'mceEditor'.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-02-23 10:35:53
Esto es lo que funcionó para mí en la versión 4.6.4, y es más simple:
Acabo de añadir #my_text_area_id a mi selector de la siguiente manera
selector: 'textarea#elm1'
<textarea id="elm1" ...>...</textarea>
Espero que ayude
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-06-29 06:41:06
Puede hacer esto usando un selector
.
selector: "#text_area_id", // Select with textarea id
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-04-28 18:06:53