Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
fix(ok): drop TrailingNode and give the trailing zone a real affordance (PRD-7931) (#3994)
serafin-garciaa749cea0abe3
diff --git a/.changeset/trailing-block-affordance.md b/.changeset/trailing-block-affordance.mdnew file mode 100644index 000000000..2586dbed2--- /dev/null+++ b/.changeset/trailing-block-affordance.md@@ -0,0 +1,11 @@+---+'@inkeep/open-knowledge': patch+---++A document whose last block is a table, list, or code fence no longer grows a blank line at the end of the file that nobody typed.++The visual editor used to keep an empty paragraph below such a block so there was somewhere to click. That paragraph was a real part of the document rather than a piece of interface, so it serialized to a blank line and landed on disk, and an MD012 lint warning came with it.++That paragraph is gone. In its place, hovering the empty space below the final block shows the same plus you already see beside every other block, at the same spot in the gutter. Clicking anywhere in that space adds the line and puts the cursor in it, so the newline in your file is one you asked for. On a touch device, where there is no hover to read, the plus stays visible whenever the space is there to use, and on a narrow screen it sits at the left edge of the text rather than out in the gutter. Arrow keys still move past the final block as before, and the cursor that lands there is now visible on the dark theme instead of drawing in black.++Two things worth knowing. A file that already picked up the extra blank line keeps it, because OpenKnowledge no longer removes trailing blank lines it did not write. Clear it with Auto-fix in the Problems panel, with `ok lint --fix`, or by hand. And Backspace immediately after a list autoformats (typing `- ` and getting a bullet) now restores the literal characters you typed no matter where you are in the document. It used to do something different on the last line than everywhere else.diff --git a/docs/content/features/editor.mdx b/docs/content/features/editor.mdxindex 0cdf5b158..7f9e02fb9 100644--- a/docs/content/features/editor.mdx+++ b/docs/content/features/editor.mdx@@ -24,6 +24,10 @@ Open any doc from the sidebar. The body renders as WYSIWYG markdown with familiaA slash command (`/`) opens an insert menu for headings, lists, tables, code blocks, callouts, footnotes, inline math, and the other content shapes the editor supports.+When a doc ends in a table, list, or code block, click the empty space below it to start a new paragraph there. A **+** appears in the gutter as you hover, showing where the line will land. On a touch device there is no hover to read, so the **+** stays visible whenever that space is there to use, and on a narrow screen it sits at the left edge of the text rather than out in the gutter. The space is only a click target, so nothing is written to the file until you use it, and a doc that ends in a table stays ending in a table.++A doc written before this behavior may still carry a blank line at the end that nobody typed. Open Knowledge leaves trailing blank lines alone rather than removing ones it did not write, so clear it with **Auto-fix** in the Problems panel, with `ok lint --fix`, or by hand. See [markdownlint rules](/docs/advanced/content-rules/markdownlint).+Markdown problems (hard tabs, heading increments, and the rest) are flagged inline as you write, with a **Problems** panel in the document panel for the whole doc or project. See [Content rules](/docs/advanced/content-rules/overview).### Tablesdiff --git a/packages/app/package.json b/packages/app/package.jsonindex 9ceafae52..3d2a48e6f 100644--- a/packages/app/package.json+++ b/packages/app/package.json@@ -29,7 +29,7 @@"measure:stress": "bash scripts/measure-stress.sh","measure:sweep": "bash scripts/measure-sweep.sh","perf:compare": "bash scripts/perf-compare.sh",- "test:e2e": "playwright test tests/stress/ux-interactions.e2e.ts tests/stress/file-tree-create.e2e.ts tests/stress/file-tree-drag-to-root.e2e.ts tests/stress/file-tree-deselect-to-root.e2e.ts tests/stress/file-tree-collapse-spaced-folder.e2e.ts tests/stress/sidebar-file-list-fills.e2e.ts tests/stress/file-tree-sticky-collapse.e2e.ts tests/stress/file-tree-fractional-zoom.e2e.ts tests/stress/create-then-rename-editable.e2e.ts tests/stress/find-replace.e2e.ts tests/stress/editor-tabs.e2e.ts tests/stress/crdt-stress.e2e.ts tests/stress/slash-command.e2e.ts tests/stress/paste-fidelity.e2e.ts tests/stress/fr-7a-disconnect-source-mode.e2e.ts tests/stress/docs-open.e2e.ts tests/stress/frozen-table-headers.e2e.ts tests/stress/asset-embed.e2e.ts tests/stress/asset-embed-advanced.e2e.ts tests/stress/asset-click-dispatch.e2e.ts tests/stress/handoff.e2e.ts tests/stress/multi-agent-presence.e2e.ts tests/stress/editor-mode-persistence.e2e.ts tests/stress/lint-config-toggle.e2e.ts tests/stress/plugin-enable-notice.e2e.ts tests/stress/schema-edit-fields-view.e2e.ts tests/stress/sidebar-search-pill.e2e.ts tests/stress/navigation-history.e2e.ts tests/stress/command-palette-semantic.e2e.ts tests/stress/agent-activity-panel.e2e.ts tests/stress/drop-pipeline-auto-open.e2e.ts tests/stress/command-palette-flicker.e2e.ts tests/stress/cm6-list-hanging-indent.e2e.ts tests/stress/ng7-rapid-nav-coherence.e2e.ts tests/stress/reveal-on-activate.e2e.ts tests/stress/selection-indicator.e2e.ts tests/stress/new-file-cross-doc-bleed.e2e.ts tests/stress/new-item-shortcut-fast-path.e2e.ts tests/stress/editor-mode-flip-cross-doc-bleed.e2e.ts tests/stress/editor-area-viewport-resize.e2e.ts tests/stress/qa-sidebar-responsive.e2e.ts tests/stress/prd-6955-reassertion-repro.e2e.ts tests/stress/prd-6955-reassertion-wedge.e2e.ts tests/stress/prd-6914-repro.e2e.ts tests/stress/showall-lazy-tree.e2e.ts tests/stress/tabs-component-strip.e2e.ts tests/stress/source-find-scroll.e2e.ts tests/stress/harness-app-warmth.e2e.ts tests/stress/qa-canary-authoring-both-modes.e2e.ts tests/stress/qa-canary-live-typing.e2e.ts tests/stress/keystroke-cadence-danger-space.e2e.ts tests/stress/jsx-unregistered-backspace-delete.e2e.ts tests/stress/jsx-unregistered-ime-concurrent.e2e.ts tests/stress/jsx-backspace-delete.e2e.ts tests/stress/link-authoring-bytes.e2e.ts tests/stress/link-authoring-apex.e2e.ts tests/stress/command-palette-parity.e2e.ts tests/stress/settings-search.e2e.ts tests/stress/okf-generated-index-settings.e2e.ts tests/stress/okf-recommended-skill-install.e2e.ts tests/stress/chip-popover-positioning.e2e.ts tests/stress/docs-open-scroll-restore.e2e.ts tests/stress/file-tree-decoration-chip-strip-repro.e2e.ts tests/stress/grip-click-nodeselect.e2e.ts tests/stress/jsx-halo-semantics.e2e.ts tests/stress/jsx-image-body-click.e2e.ts tests/stress/jsx-prop-panel-placeholder.e2e.ts tests/stress/jsx-range-encompass-halo.e2e.ts tests/stress/jsx-wildcard-convert.e2e.ts tests/stress/markdown-lint.e2e.ts tests/stress/frontmatter-schema-badge.e2e.ts tests/stress/frontmatter-glob-picker.e2e.ts tests/stress/unified-problems.e2e.ts tests/stress/mid-type-recovery.e2e.ts tests/stress/observer-a-multi-client.e2e.ts tests/stress/outline-toolbar-occlusion.e2e.ts tests/stress/selection-surface-pane-clip.e2e.ts tests/stress/quiet-tree-hidden-doc.e2e.ts tests/stress/raw-mdx-fallback-onblur-upgrade.e2e.ts tests/stress/rename-noext-probe.e2e.ts tests/stress/show-ok-folders.e2e.ts tests/stress/source-polish.e2e.ts tests/stress/warm-skeleton-scroll-restore.e2e.ts tests/stress/props-toggle-scroll-preserve.e2e.ts tests/stress/yjs-no-dual-import.e2e.ts tests/stress/graph-panel-surfaces.e2e.ts tests/stress/asset-embed-real-fidelity.e2e.ts tests/stress/image-invalid-placeholder.e2e.ts tests/stress/local-target-audit.e2e.ts tests/stress/rename-content-preservation.e2e.ts tests/stress/rename-consolidation.e2e.ts tests/stress/outline-active-heading.e2e.ts tests/stress/outline-navigation.e2e.ts tests/stress/prd-7627-default-swatch.e2e.ts tests/stress/clipboard-dollar-math-source-fallback.e2e.ts tests/stress/source-mode-undo-keymap.e2e.ts tests/stress/timeline-recovered-restore.e2e.ts tests/stress/blank-line-preservation.e2e.ts tests/stress/landing-helpers.e2e.ts tests/stress/mode-switch-landing.e2e.ts tests/stress/mode-switch-ordinal-divergence.e2e.ts tests/stress/comment-annotation-visibility.e2e.ts tests/stress/comment-opens-in-panel.e2e.ts tests/stress/qa-miles-edge-blanks.e2e.ts tests/stress/prop-upload.e2e.ts tests/stress/slash-command-auto-open.e2e.ts tests/stress/clipboard-relative-url-source-fallback.e2e.ts tests/stress/editor-split-view.e2e.ts tests/stress/language-load-failure.e2e.ts tests/stress/language-first-paint.e2e.ts tests/stress/user-text-direction.e2e.ts tests/stress/pseudolocale.e2e.ts tests/stress/language-picker.e2e.ts tests/stress/zh-hans-coverage-sweep.e2e.ts tests/stress/preview-tab-promotion.e2e.ts tests/stress/cv-paint-lock-click.e2e.ts tests/stress/cv-auto-paint-lock-click.e2e.ts tests/stress/history-traversal-preview-tab.e2e.ts tests/stress/tab-close-scroll-restore.e2e.ts tests/stress/skills-sidebar-open.e2e.ts",+ "test:e2e": "playwright test tests/stress/ux-interactions.e2e.ts tests/stress/file-tree-create.e2e.ts tests/stress/file-tree-drag-to-root.e2e.ts tests/stress/file-tree-deselect-to-root.e2e.ts tests/stress/file-tree-collapse-spaced-folder.e2e.ts tests/stress/sidebar-file-list-fills.e2e.ts tests/stress/file-tree-sticky-collapse.e2e.ts tests/stress/file-tree-fractional-zoom.e2e.ts tests/stress/create-then-rename-editable.e2e.ts tests/stress/find-replace.e2e.ts tests/stress/editor-tabs.e2e.ts tests/stress/crdt-stress.e2e.ts tests/stress/slash-command.e2e.ts tests/stress/paste-fidelity.e2e.ts tests/stress/fr-7a-disconnect-source-mode.e2e.ts tests/stress/docs-open.e2e.ts tests/stress/frozen-table-headers.e2e.ts tests/stress/asset-embed.e2e.ts tests/stress/asset-embed-advanced.e2e.ts tests/stress/asset-click-dispatch.e2e.ts tests/stress/handoff.e2e.ts tests/stress/multi-agent-presence.e2e.ts tests/stress/editor-mode-persistence.e2e.ts tests/stress/lint-config-toggle.e2e.ts tests/stress/plugin-enable-notice.e2e.ts tests/stress/schema-edit-fields-view.e2e.ts tests/stress/sidebar-search-pill.e2e.ts tests/stress/navigation-history.e2e.ts tests/stress/command-palette-semantic.e2e.ts tests/stress/agent-activity-panel.e2e.ts tests/stress/drop-pipeline-auto-open.e2e.ts tests/stress/command-palette-flicker.e2e.ts tests/stress/cm6-list-hanging-indent.e2e.ts tests/stress/ng7-rapid-nav-coherence.e2e.ts tests/stress/reveal-on-activate.e2e.ts tests/stress/selection-indicator.e2e.ts tests/stress/new-file-cross-doc-bleed.e2e.ts tests/stress/new-item-shortcut-fast-path.e2e.ts tests/stress/editor-mode-flip-cross-doc-bleed.e2e.ts tests/stress/editor-area-viewport-resize.e2e.ts tests/stress/qa-sidebar-responsive.e2e.ts tests/stress/prd-6955-reassertion-repro.e2e.ts tests/stress/prd-6955-reassertion-wedge.e2e.ts tests/stress/prd-6914-repro.e2e.ts tests/stress/showall-lazy-tree.e2e.ts tests/stress/tabs-component-strip.e2e.ts tests/stress/source-find-scroll.e2e.ts tests/stress/harness-app-warmth.e2e.ts tests/stress/qa-canary-authoring-both-modes.e2e.ts tests/stress/qa-canary-live-typing.e2e.ts tests/stress/keystroke-cadence-danger-space.e2e.ts tests/stress/jsx-unregistered-backspace-delete.e2e.ts tests/stress/jsx-unregistered-ime-concurrent.e2e.ts tests/stress/jsx-backspace-delete.e2e.ts tests/stress/link-authoring-bytes.e2e.ts tests/stress/link-authoring-apex.e2e.ts tests/stress/command-palette-parity.e2e.ts tests/stress/settings-search.e2e.ts tests/stress/okf-generated-index-settings.e2e.ts tests/stress/okf-recommended-skill-install.e2e.ts tests/stress/chip-popover-positioning.e2e.ts tests/stress/docs-open-scroll-restore.e2e.ts tests/stress/file-tree-decoration-chip-strip-repro.e2e.ts tests/stress/grip-click-nodeselect.e2e.ts tests/stress/jsx-halo-semantics.e2e.ts tests/stress/jsx-image-body-click.e2e.ts tests/stress/jsx-prop-panel-placeholder.e2e.ts tests/stress/jsx-range-encompass-halo.e2e.ts tests/stress/jsx-wildcard-convert.e2e.ts tests/stress/markdown-lint.e2e.ts tests/stress/frontmatter-schema-badge.e2e.ts tests/stress/frontmatter-glob-picker.e2e.ts tests/stress/unified-problems.e2e.ts tests/stress/mid-type-recovery.e2e.ts tests/stress/observer-a-multi-client.e2e.ts tests/stress/outline-toolbar-occlusion.e2e.ts tests/stress/selection-surface-pane-clip.e2e.ts tests/stress/quiet-tree-hidden-doc.e2e.ts tests/stress/raw-mdx-fallback-onblur-upgrade.e2e.ts tests/stress/rename-noext-probe.e2e.ts tests/stress/show-ok-folders.e2e.ts tests/stress/source-polish.e2e.ts tests/stress/warm-skeleton-scroll-restore.e2e.ts tests/stress/props-toggle-scroll-preserve.e2e.ts tests/stress/yjs-no-dual-import.e2e.ts tests/stress/graph-panel-surfaces.e2e.ts tests/stress/asset-embed-real-fidelity.e2e.ts tests/stress/image-invalid-placeholder.e2e.ts tests/stress/local-target-audit.e2e.ts tests/stress/rename-content-preservation.e2e.ts tests/stress/rename-consolidation.e2e.ts tests/stress/outline-active-heading.e2e.ts tests/stress/outline-navigation.e2e.ts tests/stress/prd-7627-default-swatch.e2e.ts tests/stress/clipboard-dollar-math-source-fallback.e2e.ts tests/stress/source-mode-undo-keymap.e2e.ts tests/stress/timeline-recovered-restore.e2e.ts tests/stress/blank-line-preservation.e2e.ts tests/stress/landing-helpers.e2e.ts tests/stress/mode-switch-landing.e2e.ts tests/stress/mode-switch-ordinal-divergence.e2e.ts tests/stress/comment-annotation-visibility.e2e.ts tests/stress/comment-opens-in-panel.e2e.ts tests/stress/qa-miles-edge-blanks.e2e.ts tests/stress/prop-upload.e2e.ts tests/stress/slash-command-auto-open.e2e.ts tests/stress/clipboard-relative-url-source-fallback.e2e.ts tests/stress/editor-split-view.e2e.ts tests/stress/language-load-failure.e2e.ts tests/stress/language-first-paint.e2e.ts tests/stress/user-text-direction.e2e.ts tests/stress/pseudolocale.e2e.ts tests/stress/language-picker.e2e.ts tests/stress/zh-hans-coverage-sweep.e2e.ts tests/stress/preview-tab-promotion.e2e.ts tests/stress/cv-paint-lock-click.e2e.ts tests/stress/cv-auto-paint-lock-click.e2e.ts tests/stress/history-traversal-preview-tab.e2e.ts tests/stress/tab-close-scroll-restore.e2e.ts tests/stress/skills-sidebar-open.e2e.ts tests/stress/trailing-affordance.e2e.ts","test:e2e:install-browsers": "playwright install chromium webkit firefox","test:visual": "playwright test --config playwright.visual.config.ts","test:visual:update": "playwright test --config playwright.visual.config.ts --update-snapshots",diff --git a/packages/app/src/editor/block-spans.ts b/packages/app/src/editor/block-spans.tsindex b7bddf608..fe2a7af98 100644--- a/packages/app/src/editor/block-spans.ts+++ b/packages/app/src/editor/block-spans.ts@@ -1,8 +1,4 @@-import {- type MarkdownManager,- MIN_CARRIED_EDGE_EMPTIES,- stripFrontmatter,-} from '@inkeep/open-knowledge-core';+import { type MarkdownManager, stripFrontmatter } from '@inkeep/open-knowledge-core';import type { Node as PmNode } from '@tiptap/pm/model';export interface SourceBlockSpans {@@ -101,7 +97,7 @@ export function comparableChildCount(doc: PmNode): number {if (child.type.name !== 'paragraph' || child.content.size !== 0) break;trailingEmpty++;}- return trailingEmpty < MIN_CARRIED_EDGE_EMPTIES ? doc.childCount - trailingEmpty : doc.childCount;+ return trailingEmpty === doc.childCount ? 0 : doc.childCount;}export function blockRangeToPositions(diff --git a/packages/app/src/editor/extensions/JsxComponentView.tsx b/packages/app/src/editor/extensions/JsxComponentView.tsxindex 7ab8a36a0..b1357b975 100644--- a/packages/app/src/editor/extensions/JsxComponentView.tsx+++ b/packages/app/src/editor/extensions/JsxComponentView.tsx@@ -47,7 +47,6 @@ import {} from '@inkeep/open-knowledge-core';import { Trans, useLingui } from '@lingui/react/macro';import type { NodeViewProps } from '@tiptap/core';-import { TextSelection } from '@tiptap/pm/state';import { NodeViewContent, NodeViewWrapper } from '@tiptap/react';import {ArrowDown,@@ -89,6 +88,7 @@ import {resolveDescriptorPlaceholder,shouldRenderPlaceholder,} from '../registry/resolve-descriptor-placeholder.ts';+import { moveCaretAfterNode, placeGapCursorAfterNode } from '../selection/place-caret.ts';import {consumeAutoOpen,createChildNode,@@ -579,11 +579,11 @@ export function JsxComponentView({ node, editor, extension, getPos, selected }:const nodeEnd = p + curNode.nodeSize;const selFrom = editor.state.selection.from;if (selFrom < p || selFrom >= nodeEnd) return;- if (isSelfClosingLeaf) {- const $end = editor.state.doc.resolve(Math.min(nodeEnd, editor.state.doc.content.size));- const nextSel = TextSelection.near($end, 1);- editor.view.dispatch(editor.state.tr.setSelection(nextSel).scrollIntoView());- } else {+ if (+ !isSelfClosingLeaf ||+ (!moveCaretAfterNode(editor.view, p, curNode.nodeSize) &&+ !placeGapCursorAfterNode(editor.view, p, curNode.nodeSize))+ ) {editor.chain().setNodeSelection(p).run();}} catch (err) {diff --git a/packages/app/src/editor/extensions/drag-handle.dom.test.ts b/packages/app/src/editor/extensions/drag-handle.dom.test.tsnew file mode 100644index 000000000..813b7197c--- /dev/null+++ b/packages/app/src/editor/extensions/drag-handle.dom.test.ts@@ -0,0 +1,57 @@+import type { Node as PmNode } from '@tiptap/pm/model';+import { beforeEach, describe, expect, test, vi } from 'vitest';++type NodeChange = (arg: { node: PmNode | null; pos: number }) => void;++let captured: { element: HTMLElement; onNodeChange: NodeChange } | null = null;++vi.mock('@tiptap/extension-drag-handle', () => ({+ DragHandlePlugin: (options: { element: HTMLElement; onNodeChange: NodeChange }) => {+ captured = { element: options.element, onNodeChange: options.onNodeChange };+ return { plugin: {} };+ },+ normalizeNestedOptions: () => ({}),+}));++const { BlockDragHandle } = await import('./drag-handle.ts');++function mountControls(): { addBtn: HTMLElement; grip: HTMLElement; fire: NodeChange } {+ captured = null;+ const build = BlockDragHandle.config.addProseMirrorPlugins as (this: {+ editor: unknown;+ }) => unknown[];+ build.call({ editor: {} });+ if (!captured) throw new Error('DragHandlePlugin was never constructed');+ const { element, onNodeChange } = captured;+ const addBtn = element.querySelector('.ok-add-block-btn');+ const grip = element.querySelector('.ok-drag-grip');+ if (!(addBtn instanceof HTMLElement) || !(grip instanceof HTMLElement)) {+ throw new Error('block controls are missing a button');+ }+ return { addBtn, grip, fire: onNodeChange };+}++describe('block controls label refresh', () => {+ let controls: ReturnType<typeof mountControls>;++ beforeEach(() => {+ controls = mountControls();+ });++ test('both buttons are labelled at construction', () => {+ expect(controls.addBtn.getAttribute('aria-label')).toBe('Add block below');+ expect(controls.grip.getAttribute('aria-label')).toBe('Select block');+ });++ test('a node change rewrites the + button label rather than leaving it as found', () => {+ controls.addBtn.setAttribute('aria-label', 'stale');+ controls.fire({ node: null, pos: 0 });+ expect(controls.addBtn.getAttribute('aria-label')).toBe('Add block below');+ });++ test('a node change rewrites the grip label too', () => {+ controls.grip.setAttribute('aria-label', 'stale');+ controls.fire({ node: null, pos: 0 });+ expect(controls.grip.getAttribute('aria-label')).toBe('Select block');+ });+});diff --git a/packages/app/src/editor/extensions/drag-handle.ts b/packages/app/src/editor/extensions/drag-handle.tsindex f6f80d063..89b7fda49 100644--- a/packages/app/src/editor/extensions/drag-handle.ts+++ b/packages/app/src/editor/extensions/drag-handle.ts@@ -1,5 +1,6 @@import { offset } from '@floating-ui/dom';import { incrementBlockGripClickSelectFailed } from '@inkeep/open-knowledge-core';+import { t } from '@lingui/core/macro';import { type Editor, Extension } from '@tiptap/core';import { DragHandlePlugin, normalizeNestedOptions } from '@tiptap/extension-drag-handle';import type { Node as PmNode } from '@tiptap/pm/model';@@ -7,23 +8,28 @@ import { TextSelection } from '@tiptap/pm/state';import { OPT_OUT_ATTR } from '../clipboard/index.ts';import { getDescriptor } from '../registry/index.ts';import { createChildNode, focusInsertedComponent } from '../slash-command/component-items.tsx';+import { GUTTER_PLUS_SVG } from './gutter-plus-icon.ts';const HANDLE_HEIGHT = 20;const MAX_SINGLE_LINE_HEIGHT = 44;const BODY_LINE_HEIGHT = 28;+function selectNamed(name: string): string {+ return t`Select ${name}`;+}+function describeBlockForGrip(node: PmNode | null): string {- if (!node) return 'Select block';+ if (!node) return t`Select block`;if (node.type.name === 'jsxComponent') {const componentName = (node.attrs.componentName as string | undefined) ?? '';if (componentName) {const descriptor = getDescriptor(componentName);const label =descriptor.name === '*' ? componentName : (descriptor.displayName ?? descriptor.name);- if (label) return `Select ${label}`;+ if (label) return selectNamed(label);}}- return `Select ${node.type.name}`;+ return selectNamed(node.type.name);}function createBlockControlsElement(): {@@ -38,9 +44,9 @@ function createBlockControlsElement(): {const addBtn = document.createElement('button');addBtn.className = 'ok-add-block-btn';- addBtn.setAttribute('aria-label', 'Add block below');+ addBtn.setAttribute('aria-label', t`Add block below`);addBtn.setAttribute('type', 'button');- addBtn.innerHTML = `<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-plus"><path d="M5 12h14"/><path d="M12 5v14"/></svg>`;+ addBtn.innerHTML = GUTTER_PLUS_SVG;addBtn.addEventListener('mousedown', (e) => {e.preventDefault();@@ -50,7 +56,7 @@ function createBlockControlsElement(): {const grip = document.createElement('button');grip.className = 'ok-drag-grip';grip.setAttribute('type', 'button');- grip.setAttribute('aria-label', 'Select block');+ grip.setAttribute('aria-label', t`Select block`);grip.setAttribute('tabindex', '-1');grip.innerHTML = `<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-grip-vertical-icon lucide-grip-vertical"><circle cx="9" cy="12" r="1"/><circle cx="9" cy="5" r="1"/><circle cx="9" cy="19" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="15" cy="5" r="1"/><circle cx="15" cy="19" r="1"/></svg>`;@@ -150,6 +156,7 @@ export const BlockDragHandle = Extension.create({currentNode = node;currentNodePos = pos ?? -1;grip.setAttribute('aria-label', describeBlockForGrip(node));+ addBtn.setAttribute('aria-label', t`Add block below`);},computePositionConfig: {placement: 'left-start',diff --git a/packages/app/src/editor/extensions/gutter-plus-icon.ts b/packages/app/src/editor/extensions/gutter-plus-icon.tsnew file mode 100644index 000000000..ad460e358--- /dev/null+++ b/packages/app/src/editor/extensions/gutter-plus-icon.ts@@ -0,0 +1 @@+export const GUTTER_PLUS_SVG = `<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-plus"><path d="M5 12h14"/><path d="M12 5v14"/></svg>`;diff --git a/packages/app/src/editor/extensions/shared.ts b/packages/app/src/editor/extensions/shared.tsindex 3d8f4b989..52e3d785e 100644--- a/packages/app/src/editor/extensions/shared.ts+++ b/packages/app/src/editor/extensions/shared.ts@@ -37,6 +37,7 @@ import { TableInsertControls } from './table-insert-controls';import { TableRowEnter } from './table-row-enter';import { TagClickPlugin } from './tag-click-plugin';import { Tag } from './tag-view';+import { TrailingAffordance } from './trailing-affordance';import { WikiLink } from './wiki-link';import { WikiLinkEmbed } from './wiki-link-embed';@@ -97,6 +98,7 @@ export const sharedExtensions = [FootnoteAnchorScroll,BlockDragHandle,BlockMover,+ TrailingAffordance,TableInsertControls,TableRowEnter,SourceDirtyObserver,diff --git a/packages/app/src/editor/extensions/trailing-affordance.dom.test.ts b/packages/app/src/editor/extensions/trailing-affordance.dom.test.tsnew file mode 100644index 000000000..3ca6352c5--- /dev/null+++ b/packages/app/src/editor/extensions/trailing-affordance.dom.test.ts@@ -0,0 +1,621 @@+import { MarkdownManager, sharedExtensions } from '@inkeep/open-knowledge-core';+import { getSchema } from '@tiptap/core';+import { Schema } from '@tiptap/pm/model';+import { EditorState, TextSelection } from '@tiptap/pm/state';+import type { EditorView } from '@tiptap/pm/view';+import { describe, expect, test, vi } from 'vitest';+import { OPT_OUT_ATTR } from '../clipboard/index.ts';+import {+ appendTrailingParagraph,+ docNeedsTrailingAffordance,+ OK_TRAILING_AFFORDANCE_CLASS,+ renderHint,+ trailingAffordanceKey,+ trailingAffordancePlugin,+} from './trailing-affordance.ts';++const schema = new Schema({+ nodes: {+ doc: { content: 'block+' },+ paragraph: { group: 'block', content: 'inline*' },+ heading: { group: 'block', content: 'inline*' },+ codeBlock: { group: 'block', content: 'text*' },+ table: { group: 'block', content: 'block*' },+ list: { group: 'block', content: 'listItem+' },+ listItem: { content: 'paragraph+' },+ thematicBreak: { group: 'block' },+ text: { group: 'inline' },+ },+ marks: {},+});++function tailNode(lastType: string) {+ if (lastType === 'table') {+ return schema.node('table', null, [schema.node('paragraph', null, [schema.text('cell')])]);+ }+ if (lastType === 'list') {+ return schema.node('list', null, [+ schema.node('listItem', null, [schema.node('paragraph', null, [schema.text('item')])]),+ ]);+ }+ if (lastType === 'thematicBreak') return schema.node('thematicBreak');+ return schema.node(lastType, null, [schema.text('tail')]);+}++function stateEndingIn(lastType: string): EditorState {+ const doc = schema.node('doc', null, [+ schema.node('paragraph', null, [schema.text('body')]),+ tailNode(lastType),+ ]);+ return EditorState.create({ doc, plugins: [trailingAffordancePlugin()] });+}++function hover(state: EditorState, next: boolean): EditorState {+ return state.apply(state.tr.setMeta(trailingAffordanceKey, next));+}++function selecting(state: EditorState): EditorState {+ return state.apply(state.tr.setSelection(TextSelection.create(state.doc, 1, 5)));+}++function decorationsOf(state: EditorState) {+ const plugin = state.plugins.find((p) => p.spec.key === trailingAffordanceKey);+ expect(plugin).toBeDefined();+ return plugin?.props.decorations?.call(plugin, state) ?? null;+}++describe('docNeedsTrailingAffordance', () => {+ test.each([+ 'table',+ 'heading',+ 'codeBlock',+ 'list',+ 'thematicBreak',+ ])('engages when the last block is a %s — nothing can host a caret below it', (type) => {+ expect(docNeedsTrailingAffordance(stateEndingIn(type).doc)).toBe(true);+ });++ test('stands down when the last block is a paragraph', () => {+ expect(docNeedsTrailingAffordance(stateEndingIn('paragraph').doc)).toBe(false);+ });+});++describe('docNeedsTrailingAffordance against the production schema', () => {+ const markdown = new MarkdownManager({ extensions: sharedExtensions });+ const prodSchema = getSchema(sharedExtensions);++ function docFrom(src: string) {+ return prodSchema.nodeFromJSON(markdown.parse(src));+ }++ test.each([+ ['a table', '| a |\n| - |\n| b |', 'table'],+ ['a heading', 'body\n\n## H', 'heading'],+ ['a fenced code block', 'body\n\n```js\nx\n```', 'codeBlock'],+ ['a bullet list', 'body\n\n- item', 'list'],+ ['an ordered list', 'body\n\n1. item', 'list'],+ ['a thematic break', 'body\n\n---', 'thematicBreak'],+ ['a blockquote', 'body\n\n> quoted', 'blockquote'],+ ['an HTML comment', 'body\n\n<!-- note -->', 'commentBlock'],+ ['a footnote definition', 'body[^1]\n\n[^1]: note', 'footnoteDefinition'],+ ['a link reference definition', 'body\n\n[a]: http://example.com', 'linkRefDef'],+ ])('engages when the document ends in %s', (_label, src, expectedType) => {+ const doc = docFrom(src);+ expect(doc.lastChild?.type.name).toBe(expectedType);+ expect(docNeedsTrailingAffordance(doc)).toBe(true);+ });++ test('stands down when real markdown ends in a paragraph', () => {+ const doc = docFrom('body\n\ntail');+ expect(doc.lastChild?.type.name).toBe('paragraph');+ expect(docNeedsTrailingAffordance(doc)).toBe(false);+ });+});++describe('hint decoration', () => {+ test('is absent until the pointer enters the zone', () => {+ expect(decorationsOf(stateEndingIn('table'))).toBeNull();+ });++ test('appears at the end of the document while hovered', () => {+ const state = hover(stateEndingIn('table'), true);+ const set = decorationsOf(state);+ const found = set?.find() ?? [];+ expect(found).toHaveLength(1);+ expect(found[0]?.from).toBe(state.doc.content.size);+ });++ test('stays absent while hovered when the last block is a paragraph', () => {+ expect(decorationsOf(hover(stateEndingIn('paragraph'), true))).toBeNull();+ });++ test('disappears again when the pointer leaves', () => {+ const state = hover(hover(stateEndingIn('table'), true), false);+ expect(decorationsOf(state)).toBeNull();+ });++ test('hovering does not change the document', () => {+ const before = stateEndingIn('table');+ const after = hover(before, true);+ expect(after.doc.eq(before.doc)).toBe(true);+ });+});++describe('renderHint', () => {+ test('is inert chrome — non-editable, hidden from AT, omitted from copies', () => {+ const el = renderHint();+ expect(el.classList.contains(OK_TRAILING_AFFORDANCE_CLASS)).toBe(true);+ expect(el.getAttribute('contenteditable')).toBe('false');+ expect(el.getAttribute('aria-hidden')).toBe('true');+ expect(el.getAttribute(OPT_OUT_ATTR)).toBe('true');+ });++ test('renders a single plus glyph', () => {+ const el = renderHint();+ const plus = el.querySelector(`.${OK_TRAILING_AFFORDANCE_CLASS}-plus`);+ expect(plus).not.toBeNull();+ expect(plus?.querySelector('svg')).not.toBeNull();+ });+});++describe('appendTrailingParagraph', () => {+ function stubView(state: EditorState) {+ const focus = vi.fn();+ const view = {+ state,+ focus,+ dispatch: (tr: unknown) => {+ view.state = view.state.apply(tr as never);+ },+ };+ return { view, focus };+ }++ test('adds one empty paragraph at the end and puts the caret in it', () => {+ const { view, focus } = stubView(stateEndingIn('table'));+ appendTrailingParagraph(view as unknown as EditorView);++ const last = view.state.doc.lastChild;+ expect(last?.type.name).toBe('paragraph');+ expect(last?.textContent).toBe('');+ expect(view.state.doc.childCount).toBe(3);+ expect(view.state.selection.$head.parent).toBe(last);+ expect(focus).toHaveBeenCalled();+ });++ test('the inserted paragraph retires the hint', () => {+ const { view } = stubView(hover(stateEndingIn('table'), true));+ appendTrailingParagraph(view as unknown as EditorView);+ expect(docNeedsTrailingAffordance(view.state.doc)).toBe(false);+ });+});++describe('trailing zone interaction', () => {+ const LAST_BLOCK_BOTTOM = 100;+ const EDITOR_BOX = { top: 0, bottom: 400, left: 40, right: 800 };+ const IN_ZONE = { clientX: 400, clientY: 200 };+ const ABOVE_ZONE = { clientX: 400, clientY: 50 };++ function rect(box: Partial<DOMRect>): DOMRect {+ return { top: 0, bottom: 0, left: 0, right: 0, ...box } as DOMRect;+ }++ function stubView(+ state: EditorState,+ { editable = true, withHint = false }: { editable?: boolean; withHint?: boolean } = {},+ ) {+ const dom = document.createElement('div');+ const block = document.createElement('p');+ block.getBoundingClientRect = () => rect({ bottom: LAST_BLOCK_BOTTOM });+ dom.append(block);+ if (withHint) {+ const hint = renderHint();+ hint.getBoundingClientRect = () => rect({ bottom: EDITOR_BOX.bottom });+ dom.append(hint);+ }+ dom.getBoundingClientRect = () => rect(EDITOR_BOX);++ const lastBlockPos = state.doc.content.size - (state.doc.lastChild?.nodeSize ?? 0);++ const view = {+ state,+ dom,+ editable,+ focus: vi.fn(),+ nodeDOM(pos: number) {+ return pos === lastBlockPos ? block : null;+ },+ dispatch(tr: unknown) {+ view.state = view.state.apply(tr as never);+ },+ };+ return view;+ }++ type EventName = 'mousemove' | 'mouseleave' | 'pointerdown' | 'pointerup' | 'pointercancel';++ function fire(+ view: ReturnType<typeof stubView>,+ type: EventName,+ init: MouseEventInit & { pointerId?: number },+ target?: Element,+ ) {+ const plugin = view.state.plugins.find((p) => p.spec.key === trailingAffordanceKey);+ const handler = plugin?.props.handleDOMEvents?.[type];+ expect(handler).toBeDefined();+ const { pointerId, ...mouseInit } = init;+ const event = new MouseEvent(type, { button: 0, cancelable: true, ...mouseInit });+ if (pointerId !== undefined) Object.defineProperty(event, 'pointerId', { value: pointerId });+ if (target) Object.defineProperty(event, 'target', { value: target });+ const handled = handler?.call(plugin, view as unknown as EditorView, event);+ return { handled, event };+ }++ function click(+ view: ReturnType<typeof stubView>,+ at: MouseEventInit & { pointerId?: number },+ target?: Element,+ ) {+ fire(view, 'pointerdown', at, target);+ return fire(view, 'pointerup', at, target);+ }++ function glyphIn(view: ReturnType<typeof stubView>): Element {+ const glyph = view.dom.querySelector(`.${OK_TRAILING_AFFORDANCE_CLASS}-plus`);+ expect(glyph).not.toBeNull();+ // biome-ignore lint/style/noNonNullAssertion: asserted non-null above.+ return glyph!;+ }++ test('a primary click below the last block authors the paragraph', () => {+ const view = stubView(stateEndingIn('table'));+ const { handled, event } = click(view, { ...IN_ZONE });++ expect(handled).toBe(true);+ expect(event.defaultPrevented).toBe(true);+ expect(view.state.doc.childCount).toBe(3);+ expect(view.state.doc.lastChild?.type.name).toBe('paragraph');+ });++ test('the press itself claims nothing', () => {+ const view = stubView(stateEndingIn('table'));+ const { handled, event } = fire(view, 'pointerdown', { ...IN_ZONE });++ expect(handled).toBe(false);+ expect(event.defaultPrevented).toBe(false);+ expect(view.state.doc.childCount).toBe(2);+ });++ test('a press that travels far enough to be a drag authors nothing', () => {+ const view = stubView(stateEndingIn('table'));+ fire(view, 'pointerdown', { ...IN_ZONE });+ const { handled } = fire(view, 'pointerup', {+ clientX: IN_ZONE.clientX,+ clientY: IN_ZONE.clientY + 60,+ });++ expect(handled).toBe(false);+ expect(view.state.doc.childCount).toBe(2);+ });++ test('a press cancelled mid-gesture authors nothing on the next release', () => {+ const view = stubView(stateEndingIn('table'));+ fire(view, 'pointerdown', { ...IN_ZONE });+ fire(view, 'pointercancel', { ...IN_ZONE });++ expect(fire(view, 'pointerup', { ...IN_ZONE }).handled).toBe(false);+ expect(view.state.doc.childCount).toBe(2);+ });++ test('a press outside the zone is not redeemed by releasing inside it', () => {+ const view = stubView(stateEndingIn('table'));+ fire(view, 'pointerdown', { ...ABOVE_ZONE });++ expect(fire(view, 'pointerup', { ...IN_ZONE }).handled).toBe(false);+ expect(view.state.doc.childCount).toBe(2);+ });++ test("a second contact in the zone does not drop the first finger's press", () => {+ const view = stubView(stateEndingIn('table'));+ fire(view, 'pointerdown', { ...IN_ZONE, pointerId: 1 });+ fire(view, 'pointerdown', { ...IN_ZONE, pointerId: 2 });++ expect(fire(view, 'pointerup', { ...IN_ZONE, pointerId: 1 }).handled).toBe(true);+ expect(view.state.doc.childCount).toBe(3);+ });++ test('a second contact in the zone cannot redeem a tap of its own', () => {+ const view = stubView(stateEndingIn('table'));+ const palm = { ...IN_ZONE, pointerId: 2 };+ fire(view, 'pointerdown', { ...IN_ZONE, pointerId: 1 });+ fire(view, 'pointerdown', palm);++ expect(fire(view, 'pointerup', palm).handled).toBe(false);+ expect(view.state.doc.childCount).toBe(2);+ });++ test('the contact that lands second cannot author, even when it is the real one', () => {+ const view = stubView(stateEndingIn('table'));+ const inZonePalm = { ...IN_ZONE, pointerId: 2 };+ fire(view, 'pointerdown', inZonePalm);+ fire(view, 'pointerdown', { ...IN_ZONE, pointerId: 1 });++ expect(fire(view, 'pointerup', { ...IN_ZONE, pointerId: 1 }).handled).toBe(false);+ expect(view.state.doc.childCount).toBe(2);+ });++ test("another pointer's cancel does not end this press", () => {+ const view = stubView(stateEndingIn('table'));+ fire(view, 'pointerdown', { ...IN_ZONE, pointerId: 1 });+ fire(view, 'pointercancel', { ...IN_ZONE, pointerId: 2 });++ expect(fire(view, 'pointerup', { ...IN_ZONE, pointerId: 1 }).handled).toBe(true);+ expect(view.state.doc.childCount).toBe(3);+ });++ test('a release from a pointer that never pressed authors nothing', () => {+ const view = stubView(stateEndingIn('table'));+ fire(view, 'pointerdown', { ...IN_ZONE, pointerId: 1 });++ expect(fire(view, 'pointerup', { ...IN_ZONE, pointerId: 2 }).handled).toBe(false);+ expect(view.state.doc.childCount).toBe(2);+ });++ test('a click that ends a selection leaves the selection to ProseMirror', () => {+ const view = stubView(selecting(stateEndingIn('table')));+ expect(click(view, { ...IN_ZONE }).handled).toBe(false);+ expect(view.state.doc.childCount).toBe(2);+ });++ test('the hint does not raise the zone floor onto itself', () => {+ const view = stubView(hover(stateEndingIn('table'), true), { withHint: true });+ expect(click(view, { ...IN_ZONE }).handled).toBe(true);+ expect(view.state.doc.childCount).toBe(3);+ });++ test.each([+ ['a secondary click', { button: 2 }],+ ['a middle click', { button: 1 }],+ ['a ctrl-click', { button: 0, ctrlKey: true }],+ ])('%s is left alone — the document is not touched and the event survives', (_label, init) => {+ const view = stubView(stateEndingIn('table'));+ const { handled, event } = click(view, { ...IN_ZONE, ...init });++ expect(handled).toBe(false);+ expect(event.defaultPrevented).toBe(false);+ expect(view.state.doc.childCount).toBe(2);+ });++ test.each([+ ['above the last block', ABOVE_ZONE],+ ['below the editor', { clientX: 400, clientY: 900 }],+ ['left of the editor', { clientX: 10, clientY: 200 }],+ ['right of the editor', { clientX: 1200, clientY: 200 }],+ ])('a click %s is outside the zone', (_label, at) => {+ const view = stubView(stateEndingIn('table'));+ expect(click(view, at).handled).toBe(false);+ expect(view.state.doc.childCount).toBe(2);+ });++ test('a read-only view never authors anything', () => {+ const view = stubView(stateEndingIn('table'), { editable: false });+ expect(click(view, { ...IN_ZONE }).handled).toBe(false);+ expect(view.state.doc.childCount).toBe(2);+ });++ test('a document already ending in a paragraph is left to ProseMirror', () => {+ const view = stubView(stateEndingIn('paragraph'));+ expect(click(view, { ...IN_ZONE }).handled).toBe(false);+ expect(view.state.doc.childCount).toBe(2);+ });++ test('moving into and out of the zone toggles the hint without claiming the event', () => {+ const view = stubView(stateEndingIn('table'));++ expect(fire(view, 'mousemove', { ...IN_ZONE }).handled).toBe(false);+ expect(trailingAffordanceKey.getState(view.state)).toBe(true);++ expect(fire(view, 'mousemove', { ...ABOVE_ZONE }).handled).toBe(false);+ expect(trailingAffordanceKey.getState(view.state)).toBe(false);+ });++ test('the glyph is in the zone even where the coordinates are not', () => {+ const view = stubView(hover(stateEndingIn('table'), true), { withHint: true });+ const outsideLeft = { clientX: EDITOR_BOX.left - 12, clientY: 200 };++ expect(fire(view, 'mousemove', outsideLeft, glyphIn(view)).handled).toBe(false);+ expect(trailingAffordanceKey.getState(view.state)).toBe(true);++ expect(click(view, outsideLeft, glyphIn(view)).handled).toBe(true);+ expect(view.state.doc.childCount).toBe(3);+ expect(view.state.doc.lastChild?.type.name).toBe('paragraph');+ });++ test("the composer's reserved band is not part of the zone", () => {+ const view = stubView(stateEndingIn('table'));+ view.dom.style.setProperty('--ask-composer-height', '200px');++ const underComposer = { clientX: 400, clientY: EDITOR_BOX.bottom - 100 };+ expect(click(view, underComposer).handled).toBe(false);+ expect(view.state.doc.childCount).toBe(2);++ expect(click(view, { ...IN_ZONE }).handled).toBe(true);+ });++ test('the click retires the hint it was rendered for', () => {+ const view = stubView(hover(stateEndingIn('table'), true), { withHint: true });+ click(view, { ...IN_ZONE });+ expect(trailingAffordanceKey.getState(view.state)).toBe(false);+ });++ describe('on a coarse pointer', () => {+ function coarse() {+ const spy = vi+ .spyOn(window, 'matchMedia')+ .mockImplementation((query) => ({ matches: query.includes('coarse') }) as MediaQueryList);+ return spy;+ }++ test('a synthesized mousemove outside the zone does not retire the hint', () => {+ const spy = coarse();+ try {+ const view = stubView(hover(stateEndingIn('table'), true), { withHint: true });+ expect(fire(view, 'mousemove', { ...ABOVE_ZONE }).handled).toBe(false);+ expect(trailingAffordanceKey.getState(view.state)).toBe(true);+ } finally {+ spy.mockRestore();+ }+ });++ test('mouseleave does not retire the hint', () => {+ const spy = coarse();+ try {+ const view = stubView(hover(stateEndingIn('table'), true), { withHint: true });+ expect(fire(view, 'mouseleave', {}).handled).toBe(false);+ expect(trailingAffordanceKey.getState(view.state)).toBe(true);+ } finally {+ spy.mockRestore();+ }+ });++ test('a tap authors the paragraph and leaves the hint pinned', () => {+ const spy = coarse();+ try {+ const view = stubView(hover(stateEndingIn('table'), true), { withHint: true });+ expect(click(view, { ...IN_ZONE }).handled).toBe(true);+ expect(view.state.doc.lastChild?.type.name).toBe('paragraph');+ expect(trailingAffordanceKey.getState(view.state)).toBe(true);+ } finally {+ spy.mockRestore();+ }+ });+ });+});++describe('plugin view lifecycle', () => {+ function stubMedia(matches: boolean) {+ const listeners = new Set<() => void>();+ const mql = {+ matches,+ addEventListener: (_type: string, fn: () => void) => {+ listeners.add(fn);+ },+ removeEventListener: (_type: string, fn: () => void) => {+ listeners.delete(fn);+ },+ };+ return {+ mql,+ listenerCount: () => listeners.size,+ change(next: boolean) {+ mql.matches = next;+ for (const fn of listeners) fn();+ },+ };+ }++ function harness(matches: boolean, { editable = true } = {}) {+ const media = stubMedia(matches);+ const spy = vi+ .spyOn(window, 'matchMedia')+ .mockImplementation(() => media.mql as unknown as MediaQueryList);+ const state = stateEndingIn('table');+ const view = {+ state,+ dom: document.createElement('div'),+ editable,+ dispatch(tr: unknown) {+ view.state = view.state.apply(tr as never);+ },+ };+ const plugin = state.plugins.find((p) => p.spec.key === trailingAffordanceKey);+ expect(plugin?.spec.view).toBeDefined();+ // biome-ignore lint/style/noNonNullAssertion: asserted defined above.+ const handle = plugin!.spec.view!(view as unknown as EditorView);+ return {+ media,+ handle,+ view,+ pinned: () => trailingAffordanceKey.getState(view.state),+ restore: () => spy.mockRestore(),+ };+ }++ test('pins the hint on a coarse pointer once the initial microtask flushes', async () => {+ const h = harness(true);+ try {+ expect(h.pinned()).toBe(false);+ await Promise.resolve();+ expect(h.pinned()).toBe(true);+ } finally {+ h.handle?.destroy?.();+ h.restore();+ }+ });++ test('leaves a read-only coarse view unpinned, and undecorated', async () => {+ const h = harness(true, { editable: false });+ try {+ await Promise.resolve();+ expect(h.pinned()).toBe(false);+ expect(decorationsOf(h.view.state)).toBeNull();+ } finally {+ h.handle?.destroy?.();+ h.restore();+ }+ });++ test('re-asks when the pointer type changes under it', async () => {+ const h = harness(false);+ try {+ await Promise.resolve();+ expect(h.pinned()).toBe(false);+ h.media.change(true);+ expect(h.pinned()).toBe(true);+ } finally {+ h.handle?.destroy?.();+ h.restore();+ }+ });++ test('re-asks when the view flips out of editable', async () => {+ const h = harness(true);+ try {+ await Promise.resolve();+ expect(h.pinned()).toBe(true);+ h.view.editable = false;+ h.handle?.update?.(h.view as unknown as EditorView, h.view.state);+ expect(h.pinned()).toBe(false);+ } finally {+ h.handle?.destroy?.();+ h.restore();+ }+ });++ test('does not re-ask on an update that left editability alone', async () => {+ const h = harness(false);+ try {+ await Promise.resolve();+ h.view.state = hover(h.view.state, true);+ h.handle?.update?.(h.view as unknown as EditorView, h.view.state);+ expect(h.pinned()).toBe(true);+ } finally {+ h.handle?.destroy?.();+ h.restore();+ }+ });++ test('drops the media listener on destroy', async () => {+ const h = harness(false);+ try {+ await Promise.resolve();+ expect(h.media.listenerCount()).toBe(1);+ h.handle?.destroy?.();+ expect(h.media.listenerCount()).toBe(0);+ h.media.change(true);+ expect(h.pinned()).toBe(false);+ } finally {+ h.restore();+ }+ });+});diff --git a/packages/app/src/editor/extensions/trailing-affordance.ts b/packages/app/src/editor/extensions/trailing-affordance.tsnew file mode 100644index 000000000..a510c7e0e--- /dev/null+++ b/packages/app/src/editor/extensions/trailing-affordance.ts@@ -0,0 +1,187 @@+/* STOP: this hint ships `aria-hidden` because every final-block type already has its own+ keyboard route to a trailing paragraph. The routes differ per type, and Gapcursor+ reaches only the table, thematic-break, atom and isolating cases, so a Gapcursor-only+ replacement silently strips the heading, list and code-fence routes. Do not make the+ hint focusable or swap out the pointer path without re-deriving all of them. Full+ route table and derivation: `packages/app/src/editor/README.md` (internal, and not+ part of the public mirror). */+import { Extension } from '@tiptap/core';+import type { Node as PmNode } from '@tiptap/pm/model';+import { Plugin, PluginKey } from '@tiptap/pm/state';+import { Decoration, DecorationSet, type EditorView } from '@tiptap/pm/view';+import { OPT_OUT_ATTR } from '../clipboard/index.ts';+import { insertParagraphAt } from '../selection/place-caret.ts';+import { ASK_COMPOSER_HEIGHT_VAR } from '../utils/editor-visible-region.ts';+import { GUTTER_PLUS_SVG } from './gutter-plus-icon.ts';++export const OK_TRAILING_AFFORDANCE_CLASS = 'ok-trailing-affordance';++export const trailingAffordanceKey = new PluginKey<boolean>('trailingAffordance');++export function docNeedsTrailingAffordance(doc: Pick<PmNode, 'lastChild'>): boolean {+ const last = doc.lastChild;+ return last != null && last.type.name !== 'paragraph';+}++function lastBlockBottom(view: EditorView): number | null {+ const { doc } = view.state;+ const last = doc.lastChild;+ if (!last) return null;+ const dom = view.nodeDOM(doc.content.size - last.nodeSize);+ if (!(dom instanceof HTMLElement)) return null;+ const rect = dom.getBoundingClientRect();+ if (rect.height === 0 && rect.top === 0) return null;+ return rect.bottom;+}++function composerInset(view: EditorView): number {+ const px = Number.parseFloat(+ getComputedStyle(view.dom).getPropertyValue(ASK_COMPOSER_HEIGHT_VAR),+ );+ return Number.isFinite(px) ? px : 0;+}++function inTrailingZone(view: EditorView, event: MouseEvent): boolean {+ if (!view.editable) return false;+ if (!docNeedsTrailingAffordance(view.state.doc)) return false;+ const target = event.target;+ if (target instanceof Element && target.closest(`.${OK_TRAILING_AFFORDANCE_CLASS}`)) return true;+ const top = lastBlockBottom(view);+ if (top == null) return false;+ const dom = view.dom.getBoundingClientRect();+ const bottom = dom.bottom - composerInset(view);+ return (+ event.clientY > top &&+ event.clientY <= bottom &&+ event.clientX >= dom.left &&+ event.clientX <= dom.right+ );+}++export function appendTrailingParagraph(view: EditorView): void {+ if (!insertParagraphAt(view, view.state.doc.content.size)) return;+ view.focus();+}++export function renderHint(): HTMLElement {+ const row = document.createElement('div');+ row.className = OK_TRAILING_AFFORDANCE_CLASS;+ row.setAttribute(OPT_OUT_ATTR, 'true');+ row.setAttribute('contenteditable', 'false');+ row.setAttribute('aria-hidden', 'true');+ const plus = document.createElement('span');+ plus.className = `${OK_TRAILING_AFFORDANCE_CLASS}-plus`;+ plus.innerHTML = GUTTER_PLUS_SVG;+ row.append(plus);+ return row;+}++function setHovered(view: EditorView, next: boolean): void {+ if (trailingAffordanceKey.getState(view.state) === next) return;+ view.dispatch(view.state.tr.setMeta(trailingAffordanceKey, next).setMeta('addToHistory', false));+}++const PRESS_SLOP_PX = 4;++function coarsePointerQuery(): MediaQueryList | null {+ return typeof window === 'undefined' ? null : (window.matchMedia?.('(pointer: coarse)') ?? null);+}++export function trailingAffordancePlugin(): Plugin<boolean> {+ let press: { id: number; x: number; y: number } | null = null;+ const coarse = coarsePointerQuery();++ function activate(view: EditorView, event: PointerEvent): boolean {+ const origin = press;+ if (!origin || origin.id !== event.pointerId) return false;+ press = null;+ if (+ Math.abs(event.clientX - origin.x) > PRESS_SLOP_PX ||+ Math.abs(event.clientY - origin.y) > PRESS_SLOP_PX+ ) {+ return false;+ }+ if (!view.state.selection.empty) return false;+ if (!inTrailingZone(view, event)) return false;+ event.preventDefault();+ appendTrailingParagraph(view);+ setHovered(view, view.editable && coarse?.matches === true);+ return true;+ }++ return new Plugin<boolean>({+ key: trailingAffordanceKey,+ state: {+ init: () => false,+ apply(tr, value) {+ const meta = tr.getMeta(trailingAffordanceKey);+ return typeof meta === 'boolean' ? meta : value;+ },+ },+ view(view) {+ const sync = () => setHovered(view, view.editable && coarse?.matches === true);+ let wasEditable = view.editable;+ queueMicrotask(() => {+ if (view.isDestroyed) return;+ sync();+ });+ coarse?.addEventListener('change', sync);+ return {+ update(updated) {+ if (updated.editable === wasEditable) return;+ wasEditable = updated.editable;+ sync();+ },+ destroy() {+ coarse?.removeEventListener('change', sync);+ },+ };+ },+ props: {+ decorations(state) {+ if (trailingAffordanceKey.getState(state) !== true) return null;+ if (!docNeedsTrailingAffordance(state.doc)) return null;+ return DecorationSet.create(state.doc, [+ Decoration.widget(state.doc.content.size, renderHint, { side: 1 }),+ ]);+ },+ handleDOMEvents: {+ mousemove(view, event) {+ if (coarse?.matches) return false;+ setHovered(view, inTrailingZone(view, event as MouseEvent));+ return false;+ },+ mouseleave(view) {+ if (coarse?.matches) return false;+ setHovered(view, false);+ return false;+ },+ pointerdown(view, event) {+ const pointer = event as PointerEvent;+ if (press && press.id !== pointer.pointerId) return false;+ press = null;+ if (pointer.button !== 0 || pointer.ctrlKey) return false;+ if (!inTrailingZone(view, pointer)) return false;+ press = { id: pointer.pointerId, x: pointer.clientX, y: pointer.clientY };+ return false;+ },+ pointerup(view, event) {+ return activate(view, event as PointerEvent);+ },+ pointercancel(_view, event) {+ const pointer = event as PointerEvent;+ if (press?.id === pointer.pointerId) press = null;+ return false;+ },+ },+ },+ });+}++export const TrailingAffordance = Extension.create({+ name: 'trailingAffordance',++ addProseMirrorPlugins() {+ return [trailingAffordancePlugin()];+ },+});diff --git a/packages/app/src/editor/list-boundary-merge.test.ts b/packages/app/src/editor/list-boundary-merge.test.tsindex 3d58290be..3fa60fc6b 100644--- a/packages/app/src/editor/list-boundary-merge.test.ts+++ b/packages/app/src/editor/list-boundary-merge.test.ts@@ -196,7 +196,7 @@ describe('preserved stock behaviors (controls — must hold before and after thetest('Backspace on the empty paragraph after a list rejoins the list (no stray bullet)', () => {const editor = mountEditor('- item one\n');- setCaret(editor, editor.state.doc.content.size - 1);+ setCaret(editor, itemPos(editor, 0, 'end'));press(editor, 'Enter');press(editor, 'Enter');press(editor, 'Backspace');@@ -204,17 +204,19 @@ describe('preserved stock behaviors (controls — must hold before and after theconst md = serialize(editor).trim();expect(md).toBe('- item one');expect(md).not.toMatch(/^- *$/m);+ expect(editor.state.doc.childCount).toBe(1);});test('Backspace on an empty nested item removes it', () => {const editor = mountEditor('- top\n - sub\n');- setCaret(editor, editor.state.doc.content.size - 1);+ setCaret(editor, itemPos(editor, 1, 'end'));press(editor, 'Enter');press(editor, 'Backspace');const md = serialize(editor);expect(md).toMatch(/^- top\n {2}- sub\n?$/m);expect(md.match(/- sub/g)).toHaveLength(1);+ expect(md).not.toMatch(/^ *- *$/m);});test('a ranged selection spanning the nested boundary deletes via the normal path', () => {@@ -315,7 +317,20 @@ describe('unusual merge targets in the owned configuration', () => {expect(md).not.toMatch(/\n\nnext/);});- test('Backspace on a fresh autoformatted empty item at the nested boundary dissolves it into the list', () => {+ test('Backspace on an empty item at the nested boundary dissolves it into the list', () => {+ const editor = mountEditor('- top\n - child\n- next');+ editor.view.dispatch(+ editor.state.tr.delete(itemPos(editor, 2, 'start'), itemPos(editor, 2, 'end')),+ );+ setCaret(editor, itemPos(editor, 2, 'start'));+ expect(press(editor, 'Backspace')).toBe(true);++ const md = serialize(editor);+ expect(md).not.toMatch(/^- *$/m);+ expect(md.trim()).toBe('- top\n - child');+ });++ test('Backspace right after a "- " autoformat at the nested boundary undoes the rule, not the merge', () => {const editor = mountEditor('- top\n - child\n\nx');const { view } = editor;let paraPos = -1;@@ -335,11 +350,11 @@ describe('unusual merge targets in the owned configuration', () => {f(view, from, from, ' ', () => view.state.tr.insertText(' ', from, from)),);expect(handled).toBe(true);- press(editor, 'Backspace');+ expect(press(editor, 'Backspace')).toBe(true);- const md = serialize(editor);- expect(md).not.toMatch(/^- *$/m);- expect(md.trim()).toBe('- top\n - child');+ expect(editor.state.doc.lastChild?.type.name).toBe('paragraph');+ expect(editor.state.doc.lastChild?.textContent).toBe('- ');+ expect(serialize(editor)).toContain('- top\n - child\n');});});diff --git a/packages/app/src/editor/mode-switch-position-resolver.test.ts b/packages/app/src/editor/mode-switch-position-resolver.test.tsindex c7932d0de..3b2e3612b 100644--- a/packages/app/src/editor/mode-switch-position-resolver.test.ts+++ b/packages/app/src/editor/mode-switch-position-resolver.test.ts@@ -1,4 +1,9 @@-import { MarkdownManager, sharedExtensions, stripFrontmatter } from '@inkeep/open-knowledge-core';+import {+ MarkdownManager,+ MIN_CARRIED_TRAILING_EMPTIES,+ sharedExtensions,+ stripFrontmatter,+} from '@inkeep/open-knowledge-core';import { getSchema } from '@tiptap/core';import type { Node as PmNode } from '@tiptap/pm/model';import { commonmark } from 'commonmark.json';@@ -144,46 +149,41 @@ describe('count tripwire', () => {expect(resolver.resolveInSource(anchor, { source, doc })?.confidence).toBe('ordinal');});- test('the tripwire reads the comparable ProseMirror child count, not a children.length', () => {- const source = '# A\n\nbody\n\n## Tail';- const baseJson = md.parse('# A\n\nbody\n\n## Tail') as { type: string; content: unknown[] };- const affordanceDoc = schema.nodeFromJSON({- ...baseJson,- content: [...baseJson.content, { type: 'paragraph' }],- });+ test('the tripwire counts a trailing empty paragraph, because the source spells it', () => {+ const source = '# A\n\nbody\n\n## Tail\n\n';+ const doc = snap(source).doc;const mdastCount = computeSourceBlocks(source, md).blocks.length;- expect(comparableChildCount(affordanceDoc)).toBe(mdastCount);- expect(affordanceDoc.childCount).toBe(mdastCount + 1);- expect(affordanceDoc.children.length).toBe(mdastCount + 1);+ expect(doc.child(doc.childCount - 1).type.name).toBe('paragraph');+ expect(doc.child(doc.childCount - 1).content.size).toBe(0);+ expect(comparableChildCount(doc)).toBe(mdastCount);+ expect(comparableChildCount(doc)).toBe(doc.childCount);- const anchor = present(- resolver.captureFromWysiwyg(affordanceDoc, pmPosOfBlock(affordanceDoc, 0)),- );- expect(resolver.resolveInSource(anchor, { source, doc: affordanceDoc })?.confidence).toBe(- 'exact',- );- expect(affordanceDoc.childCount === mdastCount).toBe(false);+ const anchor = present(resolver.captureFromWysiwyg(doc, pmPosOfBlock(doc, 0)));+ expect(resolver.resolveInSource(anchor, { source, doc })?.confidence).toBe('exact');});- test('a source-carried trailing blank run stays in the comparable count', () => {- const carried = '# A\n\nbody\n\n\n';- const doc = snap(carried).doc;- const blocks = computeSourceBlocks(carried, md).blocks;-- expect(blocks.length).toBe(4);- expect(comparableChildCount(doc)).toBe(blocks.length);-- const affordanceOnly = '## H\n';- const headingJson = md.parse(affordanceOnly) as { type: string; content: unknown[] };- const affordanceDoc = schema.nodeFromJSON({- ...headingJson,- content: [...headingJson.content, { type: 'paragraph' }],- });- expect(affordanceDoc.childCount).toBe(2);- expect(comparableChildCount(affordanceDoc)).toBe(- computeSourceBlocks(affordanceOnly, md).blocks.length,- );+ test('a source-carried trailing blank run stays in the comparable count at every length', () => {+ expect(MIN_CARRIED_TRAILING_EMPTIES).toBe(1);+ for (const [carried, expected] of [+ ['# A\n\nbody\n\n', 3],+ ['# A\n\nbody\n\n\n', 4],+ ] as const) {+ const doc = snap(carried).doc;+ const blocks = computeSourceBlocks(carried, md).blocks;+ expect(blocks.length).toBe(expected);+ expect(comparableChildCount(doc)).toBe(blocks.length);+ expect(comparableChildCount(doc)).toBe(doc.childCount);+ }+ });++ test('an all-empty doc is the schema minimum, the one paragraph no source spells', () => {+ for (const source of ['', '\n', '\n\n\n']) {+ const doc = snap(source).doc;+ expect(doc.childCount).toBe(1);+ expect(computeSourceBlocks(source, md).blocks.length).toBe(0);+ expect(comparableChildCount(doc)).toBe(0);+ }});test('a leading blank run is never subtracted, at or below the floor', () => {diff --git a/packages/app/src/editor/selection/place-caret.dom.test.ts b/packages/app/src/editor/selection/place-caret.dom.test.tsnew file mode 100644index 000000000..6107eda00--- /dev/null+++ b/packages/app/src/editor/selection/place-caret.dom.test.ts@@ -0,0 +1,137 @@+import { GapCursor } from '@tiptap/pm/gapcursor';+import { Schema } from '@tiptap/pm/model';+import { EditorState } from '@tiptap/pm/state';+import type { EditorView } from '@tiptap/pm/view';+import { describe, expect, test, vi } from 'vitest';+import { moveCaretAfterNode, placeGapCursorAfterNode } from './place-caret.ts';++const schema = new Schema({+ nodes: {+ doc: { content: 'block+' },+ paragraph: { group: 'block', content: 'inline*' },+ thematicBreak: { group: 'block' },+ text: { group: 'inline' },+ },+ marks: {},+});++const HR_POS = 6;+const HR_SIZE = 1;++function docAfterRule(...rest: ('rule' | string)[]) {+ return schema.node('doc', null, [+ schema.node('paragraph', null, [schema.text('body')]),+ schema.node('thematicBreak'),+ ...rest.map((r) =>+ r === 'rule'+ ? schema.node('thematicBreak')+ : schema.node('paragraph', null, [schema.text(r)]),+ ),+ ]);+}++function stubView(doc: ReturnType<typeof docAfterRule>) {+ const focus = vi.fn();+ const view = {+ state: EditorState.create({ doc }),+ focus,+ dispatch: (tr: unknown) => {+ view.state = view.state.apply(tr as never);+ },+ };+ return { view, focus };+}++describe('moveCaretAfterNode', () => {+ test('declines, and writes nothing, when the node ends the document', () => {+ const { view } = stubView(docAfterRule());+ const before = view.state.doc;++ expect(moveCaretAfterNode(view as unknown as EditorView, HR_POS, HR_SIZE)).toBe(false);+ expect(view.state.doc.eq(before)).toBe(true);+ expect(view.state.doc.childCount).toBe(2);+ });++ test('leaves the selection alone when it declines', () => {+ const { view } = stubView(docAfterRule());+ const before = view.state.selection;+ moveCaretAfterNode(view as unknown as EditorView, HR_POS, HR_SIZE);+ expect(view.state.selection.eq(before)).toBe(true);+ });++ test('never selects the node it was asked to move past', () => {+ const { view } = stubView(docAfterRule());+ moveCaretAfterNode(view as unknown as EditorView, HR_POS, HR_SIZE);+ expect(view.state.selection.from).not.toBe(HR_POS);+ });++ test('moves into the following block without touching the document', () => {+ const { view } = stubView(docAfterRule('tail'));+ const before = view.state.doc;++ expect(moveCaretAfterNode(view as unknown as EditorView, HR_POS, HR_SIZE)).toBe(true);+ expect(view.state.doc.eq(before)).toBe(true);+ expect(view.state.selection.$head.parent).toBe(view.state.doc.lastChild);+ expect(view.state.selection.from).toBeGreaterThan(HR_POS + HR_SIZE);+ });++ test('reports a stale position loudly rather than clamping it', () => {+ const { view } = stubView(docAfterRule());+ const past = view.state.doc.content.size + 5;++ expect(() => moveCaretAfterNode(view as unknown as EditorView, past, HR_SIZE)).toThrow(+ RangeError,+ );+ });++ test('leaves DOM focus alone', () => {+ const { view, focus } = stubView(docAfterRule('tail'));+ moveCaretAfterNode(view as unknown as EditorView, HR_POS, HR_SIZE);+ expect(focus).not.toHaveBeenCalled();+ });+});++describe('placeGapCursorAfterNode', () => {+ test('parks past a leaf that ends the document, and writes nothing', () => {+ const { view } = stubView(docAfterRule());+ const before = view.state.doc;++ expect(placeGapCursorAfterNode(view as unknown as EditorView, HR_POS, HR_SIZE)).toBe(true);+ expect(view.state.selection).toBeInstanceOf(GapCursor);+ expect(view.state.selection.from).toBe(HR_POS + HR_SIZE);+ expect(view.state.doc.eq(before)).toBe(true);+ });++ test('declines when a textblock follows, leaving selection and document alone', () => {+ const { view } = stubView(docAfterRule('tail'));+ const beforeDoc = view.state.doc;+ const beforeSel = view.state.selection;++ expect(placeGapCursorAfterNode(view as unknown as EditorView, HR_POS, HR_SIZE)).toBe(false);+ expect(view.state.selection.eq(beforeSel)).toBe(true);+ expect(view.state.doc.eq(beforeDoc)).toBe(true);+ });++ test('declines inside a textblock', () => {+ const { view } = stubView(docAfterRule());++ expect(placeGapCursorAfterNode(view as unknown as EditorView, 1, 1)).toBe(false);+ });++ test('reports a stale position loudly rather than clamping it', () => {+ const { view } = stubView(docAfterRule());+ const past = view.state.doc.content.size + 5;++ expect(() => placeGapCursorAfterNode(view as unknown as EditorView, past, HR_SIZE)).toThrow(+ RangeError,+ );+ });++ test('parks between two leaves mid-document', () => {+ const { view } = stubView(docAfterRule('rule', 'tail'));++ expect(placeGapCursorAfterNode(view as unknown as EditorView, HR_POS, HR_SIZE)).toBe(true);+ expect(view.state.selection).toBeInstanceOf(GapCursor);+ expect(view.state.selection.from).toBe(HR_POS + HR_SIZE);+ });+});diff --git a/packages/app/src/editor/selection/place-caret.ts b/packages/app/src/editor/selection/place-caret.tsnew file mode 100644index 000000000..b17e21d82--- /dev/null+++ b/packages/app/src/editor/selection/place-caret.ts@@ -0,0 +1,31 @@+import { GapCursor } from '@tiptap/pm/gapcursor';+import { Selection, TextSelection } from '@tiptap/pm/state';+import { Mapping } from '@tiptap/pm/transform';+import type { EditorView } from '@tiptap/pm/view';++export function insertParagraphAt(view: EditorView, pos: number): boolean {+ const paragraph = view.state.schema.nodes.paragraph?.create();+ if (!paragraph) return false;+ const tr = view.state.tr.insert(pos, paragraph);+ if (tr.doc.content.size === view.state.doc.content.size) return false;+ tr.setSelection(TextSelection.near(tr.doc.resolve(pos + 1)));+ view.dispatch(tr.scrollIntoView());+ return true;+}++export function moveCaretAfterNode(view: EditorView, pos: number, nodeSize: number): boolean {+ const { doc } = view.state;+ const forward = Selection.findFrom(doc.resolve(pos + nodeSize), 1, true);+ if (!forward) return false;+ view.dispatch(view.state.tr.setSelection(forward).scrollIntoView());+ return true;+}++export function placeGapCursorAfterNode(view: EditorView, pos: number, nodeSize: number): boolean {+ const { doc } = view.state;+ const $after = doc.resolve(pos + nodeSize);+ const probe = new GapCursor($after).map(doc, new Mapping());+ if (!(probe instanceof GapCursor)) return false;+ view.dispatch(view.state.tr.setSelection(probe).scrollIntoView());+ return true;+}diff --git a/packages/app/src/editor/utils/editor-visible-region.ts b/packages/app/src/editor/utils/editor-visible-region.tsindex a23e10639..bf00528b8 100644--- a/packages/app/src/editor/utils/editor-visible-region.ts+++ b/packages/app/src/editor/utils/editor-visible-region.ts@@ -70,7 +70,7 @@ export function deriveEditorClipOptions(editor: Editor): () => EditorClipOptionsconst padding = {top: editorToolbarOverlapPx(),bottom:- readRootInlinePxVar('--ask-composer-height') ++ readRootInlinePxVar(ASK_COMPOSER_HEIGHT_VAR) +readRootInlinePxVar('--conflict-footer-height'),};return boundary ? { boundary, padding } : { padding };@@ -132,6 +132,8 @@ export function editorRegionWidthPx(editor: Editor): number | null {return Math.max(0, boundary.getBoundingClientRect().width - PANE_GUTTER_PX * 2);}+export const ASK_COMPOSER_HEIGHT_VAR = '--ask-composer-height';+function readRootInlinePxVar(name: string): number {const value = Number.parseFloat(document.documentElement.style.getPropertyValue(name));return Number.isFinite(value) ? value : 0;diff --git a/packages/app/src/globals.css b/packages/app/src/globals.cssindex aa75deeb6..7d946c194 100644--- a/packages/app/src/globals.css+++ b/packages/app/src/globals.css@@ -513,6 +513,15 @@The data-agent-flash-state attribute lives on the React wrapper (stable across PM updates).Targets only the last 3 blocks (append) or first 3 blocks (prepend) — covers most agent writes.Uses :nth-last-child / :nth-child to scope the flash without touching PM-managed DOM.+ The append half counts `of :not(.ok-trailing-affordance, .ProseMirror-gapcursor)` because+ both are widget decorations that render as a direct .ProseMirror child at the document end.+ Counting either would shift the append flash one block up while it is showing. CSS cannot+ import OK_TRAILING_AFFORDANCE_CLASS from editor/extensions/trailing-affordance.ts, so this+ list is the one place carrying the names literally; globals.test.ts pins them together.++ The append and prepend halves are separate rules on purpose rather than one comma-joined+ prelude. A selector list is invalidated as a whole, so on a UA that cannot parse `of S` the+ prepend half would lose its flash too, though it uses no Selectors L4 syntax of its own.Staggered entry (30ms per block) via animation-delay for a cascading feel on multi-block writes. */@@ -559,7 +568,10 @@[data-agent-flash-state="editing"][data-agent-flash-position="append"].ProseMirror- > *:nth-last-child(-n + 3),+ > *:nth-last-child(-n + 3 of :not(.ok-trailing-affordance, .ProseMirror-gapcursor)) {+ animation: agent-flash 2s var(--ease-out-strong) forwards;+ position: relative;+}[data-agent-flash-state="editing"][data-agent-flash-position="prepend"].ProseMirror> *:nth-child(-n + 3) {@@ -570,12 +582,12 @@/* Stagger — second affected block fires 30ms after first, third at 60ms */[data-agent-flash-state="editing"][data-agent-flash-position="append"].ProseMirror- > *:nth-last-child(2) {+ > *:nth-last-child(2 of :not(.ok-trailing-affordance, .ProseMirror-gapcursor)) {animation-delay: 30ms;}[data-agent-flash-state="editing"][data-agent-flash-position="append"].ProseMirror- > *:nth-last-child(1) {+ > *:nth-last-child(1 of :not(.ok-trailing-affordance, .ProseMirror-gapcursor)) {animation-delay: 0ms;}[data-agent-flash-state="editing"][data-agent-flash-position="prepend"]@@ -599,7 +611,11 @@@media (prefers-reduced-motion: reduce) {[data-agent-flash-state="editing"][data-agent-flash-position="append"].ProseMirror- > *:nth-last-child(-n + 3),+ > *:nth-last-child(-n + 3 of :not(.ok-trailing-affordance, .ProseMirror-gapcursor)) {+ animation: none;+ box-shadow: inset 3px 0 0 var(--color-agent);+ transition: box-shadow 2s ease;+ }[data-agent-flash-state="editing"][data-agent-flash-position="prepend"].ProseMirror> *:nth-child(-n + 3) {@@ -1113,7 +1129,13 @@scroll-padding-bottom: var(--ask-composer-height, 0px);}.editor-doc-scroll :is(.ProseMirror, .cm-content) {- padding-bottom: var(--ask-composer-height, 0px);+ /* Composer inset ADDS to the trailing dead zone rather than replacing it —+ this selector outranks the base `.ProseMirror` rule, so a bare+ `var(--ask-composer-height)` here would zero the zone out from under the+ affordance for every document in the scroller. `--ok-trailing-zone` is+ declared on `.ProseMirror` only, so `.cm-content` takes the 0px fallback+ and source mode is unchanged. */+ padding-bottom: calc(var(--ask-composer-height, 0px) + var(--ok-trailing-zone, 0px));}/* Standalone Mermaid docs render OUTSIDE `.editor-doc-scroll` — a diagram +@@ -1224,6 +1246,34 @@outline: none;min-height: 200px;line-height: 1.7;+ /* Trailing dead zone — the click target `TrailingAffordance` engages in, and+ the reason it is a token rather than incidental slack. The extension reads+ the band between the last block's bottom and this element's bottom, and a+ block's own `margin-bottom` collapses THROUGH a parent with no bottom+ padding: with `padding-bottom: 0` those two edges are the same pixel and+ the band is exactly 0px tall. That is the state a document is in whenever+ the Ask composer is unmounted, because `BottomComposer` REMOVES+ `--ask-composer-height` rather than setting it to zero. With the composer+ mounted the scroller rule above does supply padding, but the composer+ floats over precisely that band, so the only room ever left to click was+ whatever `margin-bottom` the final block happened to carry. The old+ `trailingNode` paragraph supplied this height as content; 2rem reproduces+ it as layout. Anything that zeroes this silently un-ships the affordance,+ so an e2e pins it by asserting this element's resolved `padding-bottom`+ equals the composer inset plus this token, and a second assertion measures+ the band directly. That direct reading pins the token only because+ `measureZoneHeight` subtracts the other two terms sharing this edge: the+ composer's reserved inset, and the final block's own `margin-bottom`, which+ does not collapse through a padded parent and on this fixture already+ exceeds the floor on its own. A naive band measurement would stay plausible+ with the token gone, and that subtraction is what lets this one go red.++ The base is 0px and the height is granted by the opt-in rule below, so the+ CSS predicate matches the plugin's own bail (`view.editable`) instead of+ approximating it. A read-only view and every non-editor ProseMirror get no+ dead zone rather than an unreachable one. */+ --ok-trailing-zone: 0px;+ padding-bottom: var(--ok-trailing-zone);/* Extend hit area into left margin so the gap between text and the drag handledoes not prematurely hide it. padding-left compensates so text is unchanged. */margin-left: -2.5rem;@@ -1242,6 +1292,18 @@@apply text-gray-800 dark:text-white/80;}+/* The dead zone, granted only where the affordance can actually engage. The+ selector is the CSS half of `trailingAffordancePlugin`'s `view.editable`+ bail; the composer opts out because its editor is a slim one-line prompt+ whose own rule zeroes `min-height`, and 2rem of unclickable padding under it+ reads as a broken text box. This wins on specificity, not position: the+ attribute selector and the class inside `:not()` each add a class-level+ point, so (0,3,0) against the base rule's (0,1,0). Raising the base rule's+ specificity is what would break it, not moving this block. */+.ProseMirror[contenteditable="true"]:not(.composer-prosemirror) {+ --ok-trailing-zone: 2rem;+}+/* Phone-width rails. The 4rem side rails are a desktop reading measure; on a~390px screen they eat 128px, leaving a ~246px text column and starving thefloating composer — whose card is a content-column child — down to a@@ -1316,6 +1378,12 @@line-height: 1.5;margin-left: 0;padding-left: 0;+ /* No trailing dead zone either: nothing can follow a one-line prompt, so the+ affordance never engages here and the pad would only add dead space. The+ token needs no reset — this element is excluded from the opt-in rule that+ grants it — but the padding does, because the scroller rule adds the+ composer's own height on top. */+ padding-bottom: 0;/* Drop the right gutter mirror too — the slim composer is a single-line prompt,not a document body, so it needs neither the drag-handle hit area nor thefull-width-block border slack. */@@ -2402,22 +2470,44 @@user-select: none;}-/* + button */-.ok-add-block-btn {+/* Gutter "+" chrome, shared by the block handle's button (`ok-add-block-btn`, a+ real <button> parked beside a block by DragHandlePlugin) and the+ TrailingAffordance hint (`ok-trailing-affordance-plus`, a <span> inside a+ widget decoration below the last block). The two are deliberately the same+ glyph at the same gutter offset, so hovering the dead zone reads as "a block+ goes here" exactly the way hovering a block does. One rule rather than two+ copies, so they cannot drift into a near-miss that reads as a rendering bug.++ `color` clears the 3:1 WCAG 2.2 §1.4.11 floor for a non-text UI component,+ here and on the drag grip that matches it: 3.64:1 against `--background`.+ It is one value for the whole gutter vocabulary rather than a per-call-site+ choice, so both glyphs move together when it changes.++ Hover is a second surface, not a free ride, because the hover background is+ translucent and composites toward the glyph. Light hover (6% black over+ white) lands 3.19:1 and stays put. Dark hover (8% white over the dark canvas)+ lifts the ground far enough that the resting dark glyph drops to 2.79:1, so+ the dark block below lifts the glyph on hover rather than the background+ alone. Every figure is `Y = L³` for these chroma-0 colors, then the standard+ `(Y1 + 0.05) / (Y2 + 0.05)`, with the translucent layer composited in sRGB+ before linearizing. */+.ok-add-block-btn,+.ok-trailing-affordance-plus {display: flex;align-items: center;justify-content: center;width: 20px;height: 20px;cursor: pointer;- color: oklch(0.72 0 0);+ color: oklch(0.62 0 0);border-radius: 3px;border: none;background: transparent;padding: 0;transition: background-color 100ms var(--ease-out-strong);}-.ok-add-block-btn:hover {+.ok-add-block-btn:hover,+.ok-trailing-affordance-plus:hover {background-color: oklch(0 0 0 / 6%);}@@ -2432,7 +2522,7 @@width: 20px;height: 20px;cursor: grab;- color: oklch(0.72 0 0);+ color: oklch(0.62 0 0);border-radius: 3px;border: none;background: transparent;@@ -2484,17 +2574,104 @@ body[data-editor-tab-dragging] * {}/* Dark mode */-.dark .ok-add-block-btn {+.dark :is(.ok-add-block-btn, .ok-trailing-affordance-plus) {color: oklch(0.5 0 0);}-.dark .ok-add-block-btn:hover {+.dark :is(.ok-add-block-btn, .ok-trailing-affordance-plus):hover {background-color: oklch(1 0 0 / 8%);+ /* 0.5 against the hover-lifted ground is 2.79:1, under the 3:1 floor; 0.62+ restores 4.60:1. Derivation on the shared rule above. */+ color: oklch(0.62 0 0);}.dark .ok-drag-grip {color: oklch(0.5 0 0);}.dark .ok-drag-grip:hover {background-color: oklch(1 0 0 / 8%);+ /* Same ground, same floor, same lift — the grip is part of the gutter+ vocabulary and moves with it. */+ color: oklch(0.62 0 0);+}++/* TrailingAffordance hint — the "+" shown while hovering the empty region below+ a non-paragraph final block (`editor/extensions/trailing-affordance.ts`). It+ is a widget decoration, so it is chrome and never document content.++ Zero height with an absolutely positioned child: the hint appears and+ disappears under the pointer, and an in-flow box would reflow the document+ every time it did. `left: -52px` is not arbitrary — it is where+ `BlockDragHandle` parks its own "+" (floating-ui `left-start`, `mainAxis: 10`+ against the 42px controls row), so the two read as one affordance. The dead+ zone reaches the plugin because `handleDOMEvents` binds on `view.dom` and+ `inTrailingZone` classifies by coordinate, not because of anything here — a+ zero-height row has no hit region to claim it either way. What the+ `pointer-events` pair declares is that the hint is inert chrome with one+ exception: the glyph opts back in, and it has to, because `left: -52px` puts+ it partly left of `view.dom`'s border box and so outside that coordinate+ test, which is why `inTrailingZone` recognizes it by target instead. */+.ok-trailing-affordance {+ position: relative;+ height: 0;+ pointer-events: none;+ user-select: none;+}++/* Only the placement is this glyph's own — everything else comes from the+ shared gutter-"+" rule above. `left` lands it in the same column the block+ handle uses: the row is a child of `.ProseMirror`, whose content box starts+ 2.5rem (40px) inside its border box, and the handle sits 12px further out+ still. `top` centers the 20px box on the line a click would create. */+.ok-trailing-affordance-plus {+ position: absolute;+ top: 4px;+ left: -52px;+ pointer-events: auto;+}++/* Same narrow-rail gate as the `.ProseMirror` escape far above. At a 1rem rail+ the -52px gutter does not exist, so the 20px glyph lands at [-36px, -16px],+ outside `.ProseMirror`'s border box and clipped away by the scroller, and the+ affordance the plugin pins on for coarse pointers is invisible. Park it at+ the text origin instead: nothing follows the last block, so it overlaps+ nothing. Must stay AFTER the rule above — a media query adds no specificity,+ so an earlier block loses to it on source order. */+@media (width < 40rem) and (pointer: coarse) {+ .ok-trailing-affordance-plus {+ left: 0;+ }+}++/* The block handle's "+" fades in; this one is a widget decoration that enters+ the DOM already hovered, so without an entry transition it pops at full+ opacity and the two gutter glyphs read as different components. There is no+ exit half: the decoration is removed, not hidden. */+@media (prefers-reduced-motion: no-preference) {+ .ok-trailing-affordance-plus {+ transition:+ background-color 100ms var(--ease-out-strong),+ opacity 100ms var(--ease-out-strong);+ }++ @starting-style {+ .ok-trailing-affordance-plus {+ opacity: 0;+ }+ }+}++/* Gapcursor — the caret ProseMirror places where no textblock can sit (after a+ final table, between two fences). It is drawn as `border-top: 1px solid+ black`, which is all but invisible on the dark theme. Bind it to the same+ token the text caret uses.++ The descendant selector is load-bearing. prosemirror-gapcursor itself injects+ nothing (it ships `style/gapcursor.css` and tells you to include it), but+ `@tiptap/core` carries a copy of that CSS as a string and appends it to a+ `style[data-tiptap-style]` tag at runtime. Its rule has equal specificity to+ a bare `.ProseMirror-gapcursor::after` and can land after this stylesheet, so+ the extra `.ProseMirror` ancestor is what keeps this declaration winning. */+.ProseMirror .ProseMirror-gapcursor::after {+ border-top-color: var(--foreground);}/* Positioned host for the per-column / per-row cell-handle dropdowns@@ -5507,7 +5684,9 @@ html.electron-mode [data-slot="sidebar-inner"] {.dark[data-agent-flash-state="editing"][data-agent-flash-position="append"].ProseMirror- > *:nth-last-child(-n + 3),+ > *:nth-last-child(-n + 3 of :not(.ok-trailing-affordance, .ProseMirror-gapcursor)) {+ animation-name: agent-flash-dark;+}.dark[data-agent-flash-state="editing"][data-agent-flash-position="prepend"].ProseMirrordiff --git a/packages/app/src/globals.test.ts b/packages/app/src/globals.test.tsindex 0dfe5ef60..8e09cdc4f 100644--- a/packages/app/src/globals.test.ts+++ b/packages/app/src/globals.test.ts@@ -1,6 +1,7 @@import { readFileSync } from 'node:fs';import { join } from 'node:path';import { describe, expect, test } from 'vitest';+import { OK_TRAILING_AFFORDANCE_CLASS } from './editor/extensions/trailing-affordance.ts';const SRC_PATH = join(__dirname, 'globals.css');const src = readFileSync(SRC_PATH, 'utf-8');@@ -32,3 +33,13 @@ describe('globals.css drag-region neutralization (Popper outside-click in Electrexpect(src).not.toMatch(/\[data-slot="hover-card-content"\]/);});});++describe('globals.css agent-flash widget exclusion', () => {+ test('the append filter names the class the trailing-affordance plugin renders', () => {+ expect(src).toContain(`of :not(.${OK_TRAILING_AFFORDANCE_CLASS},`);+ });++ test('the append filter also names the gap cursor', () => {+ expect(src).toContain('.ProseMirror-gapcursor)');+ });+});diff --git a/packages/app/src/lib/rendered-diff/diff-extensions.ts b/packages/app/src/lib/rendered-diff/diff-extensions.tsindex de3e379f1..7bb8b208f 100644--- a/packages/app/src/lib/rendered-diff/diff-extensions.ts+++ b/packages/app/src/lib/rendered-diff/diff-extensions.ts@@ -7,6 +7,7 @@ const DROP_NAMES = new Set(['blockDragHandle','blockMover','tableInsertControls',+ 'trailingAffordance','fileHandler','gfmAutolink','inlineLinkInputRule',diff --git a/packages/app/src/locales/ar/messages.json b/packages/app/src/locales/ar/messages.jsonindex f043e1327..4844a3bae 100644--- a/packages/app/src/locales/ar/messages.json+++ b/packages/app/src/locales/ar/messages.json@@ -396,6 +396,7 @@"هل لديك مستودع git بالفعل؟ أضفه بالأمر <0>git remote add origin <url></0> في مجلد هذا المشروع. تُحدَّث هذه الصفحة تلقائيًا بمجرد اكتشاف مستودع بعيد."],"45MZFs": ["الأوامر"],+ "46YgRZ": ["إضافة كتلة أدناه"],"484LKL": ["إزالة الرابط"],"49Mb7P": ["تعذّر التحقق مما إذا كان Slidev مثبّتًا. عُد إلى هذه النافذة لإعادة المحاولة."],"4A3Yzu": ["كتلة كود"],@@ -693,6 +694,7 @@],"7PzzBU": ["المستخدم"],"7S7FNA": ["تحقق OpenKnowledge من المشروع"],+ "7Voget": ["تحديد ", ["name"]],"7WnfoD": ["هذا التقرير في طريقه بالفعل. ستظهر نتيجته في سجل تقارير العلل."],"7Y9yTo": ["تم إنشاء ", ["owner"], "/", ["name"], "، لكن فشل الدفع."],"7YRrJ9": [@@ -1146,6 +1148,7 @@"هذا الملف أكبر من أن يُفتح في محرر النصوص المدمج (الحد 1 ميغابايت). استخدم «فتح ملف» أدناه لفتحه في تطبيق آخر."],"C_cPoW": ["انتهت صلاحية جلسة GitHub لديك — سجّل الدخول مرة أخرى للتحقق من صلاحية الدفع."],+ "CbxTfe": ["تحديد الكتلة"],"CcaU4i": ["تُطبّق التعديلات مباشرة وتُحفظ تلقائيًا في هذه السمة."],"ChMshD": ["إنهاء ", ["appName"]],"Ck9XRt": ["تعذّر حفظ المفتاح — يرجى المحاولة مرة أخرى."],diff --git a/packages/app/src/locales/ar/messages.po b/packages/app/src/locales/ar/messages.poindex 1046f8be2..bd3078064 100644--- a/packages/app/src/locales/ar/messages.po+++ b/packages/app/src/locales/ar/messages.po@@ -1444,6 +1444,10 @@ msgstr "إضافة نمط آخر"msgid "Add at least one letter or number."msgstr "أضف حرفًا أو رقمًا واحدًا على الأقل."+#: src/editor/extensions/drag-handle.ts+msgid "Add block below"+msgstr "إضافة كتلة أدناه"+#: src/comments/CommentSelectionAffordance.tsx#: src/comments/PropertyCommentButton.tsxmsgid "Add Comment"@@ -11637,6 +11641,10 @@ msgstr "اطّلع على دليل التثبيت الكامل"msgid "See what's added"msgstr "اطلع على ما سيُضاف"+#: src/editor/extensions/drag-handle.ts+msgid "Select {name}"+msgstr "تحديد {name}"+#. placeholder {0}: BASE16_SLOT_ROLES[slot]#: src/components/settings/CustomThemeEditor.tsxmsgid "Select {slot} — {0}"@@ -11664,6 +11672,10 @@ msgstr "تحديد كل الملفات والمجلدات"msgid "Select all source"msgstr "تحديد كل المصدر"+#: src/editor/extensions/drag-handle.ts+msgid "Select block"+msgstr "تحديد الكتلة"+#: src/lib/keyboard-shortcuts.tsmsgid "Select every visible file-tree row when focus is in the Files sidebar."msgstr "حدّد كل صفوف شجرة الملفات الظاهرة عندما يكون التركيز في شريط الملفات الجانبي."diff --git a/packages/app/src/locales/bn/messages.json b/packages/app/src/locales/bn/messages.jsonindex 3ee780c00..bf7770059 100644--- a/packages/app/src/locales/bn/messages.json+++ b/packages/app/src/locales/bn/messages.json@@ -344,6 +344,7 @@"আগে থেকেই একটি git রিপোজিটরি আছে? এই প্রকল্পের ফোল্ডারে <0>git remote add origin <url></0> দিয়ে সেটি যোগ করুন। রিমোট শনাক্ত হলেই এই পাতা নিজে থেকে হালনাগাদ হয়।"],"45MZFs": ["কমান্ড"],+ "46YgRZ": ["নিচে ব্লক যোগ করুন"],"484LKL": ["লিংক সরান"],"49Mb7P": ["Slidev ইনস্টল আছে কিনা তা যাচাই করা যায়নি। আবার চেষ্টা করতে এই উইন্ডোতে ফিরে আসুন।"],"4A3Yzu": ["কোড ব্লক"],@@ -589,6 +590,7 @@],"7PzzBU": ["ব্যবহারকারী"],"7S7FNA": ["OpenKnowledge প্রকল্প পরীক্ষা করেছে"],+ "7Voget": [["name"], " নির্বাচন করুন"],"7WnfoD": ["এই রিপোর্ট ইতিমধ্যেই পথে আছে। এর ফলাফল বাগ রিপোর্টের ইতিহাসে দেখা যাবে।"],"7Y9yTo": [["owner"], "/", ["name"], " তৈরি হয়েছে, তবে পুশ ব্যর্থ হয়েছে।"],"7YRrJ9": [@@ -958,6 +960,7 @@"এই ফাইলটি অন্তর্নির্মিত টেক্সট সম্পাদকে খোলার জন্য অত্যন্ত বড় (১ MB সীমা)। অন্য অ্যাপে খুলতে নিচের Open file ব্যবহার করুন।"],"C_cPoW": ["আপনার GitHub সেশনের মেয়াদ শেষ — পুশের প্রবেশাধিকার যাচাই করতে আবার সাইন ইন করুন।"],+ "CbxTfe": ["ব্লক নির্বাচন করুন"],"CcaU4i": ["সম্পাদনাগুলি সঙ্গে সঙ্গে প্রয়োগ হয় এবং এই থিমে স্বয়ংক্রিয়ভাবে সংরক্ষিত হয়।"],"ChMshD": [["appName"], " থেকে প্রস্থান"],"Ck9XRt": ["কী সংরক্ষণ করা যায়নি — অনুগ্রহ করে আবার চেষ্টা করুন।"],diff --git a/packages/app/src/locales/bn/messages.po b/packages/app/src/locales/bn/messages.poindex f44c976fc..881750230 100644--- a/packages/app/src/locales/bn/messages.po+++ b/packages/app/src/locales/bn/messages.po@@ -1440,6 +1440,10 @@ msgstr "আরেকটি প্যাটার্ন যোগ করুন"msgid "Add at least one letter or number."msgstr "অন্তত একটি অক্ষর বা সংখ্যা যোগ করুন।"+#: src/editor/extensions/drag-handle.ts+msgid "Add block below"+msgstr "নিচে ব্লক যোগ করুন"+#: src/comments/CommentSelectionAffordance.tsx#: src/comments/PropertyCommentButton.tsxmsgid "Add Comment"@@ -11633,6 +11637,10 @@ msgstr "পূর্ণ ইনস্টল নির্দেশিকা দেmsgid "See what's added"msgstr "কী যুক্ত হবে দেখুন"+#: src/editor/extensions/drag-handle.ts+msgid "Select {name}"+msgstr "{name} নির্বাচন করুন"+#. placeholder {0}: BASE16_SLOT_ROLES[slot]#: src/components/settings/CustomThemeEditor.tsxmsgid "Select {slot} — {0}"@@ -11660,6 +11668,10 @@ msgstr "সব ফাইল ও ফোল্ডার নির্বাচনmsgid "Select all source"msgstr "পুরো সোর্স নির্বাচন করুন"+#: src/editor/extensions/drag-handle.ts+msgid "Select block"+msgstr "ব্লক নির্বাচন করুন"+#: src/lib/keyboard-shortcuts.tsmsgid "Select every visible file-tree row when focus is in the Files sidebar."msgstr "ফোকাস Files সাইডবারে থাকলে দৃশ্যমান প্রতিটি ফাইল-ট্রি সারি নির্বাচন করুন।"diff --git a/packages/app/src/locales/en/messages.json b/packages/app/src/locales/en/messages.jsonindex 576d6c6ae..618906ca5 100644--- a/packages/app/src/locales/en/messages.json+++ b/packages/app/src/locales/en/messages.json@@ -349,6 +349,7 @@"Already have a git repository? Add it with <0>git remote add origin <url></0> in this project's folder. This page updates automatically once a remote is detected."],"45MZFs": ["Commands"],+ "46YgRZ": ["Add block below"],"484LKL": ["Remove link"],"49Mb7P": ["We couldn't check whether Slidev is installed. Return to this window to retry."],"4A3Yzu": ["Code block"],@@ -594,6 +595,7 @@],"7PzzBU": ["User"],"7S7FNA": ["OpenKnowledge checked the project"],+ "7Voget": ["Select ", ["name"]],"7WnfoD": ["This report is already on its way. Its result will appear in your bug report history."],@@ -988,6 +990,7 @@"This file is too large to open in the built-in text editor (1 MB limit). Use Open file below to open it in another app."],"C_cPoW": ["Your GitHub session expired — sign in again to verify push access."],+ "CbxTfe": ["Select block"],"CcaU4i": ["Edits apply live and save automatically to this theme."],"ChMshD": ["Quit ", ["appName"]],"Ck9XRt": ["Couldn't save the key — please try again."],diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.poindex 3059d1f93..9fc4cc695 100644--- a/packages/app/src/locales/en/messages.po+++ b/packages/app/src/locales/en/messages.po@@ -1444,6 +1444,10 @@ msgstr "Add another pattern"msgid "Add at least one letter or number."msgstr "Add at least one letter or number."+#: src/editor/extensions/drag-handle.ts+msgid "Add block below"+msgstr "Add block below"+#: src/comments/CommentSelectionAffordance.tsx#: src/comments/PropertyCommentButton.tsxmsgid "Add Comment"@@ -11637,6 +11641,10 @@ msgstr "See the full install guide"msgid "See what's added"msgstr "See what's added"+#: src/editor/extensions/drag-handle.ts+msgid "Select {name}"+msgstr "Select {name}"+#. placeholder {0}: BASE16_SLOT_ROLES[slot]#: src/components/settings/CustomThemeEditor.tsxmsgid "Select {slot} — {0}"@@ -11664,6 +11672,10 @@ msgstr "Select all files and folders"msgid "Select all source"msgstr "Select all source"+#: src/editor/extensions/drag-handle.ts+msgid "Select block"+msgstr "Select block"+#: src/lib/keyboard-shortcuts.tsmsgid "Select every visible file-tree row when focus is in the Files sidebar."msgstr "Select every visible file-tree row when focus is in the Files sidebar."diff --git a/packages/app/src/locales/es/messages.json b/packages/app/src/locales/es/messages.jsonindex f0e90d7ba..dde9d0541 100644--- a/packages/app/src/locales/es/messages.json+++ b/packages/app/src/locales/es/messages.json@@ -400,6 +400,7 @@"¿Ya tienes un repositorio git? Añádelo con <0>git remote add origin <url></0> en la carpeta de este proyecto. Esta página se actualiza automáticamente en cuanto se detecta un remoto."],"45MZFs": ["Comandos"],+ "46YgRZ": ["Añadir bloque debajo"],"484LKL": ["Quitar el enlace"],"49Mb7P": ["No pudimos comprobar si Slidev está instalado. Vuelve a esta ventana para reintentarlo."@@ -704,6 +705,7 @@],"7PzzBU": ["Usuario"],"7S7FNA": ["OpenKnowledge revisó el proyecto"],+ "7Voget": ["Seleccionar ", ["name"]],"7WnfoD": ["Este informe ya va en camino. Su resultado aparecerá en el historial de informes de error."],@@ -1165,6 +1167,7 @@"C_cPoW": ["Tu sesión de GitHub ha caducado: inicia sesión de nuevo para verificar el acceso de push."],+ "CbxTfe": ["Seleccionar bloque"],"CcaU4i": ["Los cambios se aplican al instante y se guardan automáticamente en este tema."],"ChMshD": ["Salir de ", ["appName"]],"Ck9XRt": ["No se pudo guardar la clave; inténtalo de nuevo."],diff --git a/packages/app/src/locales/es/messages.po b/packages/app/src/locales/es/messages.poindex bb9a718a5..81463c68d 100644--- a/packages/app/src/locales/es/messages.po+++ b/packages/app/src/locales/es/messages.po@@ -1444,6 +1444,10 @@ msgstr "Añadir otro patrón"msgid "Add at least one letter or number."msgstr "Añade al menos una letra o un número."+#: src/editor/extensions/drag-handle.ts+msgid "Add block below"+msgstr "Añadir bloque debajo"+#: src/comments/CommentSelectionAffordance.tsx#: src/comments/PropertyCommentButton.tsxmsgid "Add Comment"@@ -11637,6 +11641,10 @@ msgstr "Ver la guía de instalación completa"msgid "See what's added"msgstr "Ver qué se añade"+#: src/editor/extensions/drag-handle.ts+msgid "Select {name}"+msgstr "Seleccionar {name}"+#. placeholder {0}: BASE16_SLOT_ROLES[slot]#: src/components/settings/CustomThemeEditor.tsxmsgid "Select {slot} — {0}"@@ -11664,6 +11672,10 @@ msgstr "Seleccionar todos los archivos y carpetas"msgid "Select all source"msgstr "Seleccionar todo el código"+#: src/editor/extensions/drag-handle.ts+msgid "Select block"+msgstr "Seleccionar bloque"+#: src/lib/keyboard-shortcuts.tsmsgid "Select every visible file-tree row when focus is in the Files sidebar."msgstr "Selecciona todas las filas visibles del árbol de archivos cuando el foco está en la barra lateral Archivos."diff --git a/packages/app/src/locales/fr/messages.json b/packages/app/src/locales/fr/messages.jsonindex b736c1468..59412d3f3 100644--- a/packages/app/src/locales/fr/messages.json+++ b/packages/app/src/locales/fr/messages.json@@ -414,6 +414,7 @@"Vous avez déjà un dépôt git ? Ajoutez-le avec <0>git remote add origin <url></0> dans le dossier de ce projet. Cette page se met à jour automatiquement dès qu'un dépôt distant est détecté."],"45MZFs": ["Commandes"],+ "46YgRZ": ["Ajouter un bloc en dessous"],"484LKL": ["Retirer le lien"],"49Mb7P": ["Nous n'avons pas pu vérifier si Slidev est installé. Revenez à cette fenêtre pour réessayer."@@ -726,6 +727,7 @@],"7PzzBU": ["Utilisateur"],"7S7FNA": ["OpenKnowledge a vérifié le projet"],+ "7Voget": ["Sélectionner ", ["name"]],"7WnfoD": ["Ce rapport est déjà en route. Son résultat apparaîtra dans l'historique des rapports de bug."],@@ -1185,6 +1187,7 @@"C_cPoW": ["Votre session GitHub a expiré — reconnectez-vous pour vérifier l'accès en écriture."],+ "CbxTfe": ["Sélectionner le bloc"],"CcaU4i": ["Les modifications s’appliquent immédiatement et sont automatiquement enregistrées dans ce thème."],diff --git a/packages/app/src/locales/fr/messages.po b/packages/app/src/locales/fr/messages.poindex 9f23b5756..fad143759 100644--- a/packages/app/src/locales/fr/messages.po+++ b/packages/app/src/locales/fr/messages.po@@ -1444,6 +1444,10 @@ msgstr "Ajouter un autre motif"msgid "Add at least one letter or number."msgstr "Ajoutez au moins une lettre ou un chiffre."+#: src/editor/extensions/drag-handle.ts+msgid "Add block below"+msgstr "Ajouter un bloc en dessous"+#: src/comments/CommentSelectionAffordance.tsx#: src/comments/PropertyCommentButton.tsxmsgid "Add Comment"@@ -11637,6 +11641,10 @@ msgstr "Voir le guide d'installation complet"msgid "See what's added"msgstr "Voir ce qui est ajouté"+#: src/editor/extensions/drag-handle.ts+msgid "Select {name}"+msgstr "Sélectionner {name}"+#. placeholder {0}: BASE16_SLOT_ROLES[slot]#: src/components/settings/CustomThemeEditor.tsxmsgid "Select {slot} — {0}"@@ -11664,6 +11672,10 @@ msgstr "Sélectionner tous les fichiers et dossiers"msgid "Select all source"msgstr "Sélectionner toute la source"+#: src/editor/extensions/drag-handle.ts+msgid "Select block"+msgstr "Sélectionner le bloc"+#: src/lib/keyboard-shortcuts.tsmsgid "Select every visible file-tree row when focus is in the Files sidebar."msgstr "Sélectionne toutes les lignes visibles de l'arborescence lorsque le focus est dans la barre latérale Fichiers."diff --git a/packages/app/src/locales/hi/messages.json b/packages/app/src/locales/hi/messages.jsonindex 35df32bee..4e2ea74ff 100644--- a/packages/app/src/locales/hi/messages.json+++ b/packages/app/src/locales/hi/messages.json@@ -344,6 +344,7 @@"पहले से एक git रिपॉज़िटरी है? इस प्रोजेक्ट के फ़ोल्डर में <0>git remote add origin <url></0> से इसे जोड़ें। रिमोट का पता चलते ही यह पेज अपने आप अद्यतित हो जाता है।"],"45MZFs": ["कमांड"],+ "46YgRZ": ["नीचे ब्लॉक जोड़ें"],"484LKL": ["लिंक हटाएँ"],"49Mb7P": ["हम जाँच नहीं सके कि Slidev इंस्टॉल है या नहीं। पुनः प्रयास के लिए इस विंडो पर लौटें।"],"4A3Yzu": ["कोड ब्लॉक"],@@ -592,6 +593,7 @@],"7PzzBU": ["उपयोगकर्ता"],"7S7FNA": ["OpenKnowledge ने प्रोजेक्ट की जाँच की"],+ "7Voget": [["name"], " चुनें"],"7WnfoD": ["यह रिपोर्ट पहले ही रास्ते में है। इसका नतीजा बग रिपोर्ट इतिहास में दिखेगा।"],"7Y9yTo": [["owner"], "/", ["name"], " बन गया, लेकिन पुश विफल रहा।"],"7YRrJ9": [@@ -966,6 +968,7 @@"यह फ़ाइल अंतर्निहित पाठ संपादक में खोलने के लिए बहुत बड़ी है (1 MB की सीमा)। इसे किसी दूसरे ऐप में खोलने के लिए नीचे Open file का उपयोग करें।"],"C_cPoW": ["आपका GitHub सत्र समाप्त हो गया — पुश की पहुँच जाँचने के लिए फिर से साइन इन करें।"],+ "CbxTfe": ["ब्लॉक चुनें"],"CcaU4i": ["संपादन तुरंत लागू होते हैं और इस थीम में अपने आप सहेजे जाते हैं।"],"ChMshD": [["appName"], " से बाहर निकलें"],"Ck9XRt": ["कुंजी नहीं सहेजी जा सकी — कृपया फिर कोशिश करें।"],diff --git a/packages/app/src/locales/hi/messages.po b/packages/app/src/locales/hi/messages.poindex a89b6c23e..21794b777 100644--- a/packages/app/src/locales/hi/messages.po+++ b/packages/app/src/locales/hi/messages.po@@ -1440,6 +1440,10 @@ msgstr "एक और पैटर्न जोड़ें"msgid "Add at least one letter or number."msgstr "कम से कम एक अक्षर या अंक जोड़ें।"+#: src/editor/extensions/drag-handle.ts+msgid "Add block below"+msgstr "नीचे ब्लॉक जोड़ें"+#: src/comments/CommentSelectionAffordance.tsx#: src/comments/PropertyCommentButton.tsxmsgid "Add Comment"@@ -11633,6 +11637,10 @@ msgstr "पूरी इंस्टॉल मार्गदर्शिकाmsgid "See what's added"msgstr "देखें क्या जुड़ेगा"+#: src/editor/extensions/drag-handle.ts+msgid "Select {name}"+msgstr "{name} चुनें"+#. placeholder {0}: BASE16_SLOT_ROLES[slot]#: src/components/settings/CustomThemeEditor.tsxmsgid "Select {slot} — {0}"@@ -11660,6 +11668,10 @@ msgstr "सभी फ़ाइलें और फ़ोल्डर चुनmsgid "Select all source"msgstr "पूरा स्रोत चुनें"+#: src/editor/extensions/drag-handle.ts+msgid "Select block"+msgstr "ब्लॉक चुनें"+#: src/lib/keyboard-shortcuts.tsmsgid "Select every visible file-tree row when focus is in the Files sidebar."msgstr "जब फ़ोकस Files साइडबार में हो तब हर दिखाई देने वाली फ़ाइल-ट्री पंक्ति चुनें।"diff --git a/packages/app/src/locales/id/messages.json b/packages/app/src/locales/id/messages.jsonindex ba72ce45b..8d9f9fe45 100644--- a/packages/app/src/locales/id/messages.json+++ b/packages/app/src/locales/id/messages.json@@ -348,6 +348,7 @@"Sudah punya repositori git? Tambahkan dengan <0>git remote add origin <url></0> di folder proyek ini. Halaman ini diperbarui otomatis begitu sebuah remote terdeteksi."],"45MZFs": ["Perintah"],+ "46YgRZ": ["Tambahkan blok di bawah"],"484LKL": ["Hapus tautan"],"49Mb7P": ["Kami tidak dapat memeriksa apakah Slidev terpasang. Kembali ke jendela ini untuk mencoba lagi."@@ -608,6 +609,7 @@],"7PzzBU": ["Pengguna"],"7S7FNA": ["OpenKnowledge memeriksa proyek"],+ "7Voget": ["Pilih ", ["name"]],"7WnfoD": ["Laporan ini sudah dalam perjalanan. Hasilnya akan muncul di riwayat laporan bug."],"7Y9yTo": [["owner"], "/", ["name"], " dibuat, tetapi push gagal."],"7YRrJ9": [@@ -981,6 +983,7 @@"Berkas ini terlalu besar untuk dibuka di penyunting teks bawaan (batas 1 MB). Gunakan Buka berkas di bawah untuk membukanya di aplikasi lain."],"C_cPoW": ["Sesi GitHub Anda kedaluwarsa — masuk lagi untuk memverifikasi akses push."],+ "CbxTfe": ["Pilih blok"],"CcaU4i": ["Suntingan langsung diterapkan dan disimpan otomatis ke tema ini."],"ChMshD": ["Keluar dari ", ["appName"]],"Ck9XRt": ["Kuncinya tidak bisa disimpan — silakan coba lagi."],diff --git a/packages/app/src/locales/id/messages.po b/packages/app/src/locales/id/messages.poindex ceada11dd..64622f626 100644--- a/packages/app/src/locales/id/messages.po+++ b/packages/app/src/locales/id/messages.po@@ -1440,6 +1440,10 @@ msgstr "Tambahkan pola lain"msgid "Add at least one letter or number."msgstr "Tambahkan setidaknya satu huruf atau angka."+#: src/editor/extensions/drag-handle.ts+msgid "Add block below"+msgstr "Tambahkan blok di bawah"+#: src/comments/CommentSelectionAffordance.tsx#: src/comments/PropertyCommentButton.tsxmsgid "Add Comment"@@ -11633,6 +11637,10 @@ msgstr "Lihat panduan pemasangan lengkap"msgid "See what's added"msgstr "Lihat yang ditambahkan"+#: src/editor/extensions/drag-handle.ts+msgid "Select {name}"+msgstr "Pilih {name}"+#. placeholder {0}: BASE16_SLOT_ROLES[slot]#: src/components/settings/CustomThemeEditor.tsxmsgid "Select {slot} — {0}"@@ -11660,6 +11668,10 @@ msgstr "Pilih semua berkas dan folder"msgid "Select all source"msgstr "Pilih seluruh sumber"+#: src/editor/extensions/drag-handle.ts+msgid "Select block"+msgstr "Pilih blok"+#: src/lib/keyboard-shortcuts.tsmsgid "Select every visible file-tree row when focus is in the Files sidebar."msgstr "Memilih semua baris pohon berkas yang terlihat ketika fokus ada di bilah sisi Berkas."diff --git a/packages/app/src/locales/ko/messages.json b/packages/app/src/locales/ko/messages.jsonindex 815b8b228..5eaf91150 100644--- a/packages/app/src/locales/ko/messages.json+++ b/packages/app/src/locales/ko/messages.json@@ -337,6 +337,7 @@"이미 git 저장소가 있나요? 프로젝트 폴더에서 <0>git remote add origin <url></0>을 실행해 추가합니다. 원격 저장소가 감지되면 이 페이지가 자동으로 업데이트됩니다."],"45MZFs": ["명령"],+ "46YgRZ": ["아래에 블록 추가"],"484LKL": ["링크 제거"],"49Mb7P": ["Slidev가 설치되어 있는지 확인하지 못했습니다. 이 창으로 돌아와 다시 시도합니다."],"4A3Yzu": ["코드 블록"],@@ -588,6 +589,7 @@],"7PzzBU": ["사용자"],"7S7FNA": ["OpenKnowledge에서 프로젝트 확인"],+ "7Voget": [["name"], " 선택"],"7WnfoD": ["이 보고서는 이미 전송 중입니다. 결과는 버그 신고 기록에 표시됩니다."],"7Y9yTo": [["owner"], "/", ["name"], " 생성 완료. 푸시에 실패했습니다."],"7YRrJ9": [@@ -952,6 +954,7 @@"이 파일은 기본 제공 텍스트 편집기에서 열기에는 너무 큽니다(1MB 제한). 아래의 파일 열기를 사용해 다른 앱에서 여세요."],"C_cPoW": ["GitHub 세션이 만료되었습니다. 푸시 권한을 확인하려면 로그인합니다."],+ "CbxTfe": ["블록 선택"],"CcaU4i": ["편집 내용이 실시간으로 적용되고 이 테마에 자동으로 저장됩니다."],"ChMshD": [["appName"], " 종료"],"Ck9XRt": ["키를 저장하지 못했습니다. 다시 시도합니다."],diff --git a/packages/app/src/locales/ko/messages.po b/packages/app/src/locales/ko/messages.poindex c8c16d379..966b61eac 100644--- a/packages/app/src/locales/ko/messages.po+++ b/packages/app/src/locales/ko/messages.po@@ -1444,6 +1444,10 @@ msgstr "패턴 추가"msgid "Add at least one letter or number."msgstr "문자 또는 숫자를 하나 이상 추가하세요."+#: src/editor/extensions/drag-handle.ts+msgid "Add block below"+msgstr "아래에 블록 추가"+#: src/comments/CommentSelectionAffordance.tsx#: src/comments/PropertyCommentButton.tsxmsgid "Add Comment"@@ -11637,6 +11641,10 @@ msgstr "전체 설치 안내 보기"msgid "See what's added"msgstr "추가되는 항목 보기"+#: src/editor/extensions/drag-handle.ts+msgid "Select {name}"+msgstr "{name} 선택"+#. placeholder {0}: BASE16_SLOT_ROLES[slot]#: src/components/settings/CustomThemeEditor.tsxmsgid "Select {slot} — {0}"@@ -11664,6 +11672,10 @@ msgstr "모든 파일과 폴더 선택"msgid "Select all source"msgstr "모든 소스 선택"+#: src/editor/extensions/drag-handle.ts+msgid "Select block"+msgstr "블록 선택"+#: src/lib/keyboard-shortcuts.tsmsgid "Select every visible file-tree row when focus is in the Files sidebar."msgstr "파일 사이드바에 포커스가 있을 때 표시되는 모든 파일 트리 행을 선택합니다."diff --git a/packages/app/src/locales/pseudo/messages.json b/packages/app/src/locales/pseudo/messages.jsonindex 16d2efb52..a2ab7cc42 100644--- a/packages/app/src/locales/pseudo/messages.json+++ b/packages/app/src/locales/pseudo/messages.json@@ -349,6 +349,7 @@"Àĺŕēàďŷ ĥàvē à ĝĩţ ŕēƥōśĩţōŕŷ? Àďď ĩţ ŵĩţĥ <0>ĝĩţ ŕēḿōţē àďď ōŕĩĝĩń <url></0> ĩń ţĥĩś ƥŕōĴēćţ'ś ƒōĺďēŕ. Ţĥĩś ƥàĝē ũƥďàţēś àũţōḿàţĩćàĺĺŷ ōńćē à ŕēḿōţē ĩś ďēţēćţēď."],"45MZFs": ["Ćōḿḿàńďś"],+ "46YgRZ": ["Àďď ƀĺōćķ ƀēĺōŵ"],"484LKL": ["Ŕēḿōvē ĺĩńķ"],"49Mb7P": ["Ŵē ćōũĺďń'ţ ćĥēćķ ŵĥēţĥēŕ Śĺĩďēv ĩś ĩńśţàĺĺēď. Ŕēţũŕń ţō ţĥĩś ŵĩńďōŵ ţō ŕēţŕŷ."],"4A3Yzu": ["Ćōďē ƀĺōćķ"],@@ -594,6 +595,7 @@],"7PzzBU": ["Ũśēŕ"],"7S7FNA": ["ŌƥēńĶńōŵĺēďĝē ćĥēćķēď ţĥē ƥŕōĴēćţ"],+ "7Voget": ["Śēĺēćţ ", ["name"]],"7WnfoD": ["Ţĥĩś ŕēƥōŕţ ĩś àĺŕēàďŷ ōń ĩţś ŵàŷ. Ĩţś ŕēśũĺţ ŵĩĺĺ àƥƥēàŕ ĩń ŷōũŕ ƀũĝ ŕēƥōŕţ ĥĩśţōŕŷ."],@@ -988,6 +990,7 @@"Ţĥĩś ƒĩĺē ĩś ţōō ĺàŕĝē ţō ōƥēń ĩń ţĥē ƀũĩĺţ-ĩń ţēxţ ēďĩţōŕ (1 Ḿß ĺĩḿĩţ). Ũśē Ōƥēń ƒĩĺē ƀēĺōŵ ţō ōƥēń ĩţ ĩń àńōţĥēŕ àƥƥ."],"C_cPoW": ["Ŷōũŕ ĜĩţĤũƀ śēśśĩōń ēxƥĩŕēď — śĩĝń ĩń àĝàĩń ţō vēŕĩƒŷ ƥũśĥ àććēśś."],+ "CbxTfe": ["Śēĺēćţ ƀĺōćķ"],"CcaU4i": ["Ēďĩţś àƥƥĺŷ ĺĩvē àńď śàvē àũţōḿàţĩćàĺĺŷ ţō ţĥĩś ţĥēḿē."],"ChMshD": ["Ǫũĩţ ", ["appName"]],"Ck9XRt": ["Ćōũĺďń'ţ śàvē ţĥē ķēŷ — ƥĺēàśē ţŕŷ àĝàĩń."],diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.poindex ac45a11cb..22ac00f4c 100644--- a/packages/app/src/locales/pseudo/messages.po+++ b/packages/app/src/locales/pseudo/messages.po@@ -1440,6 +1440,10 @@ msgstr ""msgid "Add at least one letter or number."msgstr ""+#: src/editor/extensions/drag-handle.ts+msgid "Add block below"+msgstr ""+#: src/comments/CommentSelectionAffordance.tsx#: src/comments/PropertyCommentButton.tsxmsgid "Add Comment"@@ -11633,6 +11637,10 @@ msgstr ""msgid "See what's added"msgstr ""+#: src/editor/extensions/drag-handle.ts+msgid "Select {name}"+msgstr ""+#. placeholder {0}: BASE16_SLOT_ROLES[slot]#: src/components/settings/CustomThemeEditor.tsxmsgid "Select {slot} — {0}"@@ -11660,6 +11668,10 @@ msgstr ""msgid "Select all source"msgstr ""+#: src/editor/extensions/drag-handle.ts+msgid "Select block"+msgstr ""+#: src/lib/keyboard-shortcuts.tsmsgid "Select every visible file-tree row when focus is in the Files sidebar."msgstr ""diff --git a/packages/app/src/locales/pt-BR/messages.json b/packages/app/src/locales/pt-BR/messages.jsonindex 652f657a3..d98e3221f 100644--- a/packages/app/src/locales/pt-BR/messages.json+++ b/packages/app/src/locales/pt-BR/messages.json@@ -396,6 +396,7 @@"Já tem um repositório git? Adicione-o com <0>git remote add origin <url></0> na pasta deste projeto. Esta página se atualiza sozinha assim que um remoto for detectado."],"45MZFs": ["Comandos"],+ "46YgRZ": ["Adicionar bloco abaixo"],"484LKL": ["Remover o link"],"49Mb7P": ["Não foi possível verificar se o Slidev está instalado. Volte para esta janela para tentar de novo."@@ -696,6 +697,7 @@],"7PzzBU": ["Usuário"],"7S7FNA": ["OpenKnowledge verificou o projeto"],+ "7Voget": ["Selecionar ", ["name"]],"7WnfoD": ["Este relatório já está a caminho. O resultado vai aparecer no histórico de relatórios de erro."],@@ -1139,6 +1141,7 @@"Este arquivo é grande demais para abrir no editor de texto integrado (limite de 1 MB). Use Abrir arquivo, abaixo, para abri-lo em outro app."],"C_cPoW": ["Sua sessão do GitHub expirou — entre de novo para verificar o acesso de envio."],+ "CbxTfe": ["Selecionar bloco"],"CcaU4i": ["As alterações são aplicadas imediatamente e salvas automaticamente neste tema."],"ChMshD": ["Encerrar o ", ["appName"]],"Ck9XRt": ["Não deu para salvar a chave — tente de novo."],diff --git a/packages/app/src/locales/pt-BR/messages.po b/packages/app/src/locales/pt-BR/messages.poindex a24d2f459..815597597 100644--- a/packages/app/src/locales/pt-BR/messages.po+++ b/packages/app/src/locales/pt-BR/messages.po@@ -1440,6 +1440,10 @@ msgstr "Adicionar outro padrão"msgid "Add at least one letter or number."msgstr "Adicione pelo menos uma letra ou número."+#: src/editor/extensions/drag-handle.ts+msgid "Add block below"+msgstr "Adicionar bloco abaixo"+#: src/comments/CommentSelectionAffordance.tsx#: src/comments/PropertyCommentButton.tsxmsgid "Add Comment"@@ -11633,6 +11637,10 @@ msgstr "Ver o guia de instalação completo"msgid "See what's added"msgstr "Ver o que será adicionado"+#: src/editor/extensions/drag-handle.ts+msgid "Select {name}"+msgstr "Selecionar {name}"+#. placeholder {0}: BASE16_SLOT_ROLES[slot]#: src/components/settings/CustomThemeEditor.tsxmsgid "Select {slot} — {0}"@@ -11660,6 +11668,10 @@ msgstr "Selecionar todos os arquivos e pastas"msgid "Select all source"msgstr "Selecionar todo o código"+#: src/editor/extensions/drag-handle.ts+msgid "Select block"+msgstr "Selecionar bloco"+#: src/lib/keyboard-shortcuts.tsmsgid "Select every visible file-tree row when focus is in the Files sidebar."msgstr "Seleciona todas as linhas visíveis da árvore de arquivos quando o foco está na barra lateral Arquivos."diff --git a/packages/app/src/locales/ur/messages.json b/packages/app/src/locales/ur/messages.jsonindex 7621d1b6f..29bc3ba64 100644--- a/packages/app/src/locales/ur/messages.json+++ b/packages/app/src/locales/ur/messages.json@@ -348,6 +348,7 @@"پہلے سے git ریپازٹری موجود ہے؟ اس پروجیکٹ کے فولڈر میں <0>git remote add origin <url></0> سے شامل کریں۔ ریموٹ کا پتا چلتے ہی یہ صفحہ خودکار طور پر تازہ ہو جاتا ہے۔"],"45MZFs": ["کمانڈز"],+ "46YgRZ": ["نیچے بلاک شامل کریں"],"484LKL": ["لنک ہٹائیں"],"49Mb7P": ["ہم جانچ نہیں سکے کہ Slidev انسٹال ہے یا نہیں۔ دوبارہ کوشش کے لیے اس ونڈو پر واپس آئیں۔"@@ -616,6 +617,7 @@],"7PzzBU": ["صارف"],"7S7FNA": ["OpenKnowledge نے پروجیکٹ کی جانچ کی"],+ "7Voget": [["name"], " منتخب کریں"],"7WnfoD": ["یہ رپورٹ پہلے ہی راستے میں ہے۔ اس کا نتیجہ بگ رپورٹ کی تاریخ میں نظر آئے گا۔"],"7Y9yTo": [["owner"], "/", ["name"], " بن گیا، لیکن پش ناکام رہا۔"],"7YRrJ9": [@@ -1002,6 +1004,7 @@"یہ فائل بلٹ اِن ٹیکسٹ ایڈیٹر میں کھولنے کے لیے بہت بڑی ہے (حد 1 MB)۔ اسے کسی اور ایپ میں کھولنے کے لیے نیچے «فائل کھولیں» استعمال کریں۔"],"C_cPoW": ["آپ کا GitHub سیشن ختم ہو گیا — پُش کی رسائی کی توثیق کے لیے دوبارہ سائن اِن کریں۔"],+ "CbxTfe": ["بلاک منتخب کریں"],"CcaU4i": ["ترامیم فوراً لاگو ہوتی ہیں اور خودکار طور پر اس تھیم میں محفوظ ہو جاتی ہیں۔"],"ChMshD": [["appName"], " سے باہر نکلیں"],"Ck9XRt": ["کلید محفوظ نہیں ہو سکی — براہِ کرم دوبارہ کوشش کریں۔"],diff --git a/packages/app/src/locales/ur/messages.po b/packages/app/src/locales/ur/messages.poindex b460585bd..cb8d10664 100644--- a/packages/app/src/locales/ur/messages.po+++ b/packages/app/src/locales/ur/messages.po@@ -1444,6 +1444,10 @@ msgstr "ایک اور پیٹرن شامل کریں"msgid "Add at least one letter or number."msgstr "کم از کم ایک حرف یا عدد شامل کریں۔"+#: src/editor/extensions/drag-handle.ts+msgid "Add block below"+msgstr "نیچے بلاک شامل کریں"+#: src/comments/CommentSelectionAffordance.tsx#: src/comments/PropertyCommentButton.tsxmsgid "Add Comment"@@ -11637,6 +11641,10 @@ msgstr "مکمل تنصیبی رہنما دیکھیں"msgid "See what's added"msgstr "دیکھیں کیا شامل ہوگا"+#: src/editor/extensions/drag-handle.ts+msgid "Select {name}"+msgstr "{name} منتخب کریں"+#. placeholder {0}: BASE16_SLOT_ROLES[slot]#: src/components/settings/CustomThemeEditor.tsxmsgid "Select {slot} — {0}"@@ -11664,6 +11672,10 @@ msgstr "تمام فائلیں اور فولڈرز منتخب کریں"msgid "Select all source"msgstr "پورا سورس منتخب کریں"+#: src/editor/extensions/drag-handle.ts+msgid "Select block"+msgstr "بلاک منتخب کریں"+#: src/lib/keyboard-shortcuts.tsmsgid "Select every visible file-tree row when focus is in the Files sidebar."msgstr "جب فوکس فائلوں کے سائیڈ بار میں ہو تو فائل ٹری کی ہر نظر آنے والی قطار منتخب کریں۔"diff --git a/packages/app/src/locales/zh-Hans/messages.json b/packages/app/src/locales/zh-Hans/messages.jsonindex 7e82d6482..b67b1cbc5 100644--- a/packages/app/src/locales/zh-Hans/messages.json+++ b/packages/app/src/locales/zh-Hans/messages.json@@ -317,6 +317,7 @@"已经有 git 仓库了?在这个项目的文件夹中用 <0>git remote add origin <url></0> 添加它。检测到远程仓库后,本页会自动更新。"],"45MZFs": ["命令"],+ "46YgRZ": ["在下方添加块"],"484LKL": ["移除链接"],"49Mb7P": ["无法检查是否已安装 Slidev。返回此窗口重试。"],"4A3Yzu": ["代码块"],@@ -545,6 +546,7 @@],"7PzzBU": ["用户"],"7S7FNA": ["OpenKnowledge 检查了项目"],+ "7Voget": ["选择 ", ["name"]],"7WnfoD": ["该报告已经在发送途中,结果会显示在错误报告历史里。"],"7Y9yTo": ["已创建 ", ["owner"], "/", ["name"], ",但推送失败。"],"7YRrJ9": [@@ -877,6 +879,7 @@"这个文件太大,无法在内置文本编辑器中打开(上限 1 MB)。请用下方的「打开文件」在其他应用中打开它。"],"C_cPoW": ["你的 GitHub 会话已过期——请重新登录以验证推送权限。"],+ "CbxTfe": ["选择块"],"CcaU4i": ["编辑会实时生效,并自动保存到此主题。"],"ChMshD": ["退出 ", ["appName"]],"Ck9XRt": ["无法保存密钥——请重试。"],diff --git a/packages/app/src/locales/zh-Hans/messages.po b/packages/app/src/locales/zh-Hans/messages.poindex 0cbb073db..5a9be06ca 100644--- a/packages/app/src/locales/zh-Hans/messages.po+++ b/packages/app/src/locales/zh-Hans/messages.po@@ -1444,6 +1444,10 @@ msgstr "再添加一个模式"msgid "Add at least one letter or number."msgstr "请至少加入一个字母或数字。"+#: src/editor/extensions/drag-handle.ts+msgid "Add block below"+msgstr "在下方添加块"+#: src/comments/CommentSelectionAffordance.tsx#: src/comments/PropertyCommentButton.tsxmsgid "Add Comment"@@ -11637,6 +11641,10 @@ msgstr "查看完整的安装指南"msgid "See what's added"msgstr "查看将添加的内容"+#: src/editor/extensions/drag-handle.ts+msgid "Select {name}"+msgstr "选择 {name}"+#. placeholder {0}: BASE16_SLOT_ROLES[slot]#: src/components/settings/CustomThemeEditor.tsxmsgid "Select {slot} — {0}"@@ -11664,6 +11672,10 @@ msgstr "选中所有文件和文件夹"msgid "Select all source"msgstr "全选源码"+#: src/editor/extensions/drag-handle.ts+msgid "Select block"+msgstr "选择块"+#: src/lib/keyboard-shortcuts.tsmsgid "Select every visible file-tree row when focus is in the Files sidebar."msgstr "当焦点在「文件」侧边栏时,选中文件树中所有可见的行。"diff --git a/packages/app/src/locales/zh-Hant/messages.json b/packages/app/src/locales/zh-Hant/messages.jsonindex 2f0b661d5..71fc1571e 100644--- a/packages/app/src/locales/zh-Hant/messages.json+++ b/packages/app/src/locales/zh-Hant/messages.json@@ -321,6 +321,7 @@"已經有 git 儲存庫了?在這個專案的資料夾中用 <0>git remote add origin <url></0> 加上它。偵測到遠端後,這個頁面會自動更新。"],"45MZFs": ["指令"],+ "46YgRZ": ["在下方新增區塊"],"484LKL": ["移除連結"],"49Mb7P": ["無法檢查是否已安裝 Slidev。請回到此視窗重試。"],"4A3Yzu": ["程式碼區塊"],@@ -547,6 +548,7 @@],"7PzzBU": ["使用者"],"7S7FNA": ["OpenKnowledge 檢查了專案"],+ "7Voget": ["選取 ", ["name"]],"7WnfoD": ["這份回報已經在傳送途中,結果會顯示在錯誤回報記錄裡。"],"7Y9yTo": ["已建立 ", ["owner"], "/", ["name"], ",但推送失敗。"],"7YRrJ9": [@@ -881,6 +883,7 @@"這個檔案太大,無法在內建文字編輯器中開啟(上限 1 MB)。請用下面的「開啟檔案」在其他應用程式中開啟它。"],"C_cPoW": ["你的 GitHub 工作階段已過期——請重新登入以確認推送權限。"],+ "CbxTfe": ["選取區塊"],"CcaU4i": ["編輯會即時套用,並自動儲存到這個主題。"],"ChMshD": ["結束 ", ["appName"]],"Ck9XRt": ["無法儲存金鑰——請再試一次。"],diff --git a/packages/app/src/locales/zh-Hant/messages.po b/packages/app/src/locales/zh-Hant/messages.poindex a6af64070..768123e49 100644--- a/packages/app/src/locales/zh-Hant/messages.po+++ b/packages/app/src/locales/zh-Hant/messages.po@@ -1444,6 +1444,10 @@ msgstr "再新增一個模式"msgid "Add at least one letter or number."msgstr "請至少加入一個字母或數字。"+#: src/editor/extensions/drag-handle.ts+msgid "Add block below"+msgstr "在下方新增區塊"+#: src/comments/CommentSelectionAffordance.tsx#: src/comments/PropertyCommentButton.tsxmsgid "Add Comment"@@ -11637,6 +11641,10 @@ msgstr "查看完整的安裝指南"msgid "See what's added"msgstr "查看將新增的內容"+#: src/editor/extensions/drag-handle.ts+msgid "Select {name}"+msgstr "選取 {name}"+#. placeholder {0}: BASE16_SLOT_ROLES[slot]#: src/components/settings/CustomThemeEditor.tsxmsgid "Select {slot} — {0}"@@ -11664,6 +11672,10 @@ msgstr "選取所有檔案和資料夾"msgid "Select all source"msgstr "全選原始碼"+#: src/editor/extensions/drag-handle.ts+msgid "Select block"+msgstr "選取區塊"+#: src/lib/keyboard-shortcuts.tsmsgid "Select every visible file-tree row when focus is in the Files sidebar."msgstr "當焦點在「檔案」側邊欄時,選取檔案樹中所有看得到的列。"diff --git a/packages/app/tests/integration/qa-fwd-regression-probe.test.ts b/packages/app/tests/integration/qa-fwd-regression-probe.test.tsindex 2e7621793..ef83f7d93 100644--- a/packages/app/tests/integration/qa-fwd-regression-probe.test.ts+++ b/packages/app/tests/integration/qa-fwd-regression-probe.test.ts@@ -69,20 +69,21 @@ async function seedDocument(raw: string, fragmentBody = raw): Promise<TestClient}describe('#3132 forward verification + regression checks', () => {- test('FWD-02: one Enter at the tail stays below the carry floor; the second Enter carries both', async () => {+ test('FWD-02: each Enter at the tail carries on its own press', async () => {const clients = await seedDocument('Above.\n\nBelow.\n');try {const a = clients[0];a.doc.transact(() => {a.fragment.insert(a.fragment.length, [para()]);});- await wait(1500);- const afterOne = clients.map((c) => c.ytext.toString());- diag('FWD-02:one-enter', { afterOne });- for (const yt of afterOne) {- expect(yt, 'single Enter is affordance-ambiguous and must not write bytes').toBe(- 'Above.\n\nBelow.\n',- );+ const afterOne = 'Above.\n\nBelow.\n\n';+ const carriedOne = await settle(+ () => clients.every((c) => c.ytext.toString() === afterOne),+ 6000,+ );+ diag('FWD-02:one-enter', { carriedOne, ytext: clients.map((c) => c.ytext.toString()) });+ for (const c of clients) {+ expect(c.ytext.toString(), 'one Enter is authored and carries immediately').toBe(afterOne);}a.doc.transact(() => {a.fragment.insert(a.fragment.length, [para()]);@@ -94,9 +95,7 @@ describe('#3132 forward verification + regression checks', () => {);diag('FWD-02:two-enters', { converged, ytext: clients.map((c) => c.ytext.toString()) });for (const c of clients) {- expect(c.ytext.toString(), 'second Enter crosses the floor and carries the run').toBe(- expected,- );+ expect(c.ytext.toString(), 'the second Enter adds the second blank line').toBe(expected);}} finally {for (const c of clients) await c.cleanup();diff --git a/packages/app/tests/stress/chip-popover-positioning.e2e.ts b/packages/app/tests/stress/chip-popover-positioning.e2e.tsindex 52647332b..d11cebe3d 100644--- a/packages/app/tests/stress/chip-popover-positioning.e2e.ts+++ b/packages/app/tests/stress/chip-popover-positioning.e2e.ts@@ -27,6 +27,14 @@ async function rectOf(_page: Page, locator: ReturnType<Page['locator']>) {return box;}+async function disableFollowFile(page: Page) {+ await page.addInitScript(() => {+ try {+ localStorage.setItem('ok-acp-follow-file-v1', '0');+ } catch {}+ });+}+test('CHIP-POS-WIKI: wiki-link PropPanel anchors to chip rect when scrolled past first viewport', async ({page,api,@@ -34,6 +42,7 @@ test('CHIP-POS-WIKI: wiki-link PropPanel anchors to chip rect when scrolled pastconst docName = `chip-pos-wiki-${Math.random().toString(36).slice(2, 10)}`;await api.createPage(`${docName}.md`);await api.replaceDoc(docName, `${FILLER}\n\nTrailing chip: [[fake-target]]\n`);+ await disableFollowFile(page);await page.goto(`/#/${docName}`);await page.waitForSelector('.ProseMirror:not(.composer-prosemirror)');await waitForActiveProviderSynced(page);@@ -64,6 +73,7 @@ test('CHIP-POS-LINK: internal-link PropPanel anchors to chip rect when scrolledconst docName = `chip-pos-link-${Math.random().toString(36).slice(2, 10)}`;await api.createPage(`${docName}.md`);await api.replaceDoc(docName, `${FILLER}\n\nTrailing chip: [Beta page](beta.md)\n`);+ await disableFollowFile(page);await page.goto(`/#/${docName}`);await page.waitForSelector('.ProseMirror:not(.composer-prosemirror)');await waitForActiveProviderSynced(page);diff --git a/packages/app/tests/stress/trailing-affordance.e2e.ts b/packages/app/tests/stress/trailing-affordance.e2e.tsnew file mode 100644index 000000000..387f9bab9--- /dev/null+++ b/packages/app/tests/stress/trailing-affordance.e2e.ts@@ -0,0 +1,279 @@+import { randomUUID } from 'node:crypto';+import type { Page } from '@playwright/test';+import { expect, test, waitForActiveProviderSynced as waitForProvider } from './_helpers';++const EDITOR = '.ProseMirror:not(.composer-prosemirror)';++const TALL_DOC_WITH_TABLE = `${Array.from(+ { length: 12 },+ (_, i) => `Paragraph ${i + 1} of filler, here to make the document taller than the editor.`,+).join('\n\n')}++| Col A | Col B |+| ----- | ----- |+| one | two |+`;++const TYPED_MARKER = 'zoneauthored';++function readSource(page: Page): Promise<string> {+ return page.evaluate(() => window.__activeProvider?.document.getText('source').toString() ?? '');+}++const TRAILING_WIDGET_CLASSES = ['ok-trailing-affordance', 'ProseMirror-gapcursor'];++function lastRealBlockMetrics(+ page: Page,+): Promise<{ bottom: number; marginBottom: number } | null> {+ return page.evaluate(+ ({ selector, widgets }) => {+ const editor = document.querySelector(selector);+ if (!editor) return null;+ let last = editor.lastElementChild;+ while (last && widgets.some((name) => last?.classList.contains(name))) {+ last = last.previousElementSibling;+ }+ if (!last) return null;+ const margin = Number.parseFloat(getComputedStyle(last).marginBottom || '0');+ return {+ bottom: last.getBoundingClientRect().bottom,+ marginBottom: Number.isFinite(margin) ? margin : 0,+ };+ },+ { selector: EDITOR, widgets: TRAILING_WIDGET_CLASSES },+ );+}++async function measureZoneHeight(page: Page): Promise<number> {+ const block = await lastRealBlockMetrics(page);+ if (!block) return -1;+ const edge = await page.evaluate((selector) => {+ const editor = document.querySelector(selector);+ if (!editor) return null;+ const composer = Number.parseFloat(+ getComputedStyle(editor).getPropertyValue('--ask-composer-height') || '0',+ );+ return {+ bottom: editor.getBoundingClientRect().bottom,+ composer: Number.isFinite(composer) ? composer : 0,+ };+ }, EDITOR);+ if (!edge) return -1;+ return edge.bottom - edge.composer - block.marginBottom - block.bottom;+}++async function zoneClickPoint(page: Page): Promise<{ x: number; y: number }> {+ await page.evaluate((selector) => {+ const scroll = document.querySelector(selector)?.closest('.editor-doc-scroll');+ if (scroll) scroll.scrollTop = scroll.scrollHeight;+ }, EDITOR);+ await page.waitForFunction(+ (selector) => {+ const scroll = document.querySelector(selector)?.closest('.editor-doc-scroll');+ if (!scroll) return false;+ return scroll.scrollTop + scroll.clientHeight >= scroll.scrollHeight - 2;+ },+ EDITOR,+ { timeout: 10_000 },+ );++ const block = await lastRealBlockMetrics(page);+ expect(block, 'the fixture must have a last block below the hint').not.toBeNull();+ // biome-ignore lint/style/noNonNullAssertion: asserted non-null above.+ const lastBottom = block!.bottom;++ const probe = await page.evaluate(+ ({ selector, lastBottom: blockBottom }) => {+ const editor = document.querySelector(selector);+ const scroll = editor?.closest('.editor-doc-scroll');+ if (!editor || !scroll) return null;+ const editorBox = editor.getBoundingClientRect();+ const composer = Number.parseFloat(+ getComputedStyle(editor).getPropertyValue('--ask-composer-height') || '0',+ );+ const clearBottom = Math.min(+ editorBox.bottom,+ scroll.getBoundingClientRect().bottom - composer,+ );+ const x = editorBox.left + 80;+ const blockers: string[] = [];+ for (let y = blockBottom + 2; y <= clearBottom - 2; y += 2) {+ const hit = document.elementFromPoint(x, y);+ if (hit === editor) return { x, y, clearBandHeight: clearBottom - blockBottom, blockers };+ const tag = hit ? `${hit.tagName.toLowerCase()}.${hit.className}` : 'null';+ if (!blockers.includes(tag)) blockers.push(tag);+ }+ return { x, y: null, clearBandHeight: clearBottom - blockBottom, blockers };+ },+ { selector: EDITOR, lastBottom },+ );++ expect(probe, 'editor and scrollport must both be present').not.toBeNull();+ // biome-ignore lint/style/noNonNullAssertion: asserted non-null above.+ const found = probe!;+ expect(+ found.y,+ `no row in the ${found.clearBandHeight.toFixed(0)}px band below the last block reaches the editor; blocked by ${found.blockers.join(', ')}`,+ ).not.toBeNull();+ // biome-ignore lint/style/noNonNullAssertion: asserted non-null above.+ return { x: found.x, y: found.y! };+}++test.describe('trailing affordance geometry', () => {+ let docName: string;++ test.beforeEach(async ({ page, api }) => {+ docName = `test-trailing-affordance-${randomUUID().slice(0, 8)}`;+ await api.createPage(`${docName}.md`);+ await api.replaceDoc(docName, TALL_DOC_WITH_TABLE);+ await page.goto(`/#/${docName}`);+ await waitForProvider(page);+ await page.waitForSelector(EDITOR);+ await page.waitForFunction(+ (selector) => document.querySelector(selector)?.querySelector('table') != null,+ EDITOR,+ { timeout: 10_000 },+ );+ });++ test('a document ending in a table leaves a clickable zone below it', async ({ page }) => {+ const editorHeight = await page.evaluate(+ (selector) => document.querySelector(selector)?.getBoundingClientRect().height ?? 0,+ EDITOR,+ );+ expect(editorHeight).toBeGreaterThan(200);++ expect(await measureZoneHeight(page)).toBeGreaterThan(16);+ });++ test('clicking the zone authors a paragraph the document keeps', async ({ page }) => {+ const before = await readSource(page);+ expect(before.trimEnd().endsWith('|')).toBe(true);+ expect(before.endsWith('\n\n')).toBe(false);++ const point = await zoneClickPoint(page);+ await page.mouse.click(point.x, point.y);++ await expect.poll(() => readSource(page), { timeout: 10_000 }).toMatch(/\|\s*\n\n$/);+ await expect(page.locator('.ProseMirror-gapcursor')).toHaveCount(0);++ await page.keyboard.type(TYPED_MARKER);+ await expect+ .poll(() => readSource(page), { timeout: 10_000 })+ .toMatch(new RegExp(`\\|\\s*\\n\\s*${TYPED_MARKER}\\s*$`));+ });++ test('the "+" hint sits in the gutter, left of the text column', async ({ page }) => {+ const point = await zoneClickPoint(page);+ await page.mouse.move(point.x, point.y);++ const plus = page.locator('.ok-trailing-affordance-plus');+ await expect(plus).toBeVisible({ timeout: 10_000 });++ const geometry = await page.evaluate((selector) => {+ const editor = document.querySelector(selector);+ const glyph = document.querySelector('.ok-trailing-affordance-plus');+ if (!editor || !glyph) return null;+ const style = getComputedStyle(editor);+ const editorBox = editor.getBoundingClientRect();+ return {+ glyphRight: glyph.getBoundingClientRect().right,+ textColumnLeft: editorBox.left + Number.parseFloat(style.paddingLeft),+ };+ }, EDITOR);+ expect(geometry).not.toBeNull();++ // biome-ignore lint/style/noNonNullAssertion: asserted non-null above.+ expect(geometry!.glyphRight).toBeLessThanOrEqual(geometry!.textColumnLeft);+ });++ test('the composer inset adds to the trailing zone rather than replacing it', async ({+ page,+ }) => {+ const padding = await page.evaluate((selector) => {+ const editor = document.querySelector<HTMLElement>(selector);+ if (!editor) return null;+ const style = getComputedStyle(editor);+ const px = (name: string) => Number.parseFloat(style.getPropertyValue(name) || '0');+ return {+ paddingBottom: Number.parseFloat(style.paddingBottom),+ composer: px('--ask-composer-height'),+ zone:+ Number.parseFloat(style.getPropertyValue('--ok-trailing-zone') || '0') *+ Number.parseFloat(getComputedStyle(document.documentElement).fontSize),+ };+ }, EDITOR);+ expect(padding).not.toBeNull();++ // biome-ignore lint/style/noNonNullAssertion: asserted non-null above.+ expect(padding!.composer).toBeGreaterThan(0);+ // biome-ignore lint/style/noNonNullAssertion: asserted non-null above.+ expect(padding!.zone).toBeGreaterThan(0);+ // biome-ignore lint/style/noNonNullAssertion: asserted non-null above.+ expect(padding!.paddingBottom).toBeCloseTo(padding!.composer + padding!.zone, 1);+ });++ test('the gapcursor after a trailing table is drawn in the theme color', async ({ page }) => {+ await page.locator(`${EDITOR} table td`).last().click();++ const gapcursor = page.locator('.ProseMirror-gapcursor');+ await expect+ .poll(+ async () => {+ await page.keyboard.press('ArrowDown');+ return gapcursor.count();+ },+ { timeout: 10_000 },+ )+ .toBe(1);++ const painted = await page.evaluate(() => {+ const el = document.querySelector('.ProseMirror-gapcursor');+ if (!el) return null;+ const probe = document.createElement('div');+ probe.style.borderTopColor = 'var(--foreground)';+ el.appendChild(probe);+ const expected = getComputedStyle(probe).borderTopColor;+ probe.remove();+ return {+ actual: getComputedStyle(el, '::after').borderTopColor,+ expected,+ token: getComputedStyle(document.documentElement).getPropertyValue('--foreground').trim(),+ };+ });+ expect(painted).not.toBeNull();++ // biome-ignore lint/style/noNonNullAssertion: asserted non-null above.+ expect(painted!.token).not.toBe('');+ // biome-ignore lint/style/noNonNullAssertion: asserted non-null above.+ expect(painted!.actual).toBe(painted!.expected);+ // biome-ignore lint/style/noNonNullAssertion: asserted non-null above.+ expect(painted!.actual).not.toBe('rgb(0, 0, 0)');+ });++ test.describe('on a coarse pointer at the narrow rail', () => {+ test.use({ hasTouch: true, viewport: { width: 390, height: 780 } });++ test('the hint is present without a hover and sits inside the editor', async ({ page }) => {+ expect(await page.evaluate(() => window.matchMedia('(pointer: coarse)').matches)).toBe(true);++ const plus = page.locator('.ok-trailing-affordance-plus');+ await expect(plus).toBeVisible({ timeout: 10_000 });++ const geometry = await page.evaluate((selector) => {+ const editor = document.querySelector(selector);+ const glyph = document.querySelector('.ok-trailing-affordance-plus');+ if (!editor || !glyph) return null;+ const editorBox = editor.getBoundingClientRect();+ const glyphBox = glyph.getBoundingClientRect();+ return { editorLeft: editorBox.left, glyphLeft: glyphBox.left, glyphWidth: glyphBox.width };+ }, EDITOR);+ expect(geometry).not.toBeNull();++ // biome-ignore lint/style/noNonNullAssertion: asserted non-null above.+ expect(geometry!.glyphWidth).toBeGreaterThan(0);+ // biome-ignore lint/style/noNonNullAssertion: asserted non-null above.+ expect(geometry!.glyphLeft).toBeGreaterThanOrEqual(geometry!.editorLeft);+ });+ });+});diff --git a/packages/core/src/extensions/shared.ts b/packages/core/src/extensions/shared.tsindex d7bb57dd1..536bd3ae8 100644--- a/packages/core/src/extensions/shared.ts+++ b/packages/core/src/extensions/shared.ts@@ -62,6 +62,7 @@ export const sharedExtensions = [SourceLiteralMark,PlainTextClipboard,StarterKit.configure({+ trailingNode: false,undoRedo: false,bulletList: false,orderedList: false,diff --git a/packages/core/src/index.ts b/packages/core/src/index.tsindex 51b11a8f8..2da97c202 100644--- a/packages/core/src/index.ts+++ b/packages/core/src/index.ts@@ -806,7 +806,10 @@ export {scrubSecrets,} from './logging/secret-scrub.ts';export { selectFenceChar, widenFenceLength } from './markdown/code-fence.ts';-export { MIN_CARRIED_EDGE_EMPTIES } from './markdown/doc-edge-blank-runs.ts';+export {+ MIN_CARRIED_LEADING_EMPTIES,+ MIN_CARRIED_TRAILING_EMPTIES,+} from './markdown/doc-edge-blank-runs.ts';export { headingContentIdentity } from './markdown/heading-content-identity.ts';export {HTML_MAX_BYTES,diff --git a/packages/core/src/markdown/doc-edge-blank-runs.ts b/packages/core/src/markdown/doc-edge-blank-runs.tsindex 22b26e8b4..d10935e50 100644--- a/packages/core/src/markdown/doc-edge-blank-runs.ts+++ b/packages/core/src/markdown/doc-edge-blank-runs.ts@@ -1,15 +1,18 @@import type { Root as MdastRoot, Paragraph } from 'mdast';import type { SourceDocBoundary } from './mdast-augmentation.ts';-export const MIN_CARRIED_EDGE_EMPTIES = 2;+export const MIN_CARRIED_LEADING_EMPTIES = 2;++export const MIN_CARRIED_TRAILING_EMPTIES = 1;export interface DocEdgeEmpties {leading: number;trailing: number;}-function applyFloor(empties: number): number {- return empties >= MIN_CARRIED_EDGE_EMPTIES ? empties : 0;+function applyFloor(empties: number, edge: 'leading' | 'trailing'): number {+ const floor = edge === 'leading' ? MIN_CARRIED_LEADING_EMPTIES : MIN_CARRIED_TRAILING_EMPTIES;+ return empties >= floor ? empties : 0;}export function carriedEdgeEmpties(source: string): DocEdgeEmpties {@@ -17,8 +20,8 @@ export function carriedEdgeEmpties(source: string): DocEdgeEmpties {const afterHead = afterBom.replace(/^\n+/, '');if (afterHead.replace(/\n+$/, '').length === 0) return { leading: 0, trailing: 0 };return {- leading: applyFloor(afterBom.length - afterHead.length),- trailing: applyFloor(afterHead.length - afterHead.replace(/\n+$/, '').length - 1),+ leading: applyFloor(afterBom.length - afterHead.length, 'leading'),+ trailing: applyFloor(afterHead.length - afterHead.replace(/\n+$/, '').length - 1, 'trailing'),};}@@ -35,11 +38,11 @@ export function materializeDocEdgeBlankRuns(const head =children.length === 0 || boundary.leading === undefined? 0- : applyFloor(boundary.leading.length);+ : applyFloor(boundary.leading.length, 'leading');const tail =children.length === 0 || boundary.trailing === undefined? 0- : applyFloor(boundary.trailing.length - 1);+ : applyFloor(boundary.trailing.length - 1, 'trailing');if (head === 0 && tail === 0) return boundary;const lastEnd = children[children.length - 1]?.position?.end;diff --git a/packages/core/src/schema-invariant.test.ts b/packages/core/src/schema-invariant.test.tsindex 3b285688e..729fe642b 100644--- a/packages/core/src/schema-invariant.test.ts+++ b/packages/core/src/schema-invariant.test.ts@@ -1,5 +1,6 @@import { existsSync, readFileSync } from 'node:fs';-import { getSchema } from '@tiptap/core';+import { getSchema, resolveExtensions } from '@tiptap/core';+import type { ContentMatch, NodeType } from '@tiptap/pm/model';import { describe, expect, test } from 'vitest';import { sharedExtensions } from './extensions/shared.ts';@@ -287,3 +288,30 @@ describe('R10: schema add-only invariant', () => {}});});++describe('resolved extension list', () => {+ const resolvedNames = resolveExtensions(sharedExtensions).map((ext) => ext.name);++ test('TrailingNode does not survive the resolve', () => {+ expect(resolvedNames).not.toContain('trailingNode');+ });++ test('Gapcursor does, so disabling TrailingNode did not take it along', () => {+ expect(resolvedNames).toContain('gapCursor');+ });+});++describe('default block type (priority-resolved, which extensionOrder does not cover)', () => {+ function defaultBlockAt(match: ContentMatch): NodeType | null {+ for (let i = 0; i < match.edgeCount; i++) {+ const { type } = match.edge(i);+ if (type.isTextblock && !type.hasRequiredAttrs()) return type;+ }+ return null;+ }++ test('the block ProseMirror authors by default is paragraph', () => {+ const schema = getSchema(sharedExtensions);+ expect(defaultBlockAt(schema.nodes.doc.contentMatch)?.name).toBe('paragraph');+ });+});diff --git a/packages/server/src/persistence-phantom-commit.test.ts b/packages/server/src/persistence-phantom-commit.test.tsindex 103ff28d8..b89818e0f 100644--- a/packages/server/src/persistence-phantom-commit.test.ts+++ b/packages/server/src/persistence-phantom-commit.test.ts@@ -70,7 +70,7 @@ describe('onStoreDocument phantom-principal-commit regression (PR #295)', () =>fixture.cleanup();});- test('y-prosemirror-style empty-paragraph append → principal NOT recorded', async () => {+ test('empty-paragraph insert at a sub-floor edge → principal NOT recorded', async () => {writeFileSync(join(fixture.contentDir, 'empty-para-doc.md'),'# Original heading\n\nOriginal body.\n',@@ -96,7 +96,7 @@ describe('onStoreDocument phantom-principal-commit regression (PR #295)', () =>connection: { context: { principalId: 'principal-test-phantom' } },};serverDoc.transact(() => {- serverDoc.getXmlFragment('default').push([new Y.XmlElement('paragraph')]);+ serverDoc.getXmlFragment('default').insert(0, [new Y.XmlElement('paragraph')]);}, connectionOrigin);await expectContributorCountRemainsAt(0, { durationMs: 800 });@@ -108,6 +108,46 @@ describe('onStoreDocument phantom-principal-commit regression (PR #295)', () =>expect(contributorCount()).toBe(0);});+ test('empty-paragraph append at the tail → principal IS recorded', async () => {+ writeFileSync(+ join(fixture.contentDir, 'tail-empty-doc.md'),+ '# Original heading\n\nOriginal body.\n',+ 'utf-8',+ );+ const server = createServer({+ contentDir: fixture.contentDir,+ projectDir: fixture.tmpDir,+ quiet: true,+ debounce: 100,+ maxDebounce: 500,+ gitEnabled: false,+ });+ await server.ready;+ try {+ const conn = await server.hocuspocus.openDirectConnection('tail-empty-doc');+ const serverDoc = server.hocuspocus.documents.get('tail-empty-doc');+ expect(serverDoc).toBeDefined();+ if (!serverDoc) return;++ serverDoc.transact(+ () => {+ serverDoc.getXmlFragment('default').push([new Y.XmlElement('paragraph')]);+ },+ {+ source: 'connection' as const,+ connection: { context: { principalId: 'principal-test-tail-empty' } },+ },+ );++ await waitForContributorCount(1);+ conn.disconnect();+ } finally {+ await server.destroy();+ }++ expect(contributorCount()).toBe(1);+ });+test('real user edit changes serialized markdown → principal IS recorded', async () => {writeFileSync(join(fixture.contentDir, 'real-edit-doc.md'),diff --git a/packages/server/src/server-observers-paired-write-baseline.test.ts b/packages/server/src/server-observers-paired-write-baseline.test.tsindex 15d7248b3..f996e9cb1 100644--- a/packages/server/src/server-observers-paired-write-baseline.test.ts+++ b/packages/server/src/server-observers-paired-write-baseline.test.ts@@ -30,7 +30,7 @@ describe('Observer A paired-write baseline — raw ytext, not canonical fragment});resetMetrics();- const fixturePayload = '## Section 1\n\nLorem ipsum dolor sit amet.\n\n';+ const fixturePayload = '## Section 1\n\nLorem ipsum dolor.\n \nSit amet.\n';const composedAppend = `\n\n${fixturePayload}`;doc.transact(() => {composeAndWriteRawBody(doc, composedAppend, 'agent');@@ -39,8 +39,9 @@ describe('Observer A paired-write baseline — raw ytext, not canonical fragmentconst ytextAfterAgent = ytext.toString();const fragmentJson = yXmlFragmentToProseMirrorRootNode(xmlFragment, schema).toJSON();const fragmentSerialized = mdManager.serialize(fragmentJson);- expect(ytextAfterAgent.endsWith('amet.\n\n')).toBe(true);- expect(fragmentSerialized.endsWith('amet.\n\n')).toBe(false);+ expect(ytextAfterAgent.includes('dolor.\n \nSit')).toBe(true);+ expect(fragmentSerialized.includes('dolor.\n \nSit')).toBe(false);+ expect(fragmentSerialized.includes('dolor.\n\nSit')).toBe(true);expect(ytextAfterAgent === fragmentSerialized).toBe(false);const pathBFiresBefore = getMetrics().observerAPathBFires;