Skip to content

Commit 98c856a

Browse files
committed
fix(editor): quiet heading chat chrome in read-only history
Gate heading chat extensions when the editor is not editable and hide residual heading widgets in history layouts for a clean read-only pad. Made-with: Cursor
1 parent 06ef54d commit 98c856a

4 files changed

Lines changed: 46 additions & 3 deletions

File tree

packages/webapp/src/components/TipTap/TipTap.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,9 @@ const Editor = ({
183183
Subscript,
184184
TextAlign,
185185
HeadingActionsExtension.configure({
186-
hoverChat: true,
187-
selectionChat: !isMobile
186+
// Read-only (e.g. version history): no heading chat/comment affordances
187+
hoverChat: editable,
188+
selectionChat: editable && !isMobile
188189
}),
189190
HyperlinkWithMarkdown.configure({
190191
protocols: ['ftp', 'mailto'],

packages/webapp/src/styles/_blocks.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
.tiptap__editor {
2020
// Matches EditorContent px-6 / sm:p-8 — drives heading-action straddle offset
2121
--tiptap-inline-pad-end: 1.5rem;
22+
height: max-content;
2223

2324
@media (min-width: 640px) {
2425
--tiptap-inline-pad-end: 2rem;
@@ -50,6 +51,11 @@
5051
display: none !important;
5152
}
5253

54+
/* Read-only: no heading chat/comment widgets (extension off; belt-and-suspenders for decorations). */
55+
.ha-wrap {
56+
display: none !important;
57+
}
58+
5359
a,
5460
img,
5561
video,

packages/webapp/src/styles/_mobile.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,23 @@ html.m_mobile #__next {
267267
user-select: text !important;
268268
}
269269
}
270+
271+
/* Version history (read-only): match main mobile scroll shell; symmetric horizontal inset (no chat straddle). */
272+
.history_editor {
273+
.editor.editorWrapper.history-mobile-editor {
274+
padding: 12px 16px 28px;
275+
}
276+
277+
.editorWrapper .tiptap__editor.docy_editor {
278+
--tiptap-inline-pad-end: 16px;
279+
padding-left: 16px;
280+
padding-right: 16px;
281+
}
282+
283+
.ProseMirror :is(h1, h2, h3, h4, h5, h6)[data-toc-id] {
284+
padding-right: 0 !important;
285+
}
286+
}
270287
}
271288

272289
.edit-fab {

packages/webapp/src/styles/components/_heading-actions.scss

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,28 @@ $ha-group-has-unread: '.ha-wrap.has-selection > .ha-group:has(.ha-chat-btn[data-
7979
flex-shrink: 0;
8080
min-height: $ha-hit-size;
8181
padding-left: 0.5rem;
82-
// Let clicks pass through the gutter; only interactive children re-enable hits
82+
// Wrapper stays inert so clicks on heading text still hit the heading; a ::before bridge
83+
// (hover tunnel) re-enables hits only in the gutter so moving to the docked btn doesn’t
84+
// fall through to the sheet and kill :hover before pointer reaches .ha-single.
8385
pointer-events: none;
8486

87+
// Invisible strip: covers reserved padding + sheet gutter up to the translated button.
88+
&:not(.has-selection)::before {
89+
content: '';
90+
position: absolute;
91+
top: 50%;
92+
right: 0;
93+
transform: translateY(-50%);
94+
width: calc(var(--tiptap-inline-pad-end, 1.5rem) + #{$ha-hit-size} * 1.5 + 12px);
95+
min-height: $ha-hit-size;
96+
height: $ha-hit-size;
97+
pointer-events: auto;
98+
z-index: 0;
99+
}
100+
85101
.ha-single {
102+
position: relative;
103+
z-index: 1;
86104
display: inline-flex;
87105
align-items: center;
88106
justify-content: center;
@@ -107,6 +125,7 @@ $ha-group-has-unread: '.ha-wrap.has-selection > .ha-group:has(.ha-chat-btn[data-
107125
flex-direction: column;
108126
align-items: center;
109127
position: relative;
128+
z-index: 1;
110129
pointer-events: auto;
111130

112131
.ha-chat-btn {

0 commit comments

Comments
 (0)