javascript - 更新到 WP 4.5 后,Wordpress 中的 Visual Composer 错误

标签 javascript wordpress

这是控制台出现错误的代码。

 /**
     * Convert html into correct element
     * @param html
     */
    html2element:function (html) {
        var attributes = {},
            $template;
        if (_.isString(html)) {
            this.template = _.template(html);
            $template = $(this.template(this.model.toJSON()).trim());
        } else {
            this.template = html;
            $template = html;
        }
        _.each($template.get(0).attributes, function (attr) {
            attributes[attr.name] = attr.value;
        });
        this.$el.attr(attributes).html($template.html());
        this.setContent();
        this.renderContent();
    },

it causes the page editor not to load!

see the line where there is an error in the code.

如果我违反了任何规则或没有足够详细地解释问题,我提前道歉。

如果可能请告知。

最佳答案

请看我的回答here .

我通过将 html2element 函数更新为以下内容来修复此错误:

html2element: function(html) {
        var $template, attributes = {},
            template = html;
        $template = $(template(this.model.toJSON()).trim()), _.each($template.get(0).attributes, function(attr) {
            attributes[attr.name] = attr.value
        }), this.$el.attr(attributes).html($template.html()), this.setContent(), this.renderContent()
    },

/wp-content/plugins/js_composer/assets/js/backend/composer-view.js

希望这对你有用!

关于javascript - 更新到 WP 4.5 后,Wordpress 中的 Visual Composer 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36622793/

相关文章:

html - 手机上的 Google Chrome 浏览器中未显示网站

php - 如何将 WordPress 主题分成两列?

javascript - 如何使用 PostCSS 将类属性保存在变量中?

javascript - ws4py - 发送/接收消息不起作用

javascript - PWA 应用程序,移动 Chrome,强制重新加载 js 缓存文件

html - 如何从 WordPress 元素中编码的图像 html 标签中删除通用 css 属性?

javascript - 这是对 Javascript 的 eval() 的错误使用吗?

javascript - 包装 jQuery.ajax : Cascading inner jqXHR as a new deffered object to return

javascript - 如何使用 jQuery 通过高级设置打开/关闭侧边栏

javascript - 在幻灯片上插入覆盖的 Div