Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/release-notes/0.4.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Floatick v0.4.1

### 中文

本次补丁修复待办和笔记编辑器的光标显示与任务清单排版。

- 修复正文为空时看不到输入光标、输入文字后光标才出现的问题。从标题进入正文后,无需先输入文字即可看到光标。
- 修复 macOS WebKit 在标题切换到正文时可能发生的编辑器事务冲突,恢复正文文本选择。
- 修复 checkbox 独占一行、文字落到下一行的问题;复选框现在与首行文字对齐,长文本和嵌套任务保持正确缩进。
- 优化复选框为圆角样式,增加主题色勾选、悬停反馈和键盘焦点提示;完成父任务不会让未完成的子任务一起变淡或显示删除线。
- 修复空正文插入任务项后被重新解析为普通列表的问题,保留空任务项和标题的编辑结构。
- 为编辑器工具栏补充无障碍名称。

### English

This patch fixes caret visibility and checklist layout in the shared todo and note editor.

- Show the native caret in an empty body before any text is entered, including when moving from the title into the body.
- Avoid a macOS WebKit transaction conflict during title-to-body focus transfer and restore text selection in the editor.
- Keep checkboxes on the same line as task text, with correct indentation for wrapped text and nested tasks.
- Refine checkboxes with rounded corners, themed checked states, hover feedback, and keyboard focus indicators. Completing a parent task no longer dims or strikes through unfinished child tasks.
- Preserve empty task items and headings instead of reparsing the editor's own Markdown updates and turning an empty checklist into a plain list.
- Add accessible names to editor toolbar controls.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "floatick",
"version": "0.4.0",
"version": "0.4.1",
"private": true,
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "floatick"
version = "0.4.0"
version = "0.4.1"
description = "A focused, local-first floating todo and note app for macOS"
authors = ["Lucas"]
edition = "2021"
Expand Down
4 changes: 2 additions & 2 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "Floatick",
"version": "0.4.0",
"version": "0.4.1",
"identifier": "io.github.lucaslushuo.floatick",
"build": {
"frontendDist": "../dist",
Expand Down Expand Up @@ -41,7 +41,7 @@
"icons/icon.ico"
],
"macOS": {
"bundleVersion": "12",
"bundleVersion": "13",
"minimumSystemVersion": "10.15"
}
}
Expand Down
21 changes: 17 additions & 4 deletions src/components/common/FloatickTiptapEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ const ToolbarButton: React.FC<ToolbarButtonProps> = ({
>
<button
type="button"
aria-label={label}
disabled={disabled}
onMouseDown={(e) => {
e.preventDefault(); // Retain editor focus and selection
Expand Down Expand Up @@ -585,6 +586,7 @@ export const FloatickTiptapEditor: React.FC<FloatickTiptapEditorProps> = ({
const containerRef = useRef<HTMLDivElement>(null);
const menuListRef = useRef<HTMLDivElement>(null);
const itemRefs = useRef<(HTMLButtonElement | null)[]>([]);
const lastEmittedMarkdownRef = useRef<string | null>(null);

const [, setSelectionTick] = useState(0);

Expand Down Expand Up @@ -645,6 +647,8 @@ export const FloatickTiptapEditor: React.FC<FloatickTiptapEditorProps> = ({
TaskList,
TaskItem.configure({
nested: true,
// Node views do not inherit the data-type added by renderHTML.
HTMLAttributes: { "data-type": "taskItem" },
}),
Markdown.configure({
html: true,
Expand Down Expand Up @@ -748,6 +752,7 @@ export const FloatickTiptapEditor: React.FC<FloatickTiptapEditorProps> = ({
}

const md = (editor.storage as any).markdown?.getMarkdown?.() ?? "";
lastEmittedMarkdownRef.current = md;
onChange?.(md);
},
onSelectionUpdate: () => {
Expand All @@ -773,7 +778,12 @@ export const FloatickTiptapEditor: React.FC<FloatickTiptapEditorProps> = ({
}, [showSlashMenu, slashMenuIndex]);

useEffect(() => {
if (editor && !editor.isDestroyed && initialContent && editor.isEmpty) {
// Hydrate late initial data without reparsing our own updates. Empty headings
// and task items are still editable structure even when editor.isEmpty is true.
if (
editor && !editor.isDestroyed && initialContent && editor.isEmpty &&
initialContent !== lastEmittedMarkdownRef.current
) {
editor.commands.setContent(initialContent);
}
}, [editor, initialContent]);
Expand Down Expand Up @@ -808,15 +818,19 @@ export const FloatickTiptapEditor: React.FC<FloatickTiptapEditorProps> = ({
editor.commands.setContent(content || "");
},
focus: () => {
editor?.commands.focus();
if (!editor || editor.isDestroyed) return;
// WebKit can flush DOM changes synchronously on focus. Focus the view
// before creating a transaction so it uses the current document state.
editor.view.focus();
editor.commands.scrollIntoView();
},
};
}, [editor, editorRef]);

return (
<div ref={containerRef} className={`relative flex-1 flex flex-col min-h-0 ${className}`}>
{showToolbar && <EditorToolbar editor={editor} />}
<EditorContent editor={editor} className="flex-1 overflow-y-auto smooth-scroll pr-1" />
<EditorContent editor={editor} className="tiptap-scroll-container flex-1 overflow-y-auto smooth-scroll pr-1" />

{/* Floating Slash Command Menu */}
{showSlashMenu && filteredCommands.length > 0 && (
Expand Down Expand Up @@ -895,4 +909,3 @@ export const FloatickTiptapEditor: React.FC<FloatickTiptapEditorProps> = ({
</div>
);
};

59 changes: 40 additions & 19 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@
font-family: var(--font-sans);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* Enable GPU rendering context on root */
transform: translateZ(0);
backface-visibility: hidden;
/* Keep native editing/caret painting out of forced compositing layers. */
}

textarea::placeholder,
Expand All @@ -94,9 +92,6 @@
background-color: var(--color-bg-panel);
border: 1px solid var(--color-border-panel);
color: var(--color-text-primary);
/* Dedicated Compositor Layer for 120Hz rendering */
transform: translateZ(0);
backface-visibility: hidden;
}

/* Zero-delay atomic theme switch: suppresses all CSS transitions during theme update to eliminate staggered lag */
Expand Down Expand Up @@ -195,8 +190,19 @@
}

/* Tiptap Editor & Task List styling */
.tiptap-scroll-container {
/* WKWebView can omit the caret in empty paragraphs inside a transformed
scrolling layer. Keep native scrolling without forcing GPU compositing. */
transform: none;
}

.tiptap {
outline: none;
/* Override the desktop shell's selection lock, including in macOS WebKit. */
-webkit-user-select: text;
user-select: text;
caret-color: var(--color-text-primary);
cursor: text;
font-family: var(--font-sans);
color: var(--color-text-primary);
font-size: 13.5px;
Expand All @@ -214,38 +220,45 @@
.tiptap ul[data-type="taskList"] li[data-type="taskItem"] {
display: flex;
align-items: flex-start;
gap: 0.55rem;
margin-bottom: 0.35rem;
line-height: 1.5;
line-height: 1.65;
}

.tiptap ul[data-type="taskList"] li[data-type="taskItem"] > label {
flex: 0 0 auto;
margin-right: 0.55rem;
-webkit-user-select: none;
user-select: none;
cursor: pointer;
display: flex;
align-items: center;
margin-top: 0.2rem;
height: 1.65em;
}

.tiptap ul[data-type="taskList"] li[data-type="taskItem"] > label input[type="checkbox"] {
cursor: pointer;
width: 15px;
height: 15px;
border-radius: 4px;
width: 16px;
height: 16px;
margin: 0;
border-radius: 5px;
border: 1.5px solid var(--color-text-subtle);
appearance: none;
-webkit-appearance: none;
outline: none;
transition: all 120ms ease;
background-color: transparent;
transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
background-color: var(--color-hover-overlay);
display: grid;
place-content: center;
position: relative;
}

.tiptap ul[data-type="taskList"] li[data-type="taskItem"] > label input[type="checkbox"]:hover {
border-color: var(--color-teal-primary);
box-shadow: 0 0 0 3px var(--color-teal-tint);
}

.tiptap ul[data-type="taskList"] li[data-type="taskItem"] > label input[type="checkbox"]:focus-visible {
outline: 2px solid var(--color-teal-primary);
outline-offset: 3px;
}

.tiptap ul[data-type="taskList"] li[data-type="taskItem"] > label input[type="checkbox"]:checked {
Expand All @@ -262,15 +275,24 @@
transform: rotate(45deg) translate(-0.5px, -0.5px);
}

.tiptap ul[data-type="taskList"] li[data-type="taskItem"][data-checked="true"] > div {
.tiptap ul[data-type="taskList"] li[data-type="taskItem"][data-checked="true"] > div > p {
text-decoration: line-through;
opacity: 0.55;
transition: opacity 150ms ease;
color: var(--color-text-subtle);
}

.tiptap ul[data-type="taskList"] li[data-type="taskItem"] > div {
flex: 1 1 auto;
min-width: 0;
overflow-wrap: anywhere;
}

.tiptap ul[data-type="taskList"] li[data-type="taskItem"] > div > p {
margin: 0;
min-height: 1.65em;
}

.tiptap ul[data-type="taskList"] li[data-type="taskItem"] > div > p + p {
margin-top: 0.35rem;
}

/* Standard Lists */
Expand Down Expand Up @@ -357,4 +379,3 @@
border-top: 1px solid var(--color-border-panel);
margin: 1rem 0;
}

Loading