|
|
@ -137,6 +137,11 @@ var EditPage = `<html> |
|
|
|
width: 100%; |
|
|
|
width: 100%; |
|
|
|
border: none; |
|
|
|
border: none; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
a { |
|
|
|
|
|
|
|
text-decoration: underline; |
|
|
|
|
|
|
|
text-decoration-style: dotted; |
|
|
|
|
|
|
|
cursor: pointer; |
|
|
|
|
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |
|
|
|
<link rel="stylesheet" href="/hugo/simplemde.css" /> |
|
|
|
<link rel="stylesheet" href="/hugo/simplemde.css" /> |
|
|
|
<script src="https://unpkg.com/vue"></script> |
|
|
|
<script src="https://unpkg.com/vue"></script> |
|
|
@ -145,17 +150,38 @@ var EditPage = `<html> |
|
|
|
|
|
|
|
|
|
|
|
<body> |
|
|
|
<body> |
|
|
|
<div id="container" > |
|
|
|
<div id="container" > |
|
|
|
|
|
|
|
<div id="header"> |
|
|
|
<div id="lastSaved"> |
|
|
|
<div id="lastSaved"> |
|
|
|
<span v-if="ltime >serverLtime && (sendQueue.length > 0 || sentRecently.length > 0)">last saved ${ lastSaved.from(now) }, saving</span> |
|
|
|
<span v-if="ltime >serverLtime && (sendQueue.length > 0 || sentRecently.length > 0)">last saved ${ lastSaved.from(now) }, saving</span> |
|
|
|
<span v-else>saved</span> |
|
|
|
<span v-else>saved</span> |
|
|
|
<span v-if="connectionError">, ${connectionError}</span> |
|
|
|
<span v-if="connectionError">, ${connectionError}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div> |
|
|
|
|
|
|
|
<a id="sideview-toggle-media">media</a> |
|
|
|
|
|
|
|
<a id="sideview-toggle-draft">draft</a> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
<div id="editor-wrapper"> |
|
|
|
<div id="editor-wrapper"> |
|
|
|
<textarea id="editor">{{ .LoadContent }}</textarea> |
|
|
|
<textarea id="editor">{{ .LoadContent }}</textarea> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div id="draft"><iframe src="{{ .IframeSource }}">Loading draft...</iframe></div> |
|
|
|
<div id="draft"><iframe src="{{ .IframeSource }}">Loading draft...</iframe></div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var iframe = document.querySelector("#draft > iframe"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
document.onclick = function (event) { |
|
|
|
|
|
|
|
var iframe = document.querySelector("#draft > iframe"); |
|
|
|
|
|
|
|
switch (event.target.id) { |
|
|
|
|
|
|
|
case "sideview-toggle-media": |
|
|
|
|
|
|
|
iframe.src = "/hugo/media"; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case "sideview-toggle-draft": |
|
|
|
|
|
|
|
iframe.src = "{{ .IframeSource }}"; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var uiBindings = { |
|
|
|
var uiBindings = { |
|
|
|
ltime: 0, |
|
|
|
ltime: 0, |
|
|
|
serverLtime: 0, |
|
|
|
serverLtime: 0, |
|
|
@ -200,7 +226,6 @@ var EditPage = `<html> |
|
|
|
// Create WebSocket connection.
|
|
|
|
// Create WebSocket connection.
|
|
|
|
var socket = connect(); |
|
|
|
var socket = connect(); |
|
|
|
|
|
|
|
|
|
|
|
var iframe = document.querySelector("#draft > iframe"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const sawChangesBumpsTo = 10; |
|
|
|
const sawChangesBumpsTo = 10; |
|
|
|
|
|
|
|
|
|
|
|