@tristan2828/ui-foundation 4.69.0 → 4.70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -26,16 +26,16 @@
|
|
|
26
26
|
- [A variant: a pressed icon inside another value's cell](#a-variant-a-pressed-icon-inside-another-values-cell) · lines 566–649
|
|
27
27
|
- [16. Title linking to the record's view](#16-title-linking-to-the-records-view) · lines 651–686
|
|
28
28
|
- [17. Quick action on the view](#17-quick-action-on-the-view) · lines 688–761
|
|
29
|
-
- [18. Editable value](#18-editable-value) · lines 763–
|
|
30
|
-
- [A list of sub-items](#a-list-of-sub-items) · lines
|
|
31
|
-
- [In a table's rows](#in-a-tables-rows) · lines
|
|
32
|
-
- [A table of a few short columns: `width="content"`](#a-table-of-a-few-short-columns-widthcontent) · lines
|
|
33
|
-
- [19. Stage circle for an ordered status](#19-stage-circle-for-an-ordered-status) · lines
|
|
34
|
-
- [20. Count linking to the related records](#20-count-linking-to-the-related-records) · lines
|
|
35
|
-
- [21. Rows grouped under headings, and a pill filter](#21-rows-grouped-under-headings-and-a-pill-filter) · lines
|
|
36
|
-
- [22. A highlighted row, and rows that are done](#22-a-highlighted-row-and-rows-that-are-done) · lines
|
|
37
|
-
- [23. A Group menu, and a record read beside the list](#23-a-group-menu-and-a-record-read-beside-the-list) · lines
|
|
38
|
-
- [24. A stored colour beside its name](#24-a-stored-colour-beside-its-name) · lines
|
|
29
|
+
- [18. Editable value](#18-editable-value) · lines 763–1228
|
|
30
|
+
- [A list of sub-items](#a-list-of-sub-items) · lines 1044–1129
|
|
31
|
+
- [In a table's rows](#in-a-tables-rows) · lines 1131–1216
|
|
32
|
+
- [A table of a few short columns: `width="content"`](#a-table-of-a-few-short-columns-widthcontent) · lines 1218–1228
|
|
33
|
+
- [19. Stage circle for an ordered status](#19-stage-circle-for-an-ordered-status) · lines 1230–1296
|
|
34
|
+
- [20. Count linking to the related records](#20-count-linking-to-the-related-records) · lines 1298–1362
|
|
35
|
+
- [21. Rows grouped under headings, and a pill filter](#21-rows-grouped-under-headings-and-a-pill-filter) · lines 1364–1432
|
|
36
|
+
- [22. A highlighted row, and rows that are done](#22-a-highlighted-row-and-rows-that-are-done) · lines 1434–1462
|
|
37
|
+
- [23. A Group menu, and a record read beside the list](#23-a-group-menu-and-a-record-read-beside-the-list) · lines 1464–1540
|
|
38
|
+
- [24. A stored colour beside its name](#24-a-stored-colour-beside-its-name) · lines 1542–1565
|
|
39
39
|
|
|
40
40
|
<!-- /index -->
|
|
41
41
|
|
|
@@ -913,8 +913,9 @@ to open, and it never closes. Ctrl/Cmd+Enter or Esc saves now and leaves
|
|
|
913
913
|
the caret where it is. It sits beside the one open value rather than
|
|
914
914
|
being it: opening another value leaves it alone. Don't give its control
|
|
915
915
|
`autoFocus`. The cost: at rest the page shows the editor, not the read
|
|
916
|
-
view,
|
|
917
|
-
|
|
916
|
+
view, and the editor loads on every visit. A click on a link in the
|
|
917
|
+
notes still opens it in a new tab (4.70.0); its words are edited from the
|
|
918
|
+
keyboard or by dragging over them, and Ctrl/Cmd+K edits its address. Use it where the notes are what the page is
|
|
918
919
|
for; elsewhere `autosave` alone keeps the read view at rest.
|
|
919
920
|
|
|
920
921
|
**Edited where it's read (`inline: true`, implies `alwaysEditable`)**,
|
|
@@ -33,8 +33,10 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
33
33
|
// - Edited blocks are written in the document's own bullet and rule marks.
|
|
34
34
|
// - Markdown pasted as plain text arrives formatted (still no HTML), and a
|
|
35
35
|
// copy out of the editor is Markdown.
|
|
36
|
-
// -
|
|
37
|
-
//
|
|
36
|
+
// - A click on a link opens it in a new tab, as the read view's links do,
|
|
37
|
+
// so notes that are always the editor still follow their links
|
|
38
|
+
// (followLink). Ctrl/Cmd+K adds or edits a link (a box at the caret: web
|
|
39
|
+
// and email addresses only); Ctrl/Cmd+Shift+Enter ticks the task item the caret is
|
|
38
40
|
// in. `[] ` at a line's start makes a task item, and Enter in one the
|
|
39
41
|
// next, unticked (rich-text-tasks.ts). Ctrl/Cmd+Enter stays the field's
|
|
40
42
|
// save, in a table too. Notion's block keys (Ctrl+Shift+1 for a
|
|
@@ -373,6 +375,30 @@ function linkTarget(state) {
|
|
|
373
375
|
});
|
|
374
376
|
return target;
|
|
375
377
|
}
|
|
378
|
+
// A plain click (or a tap) on a link opens it in a new tab, the way the
|
|
379
|
+
// read view's links open (markdown.tsx), so notes that are always the
|
|
380
|
+
// editor still work as notes. Not when the click chose words (a drag ends
|
|
381
|
+
// in a click too), extends the selection (Shift) or is Alt's; the address
|
|
382
|
+
// goes through linkHref again, so a link that came in with the Markdown
|
|
383
|
+
// can't run code (`javascript:`) either: that one stays text to click
|
|
384
|
+
// into. Read-only too, where the browser would otherwise follow it in this
|
|
385
|
+
// tab. To edit a link's words, put the caret in them from the keyboard or
|
|
386
|
+
// drag over them; Ctrl/Cmd+K edits its address.
|
|
387
|
+
function followLink(view, event) {
|
|
388
|
+
if (event.button !== 0 || event.shiftKey || event.altKey)
|
|
389
|
+
return false;
|
|
390
|
+
const anchor = event.target instanceof Element ? event.target.closest('a[href]') : null;
|
|
391
|
+
if (!anchor || !view.dom.contains(anchor))
|
|
392
|
+
return false;
|
|
393
|
+
if (!view.state.selection.empty)
|
|
394
|
+
return false;
|
|
395
|
+
const href = linkHref(anchor.getAttribute('href') ?? '');
|
|
396
|
+
if (!href)
|
|
397
|
+
return false;
|
|
398
|
+
event.preventDefault();
|
|
399
|
+
window.open(href, '_blank', 'noopener,noreferrer');
|
|
400
|
+
return true;
|
|
401
|
+
}
|
|
376
402
|
// Sets (or, with `href` empty, removes) the link on the target. With
|
|
377
403
|
// nothing selected and no link there, the address goes in as the link's
|
|
378
404
|
// own text.
|
|
@@ -668,6 +694,8 @@ export default function MilkdownEditor({ id, defaultValue, onChange, onProblem,
|
|
|
668
694
|
setFocused(false);
|
|
669
695
|
return false;
|
|
670
696
|
},
|
|
697
|
+
// A click on a link follows it (followLink).
|
|
698
|
+
click: (view, event) => followLink(view, event),
|
|
671
699
|
// The floating toolbar waits for the mouse to be up: a drag
|
|
672
700
|
// is still choosing the words.
|
|
673
701
|
mousedown: (_view, event) => {
|
|
@@ -1048,7 +1076,7 @@ export default function MilkdownEditor({ id, defaultValue, onChange, onProblem,
|
|
|
1048
1076
|
'[&_mark]:rounded-sm [&_mark]:text-foreground [&_mark[data-color=amber]]:bg-highlight-amber [&_mark[data-color=yellow]]:bg-highlight-yellow [&_mark[data-color=green]]:bg-highlight-green [&_mark[data-color=red]]:bg-highlight-red', '[&_li[data-item-type=task]>input]:mt-1 [&_li[data-item-type=task]>input]:size-4 [&_li[data-item-type=task]>input]:accent-primary',
|
|
1049
1077
|
// Headings, callouts and tables are drawn by their node views;
|
|
1050
1078
|
// these are the elements Milkdown draws itself.
|
|
1051
|
-
'[&_a]:text-link [&_a]:underline [&_a]:decoration-link/40 [&_a]:underline-offset-4', '[&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-4 [&_blockquote]:text-muted-foreground', '[&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:font-mono', '[&_:not(pre)>code]:rounded [&_:not(pre)>code]:bg-muted [&_:not(pre)>code]:px-1 [&_:not(pre)>code]:font-mono', '[&_hr]:my-2 [&_hr]:h-0.5 [&_hr]:rounded-full [&_hr]:border-0 [&_hr]:bg-rule', '[&_hr.ProseMirror-selectednode]:outline-2 [&_hr.ProseMirror-selectednode]:outline-offset-4 [&_hr.ProseMirror-selectednode]:outline-ring',
|
|
1079
|
+
'[&_a]:cursor-pointer [&_a]:text-link [&_a]:underline [&_a]:decoration-link/40 [&_a]:underline-offset-4', '[&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-4 [&_blockquote]:text-muted-foreground', '[&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:font-mono', '[&_:not(pre)>code]:rounded [&_:not(pre)>code]:bg-muted [&_:not(pre)>code]:px-1 [&_:not(pre)>code]:font-mono', '[&_hr]:my-2 [&_hr]:h-0.5 [&_hr]:rounded-full [&_hr]:border-0 [&_hr]:bg-rule', '[&_hr.ProseMirror-selectednode]:outline-2 [&_hr.ProseMirror-selectednode]:outline-offset-4 [&_hr.ProseMirror-selectednode]:outline-ring',
|
|
1052
1080
|
// An image, as <Markdown> shows it: never wider than the field.
|
|
1053
1081
|
// (ProseMirror's own separator images, around an image alone on
|
|
1054
1082
|
// its line, are left alone.)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tristan2828/ui-foundation",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.70.0",
|
|
4
4
|
"description": "Shared UI foundation for contract-first, database-backed React apps: shadcn primitives, DataTable/EntityForm composites, auth, the gateway error seam, design tokens, lint rules and the AI playbook.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|