Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一键菜单生成的代码中,tinymce富文本编辑器全屏编辑无法触发blur事件 #62

Open
HUPFC opened this issue Dec 28, 2023 · 0 comments

Comments

@HUPFC
Copy link

HUPFC commented Dec 28, 2023

一键菜单生成的代码中,富文本编辑器全屏编辑无法触发blur事件
导致全屏编辑时直接提交表单会丢失富文本中更新的内容

原因如图:富文本全屏状态下,其div区域覆盖了表单提交按钮,而提交按钮z-index在富文本之上,导致点击提交按钮时,iframe子页面的焦点依然在富文本中

20231228094931

涉及代码段:

                        layui.use(["tinymce"], function() {
                            var tinymce = layui.tinymce
                            var edit = tinymce.render({
                                elem: "#text",
                                height: "400px",
                                'images_upload_url': "/app/admin/upload/image",
                            });
                            edit.on("blur", function(){
                                layui.$("#text").val(edit.getContent());
                            });
                        });

目前通过新增mouseleave事件解决

                            edit.on("MouseLeave", function(){
                                layui.$("#text").val(edit.getContent());
                            });

不确定是否有其他更好的方式

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant