index.html 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Title</title>
  6. </head>
  7. <script src="dist/js/client.js"></script>
  8. <body>
  9. <script>
  10. if (!window.Web) {
  11. window.Web = {}
  12. }
  13. </script>
  14. <script>
  15. const webClient = new Web.Client('127.0.0.1:3000');
  16. const sheetId = 'sheet1';
  17. webClient.ready(() => {
  18. const undoManager = webClient.getUndoManager();
  19. const swapBufferData = new Web.SwapData();
  20. const redoCommand = new Web.Command(sheetId, [
  21. new Web.InsertRow({
  22. index: 0,
  23. count: 5,
  24. buffer: swapBufferData
  25. })
  26. ]);
  27. const undoCommand = new Web.Command(sheetId, [
  28. new Web.RemoveRow({
  29. index: 0,
  30. count: 5,
  31. buffer: swapBufferData
  32. })
  33. ]);
  34. undoManager.performCommand(redoCommand, undoCommand);
  35. });
  36. </script>
  37. </body>
  38. </html>