我意识到这是一个过时的问题,但我会把它留在这里,以便任何需要使用TinyMCE 4而不启用移动功能的人可以使用。
iOS Safari不会在非可点击元素上绑定单击事件。 MDN Web Docs 提供了很好的解释。TinyMCE使用div元素来触发单击事件(从查看源代码中得知)。
因此,您需要自己向按钮元素添加touchend事件处理程序。您还需要钩入编辑器上的dialog OpenWindow和CloseWindow事件,以便您可以添加touchend事件并进行清理。
tinyMCE.init({
selector: selector,
plugins: "paste,link,image",
toolbar: "undo redo | bold italic underline | link image",
file_picker_types: 'image',
images_upload_handler: image_upload_handler,
automatic_uploads: true,
setup : function(editor){
editor.on('OpenWindow', function(e){
$('.mce-browsebutton button').on('touchend', function(event) {
$(this).click();
});
});
editor.on('CloseWindow', function(e){
$('.mce-browsebutton button').off('touchend');
});
}
});
否则,您可以使用移动模式(请注意,这适用于TinyMCE 4(v5设置不同,请参阅其
文档))。
tinyMCE.init({
selector: selector,
mobile: {
theme: 'mobile'
},
plugins: "paste,link,image",
toolbar: "undo redo | bold italic underline | link image",
file_picker_types: 'image',
images_upload_handler: image_upload_handler,
automatic_uploads: true
});