Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time travel #908

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/sdk/public/multi.html
Original file line number Diff line number Diff line change
Expand Up @@ -474,4 +474,4 @@ <h2>yorkie document</h2>
main();
</script>
</body>
</html>
</html>
28 changes: 28 additions & 0 deletions packages/sdk/public/time-travel.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#change-history-list {
display: flex;
flex-wrap: wrap;
overflow-x: hidden;
width: 100%;
}

#change-history-list > span {
display: inline-block;
padding: 2px 5px;
margin: 0 2px;
border-radius: 3px;
}

#change-history-list > span.local {
background-color: yellow;
color: black;
}

#change-history-list > span.remote {
background-color: blue;
color: white;
}

#change-history-list > span.covered {
font-weight: bold;
border: 1px solid red;
}
111 changes: 111 additions & 0 deletions packages/sdk/public/time-travel.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Time Travel Example</title>
<link
href="https://cdn.quilljs.com/1.3.6/quill.snow.css"
rel="stylesheet"
/>
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="quill-two-clients.css" />
<link rel="stylesheet" href="time-travel.css" />
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/quill-cursors.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/color-hash.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/short-unique-id.min.js"></script>
</head>
<body>
<div>
<div id="network-status"></div>
<div id="online-clients"></div>
<div id="client">
Client ( id: <span class="client-id"></span>)
<div class="syncmode-option">
<span>SyncMode: </span>
<div class="realtime-sync">
<span class="realtime-sync-title">Realtime Sync</span>
<div class="option">
<input
type="radio"
id="realtime-pushpull-a"
name="syncMode-a"
value="pushpull"
checked
/>
<label for="realtime-pushpull-a">PushPull</label>
</div>
<div class="option">
<input
type="radio"
id="realtime-pushonly-a"
name="syncMode-a"
value="pushonly"
/>
<label for="realtime-pushonly-a">PushOnly</label>
</div>
<div class="option">
<input
type="radio"
id="realtime-syncoff-a"
name="syncMode-a"
value="syncoff"
/>
<label for="realtime-syncoff-a">SyncOff</label>
</div>
</div>
<div class="option">
<input
type="radio"
id="manual-a"
name="syncMode-a"
value="manual"
/>
<label for="manual-a">Manual Sync</label>
<button class="manual-sync">sync</button>
</div>
</div>

<div class="changes">
<h2>History</h2>
<div id="change-history">
<input type="checkbox" id="auto-travel" checked>auto</input>
<button id="renew-history">renew</button>
<button id="time-travel" disabled>time-travel</button>
<div id="change-history-list"></div>
<div class="history-slider">
<input type="range" id="version-slider">
<p>slider version: <span id="slider-version-text"></span></p>
<p>current version: <span id="current-version-text"></span></p>
</div>
</div>
</div>

<h2>Todo List</h2>
<div class="todos">
<ul class="todoList"></ul>
<div class="todoNew">
<input type="text" class="todoInput" placeholder="enter.." />
<button class="addButton">+</button>
</div>
</div>

<div class="counter">
<h2>Counter</h2>
<button class="increaseButton">
count is <span class="count"></span>
</button>
</div>

<h2>yorkie document</h2>
<pre style="white-space: pre-wrap" id="log-holder"></pre>
</div>
</div>
<script src="./yorkie-js-sdk.js"></script>
<script src="./util.js"></script>
<script src="./time-travel.js"></script>
<script>
document.addEventListener('DOMContentLoaded', main);
</script>
</body>
</html>
Loading
Loading