wix-incubator / react-native-zss-rich-text-editor

React Native rich text editor based on ZSSRichTextEditor
Other
839 stars 310 forks source link

IOS in Chinese input method, click the bold can be bold, but if you cancel the bold continue to input Chinese characters, bold state was selected #65

Open jianjiandandan opened 6 years ago

jianjiandandan commented 6 years ago

IOS in Chinese input method, click bold can realize bold, but if cancel bold continue to input Chinese characters, bold state is selected, italics is also, but English state, no problem, please ask how to solve。

yjb94 commented 6 years ago

@jianjiandandan did you fix this issue?

jianjiandandan commented 6 years ago

@yjb94 function setBold(){ if (document.queryCommandState('bold')) { document.execCommand('bold', false, null); document.execCommand('insertHTML', false, '‌'); } else { document.execCommand('bold', false, null); } }

不要全复制,里面判断的内容一致就好了

Geek-ch commented 6 years ago

you can fix it like this:

"react-native-zss-rich-text-editor": "^1.1.0"

path: /node_modules/react-native-zss-rich-text-editor/src/editor.html ... zss_editor.setBold = function() { if (zss_editor.isCommandEnabled('bold')) { document.execCommand('bold', false, null); document.execCommand('insertHTML', false, '‌'); } else { document.execCommand('bold', false, null); } zss_editor.enabledEditingItems(); } ...