Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -695,6 +695,61 @@ async def exe(websocket,connected,key):
|
|
695 |
'file':event["file"],
|
696 |
'content': event["content"],
|
697 |
'color':event["color"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
698 |
}
|
699 |
websockets.broadcast(connected, json.dumps(event))
|
700 |
|
|
|
695 |
'file':event["file"],
|
696 |
'content': event["content"],
|
697 |
'color':event["color"]
|
698 |
+
}
|
699 |
+
websockets.broadcast(connected, json.dumps(event))
|
700 |
+
elif event["command"]["type"]=="cursor":
|
701 |
+
|
702 |
+
event = {
|
703 |
+
"type": "cursor",
|
704 |
+
'offset': event["offset"],
|
705 |
+
|
706 |
+
}
|
707 |
+
websockets.broadcast(connected, json.dumps(event))
|
708 |
+
elif event["command"]["type"]=="select":
|
709 |
+
|
710 |
+
event = {
|
711 |
+
"type": "select",
|
712 |
+
'id': event["id"],
|
713 |
+
'startOffset': event["startOffset"],
|
714 |
+
'endOffset': event["endOffset"],
|
715 |
+
|
716 |
+
}
|
717 |
+
websockets.broadcast(connected, json.dumps(event))
|
718 |
+
elif event["command"]["type"]=="addselection":
|
719 |
+
|
720 |
+
event = {
|
721 |
+
"type": "addselection",
|
722 |
+
'sourceUser': event["sourceUser"],
|
723 |
+
|
724 |
+
}
|
725 |
+
websockets.broadcast(connected, json.dumps(event))
|
726 |
+
elif event["command"]["type"]=="insert":
|
727 |
+
|
728 |
+
event = {
|
729 |
+
"type": "insert",
|
730 |
+
'index': event["index"],
|
731 |
+
'text': event["text"],
|
732 |
+
|
733 |
+
}
|
734 |
+
websockets.broadcast(connected, json.dumps(event))
|
735 |
+
elif event["command"]["type"]=="replace":
|
736 |
+
|
737 |
+
event = {
|
738 |
+
"type": "replace",
|
739 |
+
'index': event["index"],
|
740 |
+
'length': event["length"],
|
741 |
+
'text': event["text"],
|
742 |
+
|
743 |
+
}
|
744 |
+
websockets.broadcast(connected, json.dumps(event))
|
745 |
+
elif event["command"]["type"]=="edelelte":
|
746 |
+
|
747 |
+
event = {
|
748 |
+
"type": "edelelte",
|
749 |
+
'index': event["index"],
|
750 |
+
'length': event["length"],
|
751 |
+
|
752 |
+
|
753 |
}
|
754 |
websockets.broadcast(connected, json.dumps(event))
|
755 |
|