docs: clean up comments
This commit is contained in:
1 parent
64ae976ecf
commit
20eb94d7c0
9 files changed
+49
-79
No files matched your search
@@ -685,9 +685,8 @@
|
||||
}
|
||||
|
||||
// --- Indent (Einzug) ---
|
||||
// In a list, step the list point one level via indentListForward/Backward (the same
|
||||
// commands the Tab keymap uses — see indent.ts); outside a list, step the paragraph's
|
||||
// left indent.
|
||||
// In a list, step the list point one level (indentListForward/Backward — the Tab
|
||||
// keymap's commands, see indent.ts); outside a list, step the paragraph's left indent.
|
||||
function changeIndent(dir: 1 | -1) {
|
||||
if (!editor) return;
|
||||
const c = editor.chain().focus();
|
||||
|
||||
@@ -4,10 +4,8 @@ import type { Node as PMNode } from '@tiptap/pm/model';
|
||||
import { dropCursor } from '@tiptap/pm/dropcursor';
|
||||
|
||||
// Inline, as-character image (Word's "in line with text"). width/height are
|
||||
// unscaled document px @96dpi (like tableRow.ts rowHeight); export converts them
|
||||
// to cm and import back, so size round-trips exactly. Position is fully determined
|
||||
// by the paragraph + text offset + the paragraph's alignment — no free coordinates.
|
||||
// The node view adds corner resize handles (aspect-locked, zoom-aware).
|
||||
// unscaled doc px @96dpi (like tableRow.ts rowHeight); export converts to cm and
|
||||
// back, so size round-trips exactly. The node view adds aspect-locked resize handles.
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands<ReturnType> {
|
||||
|
||||
@@ -402,10 +402,9 @@ export const PageBreaks = Extension.create({
|
||||
}
|
||||
gaps.sort((a, b) => a - b);
|
||||
const advance = gaps.length ? gaps[gaps.length >> 1] : 0;
|
||||
// Group rects into lines by top proximity, not vertical overlap: decorative
|
||||
// fonts (e.g. Trattatello) render ink boxes taller than the line advance, so
|
||||
// an overlap test chains whole paragraphs into one phantom line. Only the top
|
||||
// is used downstream; same-line runs sit within a fraction of the advance.
|
||||
// Group rects into lines by top proximity, not overlap: decorative fonts (e.g.
|
||||
// Trattatello) make ink boxes taller than the advance, so an overlap test would
|
||||
// chain paragraphs into one phantom line. Tolerance is a fraction of the advance.
|
||||
const tol = advance > 0 ? advance * 0.6 : 3;
|
||||
const lines: { top: number; bottom: number }[] = [];
|
||||
let lineTop = -Infinity;
|
||||
@@ -980,11 +979,9 @@ export const PageBreaks = Extension.create({
|
||||
|
||||
isUpdating = false;
|
||||
|
||||
// This pass measured against the spacers present at its start. When the result
|
||||
// changes — e.g. after an orientation switch, where the prior orientation's
|
||||
// spacers still sat in the DOM and suppressed a heading's top-margin collapse,
|
||||
// shifting its measured top — re-run so the next pass measures with the new
|
||||
// spacers and the layout settles. Bounded against a two-layout ping-pong.
|
||||
// Each pass measures against the spacers present at its start, so a changed
|
||||
// result needs another pass to re-measure and settle (e.g. after an orientation
|
||||
// switch). Bounded by MAX_CONVERGE_PASSES against a two-layout ping-pong.
|
||||
if (placementsChanged && convergePasses < MAX_CONVERGE_PASSES) {
|
||||
convergePasses++;
|
||||
schedule();
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { Node } from '@tiptap/core';
|
||||
|
||||
// Inline atom fields for header/footer content: current page number and total
|
||||
// page count. The DOM text is a placeholder — HeaderFooterLayer.svelte patches
|
||||
// every [data-page-field] span with the real per-page value after rendering.
|
||||
// Round-trips to ODF <text:page-number>/<text:page-count> (export/import odt.ts).
|
||||
// Inline atom fields for header/footer: current page number and total page count. The
|
||||
// DOM text is a placeholder — HeaderFooterLayer.svelte patches each [data-page-field]
|
||||
// span per page. Round-trips to ODF <text:page-number>/<text:page-count>.
|
||||
|
||||
function pageFieldNode(name: string, kind: 'number' | 'count') {
|
||||
return Node.create({
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import { Extension } from '@tiptap/core';
|
||||
import { Plugin, PluginKey } from '@tiptap/pm/state';
|
||||
|
||||
// Keep an empty paragraph at the end of the document when the last block is a
|
||||
// table. A table is an isolating block, so if it sits at the very end there is
|
||||
// nowhere to click or type below it — the cursor gets trapped inside the table
|
||||
// and the user can't continue the document. When the doc ends with a table we
|
||||
// append a paragraph; once it's there the last child is a paragraph, so the
|
||||
// check no-ops on the next round (no loop).
|
||||
// Keep an empty paragraph after a trailing table: a table is isolating, so at the very
|
||||
// end the cursor gets trapped with nowhere to type below. Appending a paragraph fixes
|
||||
// it and self-terminates (once the last child is a paragraph the check no-ops).
|
||||
const trailingNodeKey = new PluginKey('trailingNode');
|
||||
|
||||
// Block types that can't sit at the document end without trapping the cursor.
|
||||
|
||||
Reference in new issue
Block a user