[英]Tinymce text editor doesn't work on bootstrap modal window
我在我的項目中使用tinymce文本編輯器,它在主窗口中可以正常工作,但是當我嘗試加載引導程序模式時,將顯示簡單的textarea,並且沒有Tinymce的選項。 這是我的網站和登錄信息:hmodelschool.co.nf,電子郵件:admin@example.com通過:1234在新聞部分,您會看到tinymce選項正確使用。 但是,當我嘗試使用自舉模式tinymce進行編輯時,該選項沒有出現。 該做什么。 這是我正在使用的代碼。 在include.top.php中,我從CDN加載tinymce。
<!--tinymce text editor-->
<script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
<script>tinymce.init({
selector: 'textarea',
height: 300,
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
imagetools'
],
toolbar1: 'insertfile undo redo | styleselect | bold italic |
alignleft aligncenter alignright alignjustify | bullist numlist
outdent indent | link image',
toolbar2: 'print preview media | forecolor backcolor emoticons',
image_advtab: true,
});</script>
在主頁news.php中,我用以下命令調用它:
<div class="form-group">
<label class="col-sm-3 control-label">
<?php echo get_phrase('news');?></label> <div class="col-sm-5">
<div class="box closable-chat-box"> <div class="box-content padded">
<div class="chat-message-box"> <textarea name="news" id="ttt"
rows="5" placeholder="<?php echo get_phrase('add_news');?>"
class="form-control"></textarea> </div>
</div>
</div>
</div>
</div>
而且在modal_edit_news.php中,我用以下命令調用它:
<div class="form-group">
<label class="col-sm-3 control-label">
<?php echo get_phrase('news');?></label> <div class="col-sm-5">
<div class="box closable-chat-box"> <div class="box-content padded">
<div class="chat-message-box"> <textarea name="news" id="ttt"
rows="5" placeholder="<?php echo get_phrase('add_news');?>"
class="form-control"></textarea> </div>
</div>
</div>
</div>
</div>
而且tinymce不僅適用於引導模式。 任何幫助將不勝感激。
在通過AJAX請求加載模式時遇到了類似的問題。 解決方法是在加載模態時初始化TinyMCE編輯器。
$('#myModal').on('shown.bs.modal', function () {
tinymce.init({
selector: 'textarea',
height: 300,
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
imagetools'
],
toolbar1: 'insertfile undo redo | styleselect | bold italic |
alignleft aligncenter alignright alignjustify | bullist numlist
outdent indent | link image',
toolbar2: 'print preview media | forecolor backcolor emoticons',
image_advtab: true,
});
})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.