-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add a new component to support Html tags(can custom tag's implement) #2071
base: master
Are you sure you want to change the base?
Conversation
…ri.getPath() with uri.getEncodedSchemeSpecificPart(). check the code comments for detail.
synchronize new commits in master
1. support <table> render by native webView,can custom html template 2. support <img> tag to render by any view(default with ImageView) 3. integrate HtmlCompat which extract from support library into weex with many changes 4. support extract any tags, and render by any custom view
1. optimize the rule of parse html attributes 2. add rgb color style support
2. add tags option config for user to custom more tag support(default contains <img>,<table>,<video>)
2、click listener callback add view-self
2、Optimise text new line("\n") situation(delete the last one,add to start position)
Generated by 🚫 dangerJS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like you are writing a component to achieve Html.fromHtml, here is some advice
- Add document for your component on the draft branch of the weex-site
- Why not use
RichText
which already exist to achieve? Is there any special reason? - Though not forced, sending a an email to weex mailing list to discuss the feature would be great, as mailing list is where decisions are made in Apache community
Thanks for your quick reply. The WxHtmlComponent has two key points:
It's totally different scenarios with inner component richtext . Where richtext is absorbed in providing a container name BTW, The document detail already contains in the front comment. And i will follow the rules to add it in weex-site later. |
Please update the document then I will read your PR, which may took days as there are lots of code changes. |
Thanks, I will review your PR and document when available, and it may take weeks as it's a huge change. |
…ttributes, change to another way to support more styles
@brucetoo Sorry for my delay, there is just so many other issues that I have to deal with. Could you please send an email to the mailing-list to share your feature? Maybe someone else could do the code review for you. |
Already shared. but it's not that kind active as i thought. |
WXSDKManager.getInstance().postOnUiThread(runnable, 0); | ||
} | ||
Picasso.with(view.getContext()).load(url).into(view); | ||
// Runnable runnable = new Runnable() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this outcommented code left here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I change this ImageAdapter because the origin has many conditions about how to display image. It's in demo project, so not the key core code
|
There are nothing changes in native code...so is this must be corrected?
|
TravisCI is failed because of NDK environment on the TravisCI server, this can be ignored. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase to master branch, as there is a conflict.
Thanks
Add a new component to support Html tags which named WxHtmlComponent . For now it's support render
table
,img
,video
and all textview supported html tags. And we can config what tags we care, even support header and footer view add in WxHtmlComponent .Here is a full example:
Attributes
New component use in js named
html-text
, there are two attributehtml-text
The origin raw html text, looks like this, contains all kinds of rich text tags...
html-option
inner configs about how to render specified tag:
image
img tag, how to handle image(like image's attribute )
table
table tag's html template to control how to render table,the default template can be found here. it's wrapped by WRAP_PARENT WebView default.
tags
tags array that will be handled, what show above is default three tags(
img
,table
,video
), you can add any specail tag in this array, and custom implement by native view.Header&Footer
We can add header and footer in
html-text
, Only the direct first two subview can be parsed by WxHtmlComponent , which means the first one is Header, and the second one is Footer. but the header&footer view-self can be any of views as you wish.Tag Click
There are default empty click listeners, and can be customed by overide getTagViewClickListener which contains many useful information
Why custom HtmlCompat
Attributes
params in positon of start tagagb
, which already added herequote
style is extremely ugly,isn't it ? So let's make it as MarkDown looks likebullet
span can't custom gap, bullet style etc..How this works
The key thought of WxHtmlComponent is spitting origin raw html text by different tags, and use native view to render each tag. (That's because i can't find a good way to render
table
tag in html, if there exists, please contact me)Can find the source code here
Here is a relation of mapping
<img>..</img>,<img .../>
<table> ..</table>
<video ..>..</video>,<video ../>
textView supported tag