Skip to content

Commit

Permalink
Simplify textcollab example index template
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanw committed Nov 10, 2023
1 parent 15bdfae commit adc6135
Showing 1 changed file with 10 additions and 23 deletions.
33 changes: 10 additions & 23 deletions example/textcollab/templates/textcollab/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,25 @@
<title>Text Collaboration Rooms</title>
</head>
<body>
<p>What Prosemirror text collaboration room would you like to enter?</p>
<input id="room-name-input" type="text" size="100"><br>
<input id="room-name-submit" type="button" value="Enter">

<hr/>
What TipTap text collaboration room would you like to enter?<br>
<input id="room-name-input-tiptap" type="text" size="100"><br>
<input id="room-name-submit-tiptap" type="button" value="Enter">

<p>What text collaboration room would you like to enter?</p>
<label>Room name: <input id="room-name-input" type="text" size="100"></label><br>
<input id="room-name-submit" type="button" value="Enter Prosemirror room">
<input id="room-name-submit-tiptap" type="button" value="Enter TipTap room">

<script>
document.querySelector('#room-name-input').focus();
document.querySelector('#room-name-input').onkeyup = function(e) {
if (e.keyCode === 13) { // enter, return
document.querySelector('#room-name-submit').click();
}
};

document.querySelector('#room-name-submit').onclick = function(e) {
function enterRoom(prefix) {
var roomName = document.querySelector('#room-name-input').value;
window.location.pathname = '/prosemirror/' + roomName + '/';
};
window.location.href = url;
}

document.querySelector('#room-name-input-tiptap').onkeyup = function(e) {
if (e.keyCode === 13) { // enter, return
document.querySelector('#room-name-submit-tiptap').click();
}
document.querySelector('#room-name-submit').onclick = function(e) {
enterRoom('prosemirror');
};

document.querySelector('#room-name-submit-tiptap').onclick = function(e) {
var roomName = document.querySelector('#room-name-input-tiptap').value;
window.location.pathname = '/tiptap/' + roomName + '/';
enterRoom('tiptap');
};
</script>
</body>
Expand Down

0 comments on commit adc6135

Please sign in to comment.