easonyq edited a comment on pull request #13139:
URL: 
https://github.com/apache/incubator-echarts/pull/13139#issuecomment-674748442


   In #13086 @pissang has raised an issue. He says that PR will make option not 
refreshed if user didn't provide `optionToContent` or `contentToOption` 
function and changed the default text area. This PR also fix that bug.
   
   The key points here are:
   
   1. If user has provided `optionToContent` function but missed 
`contentToOption` function, the original system will try to parse the content 
in **textarea**. But actually in this case **textarea is not appended to the 
document at all**. So `textarea.value` is an empty string, parsing and applying 
this will destroy the data. (All bugs mentioned in #13031 such as one line 
missing or a list of `undefined` are all casued by this reason).
   The content we need to parse is a user-provided HTML what `optionToContent` 
returned, rather than the default **textarea**.
   2. Futhermore, if user provided a complicated HTML structure (such as a 
**table** described in #13031), it is difficult (or saying impossible) for us 
to parse it and get the right data we want.
   3. By contrast, let's image the opposite situation that user has provided 
`contentToOption` function but missed `optionToContent` function. In this case, 
the default textarea will show but the parsing function is overwritten by user, 
which is totally unnecessary.
   3. Given these facts, in my opinion user should still use `optionToContent` 
along with `contentToOption` **together**. Thus this PR gives warning when user 
missed one of these two. If he did, a warning message will be shown and all 
data will remain the same.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to