richeditor-android icon indicating copy to clipboard operation
richeditor-android copied to clipboard

editor.setTextColor() no work in android 7.0

Open xinyangmaojian opened this issue 8 years ago • 12 comments

xinyangmaojian avatar Nov 16 '17 11:11 xinyangmaojian

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 avatar Nov 16 '17 12:11 xinyangmaojian

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

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

xinyangmaojian avatar Nov 17 '17 16:11 xinyangmaojian

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

fgq233 avatar Nov 28 '17 01:11 fgq233

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

fgq233 avatar Nov 28 '17 06:11 fgq233

哈哈 能帮上忙就是好的

xinyangmaojian avatar Dec 02 '17 02:12 xinyangmaojian

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

TYUpya avatar Dec 04 '17 03:12 TYUpya

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

xinyangmaojian avatar Dec 26 '17 09:12 xinyangmaojian

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

Kolzdm avatar Jan 16 '18 09:01 Kolzdm

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); }

Kolzdm avatar Jan 26 '18 08:01 Kolzdm

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.

pedrofneves avatar Mar 21 '18 12:03 pedrofneves

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?

teenageorge608 avatar Jan 08 '19 07:01 teenageorge608

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

wlxyhy avatar Sep 10 '19 02:09 wlxyhy