nnhubbard / ZSSRichTextEditor

A beautiful rich text WYSIWYG editor for iOS with a syntax highlighted source view
MIT License
3.78k stars 584 forks source link

Set Bold is not work correctly in Chinese keyboard type, maybe it can fix this problem. #277

Open kakaxihoracker opened 3 years ago

kakaxihoracker commented 3 years ago

zss_editor.setBold = function() {

//    document.execCommand('bold', false, null);
//    zss_editor.enabledEditingItems();

if(document.queryCommandState('bold')) {
     document.execCommand('bold',false,'div');
     document.execCommand('insertHTML',false,'‌');
}else{
    document.execCommand('insertHTML',false,'<b>&zwnj;</b>');
    zss_editor.enabledEditingItems();
}

}

eternal-glory commented 3 years ago

After using this method, other states cannot coexist.