Twitter Bootstrap - TinyMCE只出现一次模态

时间:2014-11-02 03:10:48

标签: javascript html twitter-bootstrap tinymce

我试图使用以下代码在我的twitter bootstrap模式上加载TinyMCE插件:

这是我的 news.php ,它会为TinyMCE加载.js个文件:

<body>

    <h2 class="sub-header">Noticias registradas</h2>

    <button type="button" class="btn btn-primary" onclick="javascript:News()">
      <i class="glyphicon glyphicon-plus"></i>
      ADD NEW 
    </button>

    <div class="table-responsive">
    <table class="table">
        <!-- 
         ... RESPONSIVE TABLE WITH ALL DATA ...
        -->
    </table>
    </div>

<!-- THIS SHADOWBOX IS FOR LOAD AN IMAGE LINK -->
<script type="text/javascript" src="../shadowbox/shadowbox.js"></script>
<script type="text/javascript">
  Shadowbox.init();
</script>


<script src="../tinymce/tinymce.min.js"></script>

<script type="text/javascript">
function News() {
    var curl = 'news_add.php';
    $("#modal").modal();
    $("#modalContent").load(curl);
}

</script>

</body>

现在,我有tmy news_add.php ,其中包含一个简单的表单,然后是两个用于TinyMCE插件的文本:

<body>

<form id="form" name="form" enctype="multipart/form-data" autocomplete="off"
    method="post" role="form" action="news_add_save.php">

    <div class="modal-header">
        <h4>Add new one</h4>
    </div>

    <div class="modal-body">
        <div class="form-group">
            <label for="f_descript">First description *</label>
            <textarea id="f_descript" name="f_descript"></textarea>
        </div>
        <div class="form-group">
            <label for="s_descript">Second description *</label>
            <textarea id="s_descript" name="s_descript"></textarea>
        </div>

    </div>

    <div class="modal-footer">
        <button type="submit" class="btn btn-success">
            Save
        </button>
        <button type="button" class="btn btn-default" data-dismiss="modal">
            Cancel
        </button>
    </div>

</form>

</body>

<!-- THEN, I LOAD THE TINYMCE WITH THIS JS CODE -->
<script>
    tinymce.init({
        selector:'textarea',
        resize: false,
        height: 200,
        width: 600,
        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 print preview media | forecolor backcolor emoticons",
        image_advtab: true,
    });
</script>

所以问题是,当TinyMCE首次加载好时,加载模态时。

enter image description here

但是,它第二次没有。

enter image description here

您认为可能出错?

0 个答案:

没有答案