Compare commits
5 Commits
1aa2c3b9bf
...
v0.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e5b878a9c | |||
| 90320808e4 | |||
| 003815239d | |||
| d885ca1317 | |||
| 74fa5a52ab |
56
.gitea/workflows/release.yaml
Normal file
56
.gitea/workflows/release.yaml
Normal file
@@ -0,0 +1,56 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: hub.gaomia.site/titor/bun:latest
|
||||
steps:
|
||||
- name: Install git
|
||||
run: apt-get update && apt-get install -y git
|
||||
|
||||
- name: Checkout
|
||||
run: |
|
||||
git clone https://${{ secrets.release_token }}@hub.gaomia.site/titor/mio.git /workspace/mio
|
||||
cd /workspace/mio
|
||||
|
||||
- name: Create source archive
|
||||
run: |
|
||||
git archive --format=zip -o mio-source.zip HEAD
|
||||
|
||||
- name: Release
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.release_token }}
|
||||
run: |
|
||||
cd /workspace/mio
|
||||
TAG_NAME="${GITHUB_REF#refs/tags/}"
|
||||
|
||||
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
|
||||
|
||||
if [ -n "$PREV_TAG" ]; then
|
||||
CHANGES=$(git log --pretty=format:"- %s (%h)" "$PREV_TAG..HEAD" 2>/dev/null || echo "")
|
||||
else
|
||||
CHANGES=$(git log --pretty=format:"- %s (%h)" -n 20 2>/dev/null || echo "")
|
||||
fi
|
||||
|
||||
if [ -n "$CHANGES" ]; then
|
||||
RELEASE_BODY="## Changes\n\n$CHANGES"
|
||||
else
|
||||
RELEASE_BODY="Release $TAG_NAME"
|
||||
fi
|
||||
|
||||
RELEASE_RESPONSE=$(curl -s -X POST "https://hub.gaomia.site/api/v1/repos/titor/mio/releases" \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"${TAG_NAME}\",\"name\":\"${TAG_NAME}\",\"body\":\"${RELEASE_BODY}\"}")
|
||||
|
||||
RELEASE_ID=$(echo "$RELEASE_RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||
|
||||
curl -s -X POST "https://hub.gaomia.site/api/v1/repos/titor/mio/releases/${RELEASE_ID}/assets" \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-F "attachment=@mio-source.zip"
|
||||
@@ -17,6 +17,8 @@ All notable changes to this project will be documented in this file.
|
||||
- **Multi-select delete**: Double-click to enter selection mode, click to toggle selection, batch delete support
|
||||
- **Title truncation**: Long titles in the list display with ellipsis
|
||||
- **Time display**: Format "time · month/day/year", e.g., "12:45 · 4/11/2026"
|
||||
- **Copy**: In edit mode, use Shift+Arrow to select text, then Ctrl+C to copy
|
||||
- **Exit**: Press Ctrl+D to exit
|
||||
|
||||
### Technical
|
||||
|
||||
@@ -34,3 +36,10 @@ All notable changes to this project will be documented in this file.
|
||||
npm run dev # Development mode
|
||||
npm run build # Build to mio.exe
|
||||
```
|
||||
|
||||
### Keyboard Shortcuts
|
||||
|
||||
- `Shift+Arrow` - Select text in edit mode
|
||||
- `Ctrl+C` - Copy selected text (in edit mode)
|
||||
- `Ctrl+D` - Exit application
|
||||
- `Esc` - Exit application (alternative)
|
||||
@@ -1,10 +1,12 @@
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import type { TextareaRenderable } from "@opentui/core";
|
||||
import { db, type Note } from "../db";
|
||||
|
||||
interface NoteEditorProps {
|
||||
note: Note | null;
|
||||
onUpdate: () => void;
|
||||
onDelete: (id: number) => void;
|
||||
onCopySelected: () => string;
|
||||
}
|
||||
|
||||
function renderMarkdown(content: string): any {
|
||||
@@ -58,11 +60,11 @@ function renderMarkdown(content: string): any {
|
||||
return elements;
|
||||
}
|
||||
|
||||
export function NoteEditor({ note, onUpdate, onDelete }: NoteEditorProps) {
|
||||
export function NoteEditor({ note, onUpdate, onDelete, onCopySelected }: NoteEditorProps) {
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
const [title, setTitle] = useState("");
|
||||
const [content, setContent] = useState("");
|
||||
const textareaRef = useRef<{ plainText: string } | null>(null);
|
||||
const textareaRef = useRef<TextareaRenderable | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (note) {
|
||||
@@ -75,6 +77,14 @@ export function NoteEditor({ note, onUpdate, onDelete }: NoteEditorProps) {
|
||||
setIsEditing(false);
|
||||
}, [note?.id]);
|
||||
|
||||
useEffect(() => {
|
||||
if (onCopySelected) {
|
||||
(window as any).__getSelectedText = () => {
|
||||
return textareaRef.current?.getSelectedText() ?? "";
|
||||
};
|
||||
}
|
||||
}, [onCopySelected]);
|
||||
|
||||
const handleSave = async () => {
|
||||
if (note) {
|
||||
const finalContent = textareaRef.current?.plainText ?? content;
|
||||
@@ -85,6 +95,10 @@ export function NoteEditor({ note, onUpdate, onDelete }: NoteEditorProps) {
|
||||
}
|
||||
};
|
||||
|
||||
const getSelectedText = (): string => {
|
||||
return textareaRef.current?.getSelectedText() ?? "";
|
||||
};
|
||||
|
||||
if (!note) {
|
||||
return (
|
||||
<box flexGrow={1} justifyContent="center" alignItems="center">
|
||||
|
||||
@@ -77,10 +77,20 @@ function App() {
|
||||
|
||||
const selectedNote = selectedId ? notes.find((n) => n.id === selectedId) : null;
|
||||
|
||||
const handleCopySelected = (): string => {
|
||||
return (window as any).__getSelectedText?.() ?? "";
|
||||
};
|
||||
|
||||
useKeyboard((key) => {
|
||||
if (key.name === "escape") {
|
||||
if (key.ctrl && key.name === "d") {
|
||||
process.exit(0);
|
||||
}
|
||||
if (key.ctrl && key.name === "c") {
|
||||
const text = handleCopySelected();
|
||||
if (text) {
|
||||
process.stdout.write('\x1b]52;c;' + btoa(text) + '\x07');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
@@ -98,11 +108,11 @@ function App() {
|
||||
/>
|
||||
</box>
|
||||
<box flexGrow={1}>
|
||||
<NoteEditor note={selectedNote || null} onUpdate={handleUpdate} onDelete={handleDelete} />
|
||||
<NoteEditor note={selectedNote || null} onUpdate={handleUpdate} onDelete={handleDelete} onCopySelected={handleCopySelected} />
|
||||
</box>
|
||||
</box>
|
||||
);
|
||||
}
|
||||
|
||||
const renderer = await createCliRenderer();
|
||||
const renderer = await createCliRenderer({ exitOnCtrlC: false });
|
||||
createRoot(renderer).render(<App />);
|
||||
Reference in New Issue
Block a user