There is a misspelling in my last email, which may cause confusion. option -> opinion
Best Regards, YorkShen 申远 申远 <[email protected]> 于2019年2月22日周五 下午4:16写道: > Thanks, I will just paste the content description of the *Bruce too* > here. I'd really appreciate if someone could give some option or do a > review. It's the same as the original PR > https://github.com/apache/incubator-weex/pull/2071 > > *Add a new component to support Html tags which named WxHtmlComponent > <https://github.com/brucetoo/incubator-weex/blob/10c5576f4d9384967fad67759f2ec2ed39f36530/android/sdk/src/main/java/com/taobao/weex/ui/component/html/WxHtmlComponent.java> > . > 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 > <https://github.com/brucetoo/incubator-weex/blob/10c5576f4d9384967fad67759f2ec2ed39f36530/android/sdk/src/main/java/com/taobao/weex/ui/component/html/WxHtmlComponent.java> > .* > > *Here is a full example:* > > *<html-text :html-text="formatHtml" > :html-option="htmlOption"> > <div> Any Header View</div> > <div> Any Footer View</div> > </html-text> > * > > *Attributes* > > *New component use in js named html-text, there are two attribute* > > - > > *html-text* > > *The origin raw html text, looks like this > <https://www.yuque.com/tuyong/records/xdb5u8/html>, contains all kinds of > rich text tags...* > - > > *html-option* > > *inner configs about how to render specified tag:* > > *htmlOption: { > image: { > resize: 'cover' > }, > table: { > template: '' > }, > tags:['img','table','video'] > }, > * > > - > > *image* > > *img tag, how to handle image(like image > <http://weex-project.io/cn/references/components/image.html#shu-xing>'s > attribute )* > - > > *table* > > *table tag's html template to control how to render table,the > default template can be found here > > <https://github.com/brucetoo/incubator-weex/blob/10c5576f4d9384967fad67759f2ec2ed39f36530/android/sdk/src/main/java/com/taobao/weex/ui/component/html/HtmlComponent.java#L40>. > it's wrapped by WRAP_PARENT WebView > > <https://github.com/brucetoo/incubator-weex/blob/10c5576f4d9384967fad67759f2ec2ed39f36530/android/sdk/src/main/java/com/taobao/weex/ui/component/html/AtMostWebView.java> > 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 > > <https://github.com/brucetoo/incubator-weex/blob/10c5576f4d9384967fad67759f2ec2ed39f36530/android/sdk/src/main/java/com/taobao/weex/ui/component/html/adapter/DefaultHtmlTagAdapter.java#L102>by > native view.* > > *Header&Footer* > > *We can add header and footer in html-text, Only the direct first > two subview can be parsed > <https://github.com/brucetoo/incubator-weex/blob/10c5576f4d9384967fad67759f2ec2ed39f36530/android/sdk/src/main/java/com/taobao/weex/ui/component/html/WxHtmlComponent.java#L115> > by WxHtmlComponent > <https://github.com/brucetoo/incubator-weex/blob/10c5576f4d9384967fad67759f2ec2ed39f36530/android/sdk/src/main/java/com/taobao/weex/ui/component/html/WxHtmlComponent.java> > , > 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 > <https://github.com/brucetoo/incubator-weex/blob/10c5576f4d9384967fad67759f2ec2ed39f36530/android/sdk/src/main/java/com/taobao/weex/ui/component/html/adapter/DefaultHtmlTagAdapter.java#L93>, > and can be customed by overide getTagViewClickListener > <https://github.com/brucetoo/incubator-weex/blob/10c5576f4d9384967fad67759f2ec2ed39f36530/android/sdk/src/main/java/com/taobao/weex/ui/component/html/adapter/DefaultHtmlTagAdapter.java#L92> > which > contains many useful information* > *Why custom HtmlCompat > <https://github.com/brucetoo/incubator-weex/blob/10c5576f4d9384967fad67759f2ec2ed39f36530/android/sdk/src/main/java/com/taobao/weex/ui/component/html/htmlcompat/HtmlCompat.java>* > > - *For now, the source cod of HtmlCompat have been moved in AndroidX > > <https://developer.android.com/reference/androidx/core/text/HtmlCompat>,where > there are few projects has integrated* > - *The default interface HtmlCompat.TagHandler > > <https://github.com/brucetoo/incubator-weex/blob/10c5576f4d9384967fad67759f2ec2ed39f36530/android/sdk/src/main/java/com/taobao/weex/ui/component/html/htmlcompat/HtmlCompat.java#L83> > do > not contains Attributes params in positon of start tag* > - *The default css-style parse rules not support color named as agb, > which already added here > > <https://github.com/brucetoo/incubator-weex/blob/10c5576f4d9384967fad67759f2ec2ed39f36530/android/sdk/src/main/java/com/taobao/weex/ui/component/html/htmlcompat/XmlUtils.java#L108>* > - *The default quote style is extremely ugly,isn't it ? So let's make > it > > <https://github.com/brucetoo/incubator-weex/blob/10c5576f4d9384967fad67759f2ec2ed39f36530/android/sdk/src/main/java/com/taobao/weex/ui/component/html/spans/WxQuoteSpan.java> > as > MarkDown looks like* > - *The bullet span can't custom gap, bullet style etc..* > - *CUSTOM BY USER IS LIMITED, that's the primary cause* > > *How this works* > > *The key thought of WxHtmlComponent > <https://github.com/brucetoo/incubator-weex/blob/10c5576f4d9384967fad67759f2ec2ed39f36530/android/sdk/src/main/java/com/taobao/weex/ui/component/html/WxHtmlComponent.java> > 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 > <https://github.com/brucetoo/incubator-weex/blob/10c5576f4d9384967fad67759f2ec2ed39f36530/android/sdk/src/main/java/com/taobao/weex/ui/component/html/HtmlComponent.java#L212>* > > *Here is a relation of mapping* > *<img>..</img>,<img .../>**getDefaultImageView* > <https://github.com/brucetoo/incubator-weex/blob/10c5576f4d9384967fad67759f2ec2ed39f36530/android/sdk/src/main/java/com/taobao/weex/ui/component/html/adapter/DefaultHtmlTagAdapter.java#L156> > *<table> ..</table>* *getDefaultTabView* > <https://github.com/brucetoo/incubator-weex/blob/10c5576f4d9384967fad67759f2ec2ed39f36530/android/sdk/src/main/java/com/taobao/weex/ui/component/html/adapter/DefaultHtmlTagAdapter.java#L106> > *<video ..>..</video>,<video ../>* *getDefaultVideo* > <https://github.com/brucetoo/incubator-weex/blob/10c5576f4d9384967fad67759f2ec2ed39f36530/android/sdk/src/main/java/com/taobao/weex/ui/component/html/adapter/DefaultHtmlTagAdapter.java#L131> > *textView supported tag* *getDefaultTextView* > <https://github.com/brucetoo/incubator-weex/blob/10c5576f4d9384967fad67759f2ec2ed39f36530/android/sdk/src/main/java/com/taobao/weex/ui/component/html/adapter/DefaultHtmlTagAdapter.java#L192> > Best Regards, > YorkShen > > 申远 > > > Jan Piotrowski <[email protected]> 于2019年2月21日周四 下午8:56写道: > >> There also seems to be a related documentation PR at >> https://github.com/apache/incubator-weex-site/pull/308 >> >> -J >> >> Am Do., 21. Feb. 2019 um 09:41 Uhr schrieb 申远 <[email protected]>: >> > >> > It would be better if you could share your feature with more detail >> here, >> > like document so that everyone can understand what is happening here. >> > >> > Thanks >> > >> > Best Regards, >> > YorkShen >> > >> > 申远 >> > >> > >> > Bruce too <[email protected]> 于2019年2月21日周四 下午3:08写道: >> > >> > > We can check this PR < >> https://github.com/apache/incubator-weex/pull/2071> >> > > >> >
