xiumi-ue-dialog-v5.html 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  5. <title>XIUMI connect</title>
  6. <style>
  7. html, body {
  8. padding: 0;
  9. margin: 0;
  10. }
  11. #xiumi {
  12. position: absolute;
  13. width: 100%;
  14. height: 100%;
  15. border: none;
  16. box-sizing: border-box;
  17. }
  18. </style>
  19. </head>
  20. <body>
  21. <iframe id="xiumi"
  22. src="//xiumi.us/studio/v5#/paper">
  23. </iframe>
  24. <script type="text/javascript" src="/statics/plugins/neditor/dialogs/xiumi/xiumi.js"></script>
  25. <script>
  26. var xiumi = document.getElementById('xiumi');
  27. var xiumi_url = window.location.protocol + "//xiumi.us";
  28. xiumi.onload = function () {
  29. console.log("postMessage");
  30. xiumi.contentWindow.postMessage('ready', xiumi_url);
  31. };
  32. document.addEventListener("mousewheel", function (event) {
  33. event.preventDefault();
  34. event.stopPropagation();
  35. });
  36. window.addEventListener('message', function (event) {
  37. if (event.origin == xiumi_url) {
  38. editor.execCommand('insertHtml', event.data);
  39. dialog.close();
  40. }
  41. }, false);
  42. </script>
  43. </body>
  44. </html>