我无法在wordpress编辑器中添加任何短代码。它显示-
TypeError:窗口。蒂尼姆斯。execInstanceCommand不是函数
窗蒂尼姆斯。execInstanceCommand(id,“mceInsertContent”,false,shortcode)。请帮我解决这个问题。完整代码:-
function submitData($form) {
try {
$form = $form || jQuery(\'form\');
if(window.tinyMCE) {
var selectedContent = tinyMCE.activeEditor.selection.getContent(),
id = tinyMCE.activeEditor.editorId || \'content\',
shortcodeName = $form.attr(\'name\'),
shortcode = \' [\' + shortcodeName + \' \';
$form.find(\'[data-name]\').each(function() {
var $this = jQuery(this),
type = $this.data(\'type\'),
value = ($this.attr(\'type\') == \'checkbox\')
? ($this.is(\':checked\')) ? \'on\' : \'\'
: $this.val() || \'\';
value = fitValue(type, value);
shortcode += $this.data(\'name\') + \'="\' + value + \'" \';
});
shortcode += \']\' + selectedContent + \'[/\' + shortcodeName + \'] \';
window.tinyMCE.execInstanceCommand(id, \'mceInsertContent\', false, shortcode)
tinyMCEPopup.editor.execCommand(\'mceRepaint\');
tinyMCEPopup.close();
}
} catch (e) {
console.error(e);
}
return;
}