tinymce-3 – TypeError:window.tinyMCE.execInstanceCommand不
发布时间:2020-12-14 04:16:35 所属栏目:Windows 来源:网络整理
导读:我无法在wordpress编辑器中添加任何短代码.它显示 – 未捕获TypeError:对象[object Object]没有方法’execInstanceCommand’. plesase帮助我解决这个问题. 代码(tinymce.js) function init() { tinyMCEPopup.resizeToInnerSize();}function getCheckedValue
我无法在wordpress编辑器中添加任何短代码.它显示 – 未捕获TypeError:对象[object Object]没有方法’execInstanceCommand’. plesase帮助我解决这个问题.
代码(tinymce.js) function init() { tinyMCEPopup.resizeToInnerSize(); } function getCheckedValue(radioObj) { if(!radioObj) return ""; var radioLength = radioObj.length; if(radioLength == undefined) if(radioObj.checked) return radioObj.value; else return ""; for(var i = 0; i < radioLength; i++) { if(radioObj[i].checked) { return radioObj[i].value; } } return ""; } function tjshortcodesubmit() { var tagtext; var tj_shortcode = document.getElementById('tjshortcode_panel'); // who is active ? if (tj_shortcode.className.indexOf('current') != -1) { var tj_shortcodeid = document.getElementById('tjshortcode_tag').value; switch(tj_shortcodeid) { case 0: tinyMCEPopup.close(); break; case "button": tagtext = "["+ tj_shortcodeid + " url="#" style="white" size="small"] Button text [/" + tj_shortcodeid + "]"; break; case "alert": tagtext = "["+ tj_shortcodeid + " style="white"] Alert text [/" + tj_shortcodeid + "]"; break; case "toggle": tagtext = "["+ tj_shortcodeid + " title="Title goes here"] Content here [/" + tj_shortcodeid + "]"; break; case "tabs": tagtext="["+tj_shortcodeid + " tab1="Tab 1 Title" tab2="Tab 2 Title" tab3="Tab 3 Title"] [tab]Insert tab 1 content here[/tab] [tab]Insert tab 2 content here[/tab] [tab]Insert tab 3 content here[/tab] [/" + tj_shortcodeid + "]"; break; default: tagtext="["+tj_shortcodeid + "] Insert you content here [/" + tj_shortcodeid + "]"; } } if(window.tinyMCE) { //TODO: For QTranslate we should use here 'qtrans_textarea_content' instead 'content' window.tinyMCE.execInstanceCommand('content','mceInsertContent',false,tagtext); //Peforms a clean up of the current editor HTML. //tinyMCEPopup.editor.execCommand('mceCleanup'); //Repaints the editor. Sometimes the browser has graphic glitches. tinyMCEPopup.editor.execCommand('mceRepaint'); tinyMCEPopup.close(); } return; }
我有同样的问题.将您的代码更改为此,它应该工作:
if(window.tinyMCE) { /* get the TinyMCE version to account for API diffs */ var tmce_ver=window.tinyMCE.majorVersion; if (tmce_ver>="4") { window.tinyMCE.execCommand('mceInsertContent',tagtext); } else { window.tinyMCE.execInstanceCommand('content',tagtext); } tinyMCEPopup.editor.execCommand('mceRepaint'); tinyMCEPopup.close(); } return; } 注意:由于缓存了.js文件,因此您需要进行硬刷新才能使其正常工作.如果您仍然看到相同的控制台错误,那可能是原因. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- windows-server-2008 – 用户从文件/文件夹权限中删除管理员
- windows-7 – 在Ctrl-Alt-Delete桌面上启动特定程序
- active-directory – 检查WQL中的缺失值或(WQL / WMI过滤器
- windows-phone-7 – 应用程序图标透明度问题(Windows Phone
- windows-server-2008-r2 – “在RD会话主机服务器上使用强制
- windows-installer – windows Installer – 当安装策略版本
- windows – 如何导出/传输DHCP数据?
- 用于windows的wan模拟器
- 如何清理microsoft html doc?
- windows-server-2003 – 如何从启动CD获取许可证密钥?
推荐文章
站长推荐
- 将Cygwin路径转换为文件中的Windows路径
- 是否可以在NTFS中授予重命名权限,但不能删除?
- windows-server-2008 – 如何使用组策略设置默认
- 无法加载文件或程序集“Microsoft.WindowsAzure.
- 在netbeans中为.dll / .so文件提供“java.librar
- Windows Phone模拟器错误,Hyper-V组件未运行,Win
- Windows上的本机C有哪些优秀的分析器?
- 在window10平台下安装TensorFlow(only cpu)
- windows-server-2012 – 对共享文件夹的NetworkS
- windows – 是否可以从终端服务远程应用程序本地
热点阅读