2

我将 tinyMCE 库用于我的文本区域,也用于图像上传,但是当它们都在一个页面上时它不起作用。当它是其中之一时很好,但是只要我在页面上放置一个 tinyMCE 文本区域和一个启动 imagemanager 对话框的按钮,对话框就会加载,但旋转的加载图标只是继续运行,而不是从我的根路径。

在我的文件的开头,我有:

tinyMCE.init({

  // General options
  mode : "textareas",
  theme : "advanced",
    editor_selector : "mceEditor",
  editor_deselector : "mceNoEditor",
  plugins : "style,advlink,inlinepopups,preview,contextmenu,paste,directionality,fullscreen,noneditable,imagemanager,media",

  // Theme options
  theme_advanced_buttons1 : "cut,copy,paste,pastetext,pasteword,|,undo,redo,|,link,unlink,code,|,fullscreen",
  theme_advanced_buttons2 : "",
    theme_advanced_buttons3 : "",
    theme_advanced_buttons4 : "",
    theme_advanced_toolbar_location : "bottom",
  theme_advanced_toolbar_align : "center",
  theme_advanced_resizing : false,
    media_strict: false
});

这对我的文本区域非常有用,然后在 document.ready() 上使用 jQuery 我有以下上传内容:

    $('.add_image_button').click(function(){

      mcImageManager.open(''{

          rootpath : '{0}/',
          oninsert:function(o){
              var location = o.focusedFile.path;
              location = location.substr(4);
      location = '_uploads/'+location;
      var preview_image = '../' + location;

      $('#selected_image > img').attr('src', preview_image);
      $('#image_path').val(location);
          }
      });
      return false;
  });

如果我在页面上有一个 MCE 文本区域并按下我的上传图片按钮,我会收到以下 javascript 错误:

Uncaught TypeError: Cannot set property 'innerHTML' of null - editor_plugin.js:1 Uncaught TypeError: Cannot call method 'getArgs' of undefined - index.php:1

I have tried the tinyMCE.init() after DOM ready, but no joy.

It feels like there might be some kind of path configuration conflict like the imagemanager. Does anybody know if there is a way of looking if the rootpath is getting screwed somehow on the imagemanager?

Cheers

4

1 回答 1

1

If anybody comes across this... I fixed it by removing inlinepopups from the plugins list.

于 2012-06-14T10:20:52.617 回答