Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created October 23, 2017 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/d89f0052306428d0d3d77f2835087211 to your computer and use it in GitHub Desktop.
Save bjoerntx/d89f0052306428d0d3d77f2835087211 to your computer and use it in GitHub Desktop.
@using TXTextControl.Web
@using TXTextControl.Web.MVC
@Html.TXTextControl().TextControl(settings =>
{
settings.Dock = DockStyle.Window;
}).Render()
<script>
window.onload = function () {
function receiveMessage(e) {
if (e.origin !== "http://localhost:3053")
return;
var message = JSON.parse(e.data);
if (message.txtextcontrol == null)
return;
switch (message.txtextcontrol.method) {
case "loadDocument": {
var encoded = btoa(message.txtextcontrol.parameter);
TXTextControl.loadSelection(TXTextControl.StreamType.HTMLFormat, encoded);
}
}
}
window.addEventListener('message', receiveMessage);
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment