视觉作曲家前编辑器不工作
问题描述:
嗨我正在使用Word新闻视觉作曲家..问题是,与一些页面(并非所有网页),前端编辑器不工作,它只是不断加载,首先它wasn没有与所有页面一起工作..但是当我添加一个空白页面时,Front编辑器与空白页面和一些其他页面一起工作,那么如何使视觉作曲家前端编辑器与这些页面一起工作? 我使用单词按7主题。 这是我的痛苦:视觉作曲家前编辑器不工作
答
可能有许多原因,但根源是JS错误。 1.首先禁用页面“preloader”并尝试。 2.如果不工作,请尝试禁用可能有js冲突的wordpress其他插件。 3.最好的方法:查看控制台日志中浏览器的开发人员工具中的js错误并修复它们。
答
我有视觉问题。在我的情况下,当我改变了经典模式并返回到后端编辑器时,我的情况有所帮助。
答
这个问题主要与composer-view.js
,我面临着同样的问题,它得到了以下链接后解决 - visual-composer-templateget-is-not-a-functi和Visual Composer is not working
您需要如下,以取代旧composer-view.js
代码。 (PS: - 更换此代码之前备份您的旧文件) 您可以在以下位置 -
的wp-content /插件/ js_composer /资产/ JS /后端找到这个文件
老代码
html2element: function (html) {
var attributes = {},
$template;
if (_.isString(html)) {
this.template = _.template(html);
$template = $(this.template(this.model.toJSON(), vc.templateOptions.default).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();
}
更换新如下 -
html2element:function (html) {
var attributes = {},
$template;
if (_.isString(html)) {
this.template = _.template(html);
} else {
try {
this.template = _.template(html());
} catch (err) {
this.template = html;
}
}
$template = $(this.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();
}
则同时更换渲染功能
旧代码
render: function() {
var $shortcode_template_el = $('#vc_shortcode-template-' + this.model.get('shortcode'));
if ($shortcode_template_el.is('script')) {
this.html2element(_.template($shortcode_template_el.html(),
this.model.toJSON(),
vc.templateOptions.default));
} else {
var params = this.model.get('params');
$.ajax({
type: 'POST',
url: window.ajaxurl,
data: {
action: 'wpb_get_element_backend_html',
data_element: this.model.get('shortcode'),
data_width: _.isUndefined(params.width) ? '1/1' : params.width,
_vcnonce: window.vcAdminNonce
},
dataType: 'html',
context: this
}).done(function (html) {
this.html2element(html);
});
}
this.model.view = this;
this.$controls_buttons = this.$el.find('.vc_controls > :first');
return this;
}
用新的代码替换如下 -
render: function() {
var $shortcode_template_el = $('#vc_shortcode-template-' + this.model.get('shortcode'));
if ($shortcode_template_el.is('script')) {
var newHtmlCode = _.template($shortcode_template_el.html(),
this.model.toJSON(),
vc.templateOptions.default);
if(!_.isString(newHtmlCode)){
newHtmlCode = $shortcode_template_el.html();
}
this.html2element(newHtmlCode);
} else {
var params = this.model.get('params');
$.ajax({
type: 'POST',
url: window.ajaxurl,
data: {
action: 'wpb_get_element_backend_html',
data_element: this.model.get('shortcode'),
data_width: _.isUndefined(params.width) ? '1/1' : params.width,
_vcnonce: window.vcAdminNonce
},
dataType: 'html',
context: this
}).done(function (html) {
this.html2element(html);
});
}
this.model.view = this;
this.$controls_buttons = this.$el.find('.vc_controls > :first');
return this;
}
首先感谢您的回复,如果你请告诉我如何请详细说明,因为我是初学者,仍在学习如何散步。我感谢您的帮助 –