【问题标题】:how can I load tinymce 4 in modal window?如何在模态窗口中加载 tinymce 4?
【发布时间】:2013-08-12 10:12:54
【问题描述】:

我在 cakephp 中有一个表单。我在扩展 jquery 的模态窗口中打开它。 现在我已经在我的表单中加载了tinymce,但它没有以模态加载。 tinymce.js 正在加载。即使它的所有设置也正确加载。 任何人都可以提出什么问题?

谢谢

【问题讨论】:

    标签: javascript cakephp-2.1 tinymce-4


    【解决方案1】:

    我也有这个问题。。 我正在使用引导模式框并使用插件打开多模式

    我正在使用这个代码助手: http://bakery.cakephp.org/articles/jwilcox09/2012/01/04/adding_a_tinymce_image_browser_to_cakephp_2

    在控制器中我使用此代码:

    公共函数添加(){ if ($this->RequestHandler->isAjax()) { $this->layout = '模态'; }

        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'));
    }
    

    在索引视图中我使用此代码

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

    Js->link(__('پست تازه'), array('action' => 'add'), array( '更新' => '#ajax-modal', 'htmlAttributes' => array('id' => 'EzafKardan', 'class'=>'modalBarGozar btn btn-primary btn-lg', '数据切换'=>'模态') )); ?>

    $(函数(){

    $.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'); $('.modalBarGozar').on('点击', function(){ var 链接 = $(this).attr("href"); $('body').modalmanager('loading'); 设置超时(函数(){ $modal.load(链接,'',函数(){ $modal.modal(); }); }, 1000); });

    在模态布局中,我添加了 tinymce.js 的链接,并添加到默认布局和其他布局中

    我尝试了所有方法,但没有成功......

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多