wasabeef / richeditor-android

RichEditor for Android is a beautiful Rich Text WYSIWYG Editor for Android.
Apache License 2.0
6.24k stars 1.2k forks source link

editor.setTextColor() no work in android 7.0 #142

Open xinyangmaojian opened 6 years ago

xinyangmaojian commented 6 years ago

in android 7.0(wrong) invoke evaluateJavascript(trigger, null) set text color log : "javascript:RE.setTextColor('#00FF00')" input "y" callback log : "< font color="#00FF00" >y< / font >" then evaluateJavascript(trigger, null) set text color again ,log : "javascript:RE.setTextColor('#FFFF00')" input "f" callback log : " < font color="#00FF00" >yf< / font > "

in android 6.0 or android 4.4.4 (this is right): invoke evaluateJavascript(trigger, null) set text color log : "javascript:RE.setTextColor('#00FF00')" input "y" callback log : "< font color="#00FF00" >y< / font >" then evaluateJavascript(trigger, null) set text color again ,log : "javascript:RE.setTextColor('#FFFF00')" input "f" callback log : " < font color="#00FF00" >y< / font > < font color="#FFFF00" >f< / font >"

xinyangmaojian commented 6 years ago

找到了问题原因: 1.此demo上选择颜色没什么问题 2.在7.0上(目前只用了小米note android7.0)当把颜色或字号选项用弹出popupwindow或者是dialogFragment 来选,这时设置颜色是无效的 非常奇怪。也执行了调用js setTextColor的语句

解决方法: 用腾讯x5的webview替换一下,代码用个demo的richeditor代码 除了webview相关的导包不一样 其他都一样

fgq233 commented 6 years ago

大兄弟,你的方法可以改颜色了,可以第二天发现编辑功能不能用了,一编辑就显示无法打开网页,点击空白处刷新

fgq233 commented 6 years ago

粗心了,我又调用了setWebViewClient,所以出错了,感谢你,大兄弟

xinyangmaojian commented 6 years ago

哈哈 能帮上忙就是好的

TYUpya commented 6 years ago

@xinyangmaojian 请问怎么修改字体大小? (不是标题大小,是普通字体大小) 例如:Test , 有没有接口可以设置字体大小?

xinyangmaojian commented 6 years ago

@TYUpya 有的 editor.setFontSize() 就是设置字体大小的

Kolzdm commented 6 years ago

setTextBackgroundColor(int color)no work in android 7.0???

Kolzdm commented 6 years ago

Find the problem: richeditor-android-master\richeditor\src\main\assets\rich_editor.js

RE.setTextBackgroundColor = function(color) { RE.restorerange();//Annotate,it's redundant document.execCommand("styleWithCSS", null, true); document.execCommand('hiliteColor', false, color); document.execCommand("styleWithCSS", null, false); }

pedrofneves commented 6 years ago

Kolzdm, what was the problem? Just comment these line does not works for me. I used a color picker (dialog) the lost the editor focus.

teenageorge608 commented 5 years ago

Kolzdm, what was the problem? Just comment these line does not works for me. I used a color picker (dialog) the lost the editor focus.

This is the problem i'm facing too. I'm using a custom color palette popup. The focus from editor is lost on selection of a color. Thus the color is not reflected. Any solution found to make it work?

wlxyhy commented 5 years ago

the same problem, doesn't work even if you don't use popup, android9.0