繁体   English   中英

Tinymce文本编辑器在引导模式窗口中不起作用

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM