开发者

issues while re-editing text using open-WysiWyg editor

开发者 https://www.devze.com 2023-03-31 12:36 出处:网络
I am using openWysiWyg editor in my website. This is attached to a text-area where I can type in the 开发者_JAVA百科content and the content is then saved to some php text file with the html tags intac

I am using openWysiWyg editor in my website. This is attached to a text-area where I can type in the 开发者_JAVA百科content and the content is then saved to some php text file with the html tags intact. In the view page on my site i directly include this php file and everything works fine.

Recently I got requests to have some facility to re-edit the already submitted text. For that, I am using the same editor attached to a textarea and I read the contents of the file and pass it to the textarea as . The content get loaded in to the textarea and everything is fine excpet the following issue. If i try to re-edit something like "& lt ;pankaj & gt ;" - upon loading this content in the editor it gets converted to "< pankaj >< /pankaj >" upon submitting the new changes. So I am having two issues - why "& lt ;" is getting converted to '<' and why is this auto-completion of tags happening.

I figured out the editor does the following steps :

  1. take textarea.value in some string
  2. use document.write() to copy that value to the texarea's div which in itself is a iframe.
  3. upon submitting it takes object.innerHTML to get the contents and then I save it to the disk

the above issues doesnt happen for text - "i & lt ; 5".


why "& lt ;" is getting converted to '<'

The editor is disabling the escape character &lt; and replacing it with the literal <

why is this auto-completion of tags happening.

The editor is converting the unescaped tag to valid XHTML

the above issues doesnt happen for text - "i & lt ; 5".

That is a numeric comparison, not markup

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号