Skip to content

Commit

Permalink
Add created/updated times to initial content
Browse files Browse the repository at this point in the history
  • Loading branch information
mlshapiro committed Jan 2, 2024
1 parent 44e764b commit 761ca5e
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions electron/initial-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,23 @@ if (isWindows || isLinux) {
const keyMaxLength = keyHelp.map(([key, help]) => key.length).reduce((a, b) => Math.max(a, b))
const keyHelpStr = keyHelp.map(([key, help]) => `${key.padEnd(keyMaxLength)} ${help}`).join("\n")

// see src/editor/time.js for templates
const getTime = () => {
// Return time in ISO8601 string YYYY-MM-DDTHH:mm:ssZ
return (new Date()).toISOString().replace(/\.\d+Z/,'Z')
}

export const newCreatedUpdatedTime = () => {
return `-c${getTime()}-u${getTime()}`
}


export const initialContent = `
∞∞∞text
∞∞∞text${newCreatedUpdatedTime()}
Welcome to Heynote! 👋
${keyHelpStr}
∞∞∞math
∞∞∞math${newCreatedUpdatedTime()}
This is a Math block. Here, rows are evaluated as math expressions.
radius = 5
Expand All @@ -40,16 +50,16 @@ time = 3900 seconds to minutes
time * 2
1 EUR in USD
∞∞∞markdown
∞∞∞markdown${newCreatedUpdatedTime()}
In Markdown blocks, lists with [x] and [ ] are rendered as checkboxes:
- [x] Download Heynote
- [ ] Try out Heynote
∞∞∞text-a
∞∞∞text-a${newCreatedUpdatedTime()}
`

export const initialDevContent = initialContent + `
∞∞∞python-a
∞∞∞python-a${newCreatedUpdatedTime()}
# hmm
def my_func():
print("hejsan")
Expand All @@ -60,7 +70,7 @@ import {EditorView, keymap} from "@codemirror/view"
import {javascript} from "@codemirror/lang-javascript"
import {indentWithTab, insertTab, indentLess, indentMore} from "@codemirror/commands"
import {nord} from "./nord.mjs"
∞∞∞javascript-a
∞∞∞javascript-a${newCreatedUpdatedTime()}
let editor = new EditorView({
//extensions: [basicSetup, javascript()],
extensions: [
Expand All @@ -84,7 +94,7 @@ let editor = new EditorView({
],
parent: document.getElementById("editor"),
})
∞∞∞json
∞∞∞json${newCreatedUpdatedTime()}
{
"name": "heynote-codemirror",
"type": "module",
Expand Down Expand Up @@ -112,7 +122,7 @@ let editor = new EditorView({
"typescript": "^4.9.4"
}
}
∞∞∞html
∞∞∞html${newCreatedUpdatedTime()}
<html>
<head>
<title>Test</title>
Expand All @@ -124,9 +134,9 @@ let editor = new EditorView({
</script>
</body>
</html>
∞∞∞sql
∞∞∞sql${newCreatedUpdatedTime()}
SELECT * FROM table WHERE id = 1;
∞∞∞text
∞∞∞text${newCreatedUpdatedTime()}
Shopping list:
- Milk
Expand Down

0 comments on commit 761ca5e

Please sign in to comment.