Open manikandan-gopal opened 4 years ago
@manikandan-gopal You can check out wassabeef/RichEditor-android (works slightly better than this repo's but this repo is more compatible with iOS and CBess and my repos are more compatible with the latest version of iOS). All-in-all, though, we use document.execHTML so we don't have ZSS's issue.
Our issue is with memory issues (even with WKWebView) to the point that sometimes we can't have underline and strikethrough at the same time.
But, I'll look into your code if you haven't solved it yet. However, I'm no JS expert (and by the looks of it, are you guys using JQuery?).
Try this rich_editor.js
RE.isCommandEnabled = function(commandName) {
return document.queryCommandState(commandName);
}
document.addEventListener('touchend', function(e) {
RE.callback("touchend");
});
document.addEventListener('touchmove', function(e) {
RE.callback("touchmove");
});
document.addEventListener('touchstart', function(e) {
RE.callback("touchstart");
});
document.addEventListener("selectionchange", function(e) {
RE.callback("selectionchange");
RE.backuprange();
});
RichEditorView.swift in private func performCommand(_ method: String)
if method.hasPrefix("touchend") {
enabledEditingItems()
}
else if method.hasPrefix("touchmove") {
enabledEditingItems()
}
else if method.hasPrefix("touchstart") {
enabledEditingItems()
}
else if method.hasPrefix("selectionchange") {
enabledEditingItems()
}
func enabledEditingItems() {
runJS("RE.isCommandEnabled('bold')") { content in
print(content) // Bool
}
}
then you can check the "content" value for each style. I know its not best, but it does work for me :)
Can anyone provide a workaround for the following issue?
https://github.com/nnhubbard/ZSSRichTextEditor/issues/252#issue-542460709
The issue I guess is with the Java script code.