First, I would like to complain that Silverlight 4 cannot use Chinese Input in windowless mode. Therefore, there are defects in the method described below.
1. Embed HTML pages
The tool is a free htmlhost plug-in that can be used to embed HTML pages and URLs in Silverlight.
Http://www.divelements.com/silverlight/tools.aspx
The htmleditor.htm page contains a JS ckeditor and some JS functions that read the editor.
Note that Silverlight must be setWindowlessMode. The principle should be to add an HTML frame element directly on the webpage and then
Overwrite Silverlight.
<Grid margin = ","> <br/> <divtools: htmlhost name = "htmlhost" sourceuri = "http: // localhost: 5349/htmleditor/htmleditor.htm "horizontalalignment =" Left "verticalignment =" TOP "width =" 850 "Height =" 400 "documentready =" htmlhost_documentready_1 "> </divtools: htmlhost> <br/> </GRID>
Ii. Call js code embedded on the page
The problem now is how to call the JS Code embedded in a page. Because it does not belong to the same page of Silverlight, it cannot directly use Silverlight
Technology to call. I did not solve the problem after I checked a lot of information on the Internet, and in fact I was just switching to a website. html and JS are really cloudification for me.
Fortunately, the project manager with Wei Feng helped me solve this problem.
The solution is to write a proxy function on the Silverlight page, and then you can call this proxy function in Silverlight to read or operate.
The editor is embedded in the page.
Function geteditorframe () {<br/> return response parent.doc ument. getelementsbytagname ("iframe") [1]; <br/>}< br/> function getallimgsrc () {<br/> var frame = geteditorframe (); <br/> If (frame = NULL) <br/> return NULL; <br/> return frame. contentWindow. getallimgsrc (); <br/>}
Explanation
Geteditorframe function, which returns the embedded html iframe window.
Use the following methods to call the JS Code of an IFRAME window: compatible with IE and Firefox
Response response parent.doc ument. getelementsbytagname ("iframe") [x]. contentWindow. getallimgsrc ();
X: Can be 0, 1, 2, 3 ..
The frame. contentWindow. getallimgsrc function is the JS function in htmleditor.htm.
Iii. Summary
Silverlight 4 currently has few useful htmleditor controls, and the above method causes all plug-in
Cannot input Chinese characters. It is a tragedy for the full-site Silverlight application.
In the end, we discard this method to directly bring up another page that is not pure Silverlight for editing, and then interact with the home page through the SL message mechanism.
Another method should be to separate the editor into a Silverlight plug-in, and then stack the plug-in the SL page, but it seems that there is still scrolling control in the layout.
What is difficult to control? Who can give me a thought?
If you cannot enter Chinese characters, this sl4 is not very powerful. I hope sl5 will be used by the supervisor.