一个模式对话框,只有当它被打开的第一次内部填充数据的UI,TinyMCE的对话框、当它、模式、数据

由网友(精神建設)分享简介:我用下面的code在一个模式对话框:I am using the following code in a modal dialog box:我用下面的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.

阅读全文

相关推荐

最新文章