add table n stuff

This commit is contained in:
2026-01-12 11:50:33 +13:00
parent 8f9733d2b2
commit e448e68c1d
2 changed files with 26 additions and 7 deletions

View File

@@ -1,4 +1,16 @@
import { defineDb } from 'astro:db'; import { defineDb, column, defineTable, NOW } from 'astro:db';
const Entry = defineTable({
columns: {
id: column.number({ primaryKey: true }),
date: column.date({ default: NOW }),
location: column.json(),
content: column.json({ default: {} })
},
indexes: [
{ on: ['date', 'content'] }
]
})
// https://astro.build/db/config // https://astro.build/db/config
export default defineDb({ export default defineDb({

View File

@@ -2,13 +2,13 @@
import "../styles/global.css" import "../styles/global.css"
--- ---
<script is:inline> <script>
import Quill from "quill"; import Quill from "quill";
const quill = new Quill('#editor', { const quill = new Quill('#editor', {
modules: { modules: {
toolbar: [ toolbar: [
[{ header: [1, 2, false] }], // [{ header: [1, 2, false] }],
['bold', 'italic', 'underline'], ['bold', 'italic', 'underline'],
['image'], ['image'],
], ],
@@ -17,6 +17,14 @@ import "../styles/global.css"
theme: 'snow', // or 'bubble' theme: 'snow', // or 'bubble'
}); });
document.querySelector("#render")?.addEventListener('click', () => {
const contents = JSON.stringify(quill.getContents())
const el = document.getElementById("result")
el!.innerText = contents
})
</script> </script>
@@ -37,13 +45,12 @@ import "../styles/global.css"
<p><br /></p> <p><br /></p>
</div> </div>
<!-- <button id="render" class="mt-2" onclick="renderText"> <button id="render" class="mt-2">
render render
</button> --> </button>
<div id="snya"> <div id="result">
</div> </div>
</body> </body>
</html> </html>