Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xinyangmaojian opened this issue Nov 16, 2017 · 12 comments
Open

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

xinyangmaojian opened this issue Nov 16, 2017 · 12 comments

Comments

@xinyangmaojian
Copy link

No description provided.

@xinyangmaojian xinyangmaojian changed the title editor.setTextColor() no work in android editor.setTextColor() no work in android 7.0 Nov 16, 2017
@xinyangmaojian
Copy link
Author

xinyangmaojian commented Nov 16, 2017

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
Copy link
Author

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

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

@fgq233
Copy link

fgq233 commented Nov 28, 2017

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

@fgq233
Copy link

fgq233 commented Nov 28, 2017

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

@xinyangmaojian
Copy link
Author

哈哈 能帮上忙就是好的

@TYUpya
Copy link

TYUpya commented Dec 4, 2017

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

@xinyangmaojian
Copy link
Author

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

@Kolzdm
Copy link

Kolzdm commented Jan 16, 2018

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

@Kolzdm
Copy link

Kolzdm commented Jan 26, 2018

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
Copy link

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
Copy link

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
Copy link

wlxyhy commented Sep 10, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants