add table n stuff
This commit is contained in:
14
db/config.ts
14
db/config.ts
@@ -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
|
||||
export default defineDb({
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
import "../styles/global.css"
|
||||
---
|
||||
|
||||
<script is:inline>
|
||||
<script>
|
||||
import Quill from "quill";
|
||||
|
||||
const quill = new Quill('#editor', {
|
||||
modules: {
|
||||
toolbar: [
|
||||
[{ header: [1, 2, false] }],
|
||||
// [{ header: [1, 2, false] }],
|
||||
['bold', 'italic', 'underline'],
|
||||
['image'],
|
||||
],
|
||||
@@ -17,6 +17,14 @@ import "../styles/global.css"
|
||||
theme: 'snow', // or 'bubble'
|
||||
});
|
||||
|
||||
document.querySelector("#render")?.addEventListener('click', () => {
|
||||
const contents = JSON.stringify(quill.getContents())
|
||||
|
||||
const el = document.getElementById("result")
|
||||
|
||||
el!.innerText = contents
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@@ -37,13 +45,12 @@ import "../styles/global.css"
|
||||
<p><br /></p>
|
||||
</div>
|
||||
|
||||
<!-- <button id="render" class="mt-2" onclick="renderText">
|
||||
<button id="render" class="mt-2">
|
||||
render
|
||||
</button> -->
|
||||
</button>
|
||||
|
||||
<div id="snya">
|
||||
<div id="result">
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user