Hello!
I want an autotext in the standart RichTextEditor at Phoneticket for each Queue. Have your any idea how i can do that?
Autotext at the RichTextEditor
Moderator: crythias
Autotext at the RichTextEditor
OTRS: 3.0.7
BS: Win 7
BS: Win 7
Re: Autotext at the RichTextEditor
I done it by myself with an javascript:
<script type="text/javascript">//<![CDATA[
var Texte = new Array();
Texte['E-Mails'] = 'Text 1';
Texte['Postmaster'] = 'Text 2';
$("#Subject").change(function(){
var selectedValue = $(this).find(":selected").val();
if (typeof(Texte[selectedValue]) != 'undefined'){
var element = $('iframe').contents().find('body.cke_show_borders').get(0);
elem=CKEDITOR.dom.element.get( element )
elem.setText(Texte[selectedValue]);
}
});
<script type="text/javascript">//<![CDATA[
var Texte = new Array();
Texte['E-Mails'] = 'Text 1';
Texte['Postmaster'] = 'Text 2';
$("#Subject").change(function(){
var selectedValue = $(this).find(":selected").val();
if (typeof(Texte[selectedValue]) != 'undefined'){
var element = $('iframe').contents().find('body.cke_show_borders').get(0);
elem=CKEDITOR.dom.element.get( element )
elem.setText(Texte[selectedValue]);
}
});
OTRS: 3.0.7
BS: Win 7
BS: Win 7
Re: Autotext at the RichTextEditor
I had same idea to populate the Editor during runtime and found a better way to get the Editor
see http://docs.cksource.com/ckeditor_api/ for further documentation
Code: Select all
var Texte = new Array();
Texte['E-Mails'] = 'Text 1';
Texte['Postmaster'] = 'Text 2';
$("#Subject").change(function(){
var selectedValue = $(this).find(":selected").val();
if (typeof(Texte[selectedValue]) != 'undefined'){
var oEditor = CKEDITOR.instances.RichText; //RichText is the id of the instance
var oldHTMLText = oEditor.getData();
var newHTMLText = '<p>Texte[selectedValue]</p>';
//set new
elem.setData(newHTMLText )
// append HTML
oEditor.insertHtml(newHTMLText )
// append Text
oEditor.insertText(Texte[selectedValue]);
}
});
OTRS: 3.1.7 (Test) 3.1.7(Prod)
OS: CentOS
Web/DB: Apache2/MySQL 5 ? MSSQL
OS: CentOS
Web/DB: Apache2/MySQL 5 ? MSSQL