Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions packages/editor/src/TranscriptEditor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -1213,18 +1213,14 @@
pointer-events: none;
}

:global(.utt-row[data-has-continuation] .utt-content::after) {
content: '\2060↩';
display: inline-block;
:global(.utt-head-mark) {
color: var(--color-text-muted, #bbb);
margin-left: 0.35em;
margin-left: 0.2em;
user-select: none;
pointer-events: none;
vertical-align: baseline;
}

:global(.utt-continuation-mark) {
transform: scaleY(-1);
color: var(--color-text-muted, #bbb);
font-weight: 400;
cursor: default;
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/nodeviews/UtteranceNodeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export class UtteranceNodeView implements NodeView {
private _refreshSepEl(continuationOfId: string | null): void {
if (continuationOfId) {
this._sepEl.className = 'utt-participant-sep utt-continuation-mark'
this._sepEl.textContent = ''
this._sepEl.textContent = ''
} else {
this._sepEl.className = 'utt-participant-sep'
this._sepEl.textContent = ':'
Expand Down
18 changes: 17 additions & 1 deletion packages/editor/src/plugins/playback-plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,18 @@ export function buildContinuationHeadPlugin(): Plugin {
})
}

function _makeHeadMarkEl(): HTMLSpanElement {
const span = document.createElement('span')
span.className = 'utt-head-mark'
// U+2060 word-joiner as first text character: the line-breaking algorithm
// processes it as real inline text in both Chrome and Firefox, so it
// suppresses the break between any preceding trailing space and this glyph.
// (A CSS ::after pseudo-element is a separate formatting object in Firefox
// and the WJ cannot cross that boundary.)
span.textContent = '⁠⤦'
return span
}

function _buildContinuationHeadDecos(doc: Parameters<typeof DecorationSet.create>[0]): DecorationSet {
// Collect continuations per head, in doc order (forEach is doc order)
const contsByHead = new Map<string, Array<{ id: string; offset: number; size: number }>>()
Expand All @@ -128,11 +140,15 @@ function _buildContinuationHeadDecos(doc: Parameters<typeof DecorationSet.create
for (const [headId, conts] of contsByHead) {
// Head block always gets the marker
const head = headOffsets.get(headId)
if (head) decos.push(Decoration.node(head.offset, head.offset + head.size, { 'data-has-continuation': 'true' }))
if (head) {
decos.push(Decoration.node(head.offset, head.offset + head.size, { 'data-has-continuation': 'true' }))
decos.push(Decoration.widget(head.offset + head.size - 1, _makeHeadMarkEl, { side: 1, key: 'head-mark' }))
}
// All continuations except the last also get the marker
for (let i = 0; i < conts.length - 1; i++) {
const c = conts[i]!
decos.push(Decoration.node(c.offset, c.offset + c.size, { 'data-has-continuation': 'true' }))
decos.push(Decoration.widget(c.offset + c.size - 1, _makeHeadMarkEl, { side: 1, key: 'head-mark' }))
}
}

Expand Down
Loading