我想在下拉列表更改时更改tinyMCE的方向性:
$('.ddlLanguage').change(function () {
setLanguage();
});
function setLanguage() {
var lang = $('.ddlLanguage').val()
if ((lang == "En") || (lang == "Ru") || (lang == "Tr")) {
tinymce.settings['directionality'] = 'ltr';
};
if ((lang == "Ar") || (lang == "Fa")) {
tinymce.settings['directionality'] = 'rtl';
};
};
$(document).ready(function () {
setLanguage();
});
它设置页面加载的方向性,但在第一次之后它不会改变它。
任何帮助都将不胜感激。
答案 0 :(得分:0)
我已经删除并重新启动它,它解决了我的问题:
function tinyInit(tinyDir) {
tinymce.init({
selector: ".txaContent",
theme: "modern",
plugins: [
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime media nonbreaking save table contextmenu directionality",
"emoticons template paste textcolor colorpicker textpattern"
],
toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
toolbar2: "print preview media | forecolor backcolor emoticons | ltr rtl",
image_advtab: true,
directionality: tinyDir
};
function setLanguage() {
var lang = $('.ddlLanguage').val()
if ((lang == "En") || (lang == "Ru") || (lang == "Tr")) {
tinymce.remove();
tinyInit("ltr");
};
if ((lang == "Ar") || (lang == "Fa")) {
tinymce.remove();
tinyInit("rtl");
};
};