Houfeng / mditor

📝 [ M ] arkdown + E [ ditor ] = Mditor
http://mditor.com/
533 stars 79 forks source link

有没有相关的调试方法什么的? #39

Closed JaxsonWang closed 4 years ago

JaxsonWang commented 6 years ago

我想把您的项目做成WordPress的插件,过程中发现如下问题:

image

所以想问问有什么办法在控制台查看相关报错信息,谢谢!

JaxsonWang commented 6 years ago

image

Houfeng commented 6 years ago

能否提供更多的信息,比如浏览器及版本,并贴更多的代码,让我重现一下这个问题?

JaxsonWang commented 6 years ago

MacOS 10.13.12 Chrome 63.0.3239.84(正式版本)(64 位)

编辑器配置安装文档默认的配置:

var mditor =  Mditor.fromTextarea(document.getElementById('wp-content-editor-container'));

//获取或设置编辑器的值
mditor.on('ready',function(){
        mditor.value = '** hello **';
        console.log(mditor.value);
});

FireFox Quantum 57.0.1 (64 位):

image

TypeError: this.textarea is undefined

getValue  index.js:178:4
onReady/<  index.js:28:15

Safari 11.0.2 (13604.4.7.1.3)控制台报错如下:

TypeError: undefined is not an object (evaluating 'this.textarea.value')
Houfeng commented 6 years ago

@JaxsonWang ID 为 wp-content-editor-containertextarea 确实存在?并在 mditor 的初始化之前?

JaxsonWang commented 6 years ago

呃,是textarea?div不行吗?如果是这样的话,那的确麻烦多了

Houfeng commented 6 years ago

@JaxsonWang

var mditor = new Mditor();
// 挂载到指定的元素
mditor.$mount(document.body); 

这样也能创建 mditor 实例