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
|
// https://astro.build/db/config
|
||||||
export default defineDb({
|
export default defineDb({
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user