一个模式对话框,只有当它被打开的第一次内部填充数据的UI,TinyMCE的 [英] data-ui-tinymce inside a modal dialog only populated when it is opened for the first time

查看:704
本文介绍了一个模式对话框,只有当它被打开的第一次内部填充数据的UI,TinyMCE的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用下面的code在一个模式对话框:

I am using the following code in a modal dialog box:

    <input data-ng-model="modal.formData.text" type="text">
    <textarea
        data-ui-tinymce
        data-ng-disabled="modal.action=='delete'"
        data-ng-model="modal.formData.text"
        id="inputText"
        required></textarea>

当用户点击行的表内的网格编辑按钮打开的对话​​框。

The dialog box is opened when a user clicks on a grid edit button inside a table of rows.

第一次(硬刷新后),用户点击编辑则&LT;输入&GT; 盒和TinyMCE的窗口被填充。编辑,随后单击打开对话框但只有&LT;输入&gt;的填充框。

The first time (after a hard refresh) the user clicks edit then the <input> box and tinymce window are populated. Subsequent clicks of edit open the dialog but only the <input> box is populated.

推荐答案

我度过了最后三天试图解决这个问题,最终为开沟的TinyMCE的指令angularjs。我不认为它完全准备好黄金时段。我的解决方法就是把这个在角引导模式对话框的控制器:

I spent the last three days trying to solve this problem and ended up ditching the angularjs directive for tinymce. I don't think its quite ready for prime-time. My work-around was to put this in the Angular-Bootstrap modal dialog box's controller:

    setTimeout(function() {   //wait for the dialog to be open
        tinymce.init({
            selector: "#editorID",
            setup:function(ed) {
                ed.on("init", function(){
                    $scope.editor = ed; //save a reference to the editor
                    //manually put your model into the editor:
                    $scope.editor.setContent($scope.model.textForTheEditor); 
                });
            }   
        });
    }, 333); //a third of a second is more time than you need, but it works

然后当对话框关闭,与编辑的内容更新你的模型:

And then when the dialog closes, update your model with the content of the editor:

   $scope.model.textForTheEditor = $scope.editor.getContent();

我知道你想它不太解决方案,它违反范式整个控制器中没有-DOM,但它似乎是得到TinyMCE的在Anguler / Twitter的引导对话框反复工作的唯一途径。

I know its not quite the solution you wanted and it violates the whole "no-DOM in the controller" paradigm, but it seems to be the only way to get TinyMCE to work repeatedly in the Anguler/Twitter Bootstrap dialog boxes.

我也要用Angularjs指令爱一个更好的解决方案!希望这有助于。

I too would love a better solution using the Angularjs directive! Hope this helps.

这篇关于一个模式对话框,只有当它被打开的第一次内部填充数据的UI,TinyMCE的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆