Nicole Tietz-Sokolskaya
137dfa747d
This makes the editor experience much better (by subjective measures). Now instead of a WYSIWYG editor, we have a markdown code editor, and we also have the ability to view documents without editing them. While I was at it, I fixed a bug where if you didn't edit a document at all, it would save blank. This was fixed as a happenstance from the switch. Also included here is making the UI work with Javascript disabled. If you don't have JS, you will get a textarea which allows editing the markdown directly. If you do have JS enabled, you'll get a smarter editor. Reviewed-on: #3
37 lines
1.3 KiB
HTML
37 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en" class="h-full bg-white">
|
|
{% include "head.html" %}
|
|
<body class="h-full">
|
|
|
|
<div class="h-full">
|
|
{% set current_page = "documents" %}
|
|
{% include "components/sidebar.html" %}
|
|
|
|
<main class="pl-72 bg-gray-50 h-full">
|
|
<form action="/documents/edit/{{ document.id }}" method="POST" class="h-full flex flex-col">
|
|
<div class="py-1 px-1 gap-x-1 flex flex-row justify-center align-middle bg-accent text-accent-content">
|
|
<input type="text" id="title" name="title" class="grow font-bold" value="{{ document.title }}" />
|
|
<a class="btn btn-sm my-auto" href="/documents">
|
|
{{ "arrow-left"|heroicon("w-6 h-6")|safe }} Exit
|
|
</a>
|
|
<button class="btn btn-sm my-auto">Save</button>
|
|
</div>
|
|
|
|
<div class="flex flex-col h-full">
|
|
<div id="editor-{{ document.id }}" name="editor" class="w-full h-full">
|
|
<noscript>
|
|
<textarea id="content-{{ document.id }}" name="content" class="w-full h-full">{{ document.content }}</textarea>
|
|
</noscript>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</main>
|
|
|
|
|
|
<script type="text/javascript" src="/static/main.js"></script>
|
|
<script type="text/javascript">
|
|
window.makeEditor("#editor-{{document.id}}", {{ document.content | tojson }});
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|