简体   繁体   English

如何在模式窗口中加载tinymce 4?

[英]how can I load tinymce 4 in modal window?

I have a form in cakephp.. I am opening it in a modal window whih extends jquery. 我在cakephp中有一个表单。.我在扩展jQuery的模态窗口中打开它。 Now I have loaded tinymce in my form but it is not loading in modal. 现在,我已在表单中加载了tinymce,但未以模式加载。 tinymce.js is loading. tinymce.js正在加载。 even its all settings are also loading properly. 即使所有设置也都可以正确加载。 Can anyone suggest What can be problem ? 谁能建议可能是什么问题?

Thanks 谢谢

I have this problem too.. I'm using bootstrap modal box and use the plugin for open multi-modal 我也有这个问题。我正在使用引导模态框,并使用插件打开多模态

I'm use this code Helper : http://bakery.cakephp.org/articles/jwilcox09/2012/01/04/adding_a_tinymce_image_browser_to_cakephp_2 我正在使用此代码帮助器: http : //bakery.cakephp.org/articles/jwilcox09/2012/01/04/adding_a_tinymce_image_browser_to_cakephp_2

In the controller i use this code : 在控制器中,我使用以下代码:

public function add() { if ($this->RequestHandler->isAjax()) { $this->layout = 'modal'; 公共功能add(){如果($ this-> RequestHandler-> isAjax()){$ this-> layout ='modal'; } }

    if ($this->request->is('post')) {
        $this->Post->create();
        if ($this->Post->saveAll($this->request->data, array('deep' => true))) {
            $this->Session->setFlash(__('The post has been saved.'));
            return $this->redirect(array('action' => 'index'));
        } else {
            $this->Session->setFlash(__('The post could not be saved. Please, try again.'));
        }
    }
    $users = $this->Post->User->find('list');
    $this->set(compact('users'));
}

In the index view i use this code 在索引视图中,我使用此代码

از این قسمت میتوانید یک پست تازه وارد سایت کنید ازنقسمتمیتوانیدیکپستتازهواردسایتکنید

Js->link(__('پست تازه'), array('action' => 'add'), array( 'update' => '#ajax-modal', 'htmlAttributes' => array('id' => 'EzafKardan', 'class'=>'modalBarGozar btn btn-primary btn-lg', 'data-toggle'=>'modal') )); Js-> link(__('(پستتازه'),array('action'=>'add'),array('update'=>'#ajax-modal','htmlAttributes'=> array('id'= >'EzafKardan','class'=>'modalBarGozar btn btn-primary btn-lg','data-toggle'=>'modal'))); ?> ?>

$(function(){ $(function(){

 $.fn.modal.defaults.spinner = $.fn.modalmanager.defaults.spinner = '<div class="loading-spinner" style="width: 200px; margin-left: -100px;">' + '<div class="progress progress-striped active">' + '<div class="progress-bar" style="width: 100%;"></div>' + '</div>' + '</div>'; $.fn.modalmanager.defaults.resize = true; $('[data-source]').each(function(){ var $this = $(this), $source = $($this.data('source')); var text = []; $source.each(function(){ var $s = $(this); if ($s.attr('type') === 'text/javascript'){ text.push($s.html().replace(/(\\n)*/, '')); } else { text.push($s.clone().wrap('<div>').parent().html()); } }); $this.text(text.join('\\n\\n').replace(/\\t/g, ' ')); }); }); </script> 
var $modal = $('#ajaxKhabari'); var $ modal = $('#ajaxKhabari'); $('.modalBarGozar').on('click', function(){ var link = $(this).attr("href"); $('body').modalmanager('loading'); setTimeout(function(){ $modal.load(link, '', function(){ $modal.modal(); }); }, 1000); }); $('。modalBarGozar')。on('click',function(){var link = $(this).attr(“ href”); $('body')。modalmanager('loading'); setTimeout(function (){$ modal.load(link,'',function(){$ modal.modal();});},1000);});

in the modal layout i add the link for tinymce.js and also add to defoult layout and other layout 在模式布局中,我添加了tinymce.js的链接,还添加了默认布局和其他布局

I'm try everything but did not work... 我正在尝试所有方法,但是没有用...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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