2013-04-08 16 views
1

以下腳本通過tinyMCE編輯器調用內聯彈出窗口。我需要將寬度轉換爲百分比值而不是基於像素的值。任何想法如何?使用窗口寬度的百分比值調用tinyMCE windowManager.open

(function() { 
    // Load plugin specific language pack 
    tinymce.PluginManager.requireLangPack('CustomCodes'); 

    tinymce.create('tinymce.plugins.CustomCodes', { 
     /** 
     * Initializes the plugin, this will be executed after the plugin has been created. 
     * This call is done before the editor instance has finished it's initialization so use the onInit event 
     * of the editor instance to intercept that event. 
     * 
     * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in. 
     * @param {string} url Absolute URL to where the plugin is located. 
     */ 
     init : function(ed, url) { 
      // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample'); 

      ed.addCommand('mceCustomCodes', function() { 
       ed.windowManager.open({ 
        file : url + '/custom_post.php', 
        width : 1024 + ed.getLang('CustomCodes.delta_width', 0), 
        height : 600 + ed.getLang('CustomCodes.delta_height', 0), 
        inline : 1 
       }, { 
        plugin_url : url // Plugin absolute URL 
       }); 
      }); 

回答

0

您可以調整iframe的內部寬度並根據所需的寬度百分比分配像素值。