1

下面的脚本从 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
                });
            });
4

1 回答 1

0

您可以弄乱 iframe 的内部宽度并根据所需的宽度百分比分配像素值。

于 2013-04-09T08:29:23.423 回答