使用窗口宽度的百分比值调用tinyMCE windowManager.open

使用窗口宽度的百分比值调用tinyMCE windowManager.open,tinymce,Tinymce,下面的脚本从tinyMCE编辑器调用内联弹出窗口。我需要将宽度转换为百分比值,而不是基于像素的值。你知道怎么做吗 (function() { // Load plugin specific language pack tinymce.PluginManager.requireLangPack('CustomCodes'); tinymce.create('tinymce.plugins.CustomCodes', { /** * Ini

下面的脚本从tinyMCE编辑器调用内联弹出窗口。我需要将宽度转换为百分比值,而不是基于像素的值。你知道怎么做吗

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

您可以测量iframe的内部宽度,并根据所需的宽度百分比指定像素值