@nivaro/react 0.3.114 → 0.3.115
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.
- package/dist/components/ScreenShareHost.js +24 -0
- package/dist/full.css +50 -2
- package/dist/hooks/useSessionRecorder.js +61 -60
- package/dist/index.d.ts +1717 -21
- package/dist/index.js +1091 -950
- package/dist/shared/components/ActivityEntry.js +209 -97
- package/dist/shared/components/AgentPresenceChip.js +51 -0
- package/dist/shared/components/AnnouncementBanner.js +56 -41
- package/dist/shared/components/AutolinkedText.js +98 -85
- package/dist/shared/components/BroadcastView.js +149 -141
- package/dist/shared/components/CacheStamp.js +78 -30
- package/dist/shared/components/CollectionBrowserView.js +4088 -3592
- package/dist/shared/components/ConfigChangeStrip.js +63 -0
- package/dist/shared/components/ConfigReachNote.js +107 -0
- package/dist/shared/components/ConformanceView.js +389 -319
- package/dist/shared/components/DataTable.js +1 -0
- package/dist/shared/components/DelegateCoverLine.js +164 -0
- package/dist/shared/components/EnvironmentNotice.js +56 -65
- package/dist/shared/components/FilePreviewLightbox.js +89 -43
- package/dist/shared/components/FindingFixedMark.js +23 -0
- package/dist/shared/components/GridPresenceLine.js +100 -0
- package/dist/shared/components/IdleReloadWatcher.js +82 -43
- package/dist/shared/components/InStep.js +46 -0
- package/dist/shared/components/ItemEditForm.js +5504 -4889
- package/dist/shared/components/LiveAnnouncer.js +62 -0
- package/dist/shared/components/LiveCount.js +54 -0
- package/dist/shared/components/LiveFigure.js +28 -0
- package/dist/shared/components/LiveListControls.js +114 -0
- package/dist/shared/components/LiveNewMatchesPill.js +25 -0
- package/dist/shared/components/LiveOffNote.js +44 -0
- package/dist/shared/components/LivePreferenceHost.js +42 -0
- package/dist/shared/components/LiveRowMark.js +25 -20
- package/dist/shared/components/LiveTraceView.js +257 -0
- package/dist/shared/components/MapView.js +30 -29
- package/dist/shared/components/MatrixEditor.js +497 -462
- package/dist/shared/components/MyWorkView.js +346 -272
- package/dist/shared/components/NotificationBell.js +215 -201
- package/dist/shared/components/PageRenderer.js +636 -599
- package/dist/shared/components/PresenceDot.js +21 -0
- package/dist/shared/components/ProfileView.js +656 -536
- package/dist/shared/components/RealtimeStatusBanner.js +25 -25
- package/dist/shared/components/RecentRecordsRail.js +51 -48
- package/dist/shared/components/RecordCompare.js +241 -150
- package/dist/shared/components/RecordDrilldownSheet.js +66 -64
- package/dist/shared/components/RecordGridEditor.js +350 -311
- package/dist/shared/components/RecordHoverCard.js +147 -0
- package/dist/shared/components/RecordPeekHost.js +111 -0
- package/dist/shared/components/RecordReadView.js +414 -412
- package/dist/shared/components/RelativeTime.js +16 -0
- package/dist/shared/components/ReportView.js +1396 -1304
- package/dist/shared/components/ScreenRefreshButton.js +77 -0
- package/dist/shared/components/TabCountHost.js +10 -0
- package/dist/shared/components/TickerNumber.js +19 -18
- package/dist/shared/components/TipLayer.js +70 -58
- package/dist/shared/components/WidgetImageMenu.js +59 -0
- package/dist/shared/components/WidgetSlot.js +571 -524
- package/dist/shared/components/activity/RecordActivityStream.js +317 -0
- package/dist/shared/components/bulk/BulkSelectionNotices.js +220 -0
- package/dist/shared/components/cbv/approval-changed.js +20 -0
- package/dist/shared/components/cbv/changed-by-others.js +251 -0
- package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +320 -0
- package/dist/shared/components/change-proposals/ProposalValue.js +28 -0
- package/dist/shared/components/change-proposals/ProposeChangeButton.js +44 -0
- package/dist/shared/components/change-proposals/ProposeChangeDialog.js +359 -0
- package/dist/shared/components/change-proposals/types.js +4 -0
- package/dist/shared/components/chat/ChatPanel.js +1571 -1528
- package/dist/shared/components/chat/Composer.js +276 -298
- package/dist/shared/components/chat/room-due.js +13 -0
- package/dist/shared/components/collections-directory/CollectionRow.js +76 -75
- package/dist/shared/components/collections-directory/CollectionsDirectory.js +415 -395
- package/dist/shared/components/collections-directory/directory-data.js +75 -63
- package/dist/shared/components/imports/ImportConsole.js +159 -155
- package/dist/shared/components/imports/ImportDuplicatesNotice.js +46 -31
- package/dist/shared/components/integrations/SendStatus.js +202 -0
- package/dist/shared/components/integrations/console/IntegrationsConsole.js +45 -36
- package/dist/shared/components/integrations/console/ReadyToSendView.js +453 -0
- package/dist/shared/components/integrations/console/api.js +161 -117
- package/dist/shared/components/integrations/console/tone.js +15 -12
- package/dist/shared/components/item-edit/CatalogPickerField.js +1353 -1245
- package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +162 -0
- package/dist/shared/components/item-edit/CloneDialog.js +208 -206
- package/dist/shared/components/item-edit/DerivedCauseNote.js +57 -0
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +81 -70
- package/dist/shared/components/item-edit/DuplicateNotice.js +169 -101
- package/dist/shared/components/item-edit/FieldAffordances.js +294 -385
- package/dist/shared/components/item-edit/FieldComments.js +159 -116
- package/dist/shared/components/item-edit/FieldPointer.js +132 -0
- package/dist/shared/components/item-edit/FieldRenderer.js +277 -273
- package/dist/shared/components/item-edit/FieldRow.js +519 -439
- package/dist/shared/components/item-edit/FieldSourceBadge.js +88 -0
- package/dist/shared/components/item-edit/FilePickerField.js +454 -369
- package/dist/shared/components/item-edit/GroupSection.js +618 -567
- package/dist/shared/components/item-edit/HeldEditsChip.js +113 -0
- package/dist/shared/components/item-edit/InlineTableField.js +2891 -2723
- package/dist/shared/components/item-edit/ListNeighborNav.js +79 -0
- package/dist/shared/components/item-edit/LiveTraceSheet.js +26 -0
- package/dist/shared/components/item-edit/M2MCombobox.js +284 -273
- package/dist/shared/components/item-edit/OutboxReviewTray.js +313 -0
- package/dist/shared/components/item-edit/PickerBadges.js +52 -0
- package/dist/shared/components/item-edit/PlanGrid.js +434 -439
- package/dist/shared/components/item-edit/RecalcValue.js +55 -0
- package/dist/shared/components/item-edit/RecordChatActions.js +76 -64
- package/dist/shared/components/item-edit/RecordChatMentionsChip.js +103 -0
- package/dist/shared/components/item-edit/RecordGrantTools.js +87 -86
- package/dist/shared/components/item-edit/RecordHelpChip.js +70 -0
- package/dist/shared/components/item-edit/RecordLiveSync.js +230 -217
- package/dist/shared/components/item-edit/RecordOutbox.js +53 -52
- package/dist/shared/components/item-edit/RecordRecapStrip.js +109 -36
- package/dist/shared/components/item-edit/RelationCombobox.js +229 -217
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +105 -100
- package/dist/shared/components/item-edit/RemoteChangeUi.js +454 -0
- package/dist/shared/components/item-edit/RemoteUploads.js +55 -0
- package/dist/shared/components/item-edit/RemovedLineNote.js +92 -0
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +298 -223
- package/dist/shared/components/item-edit/ScheduledChangeChip.js +244 -0
- package/dist/shared/components/item-edit/SectionPresence.js +78 -0
- package/dist/shared/components/item-edit/SplitLinesButton.js +166 -0
- package/dist/shared/components/item-edit/catalog-line-watch.js +94 -0
- package/dist/shared/components/item-edit/coedit/collab.js +84 -0
- package/dist/shared/components/item-edit/coedit/context.js +24 -0
- package/dist/shared/components/item-edit/coedit/cursors.js +103 -0
- package/dist/shared/components/item-edit/coedit/safe-link.js +15 -0
- package/dist/shared/components/item-edit/coedit/session.js +382 -0
- package/dist/shared/components/item-edit/coedit/useCoedit.js +49 -0
- package/dist/shared/components/item-edit/file-live.js +77 -0
- package/dist/shared/components/item-edit/file-processing.js +87 -0
- package/dist/shared/components/item-edit/layout-switch.js +148 -0
- package/dist/shared/components/item-edit/live-related.js +23 -0
- package/dist/shared/components/item-edit/live-title.js +66 -0
- package/dist/shared/components/item-edit/partner-needs.js +142 -0
- package/dist/shared/components/item-edit/removed-line.js +58 -0
- package/dist/shared/components/item-edit/render-stability.js +70 -59
- package/dist/shared/components/layout-editor/ChangeNote.js +36 -34
- package/dist/shared/components/layout-editor/CollabParts.js +72 -70
- package/dist/shared/components/layout-editor/LayoutEditor.js +306 -303
- package/dist/shared/components/list/InlineEdit.js +504 -208
- package/dist/shared/components/list/ListViewers.js +81 -0
- package/dist/shared/components/merge/MergeRecordsDialog.js +1227 -0
- package/dist/shared/components/merge/MergeWithFlow.js +290 -0
- package/dist/shared/components/merge/merge-values.js +110 -0
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +285 -258
- package/dist/shared/components/notifications/NotificationCenterView.js +388 -321
- package/dist/shared/components/notifications/NotificationDetailBits.js +205 -130
- package/dist/shared/components/notifications/NotificationRulesEditor.js +72 -52
- package/dist/shared/components/notifications/bundles.js +21 -19
- package/dist/shared/components/notifications/resolved-line.js +25 -0
- package/dist/shared/components/ops/OpsTasksView.js +45 -44
- package/dist/shared/components/panels/AccessGrantedNote.js +85 -0
- package/dist/shared/components/panels/AlertBanners.js +132 -0
- package/dist/shared/components/panels/AsyncUserPicker.js +54 -45
- package/dist/shared/components/panels/BranchLanes.js +82 -54
- package/dist/shared/components/panels/CommentAwareness.js +332 -0
- package/dist/shared/components/panels/CommentImages.js +219 -0
- package/dist/shared/components/panels/CommentPanel.js +649 -530
- package/dist/shared/components/panels/ExternalRequestsChip.js +98 -80
- package/dist/shared/components/panels/NewSinceChip.js +16 -0
- package/dist/shared/components/panels/OwnerOpenedLine.js +85 -0
- package/dist/shared/components/panels/PipelinePanel.js +1644 -1494
- package/dist/shared/components/panels/ResubmissionDiff.js +293 -0
- package/dist/shared/components/panels/SlaBreachBanner.js +30 -29
- package/dist/shared/components/panels/SlaClock.js +130 -99
- package/dist/shared/components/panels/TaskPanel.js +308 -287
- package/dist/shared/components/panels/unseen-move-check.js +101 -0
- package/dist/shared/components/pipeline/OwnerMatrix.js +80 -71
- package/dist/shared/components/pipeline/OwnerMatrixSheet.js +495 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +1855 -1771
- package/dist/shared/components/profile/AgentNameField.js +141 -0
- package/dist/shared/components/profile/AgentsPanel.js +55 -46
- package/dist/shared/components/profile/PersonAccess.js +398 -330
- package/dist/shared/components/profile/PersonAdminTools.js +127 -113
- package/dist/shared/components/profile/PersonProfile.js +81 -73
- package/dist/shared/components/profile/SignInTroubleshooter.js +361 -0
- package/dist/shared/components/queue/QueueBulkBar.js +101 -84
- package/dist/shared/components/queue/QueueItemSheet.js +66 -66
- package/dist/shared/components/queue/QueueTeamStrip.js +279 -0
- package/dist/shared/components/queue/QueueWorklist.js +1927 -1635
- package/dist/shared/components/send-view/SendViewButton.js +136 -0
- package/dist/shared/components/send-view/SentViewCards.js +147 -0
- package/dist/shared/components/support/ReportProblem.js +1 -0
- package/dist/shared/components/support/ScreenShare.js +554 -0
- package/dist/shared/components/support/SupportView.js +160 -129
- package/dist/shared/components/support/TicketDetailSheet.js +101 -89
- package/dist/shared/components/watch-list/WatchDock.js +1044 -0
- package/dist/shared/components/watch-list/WatchExtras.js +723 -0
- package/dist/shared/components/watch-list/WatchListButton.js +46 -0
- package/dist/shared/components/watch-list/WatchPinButton.js +67 -0
- package/dist/shared/components/watch-list/WatchRows.js +348 -0
- package/dist/shared/lib/activity-sentence.js +87 -75
- package/dist/shared/lib/agent-presence.js +46 -0
- package/dist/shared/lib/approval-progress.js +49 -0
- package/dist/shared/lib/attention-prefs.js +27 -0
- package/dist/shared/lib/cell-locks.js +56 -0
- package/dist/shared/lib/co-edit.js +166 -0
- package/dist/shared/lib/coedit-registry.js +44 -0
- package/dist/shared/lib/comment-awareness.js +124 -0
- package/dist/shared/lib/comment-images.js +45 -0
- package/dist/shared/lib/config-watch.js +94 -0
- package/dist/shared/lib/copy-rules.js +65 -0
- package/dist/shared/lib/count-step.js +30 -0
- package/dist/shared/lib/deadline-ticker.js +68 -0
- package/dist/shared/lib/derived-causes.js +115 -0
- package/dist/shared/lib/draft-store.js +114 -85
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/field-merge.js +126 -0
- package/dist/shared/lib/filter-sentence.js +10 -10
- package/dist/shared/lib/focus-mode.js +16 -12
- package/dist/shared/lib/grid-cursors.js +77 -0
- package/dist/shared/lib/grid-presence.js +182 -0
- package/dist/shared/lib/idle-reload.js +100 -73
- package/dist/shared/lib/in-step.js +45 -0
- package/dist/shared/lib/integration-chip.js +19 -18
- package/dist/shared/lib/line-locks.js +141 -0
- package/dist/shared/lib/line-split.js +41 -0
- package/dist/shared/lib/linked-changes.js +150 -0
- package/dist/shared/lib/list-return.js +231 -0
- package/dist/shared/lib/list-viewers.js +52 -0
- package/dist/shared/lib/live-announcer.js +86 -0
- package/dist/shared/lib/live-counts.js +85 -0
- package/dist/shared/lib/live-data-changed.js +108 -0
- package/dist/shared/lib/live-deltas.js +81 -0
- package/dist/shared/lib/live-findings.js +113 -0
- package/dist/shared/lib/live-groups.js +122 -0
- package/dist/shared/lib/live-link-labels.js +162 -0
- package/dist/shared/lib/live-list-flow.js +334 -0
- package/dist/shared/lib/live-list.js +143 -129
- package/dist/shared/lib/live-moves.js +51 -0
- package/dist/shared/lib/live-ops.js +26 -26
- package/dist/shared/lib/live-pickers.js +7 -0
- package/dist/shared/lib/live-preference.js +184 -0
- package/dist/shared/lib/live-queries.js +226 -181
- package/dist/shared/lib/live-screen.js +333 -0
- package/dist/shared/lib/live-search.js +108 -0
- package/dist/shared/lib/live-seen.js +35 -0
- package/dist/shared/lib/live-views.js +100 -0
- package/dist/shared/lib/live.js +159 -133
- package/dist/shared/lib/missed-updates.js +198 -0
- package/dist/shared/lib/newer-file.js +56 -0
- package/dist/shared/lib/notification-sound.js +42 -20
- package/dist/shared/lib/own-writes.js +59 -41
- package/dist/shared/lib/picker-badges.js +94 -0
- package/dist/shared/lib/presence-signals.js +131 -84
- package/dist/shared/lib/realtime.js +49 -24
- package/dist/shared/lib/record-gaps.js +85 -0
- package/dist/shared/lib/record-outbox.js +369 -222
- package/dist/shared/lib/record-peek.js +75 -0
- package/dist/shared/lib/record-tabs.js +92 -72
- package/dist/shared/lib/relative-ticker.js +42 -0
- package/dist/shared/lib/request-gate.js +119 -119
- package/dist/shared/lib/rollup-recalc.js +107 -0
- package/dist/shared/lib/room-gaps.js +40 -36
- package/dist/shared/lib/rum.js +137 -87
- package/dist/shared/lib/save-progress.js +20 -0
- package/dist/shared/lib/scheduled-countdown.js +67 -0
- package/dist/shared/lib/screen-refresh.js +160 -0
- package/dist/shared/lib/screen-share.js +234 -0
- package/dist/shared/lib/seen-since.js +74 -0
- package/dist/shared/lib/selection-watch.js +205 -0
- package/dist/shared/lib/send-status.js +132 -0
- package/dist/shared/lib/send-view.js +23 -0
- package/dist/shared/lib/socket-liveness.js +155 -0
- package/dist/shared/lib/socket-realtime.js +168 -140
- package/dist/shared/lib/state-census.js +53 -0
- package/dist/shared/lib/summary-mode.js +61 -39
- package/dist/shared/lib/tab-attention.js +143 -32
- package/dist/shared/lib/table-density.js +64 -0
- package/dist/shared/lib/track-travel.js +40 -0
- package/dist/shared/lib/unseen-changes.js +68 -0
- package/dist/shared/lib/upload-file.js +33 -0
- package/dist/shared/lib/upload-presence.js +127 -0
- package/dist/shared/lib/urgent-chime.js +65 -0
- package/dist/shared/lib/use-online-users.js +32 -11
- package/dist/shared/lib/user-sync.js +155 -39
- package/dist/shared/lib/waiting-count.js +44 -0
- package/dist/shared/lib/watch-desktop.js +83 -0
- package/dist/shared/lib/watch-list.js +447 -0
- package/dist/shared/lib/widget-image-render.js +64 -0
- package/dist/shared/lib/widget-image.js +111 -0
- package/dist/shared/lib/worker-socket.js +130 -104
- package/dist/shared/lib/write-to-screen.js +133 -0
- package/package.json +1 -1
- package/styles.css +49 -1
|
@@ -1,287 +1,321 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { useEditor as
|
|
7
|
-
import
|
|
8
|
-
import { Bold as
|
|
9
|
-
import { useState as
|
|
10
|
-
import { useApiFetchConfig as
|
|
11
|
-
import { cn as
|
|
12
|
-
import { SimpleSelect as
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { jsxs as m, Fragment as z, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as B } from "@tanstack/react-query";
|
|
3
|
+
import Q from "@tiptap/extension-link";
|
|
4
|
+
import V from "@tiptap/extension-placeholder";
|
|
5
|
+
import X from "@tiptap/extension-underline";
|
|
6
|
+
import { useEditor as Y, EditorContent as G } from "@tiptap/react";
|
|
7
|
+
import Z from "@tiptap/starter-kit";
|
|
8
|
+
import { Bold as ee, Italic as te, UnderlineIcon as re, Strikethrough as ie, Heading1 as ne, Heading2 as oe, Heading3 as ae, List as le, ListOrdered as ce, Quote as se, Code as de, Minus as pe, Link as ue, Link2Off as he, FileSymlink as P, Check as fe, X as W, Loader2 as me } from "lucide-react";
|
|
9
|
+
import { useState as w, useRef as D, useMemo as ge, useEffect as R } from "react";
|
|
10
|
+
import { useApiFetchConfig as be, useItemNavigation as ke } from "../../context.js";
|
|
11
|
+
import { cn as K } from "../../lib/utils.js";
|
|
12
|
+
import { SimpleSelect as xe } from "../ui/SimpleSelect.js";
|
|
13
|
+
import { COEDIT_REMOTE as ve } from "./coedit/collab.js";
|
|
14
|
+
import { CoeditCursors as _e, COEDIT_CURSOR_CSS as ye } from "./coedit/cursors.js";
|
|
15
|
+
import { isSafeLinkHref as we } from "./coedit/safe-link.js";
|
|
16
|
+
import { useCoedit as Ne } from "./coedit/useCoedit.js";
|
|
17
|
+
function H(t) {
|
|
18
|
+
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
15
19
|
}
|
|
16
|
-
function
|
|
20
|
+
function Ce(t) {
|
|
17
21
|
try {
|
|
18
|
-
return (JSON.parse(
|
|
19
|
-
const
|
|
20
|
-
switch (
|
|
22
|
+
return (JSON.parse(t || "{}").blocks ?? []).map((a) => {
|
|
23
|
+
const l = H(String(a.data.text ?? "")), c = Math.max(1, Math.min(6, Number(a.data.level ?? 2)));
|
|
24
|
+
switch (a.type) {
|
|
21
25
|
case "paragraph":
|
|
22
|
-
return `<p>${
|
|
26
|
+
return `<p>${l}</p>`;
|
|
23
27
|
case "header":
|
|
24
|
-
return `<h${
|
|
28
|
+
return `<h${c}>${l}</h${c}>`;
|
|
25
29
|
case "list": {
|
|
26
|
-
const
|
|
27
|
-
return
|
|
30
|
+
const p = (a.data.items ?? []).map((N) => `<li>${H(N)}</li>`).join("");
|
|
31
|
+
return a.data.style === "ordered" ? `<ol>${p}</ol>` : `<ul>${p}</ul>`;
|
|
28
32
|
}
|
|
29
33
|
case "quote":
|
|
30
|
-
return `<blockquote><p>${
|
|
34
|
+
return `<blockquote><p>${l}</p></blockquote>`;
|
|
31
35
|
default:
|
|
32
|
-
return
|
|
36
|
+
return l ? `<p>${l}</p>` : "";
|
|
33
37
|
}
|
|
34
38
|
}).join("");
|
|
35
39
|
} catch {
|
|
36
|
-
return `<p>${
|
|
40
|
+
return `<p>${H(t)}</p>`;
|
|
37
41
|
}
|
|
38
42
|
}
|
|
43
|
+
const Le = 2e3;
|
|
44
|
+
function M(t) {
|
|
45
|
+
return t ? t.trimStart().startsWith('{"time":') && t.includes('"blocks":') ? Ce(t) : t : "";
|
|
46
|
+
}
|
|
39
47
|
function s({
|
|
40
|
-
active:
|
|
41
|
-
title:
|
|
42
|
-
onClick:
|
|
43
|
-
children:
|
|
48
|
+
active: t,
|
|
49
|
+
title: d,
|
|
50
|
+
onClick: a,
|
|
51
|
+
children: l
|
|
44
52
|
}) {
|
|
45
53
|
return /* @__PURE__ */ e(
|
|
46
54
|
"button",
|
|
47
55
|
{
|
|
48
56
|
type: "button",
|
|
49
|
-
title:
|
|
50
|
-
onMouseDown: (
|
|
51
|
-
|
|
57
|
+
title: d,
|
|
58
|
+
onMouseDown: (c) => {
|
|
59
|
+
c.preventDefault(), a();
|
|
52
60
|
},
|
|
53
|
-
className:
|
|
61
|
+
className: K(
|
|
54
62
|
"flex h-6 w-6 items-center justify-center rounded text-slate-500 transition-colors hover:bg-slate-200 hover:text-slate-700 dark:text-slate-300 dark:hover:bg-[#334155] dark:hover:text-white",
|
|
55
|
-
|
|
63
|
+
t && "bg-slate-200 text-slate-900 dark:bg-[#334155] dark:text-white"
|
|
56
64
|
),
|
|
57
|
-
children:
|
|
65
|
+
children: l
|
|
58
66
|
}
|
|
59
67
|
);
|
|
60
68
|
}
|
|
61
|
-
function
|
|
69
|
+
function $() {
|
|
62
70
|
return /* @__PURE__ */ e("div", { className: "mx-0.5 h-4 w-px bg-slate-200 dark:bg-[#475569]" });
|
|
63
71
|
}
|
|
64
|
-
function
|
|
65
|
-
value:
|
|
66
|
-
onChange:
|
|
67
|
-
placeholder:
|
|
68
|
-
disabled:
|
|
69
|
-
pastePlain:
|
|
72
|
+
function ze({
|
|
73
|
+
value: t,
|
|
74
|
+
onChange: d,
|
|
75
|
+
placeholder: a,
|
|
76
|
+
disabled: l,
|
|
77
|
+
pastePlain: c,
|
|
78
|
+
coedit: p
|
|
70
79
|
}) {
|
|
71
|
-
const [
|
|
80
|
+
const [N, k] = w(!1), [C, g] = w(""), [S, y] = w(!1), x = D(null), v = be(), b = ke(), A = ge(() => M(t), [t]), n = D(null), u = D([]), r = Y({
|
|
72
81
|
immediatelyRender: !1,
|
|
73
82
|
extensions: [
|
|
74
83
|
// StarterKit 3 bundles its own Link (autolink on) and Underline; they are
|
|
75
84
|
// registered below with this editor's options, so the kit's copies stay out.
|
|
76
|
-
|
|
85
|
+
Z.configure({
|
|
77
86
|
bulletList: { keepMarks: !0 },
|
|
78
87
|
orderedList: { keepMarks: !0 },
|
|
79
88
|
link: !1,
|
|
80
89
|
underline: !1
|
|
81
90
|
}),
|
|
82
|
-
|
|
83
|
-
|
|
91
|
+
X,
|
|
92
|
+
V.configure({ placeholder: a ?? "Start writing…" }),
|
|
84
93
|
// 'record' protocol (#666): record://<collection>/<id> links survive the
|
|
85
94
|
// Link extension's allowed-URI validation and render as record chips.
|
|
86
95
|
// No autolink while typing: EFP site codes read like domains (byron.il,
|
|
87
96
|
// oswego.il) and every one became a bogus http:// link in notes that go
|
|
88
97
|
// to suppliers. Links are explicit — the toolbar, or pasting a URL.
|
|
89
|
-
|
|
98
|
+
// Never a script / data / file href, whoever typed it (co-edited text included, L7).
|
|
99
|
+
Q.configure({
|
|
100
|
+
openOnClick: !1,
|
|
101
|
+
autolink: !1,
|
|
102
|
+
protocols: ["record"],
|
|
103
|
+
isAllowedUri: (i, o) => we(i) && o.defaultValidate(i)
|
|
104
|
+
}),
|
|
105
|
+
// Others' cursors while people write here together (inert otherwise).
|
|
106
|
+
_e
|
|
90
107
|
],
|
|
91
|
-
content:
|
|
92
|
-
editable: !
|
|
108
|
+
content: A,
|
|
109
|
+
editable: !l,
|
|
93
110
|
// NEVER undefined: an explicit `editorProps: undefined` overrides tiptap's
|
|
94
111
|
// `{}` default in the options merge, and 3.26's createView reads
|
|
95
112
|
// `editorProps.dispatchTransaction` unguarded — every non-pastePlain
|
|
96
113
|
// editor crashed at mount ("Cannot read properties of undefined").
|
|
97
|
-
editorProps:
|
|
98
|
-
handlePaste(
|
|
99
|
-
var
|
|
100
|
-
const
|
|
101
|
-
return
|
|
114
|
+
editorProps: c ? {
|
|
115
|
+
handlePaste(i, o) {
|
|
116
|
+
var h;
|
|
117
|
+
const f = (h = o.clipboardData) == null ? void 0 : h.getData("text/plain");
|
|
118
|
+
return f == null ? !1 : (o.preventDefault(), i.dispatch(i.state.tr.insertText(f)), !0);
|
|
102
119
|
}
|
|
103
120
|
} : {},
|
|
104
|
-
onUpdate({ editor:
|
|
105
|
-
|
|
121
|
+
onUpdate({ editor: i, transaction: o }) {
|
|
122
|
+
var L;
|
|
123
|
+
if (o.getMeta(ve) && !((L = n.current) != null && L.tracking())) return;
|
|
124
|
+
const f = i.getHTML(), h = u.current;
|
|
125
|
+
h.push({ html: f, at: Date.now() }), h.length > 64 && h.shift(), d(f);
|
|
106
126
|
}
|
|
107
|
-
}),
|
|
127
|
+
}), _ = Ne(r, p ?? null, t, M);
|
|
128
|
+
n.current = _.session;
|
|
129
|
+
const q = D(null);
|
|
130
|
+
R(() => {
|
|
131
|
+
var o;
|
|
132
|
+
const i = (o = q.current) == null ? void 0 : o.closest("[data-field]");
|
|
133
|
+
if (i)
|
|
134
|
+
return i.toggleAttribute("data-coedit-live", _.live), () => i.removeAttribute("data-coedit-live");
|
|
135
|
+
}, [_.live]);
|
|
136
|
+
const O = D(t);
|
|
108
137
|
if (R(() => {
|
|
109
|
-
if (!
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
138
|
+
if (!r || O.current === t) return;
|
|
139
|
+
O.current = t;
|
|
140
|
+
const i = Date.now();
|
|
141
|
+
if (u.current.some((h) => h.html === t && i - h.at < Le)) return;
|
|
142
|
+
const o = n.current;
|
|
143
|
+
if (o != null && o.isLive() && (r.isFocused || !o.tracking())) return;
|
|
144
|
+
const f = M(t);
|
|
145
|
+
r.getHTML() !== f && r.commands.setContent(f, { emitUpdate: !1 });
|
|
146
|
+
}, [r, t]), !r) return null;
|
|
147
|
+
const J = () => {
|
|
148
|
+
const i = r.getAttributes("link").href;
|
|
149
|
+
g(i ?? "https://"), k(!0), setTimeout(() => {
|
|
150
|
+
var o;
|
|
151
|
+
return (o = x.current) == null ? void 0 : o.select();
|
|
119
152
|
}, 0);
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
},
|
|
123
|
-
|
|
153
|
+
}, T = () => {
|
|
154
|
+
C === "" ? r.chain().focus().extendMarkRange("link").unsetLink().run() : r.chain().focus().extendMarkRange("link").setLink({ href: C }).run(), k(!1), g("");
|
|
155
|
+
}, E = () => {
|
|
156
|
+
k(!1), g("");
|
|
124
157
|
};
|
|
125
|
-
return /* @__PURE__ */
|
|
158
|
+
return /* @__PURE__ */ m(
|
|
126
159
|
"div",
|
|
127
160
|
{
|
|
128
|
-
|
|
161
|
+
ref: q,
|
|
162
|
+
className: K(
|
|
129
163
|
"overflow-hidden rounded-md border border-slate-200 bg-background focus-within:ring-1 focus-within:ring-nvr-cyan focus-within:border-nvr-cyan dark:border-border",
|
|
130
|
-
|
|
164
|
+
l && "opacity-60"
|
|
131
165
|
),
|
|
132
166
|
children: [
|
|
133
|
-
!
|
|
134
|
-
/* @__PURE__ */
|
|
167
|
+
!l && /* @__PURE__ */ m(z, { children: [
|
|
168
|
+
/* @__PURE__ */ m("div", { className: "flex flex-wrap items-center gap-0.5 border-b border-slate-200 bg-slate-50 px-2 py-1.5 dark:border-border dark:bg-muted", children: [
|
|
135
169
|
/* @__PURE__ */ e(
|
|
136
170
|
s,
|
|
137
171
|
{
|
|
138
172
|
title: "Bold",
|
|
139
|
-
active:
|
|
140
|
-
onClick: () =>
|
|
141
|
-
children: /* @__PURE__ */ e(
|
|
173
|
+
active: r.isActive("bold"),
|
|
174
|
+
onClick: () => r.chain().focus().toggleBold().run(),
|
|
175
|
+
children: /* @__PURE__ */ e(ee, { className: "h-3.5 w-3.5" })
|
|
142
176
|
}
|
|
143
177
|
),
|
|
144
178
|
/* @__PURE__ */ e(
|
|
145
179
|
s,
|
|
146
180
|
{
|
|
147
181
|
title: "Italic",
|
|
148
|
-
active:
|
|
149
|
-
onClick: () =>
|
|
150
|
-
children: /* @__PURE__ */ e(
|
|
182
|
+
active: r.isActive("italic"),
|
|
183
|
+
onClick: () => r.chain().focus().toggleItalic().run(),
|
|
184
|
+
children: /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5" })
|
|
151
185
|
}
|
|
152
186
|
),
|
|
153
187
|
/* @__PURE__ */ e(
|
|
154
188
|
s,
|
|
155
189
|
{
|
|
156
190
|
title: "Underline",
|
|
157
|
-
active:
|
|
158
|
-
onClick: () =>
|
|
159
|
-
children: /* @__PURE__ */ e(
|
|
191
|
+
active: r.isActive("underline"),
|
|
192
|
+
onClick: () => r.chain().focus().toggleUnderline().run(),
|
|
193
|
+
children: /* @__PURE__ */ e(re, { className: "h-3.5 w-3.5" })
|
|
160
194
|
}
|
|
161
195
|
),
|
|
162
196
|
/* @__PURE__ */ e(
|
|
163
197
|
s,
|
|
164
198
|
{
|
|
165
199
|
title: "Strikethrough",
|
|
166
|
-
active:
|
|
167
|
-
onClick: () =>
|
|
168
|
-
children: /* @__PURE__ */ e(
|
|
200
|
+
active: r.isActive("strike"),
|
|
201
|
+
onClick: () => r.chain().focus().toggleStrike().run(),
|
|
202
|
+
children: /* @__PURE__ */ e(ie, { className: "h-3.5 w-3.5" })
|
|
169
203
|
}
|
|
170
204
|
),
|
|
171
|
-
/* @__PURE__ */ e(
|
|
205
|
+
/* @__PURE__ */ e($, {}),
|
|
172
206
|
/* @__PURE__ */ e(
|
|
173
207
|
s,
|
|
174
208
|
{
|
|
175
209
|
title: "Heading 1",
|
|
176
|
-
active:
|
|
177
|
-
onClick: () =>
|
|
178
|
-
children: /* @__PURE__ */ e(
|
|
210
|
+
active: r.isActive("heading", { level: 1 }),
|
|
211
|
+
onClick: () => r.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
212
|
+
children: /* @__PURE__ */ e(ne, { className: "h-3.5 w-3.5" })
|
|
179
213
|
}
|
|
180
214
|
),
|
|
181
215
|
/* @__PURE__ */ e(
|
|
182
216
|
s,
|
|
183
217
|
{
|
|
184
218
|
title: "Heading 2",
|
|
185
|
-
active:
|
|
186
|
-
onClick: () =>
|
|
187
|
-
children: /* @__PURE__ */ e(
|
|
219
|
+
active: r.isActive("heading", { level: 2 }),
|
|
220
|
+
onClick: () => r.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
221
|
+
children: /* @__PURE__ */ e(oe, { className: "h-3.5 w-3.5" })
|
|
188
222
|
}
|
|
189
223
|
),
|
|
190
224
|
/* @__PURE__ */ e(
|
|
191
225
|
s,
|
|
192
226
|
{
|
|
193
227
|
title: "Heading 3",
|
|
194
|
-
active:
|
|
195
|
-
onClick: () =>
|
|
196
|
-
children: /* @__PURE__ */ e(
|
|
228
|
+
active: r.isActive("heading", { level: 3 }),
|
|
229
|
+
onClick: () => r.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
230
|
+
children: /* @__PURE__ */ e(ae, { className: "h-3.5 w-3.5" })
|
|
197
231
|
}
|
|
198
232
|
),
|
|
199
|
-
/* @__PURE__ */ e(
|
|
233
|
+
/* @__PURE__ */ e($, {}),
|
|
200
234
|
/* @__PURE__ */ e(
|
|
201
235
|
s,
|
|
202
236
|
{
|
|
203
237
|
title: "Bullet list",
|
|
204
|
-
active:
|
|
205
|
-
onClick: () =>
|
|
206
|
-
children: /* @__PURE__ */ e(
|
|
238
|
+
active: r.isActive("bulletList"),
|
|
239
|
+
onClick: () => r.chain().focus().toggleBulletList().run(),
|
|
240
|
+
children: /* @__PURE__ */ e(le, { className: "h-3.5 w-3.5" })
|
|
207
241
|
}
|
|
208
242
|
),
|
|
209
243
|
/* @__PURE__ */ e(
|
|
210
244
|
s,
|
|
211
245
|
{
|
|
212
246
|
title: "Ordered list",
|
|
213
|
-
active:
|
|
214
|
-
onClick: () =>
|
|
215
|
-
children: /* @__PURE__ */ e(
|
|
247
|
+
active: r.isActive("orderedList"),
|
|
248
|
+
onClick: () => r.chain().focus().toggleOrderedList().run(),
|
|
249
|
+
children: /* @__PURE__ */ e(ce, { className: "h-3.5 w-3.5" })
|
|
216
250
|
}
|
|
217
251
|
),
|
|
218
|
-
/* @__PURE__ */ e(
|
|
252
|
+
/* @__PURE__ */ e($, {}),
|
|
219
253
|
/* @__PURE__ */ e(
|
|
220
254
|
s,
|
|
221
255
|
{
|
|
222
256
|
title: "Blockquote",
|
|
223
|
-
active:
|
|
224
|
-
onClick: () =>
|
|
225
|
-
children: /* @__PURE__ */ e(
|
|
257
|
+
active: r.isActive("blockquote"),
|
|
258
|
+
onClick: () => r.chain().focus().toggleBlockquote().run(),
|
|
259
|
+
children: /* @__PURE__ */ e(se, { className: "h-3.5 w-3.5" })
|
|
226
260
|
}
|
|
227
261
|
),
|
|
228
262
|
/* @__PURE__ */ e(
|
|
229
263
|
s,
|
|
230
264
|
{
|
|
231
265
|
title: "Code block",
|
|
232
|
-
active:
|
|
233
|
-
onClick: () =>
|
|
234
|
-
children: /* @__PURE__ */ e(
|
|
266
|
+
active: r.isActive("codeBlock"),
|
|
267
|
+
onClick: () => r.chain().focus().toggleCodeBlock().run(),
|
|
268
|
+
children: /* @__PURE__ */ e(de, { className: "h-3.5 w-3.5" })
|
|
235
269
|
}
|
|
236
270
|
),
|
|
237
271
|
/* @__PURE__ */ e(
|
|
238
272
|
s,
|
|
239
273
|
{
|
|
240
274
|
title: "Horizontal rule",
|
|
241
|
-
onClick: () =>
|
|
242
|
-
children: /* @__PURE__ */ e(
|
|
275
|
+
onClick: () => r.chain().focus().setHorizontalRule().run(),
|
|
276
|
+
children: /* @__PURE__ */ e(pe, { className: "h-3.5 w-3.5" })
|
|
243
277
|
}
|
|
244
278
|
),
|
|
245
|
-
/* @__PURE__ */ e(
|
|
279
|
+
/* @__PURE__ */ e($, {}),
|
|
246
280
|
/* @__PURE__ */ e(
|
|
247
281
|
s,
|
|
248
282
|
{
|
|
249
283
|
title: "Link",
|
|
250
|
-
active:
|
|
251
|
-
onClick:
|
|
252
|
-
children: /* @__PURE__ */ e(
|
|
284
|
+
active: r.isActive("link"),
|
|
285
|
+
onClick: J,
|
|
286
|
+
children: /* @__PURE__ */ e(ue, { className: "h-3.5 w-3.5" })
|
|
253
287
|
}
|
|
254
288
|
),
|
|
255
|
-
|
|
289
|
+
r.isActive("link") && /* @__PURE__ */ e(
|
|
256
290
|
s,
|
|
257
291
|
{
|
|
258
292
|
title: "Remove link",
|
|
259
|
-
onClick: () =>
|
|
260
|
-
children: /* @__PURE__ */ e(
|
|
293
|
+
onClick: () => r.chain().focus().unsetLink().run(),
|
|
294
|
+
children: /* @__PURE__ */ e(he, { className: "h-3.5 w-3.5" })
|
|
261
295
|
}
|
|
262
296
|
),
|
|
263
297
|
/* @__PURE__ */ e(
|
|
264
298
|
s,
|
|
265
299
|
{
|
|
266
300
|
title: "Link record",
|
|
267
|
-
active:
|
|
301
|
+
active: S,
|
|
268
302
|
onClick: () => {
|
|
269
|
-
y((
|
|
303
|
+
y((i) => !i), k(!1);
|
|
270
304
|
},
|
|
271
|
-
children: /* @__PURE__ */ e(
|
|
305
|
+
children: /* @__PURE__ */ e(P, { className: "h-3.5 w-3.5" })
|
|
272
306
|
}
|
|
273
307
|
)
|
|
274
308
|
] }),
|
|
275
|
-
|
|
309
|
+
N && /* @__PURE__ */ m("div", { className: "flex items-center gap-1.5 border-b border-slate-200 bg-slate-50 px-2 py-1.5 dark:border-border dark:bg-muted", children: [
|
|
276
310
|
/* @__PURE__ */ e(
|
|
277
311
|
"input",
|
|
278
312
|
{
|
|
279
|
-
ref:
|
|
313
|
+
ref: x,
|
|
280
314
|
type: "url",
|
|
281
|
-
value:
|
|
282
|
-
onChange: (
|
|
283
|
-
onKeyDown: (
|
|
284
|
-
|
|
315
|
+
value: C,
|
|
316
|
+
onChange: (i) => g(i.target.value),
|
|
317
|
+
onKeyDown: (i) => {
|
|
318
|
+
i.key === "Enter" && (i.preventDefault(), T()), i.key === "Escape" && (i.preventDefault(), E());
|
|
285
319
|
},
|
|
286
320
|
placeholder: "https://example.com",
|
|
287
321
|
"aria-label": "Link URL",
|
|
@@ -293,11 +327,11 @@ function De({
|
|
|
293
327
|
{
|
|
294
328
|
type: "button",
|
|
295
329
|
title: "Apply link",
|
|
296
|
-
onMouseDown: (
|
|
297
|
-
|
|
330
|
+
onMouseDown: (i) => {
|
|
331
|
+
i.preventDefault(), T();
|
|
298
332
|
},
|
|
299
333
|
className: "flex h-5 w-5 items-center justify-center rounded text-emerald-600 hover:bg-emerald-50",
|
|
300
|
-
children: /* @__PURE__ */ e(
|
|
334
|
+
children: /* @__PURE__ */ e(fe, { className: "h-3.5 w-3.5" })
|
|
301
335
|
}
|
|
302
336
|
),
|
|
303
337
|
/* @__PURE__ */ e(
|
|
@@ -305,23 +339,23 @@ function De({
|
|
|
305
339
|
{
|
|
306
340
|
type: "button",
|
|
307
341
|
title: "Cancel",
|
|
308
|
-
onMouseDown: (
|
|
309
|
-
|
|
342
|
+
onMouseDown: (i) => {
|
|
343
|
+
i.preventDefault(), E();
|
|
310
344
|
},
|
|
311
345
|
className: "flex h-5 w-5 items-center justify-center rounded text-slate-400 hover:bg-slate-100 dark:hover:bg-[#334155]",
|
|
312
|
-
children: /* @__PURE__ */ e(
|
|
346
|
+
children: /* @__PURE__ */ e(W, { className: "h-3.5 w-3.5" })
|
|
313
347
|
}
|
|
314
348
|
)
|
|
315
349
|
] }),
|
|
316
|
-
|
|
317
|
-
|
|
350
|
+
S && /* @__PURE__ */ e(
|
|
351
|
+
$e,
|
|
318
352
|
{
|
|
319
|
-
apiBase:
|
|
320
|
-
authHeaders:
|
|
321
|
-
credentials:
|
|
322
|
-
onInsert: (
|
|
323
|
-
|
|
324
|
-
{ type: "text", text:
|
|
353
|
+
apiBase: v.apiBase,
|
|
354
|
+
authHeaders: v.authHeaders,
|
|
355
|
+
credentials: v.credentials,
|
|
356
|
+
onInsert: (i, o) => {
|
|
357
|
+
r.chain().focus().insertContent([
|
|
358
|
+
{ type: "text", text: i, marks: [{ type: "link", attrs: { href: o } }] },
|
|
325
359
|
{ type: "text", text: " " }
|
|
326
360
|
]).run(), y(!1);
|
|
327
361
|
},
|
|
@@ -337,92 +371,133 @@ function De({
|
|
|
337
371
|
border-radius: 9999px; padding: 0 8px; font-weight: 500; font-size: 0.92em;
|
|
338
372
|
}
|
|
339
373
|
.nivaro-rich-text a[href^="record://"]::before { content: '↗ '; opacity: 0.55; }
|
|
374
|
+
.nivaro-rich-text .tiptap ::selection { background: rgb(var(--nvr-cyan-rgb, 0 206 255) / 0.26); }
|
|
375
|
+
${ye}
|
|
376
|
+
.nivaro-rich-text .tiptap > :first-child .nvr-coedit-flag {
|
|
377
|
+
bottom: auto; top: 100%; margin: 1px 0 0; border-radius: 0 3px 3px 3px;
|
|
378
|
+
}
|
|
340
379
|
` }),
|
|
341
380
|
/* @__PURE__ */ e(
|
|
342
|
-
|
|
381
|
+
G,
|
|
343
382
|
{
|
|
344
|
-
onClick: (
|
|
345
|
-
var
|
|
346
|
-
const
|
|
347
|
-
if (
|
|
348
|
-
|
|
349
|
-
const [
|
|
350
|
-
|
|
383
|
+
onClick: (i) => {
|
|
384
|
+
var h, L;
|
|
385
|
+
const o = (L = (h = i.target).closest) == null ? void 0 : L.call(h, "a"), f = (o == null ? void 0 : o.getAttribute("href")) ?? "";
|
|
386
|
+
if (f.startsWith("record://")) {
|
|
387
|
+
i.preventDefault();
|
|
388
|
+
const [I, j] = f.slice(9).split("/");
|
|
389
|
+
I && j && b.open({ collection: I, itemId: j });
|
|
351
390
|
}
|
|
352
391
|
},
|
|
353
|
-
editor:
|
|
392
|
+
editor: r,
|
|
354
393
|
className: "nivaro-rich-text min-h-[120px] px-3 py-2 text-[13px] [&_.tiptap]:outline-none [&_.tiptap]:min-h-[100px] [&_.tiptap_p]:my-1 [&_.tiptap_h1]:text-xl [&_.tiptap_h2]:text-lg [&_.tiptap_h3]:text-base [&_.tiptap_h1,&_.tiptap_h2,&_.tiptap_h3]:font-semibold [&_.tiptap_ul]:list-disc [&_.tiptap_ol]:list-decimal [&_.tiptap_ul]:!pl-6 [&_.tiptap_ol]:!pl-6 [&_.tiptap_ul]:list-outside [&_.tiptap_ol]:list-outside [&_.tiptap_li]:my-0.5 [&_.tiptap_blockquote]:border-l-2 [&_.tiptap_blockquote]:border-slate-300 [&_.tiptap_blockquote]:pl-3 [&_.tiptap_blockquote]:text-slate-500 dark:[&_.tiptap_blockquote]:border-slate-600 dark:[&_.tiptap_blockquote]:text-slate-400 [&_.tiptap_code]:bg-slate-100 dark:[&_.tiptap_code]:bg-[#1e293b] [&_.tiptap_code]:rounded [&_.tiptap_code]:px-1 [&_.tiptap_pre]:bg-slate-100 dark:[&_.tiptap_pre]:bg-[#1e293b] [&_.tiptap_pre]:rounded [&_.tiptap_pre]:p-2 [&_.tiptap_pre]:font-mono [&_.tiptap_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)] [&_.tiptap_p.is-editor-empty:first-child::before]:text-slate-400 dark:[&_.tiptap_p.is-editor-empty:first-child::before]:text-slate-500 [&_.tiptap_p.is-editor-empty:first-child::before]:pointer-events-none [&_.tiptap_p.is-editor-empty:first-child::before]:float-left [&_.tiptap_p.is-editor-empty:first-child::before]:h-0"
|
|
355
394
|
}
|
|
356
|
-
)
|
|
395
|
+
),
|
|
396
|
+
/* @__PURE__ */ e(De, { peers: _.peers, diverged: _.diverged })
|
|
397
|
+
]
|
|
398
|
+
}
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
const U = (t) => t.trim().split(/\s+/)[0] || t;
|
|
402
|
+
function F(t) {
|
|
403
|
+
return t.length <= 1 ? t[0] ?? "" : t.length === 2 ? `${t[0]} and ${t[1]}` : `${t[0]}, ${t[1]} and ${t.length - 2} more`;
|
|
404
|
+
}
|
|
405
|
+
function De({
|
|
406
|
+
peers: t,
|
|
407
|
+
diverged: d
|
|
408
|
+
}) {
|
|
409
|
+
return !d && t.length === 0 ? null : /* @__PURE__ */ m(
|
|
410
|
+
"div",
|
|
411
|
+
{
|
|
412
|
+
className: "flex min-h-[26px] items-center gap-1.5 border-t border-slate-100 px-3 py-1 text-[11px] text-slate-500 dark:border-border dark:text-slate-400",
|
|
413
|
+
"aria-live": "polite",
|
|
414
|
+
children: [
|
|
415
|
+
/* @__PURE__ */ e("span", { className: "flex -space-x-0.5", "aria-hidden": "true", children: (t.length ? t : [{ name: "", color: "#94a3b8" }]).slice(0, 4).map((a) => /* @__PURE__ */ e(
|
|
416
|
+
"span",
|
|
417
|
+
{
|
|
418
|
+
className: "h-2 w-2 rounded-full ring-2 ring-background",
|
|
419
|
+
style: { backgroundColor: a.color }
|
|
420
|
+
},
|
|
421
|
+
a.name || "someone"
|
|
422
|
+
)) }),
|
|
423
|
+
d ? /* @__PURE__ */ m("span", { className: "min-w-0", children: [
|
|
424
|
+
t.length ? F(t.map((a) => U(a.name))) : "Someone else",
|
|
425
|
+
" ",
|
|
426
|
+
t.length > 1 ? "are" : "is",
|
|
427
|
+
" writing here too. Your unsaved changes stay separate until you save."
|
|
428
|
+
] }) : /* @__PURE__ */ m("span", { className: "truncate", children: [
|
|
429
|
+
"Writing together with ",
|
|
430
|
+
F(t.map((a) => U(a.name)))
|
|
431
|
+
] })
|
|
357
432
|
]
|
|
358
433
|
}
|
|
359
434
|
);
|
|
360
435
|
}
|
|
361
|
-
function
|
|
362
|
-
return
|
|
363
|
-
if (
|
|
364
|
-
const
|
|
365
|
-
return
|
|
436
|
+
function Se(t, d) {
|
|
437
|
+
return t ? t.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (a, l) => {
|
|
438
|
+
if (l.includes(".")) return "";
|
|
439
|
+
const c = d[l];
|
|
440
|
+
return c == null ? "" : String(c);
|
|
366
441
|
}).replace(/\s+/g, " ").trim() : "";
|
|
367
442
|
}
|
|
368
|
-
function
|
|
369
|
-
const
|
|
370
|
-
if (
|
|
371
|
-
for (const
|
|
372
|
-
const
|
|
373
|
-
if (typeof
|
|
443
|
+
function Ae(t, d) {
|
|
444
|
+
const a = Se(d, t);
|
|
445
|
+
if (a) return a;
|
|
446
|
+
for (const l of ["name", "title", "label", "subject"]) {
|
|
447
|
+
const c = t[l];
|
|
448
|
+
if (typeof c == "string" && c.trim()) return c.trim();
|
|
374
449
|
}
|
|
375
|
-
return `#${String(
|
|
450
|
+
return `#${String(t.id ?? "")}`;
|
|
376
451
|
}
|
|
377
|
-
function
|
|
378
|
-
apiBase:
|
|
379
|
-
authHeaders:
|
|
380
|
-
credentials:
|
|
381
|
-
onInsert:
|
|
382
|
-
onClose:
|
|
452
|
+
function $e({
|
|
453
|
+
apiBase: t,
|
|
454
|
+
authHeaders: d,
|
|
455
|
+
credentials: a,
|
|
456
|
+
onInsert: l,
|
|
457
|
+
onClose: c
|
|
383
458
|
}) {
|
|
384
|
-
const [
|
|
459
|
+
const [p, N] = w(""), [k, C] = w(""), [g, S] = w("");
|
|
385
460
|
R(() => {
|
|
386
|
-
const
|
|
387
|
-
return () => clearTimeout(
|
|
388
|
-
}, [
|
|
389
|
-
const
|
|
390
|
-
headers:
|
|
391
|
-
credentials:
|
|
392
|
-
}).then((
|
|
393
|
-
if (!
|
|
394
|
-
return
|
|
395
|
-
}), { data:
|
|
461
|
+
const n = setTimeout(() => S(k), 300);
|
|
462
|
+
return () => clearTimeout(n);
|
|
463
|
+
}, [k]);
|
|
464
|
+
const y = (n) => fetch(`${t}${n}`, {
|
|
465
|
+
headers: d,
|
|
466
|
+
credentials: a
|
|
467
|
+
}).then((u) => {
|
|
468
|
+
if (!u.ok) throw new Error(String(u.status));
|
|
469
|
+
return u.json();
|
|
470
|
+
}), { data: x } = B({
|
|
396
471
|
queryKey: ["rte-record-link-collections"],
|
|
397
|
-
queryFn: () =>
|
|
398
|
-
(
|
|
399
|
-
(
|
|
472
|
+
queryFn: () => y("/collections").then(
|
|
473
|
+
(n) => (Array.isArray(n == null ? void 0 : n.data) ? n.data : []).filter(
|
|
474
|
+
(u) => !u.hidden && !u.collection.startsWith("nivaro_")
|
|
400
475
|
)
|
|
401
476
|
),
|
|
402
477
|
staleTime: 5 * 6e4
|
|
403
|
-
}),
|
|
404
|
-
queryKey: ["rte-record-link-search",
|
|
405
|
-
enabled: !!
|
|
406
|
-
queryFn: () =>
|
|
407
|
-
`/items/${
|
|
478
|
+
}), v = x == null ? void 0 : x.find((n) => n.collection === p), { data: b, isFetching: A } = B({
|
|
479
|
+
queryKey: ["rte-record-link-search", p, g],
|
|
480
|
+
enabled: !!p && g.trim().length > 0,
|
|
481
|
+
queryFn: () => y(
|
|
482
|
+
`/items/${p}?limit=10&search=${encodeURIComponent(g.trim())}`
|
|
408
483
|
).then(
|
|
409
|
-
(
|
|
484
|
+
(n) => Array.isArray(n == null ? void 0 : n.data) ? n.data : []
|
|
410
485
|
)
|
|
411
486
|
});
|
|
412
|
-
return /* @__PURE__ */
|
|
413
|
-
/* @__PURE__ */
|
|
487
|
+
return /* @__PURE__ */ m("div", { className: "space-y-1.5 border-b border-slate-200 bg-slate-50 px-2 py-1.5 dark:border-border dark:bg-muted", children: [
|
|
488
|
+
/* @__PURE__ */ m("div", { className: "flex items-center gap-1.5", children: [
|
|
414
489
|
/* @__PURE__ */ e(
|
|
415
|
-
|
|
490
|
+
xe,
|
|
416
491
|
{
|
|
417
|
-
value:
|
|
418
|
-
onChange:
|
|
492
|
+
value: p,
|
|
493
|
+
onChange: N,
|
|
419
494
|
ariaLabel: "Collection",
|
|
420
495
|
className: "h-6 w-44 rounded border-slate-200 bg-white text-[12px] dark:border-border dark:bg-background",
|
|
421
496
|
options: [
|
|
422
497
|
{ value: "", label: "Collection…" },
|
|
423
|
-
...(
|
|
424
|
-
value:
|
|
425
|
-
label:
|
|
498
|
+
...(x ?? []).map((n) => ({
|
|
499
|
+
value: n.collection,
|
|
500
|
+
label: n.display_name || n.collection
|
|
426
501
|
}))
|
|
427
502
|
]
|
|
428
503
|
}
|
|
@@ -430,57 +505,57 @@ function fe({
|
|
|
430
505
|
/* @__PURE__ */ e(
|
|
431
506
|
"input",
|
|
432
507
|
{
|
|
433
|
-
value:
|
|
434
|
-
onChange: (
|
|
435
|
-
onKeyDown: (
|
|
436
|
-
placeholder:
|
|
437
|
-
disabled: !
|
|
508
|
+
value: k,
|
|
509
|
+
onChange: (n) => C(n.target.value),
|
|
510
|
+
onKeyDown: (n) => n.key === "Escape" && c(),
|
|
511
|
+
placeholder: p ? "Search records…" : "Pick a collection first",
|
|
512
|
+
disabled: !p,
|
|
438
513
|
"aria-label": "Search records",
|
|
439
514
|
className: "flex-1 rounded border border-slate-200 bg-white px-2 py-0.5 text-[12px] text-slate-700 outline-none focus:border-nvr-cyan disabled:opacity-50"
|
|
440
515
|
}
|
|
441
516
|
),
|
|
442
|
-
|
|
517
|
+
A && /* @__PURE__ */ e(me, { className: "h-3.5 w-3.5 animate-spin text-slate-400" }),
|
|
443
518
|
/* @__PURE__ */ e(
|
|
444
519
|
"button",
|
|
445
520
|
{
|
|
446
521
|
type: "button",
|
|
447
522
|
title: "Close",
|
|
448
|
-
onMouseDown: (
|
|
449
|
-
|
|
523
|
+
onMouseDown: (n) => {
|
|
524
|
+
n.preventDefault(), c();
|
|
450
525
|
},
|
|
451
526
|
className: "flex h-5 w-5 items-center justify-center rounded text-slate-400 hover:bg-slate-100",
|
|
452
|
-
children: /* @__PURE__ */ e(
|
|
527
|
+
children: /* @__PURE__ */ e(W, { className: "h-3.5 w-3.5" })
|
|
453
528
|
}
|
|
454
529
|
)
|
|
455
530
|
] }),
|
|
456
|
-
|
|
457
|
-
((
|
|
458
|
-
const
|
|
459
|
-
return /* @__PURE__ */
|
|
531
|
+
p && g.trim() && ((b == null ? void 0 : b.length) ?? 0) === 0 && !A && /* @__PURE__ */ e("p", { className: "px-1 text-[11px] text-slate-400", children: "No matching records." }),
|
|
532
|
+
((b == null ? void 0 : b.length) ?? 0) > 0 && /* @__PURE__ */ e("div", { className: "max-h-40 overflow-y-auto rounded border border-slate-200 bg-white", children: (b ?? []).map((n) => {
|
|
533
|
+
const u = Ae(n, v == null ? void 0 : v.display_template), r = String(n.id ?? "");
|
|
534
|
+
return /* @__PURE__ */ m(
|
|
460
535
|
"button",
|
|
461
536
|
{
|
|
462
537
|
type: "button",
|
|
463
|
-
onMouseDown: (
|
|
464
|
-
|
|
538
|
+
onMouseDown: (_) => {
|
|
539
|
+
_.preventDefault(), r && l(u, `record://${p}/${r}`);
|
|
465
540
|
},
|
|
466
541
|
className: "flex w-full items-center gap-1.5 px-2 py-1 text-left text-[12px] text-slate-700 hover:bg-muted",
|
|
467
542
|
children: [
|
|
468
|
-
/* @__PURE__ */ e(
|
|
469
|
-
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate", children:
|
|
470
|
-
/* @__PURE__ */
|
|
543
|
+
/* @__PURE__ */ e(P, { className: "h-3 w-3 shrink-0 text-[#00a5cc]" }),
|
|
544
|
+
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate", children: u }),
|
|
545
|
+
/* @__PURE__ */ m("span", { className: "shrink-0 font-mono text-[10.5px] text-slate-400", children: [
|
|
471
546
|
"#",
|
|
472
|
-
|
|
547
|
+
r
|
|
473
548
|
] })
|
|
474
549
|
]
|
|
475
550
|
},
|
|
476
|
-
|
|
551
|
+
r
|
|
477
552
|
);
|
|
478
553
|
}) })
|
|
479
554
|
] });
|
|
480
555
|
}
|
|
481
556
|
export {
|
|
482
|
-
|
|
483
|
-
|
|
557
|
+
ze as RichTextEditor,
|
|
558
|
+
$ as TiptapDivider,
|
|
484
559
|
s as TiptapToolbarButton,
|
|
485
|
-
|
|
560
|
+
Ce as editorJsToHtml
|
|
486
561
|
};
|