简体   繁体   中英

How do I end the current predictive text word on mobile?

I've been working on a rich text editor in a web view for Android, and I've had trouble getting formatting to work correctly on mobile. Specifically adding formatting through document.execcommand like bold/italic does not work correctly while the predictive text input is active.

I noticed that QuillJS ends the current predictive text input word when you hit a button like bold, and then it works.

How do I trigger this from javascript (or native Android code)?

You could call some Quill API function (like prepareFormat) by the loadURL function of Android webView.

You can find exmaples of how to call use prepare format in the link below: http://quilljs.com/docs/api/#quillprototypeprepareformat

webEditor.loadUrl("javascript:editor.prepareFormat('bold',true);");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM