From f2029881d221ae335a132ddf492a830bc780ee98 Mon Sep 17 00:00:00 2001 From: Le Vivilet Date: Sun, 21 Jun 2026 19:38:12 +0200 Subject: [PATCH 1/6] feature: move buttons to contentright --- .../GetContentRightDom/GetContentRightDom.ts | 18 ++++ .../GetDiffEditorVirtualDom.ts | 18 ++-- .../GetImageRightDom/GetImageRightDom.ts | 7 +- .../RenderEventListeners.ts | 5 + .../diff-view/test/GetContentRightDom.test.ts | 95 ++++++++++++++++++- .../test/GetDiffEditorVirtualDom.test.ts | 76 +++++++++++++-- 6 files changed, 194 insertions(+), 25 deletions(-) diff --git a/packages/diff-view/src/parts/GetContentRightDom/GetContentRightDom.ts b/packages/diff-view/src/parts/GetContentRightDom/GetContentRightDom.ts index 7d6fd5b6..5316ab6c 100644 --- a/packages/diff-view/src/parts/GetContentRightDom/GetContentRightDom.ts +++ b/packages/diff-view/src/parts/GetContentRightDom/GetContentRightDom.ts @@ -4,13 +4,20 @@ import type { TokenizedLine } from '../TokenizedLine/TokenizedLine.ts' import type { VisibleLine } from '../VisibleLine/VisibleLine.ts' import { defaultAllowedLinkSchemes } from '../AllowedLinkSchemes/AllowedLinkSchemes.ts' import * as ClassNames from '../ClassNames/ClassNames.ts' +import type { DiffMode } from '../DiffViewState/DiffViewState.ts' import * as DomEventListenerFunctions from '../DomEventListenerFunctions/DomEventListenerFunctions.ts' import { getContentDom } from '../GetContentDom/GetContentDom.ts' +<<<<<<< Updated upstream +======= +import { getCursorDom } from '../GetCursorDom/GetCursorDom.ts' +import { getDiffEditorButtonsDom } from '../GetDiffEditorButtonsDom/GetDiffEditorButtonsDom.ts' +>>>>>>> Stashed changes import * as InputName from '../InputName/InputName.ts' interface GetContentRightDomOptions { readonly allowedLinkSchemes?: readonly string[] readonly contentRight: string + readonly diffMode?: DiffMode readonly editable?: boolean readonly errorCodeFrame?: string readonly errorMessage?: string @@ -21,6 +28,7 @@ interface GetContentRightDomOptions { readonly lineNumbers?: boolean readonly maxLineY?: number readonly minLineY?: number + readonly showWhitespace?: boolean readonly tokenizedLines?: readonly TokenizedLine[] readonly totalLineCount?: number readonly visibleLines?: readonly VisibleLine[] @@ -45,6 +53,7 @@ const getInputWrapperDom = (inputValue: string): readonly VirtualDomNode[] => [ export const getContentRightDom = ({ allowedLinkSchemes = defaultAllowedLinkSchemes, contentRight, + diffMode = 'sideBySide', editable = false, errorCodeFrame = '', errorMessage = '', @@ -55,6 +64,7 @@ export const getContentRightDom = ({ lineNumbers = true, maxLineY, minLineY = 0, + showWhitespace = false, tokenizedLines = [], totalLineCount, visibleLines = [], @@ -79,24 +89,32 @@ export const getContentRightDom = ({ visibleLines, itemHeight, ) + const buttonsDom = getDiffEditorButtonsDom(diffMode, showWhitespace) if (!editable || errorMessage) { const [content, ...rest] = contentDom return [ { ...content, + childCount: content.childCount + 1, onClick: DomEventListenerFunctions.HandleClickRightSide, }, ...rest, + ...buttonsDom, ] } const [content, ...rest] = contentDom return [ { ...content, +<<<<<<< Updated upstream childCount: content.childCount + 1, +======= + childCount: content.childCount + 3, +>>>>>>> Stashed changes onClick: DomEventListenerFunctions.HandleClickRightSide, }, ...rest, ...getInputWrapperDom(inputValue), + ...buttonsDom, ] } diff --git a/packages/diff-view/src/parts/GetDiffEditorVirtualDom/GetDiffEditorVirtualDom.ts b/packages/diff-view/src/parts/GetDiffEditorVirtualDom/GetDiffEditorVirtualDom.ts index f3acf1c1..3ba70f7a 100644 --- a/packages/diff-view/src/parts/GetDiffEditorVirtualDom/GetDiffEditorVirtualDom.ts +++ b/packages/diff-view/src/parts/GetDiffEditorVirtualDom/GetDiffEditorVirtualDom.ts @@ -5,7 +5,6 @@ import * as ClassNames from '../ClassNames/ClassNames.ts' import * as DomEventListenerFunctions from '../DomEventListenerFunctions/DomEventListenerFunctions.ts' import { getContentLeftDom } from '../GetContentLeftDom/GetContentLeftDom.ts' import { getContentRightDom } from '../GetContentRightDom/GetContentRightDom.ts' -import { getDiffEditorButtonsDom } from '../GetDiffEditorButtonsDom/GetDiffEditorButtonsDom.ts' import { getDiffSearchHeaderDom } from '../GetDiffSearchHeaderDom/GetDiffSearchHeaderDom.ts' import { getImageLeftDom } from '../GetImageLeftDom/GetImageLeftDom.ts' import { getImageRightDom } from '../GetImageRightDom/GetImageRightDom.ts' @@ -36,18 +35,16 @@ const getDiffEditorWithSearchDom = ( sashLayoutClass: string, leftDom: readonly VirtualDomNode[], rightDom: readonly VirtualDomNode[], - buttonsDom: readonly VirtualDomNode[], scrollBarDom: readonly VirtualDomNode[], scrollBarActive: boolean, ): readonly VirtualDomNode[] => { return [ - getRootDom(scrollBarActive ? 4 : 3, `${ClassNames.Viewlet} ${ClassNames.DiffEditor} ${diffEditorLayoutClass} ${ClassNames.DiffEditorWithSearch}`), + getRootDom(scrollBarActive ? 3 : 2, `${ClassNames.Viewlet} ${ClassNames.DiffEditor} ${diffEditorLayoutClass} ${ClassNames.DiffEditorWithSearch}`), ...getDiffSearchHeaderDom(), getEditorBodyDom(diffEditorLayoutClass), ...leftDom, getSashDom(sashLayoutClass), ...rightDom, - ...buttonsDom, ...scrollBarDom, ] } @@ -57,16 +54,14 @@ const getDiffEditorWithoutSearchDom = ( sashLayoutClass: string, leftDom: readonly VirtualDomNode[], rightDom: readonly VirtualDomNode[], - buttonsDom: readonly VirtualDomNode[], scrollBarDom: readonly VirtualDomNode[], scrollBarActive: boolean, ): readonly VirtualDomNode[] => { return [ - getRootDom(scrollBarActive ? 5 : 4, `${ClassNames.Viewlet} ${ClassNames.DiffEditor} ${diffEditorLayoutClass}`), + getRootDom(scrollBarActive ? 4 : 3, `${ClassNames.Viewlet} ${ClassNames.DiffEditor} ${diffEditorLayoutClass}`), ...leftDom, getSashDom(sashLayoutClass), ...rightDom, - ...buttonsDom, ...scrollBarDom, ] } @@ -134,10 +129,11 @@ export const getDiffEditorVirtualDom = (state: DiffViewState): readonly VirtualD }) const rightDom = renderModeRight === 'image' && !errorRightMessage - ? getImageRightDom(uriRight, imageSrcRight) + ? getImageRightDom(uriRight, imageSrcRight, diffMode, showWhitespace) : getContentRightDom({ allowedLinkSchemes, contentRight, + diffMode, editable: true, errorCodeFrame: errorRightCodeFrame, errorMessage: errorRightMessage, @@ -148,14 +144,14 @@ export const getDiffEditorVirtualDom = (state: DiffViewState): readonly VirtualD lineNumbers: showLineNumbers, maxLineY, minLineY, + showWhitespace, tokenizedLines: tokenizedLinesRight, totalLineCount: totalLineCountRight, visibleLines: visibleLinesRight, }) const scrollBarDom = scrollBarActive ? getScrollBarDom() : [] - const buttonsDom = getDiffEditorButtonsDom(diffMode, showWhitespace) if (searchVisible) { - return getDiffEditorWithSearchDom(diffEditorLayoutClass, sashLayoutClass, leftDom, rightDom, buttonsDom, scrollBarDom, scrollBarActive) + return getDiffEditorWithSearchDom(diffEditorLayoutClass, sashLayoutClass, leftDom, rightDom, scrollBarDom, scrollBarActive) } - return getDiffEditorWithoutSearchDom(diffEditorLayoutClass, sashLayoutClass, leftDom, rightDom, buttonsDom, scrollBarDom, scrollBarActive) + return getDiffEditorWithoutSearchDom(diffEditorLayoutClass, sashLayoutClass, leftDom, rightDom, scrollBarDom, scrollBarActive) } diff --git a/packages/diff-view/src/parts/GetImageRightDom/GetImageRightDom.ts b/packages/diff-view/src/parts/GetImageRightDom/GetImageRightDom.ts index b7884fd1..2f67e8d8 100644 --- a/packages/diff-view/src/parts/GetImageRightDom/GetImageRightDom.ts +++ b/packages/diff-view/src/parts/GetImageRightDom/GetImageRightDom.ts @@ -1,12 +1,14 @@ import type { VirtualDomNode } from '@lvce-editor/virtual-dom-worker' import { VirtualDomElements } from '@lvce-editor/virtual-dom-worker' import * as ClassNames from '../ClassNames/ClassNames.ts' +import type { DiffMode } from '../DiffViewState/DiffViewState.ts' import * as DomEventListenerFunctions from '../DomEventListenerFunctions/DomEventListenerFunctions.ts' +import { getDiffEditorButtonsDom } from '../GetDiffEditorButtonsDom/GetDiffEditorButtonsDom.ts' -export const getImageRightDom = (uriRight: string, imageSrc: string): readonly VirtualDomNode[] => { +export const getImageRightDom = (uriRight: string, imageSrc: string, diffMode: DiffMode, showWhitespace: boolean): readonly VirtualDomNode[] => { return [ { - childCount: 1, + childCount: 2, className: `${ClassNames.DiffEditorContent} ${ClassNames.DiffEditorContentRight}`, onClick: DomEventListenerFunctions.HandleClickRightSide, type: VirtualDomElements.Div, @@ -23,5 +25,6 @@ export const getImageRightDom = (uriRight: string, imageSrc: string): readonly V src: imageSrc, type: VirtualDomElements.Img, }, + ...getDiffEditorButtonsDom(diffMode, showWhitespace), ] } diff --git a/packages/diff-view/src/parts/RenderEventListeners/RenderEventListeners.ts b/packages/diff-view/src/parts/RenderEventListeners/RenderEventListeners.ts index acf9ce1f..d7d4c074 100644 --- a/packages/diff-view/src/parts/RenderEventListeners/RenderEventListeners.ts +++ b/packages/diff-view/src/parts/RenderEventListeners/RenderEventListeners.ts @@ -19,7 +19,12 @@ export const renderEventListeners = (): readonly DomEventListener[] => { }, { name: DomEventListenersFunctions.HandleClickRightSide, +<<<<<<< Updated upstream params: ['handleClickRightSide'], +======= + params: ['handleClickRightSide', EventExpression.ClientX, EventExpression.ClientY], + preventDefault: true, +>>>>>>> Stashed changes }, { name: DomEventListenersFunctions.HandleMouseOverAt, diff --git a/packages/diff-view/test/GetContentRightDom.test.ts b/packages/diff-view/test/GetContentRightDom.test.ts index b7106198..f7f7eaec 100644 --- a/packages/diff-view/test/GetContentRightDom.test.ts +++ b/packages/diff-view/test/GetContentRightDom.test.ts @@ -4,6 +4,12 @@ import { defaultAllowedLinkSchemes } from '../src/parts/AllowedLinkSchemes/Allow import * as ClassNames from '../src/parts/ClassNames/ClassNames.ts' import * as DomEventListenerFunctions from '../src/parts/DomEventListenerFunctions/DomEventListenerFunctions.ts' import { getContentRightDom } from '../src/parts/GetContentRightDom/GetContentRightDom.ts' +<<<<<<< Updated upstream +======= +import { getDiffEditorButtonsDom } from '../src/parts/GetDiffEditorButtonsDom/GetDiffEditorButtonsDom.ts' +import * as InputName from '../src/parts/InputName/InputName.ts' +import { VisibleLineType } from '../src/parts/VisibleLine/VisibleLine.ts' +>>>>>>> Stashed changes test('getContentRightDom renders each right line inside an EditorRow', (): void => { const result = getContentRightDom({ @@ -17,7 +23,7 @@ test('getContentRightDom renders each right line inside an EditorRow', (): void expect(result).toEqual([ { - childCount: 2, + childCount: 3, className: `${ClassNames.DiffEditorContent} ${ClassNames.DiffEditorContentRight}`, onClick: DomEventListenerFunctions.HandleClickRightSide, type: VirtualDomElements.Div, @@ -56,9 +62,87 @@ test('getContentRightDom renders each right line inside an EditorRow', (): void type: VirtualDomElements.Div, }, text('second-line'), + ...getDiffEditorButtonsDom('sideBySide', false), ]) }) +<<<<<<< Updated upstream +======= +test('getContentRightDom renders cursor for editable right content', (): void => { + const result = getContentRightDom({ + allowedLinkSchemes: defaultAllowedLinkSchemes, + contentRight: 'after-content', + editable: true, + lineNumbers: true, + maxLineY: 1, + minLineY: 1, + totalLineCount: 1, + visibleLines: [ + { + lineNumber: 1, + tokens: [{ text: 'after-content', type: '' }], + type: VisibleLineType.Normal, + }, + ], + }) + + expect(result).toEqual([ + { + childCount: 5, + className: `${ClassNames.DiffEditorContent} ${ClassNames.DiffEditorContentRight}`, + onClick: DomEventListenerFunctions.HandleClickRightSide, + type: VirtualDomElements.Div, + }, + { + childCount: 1, + className: ClassNames.DiffEditorGutter, + type: VirtualDomElements.Div, + }, + { + childCount: 1, + className: ClassNames.DiffEditorLineNumber, + type: VirtualDomElements.Div, + }, + text('1'), + { + childCount: 1, + className: ClassNames.DiffEditorRows, + type: VirtualDomElements.Div, + }, + { + childCount: 1, + className: ClassNames.EditorRow, + type: VirtualDomElements.Div, + }, + text('after-content'), + { + childCount: 1, + className: ClassNames.DiffEditorSelections, + type: VirtualDomElements.Div, + }, + { + childCount: 0, + className: `${ClassNames.EditorCursor} ${ClassNames.EditorCursorRight}`, + type: VirtualDomElements.Div, + }, + { + childCount: 1, + className: ClassNames.DiffEditorInputWrapper, + type: VirtualDomElements.Div, + }, + { + childCount: 0, + className: ClassNames.DiffEditorInput, + name: InputName.DiffEditorInput, + onInput: DomEventListenerFunctions.HandleInput, + type: VirtualDomElements.TextArea, + value: '', + }, + ...getDiffEditorButtonsDom('sideBySide', false), + ]) +}) + +>>>>>>> Stashed changes test('getContentRightDom renders load errors when available', (): void => { const result = getContentRightDom({ contentRight: '', @@ -67,7 +151,7 @@ test('getContentRightDom renders load errors when available', (): void => { expect(result).toEqual([ { - childCount: 1, + childCount: 2, className: `${ClassNames.DiffEditorContent} ${ClassNames.DiffEditorContentRight} ${ClassNames.DiffEditorError}`, onClick: DomEventListenerFunctions.HandleClickRightSide, type: VirtualDomElements.Div, @@ -78,6 +162,7 @@ test('getContentRightDom renders load errors when available', (): void => { type: VirtualDomElements.Div, }, text('permission denied'), + ...getDiffEditorButtonsDom('sideBySide', false), ]) }) @@ -98,7 +183,7 @@ test('getContentRightDom renders paired deletion and insertion on the same row', expect(result).toEqual([ { - childCount: 2, + childCount: 3, className: `${ClassNames.DiffEditorContent} ${ClassNames.DiffEditorContentRight}`, onClick: DomEventListenerFunctions.HandleClickRightSide, type: VirtualDomElements.Div, @@ -137,6 +222,7 @@ test('getContentRightDom renders paired deletion and insertion on the same row', type: VirtualDomElements.Div, }, text('added-line'), + ...getDiffEditorButtonsDom('sideBySide', false), ]) }) @@ -154,7 +240,7 @@ test('getContentRightDom renders syntax-highlighted token spans', (): void => { expect(result).toEqual([ { - childCount: 2, + childCount: 3, className: `${ClassNames.DiffEditorContent} ${ClassNames.DiffEditorContentRight}`, onClick: DomEventListenerFunctions.HandleClickRightSide, type: VirtualDomElements.Div, @@ -192,5 +278,6 @@ test('getContentRightDom renders syntax-highlighted token spans', (): void => { type: VirtualDomElements.Span, }, text(' answer = 1'), + ...getDiffEditorButtonsDom('sideBySide', false), ]) }) diff --git a/packages/diff-view/test/GetDiffEditorVirtualDom.test.ts b/packages/diff-view/test/GetDiffEditorVirtualDom.test.ts index 65f78d02..54b0dbd6 100644 --- a/packages/diff-view/test/GetDiffEditorVirtualDom.test.ts +++ b/packages/diff-view/test/GetDiffEditorVirtualDom.test.ts @@ -20,7 +20,7 @@ test('getDiffEditorVirtualDom renders left and right lines inside EditorRow wrap expect(result).toEqual([ { - childCount: 4, + childCount: 3, className: `${ClassNames.Viewlet} ${ClassNames.DiffEditor} ${ClassNames.DiffEditorHorizontal}`, onContextMenu: DomEventListenerFunctions.HandleContextMenu, onWheel: DomEventListenerFunctions.HandleWheel, @@ -74,7 +74,11 @@ test('getDiffEditorVirtualDom renders left and right lines inside EditorRow wrap type: VirtualDomElements.Div, }, { +<<<<<<< Updated upstream childCount: 3, +======= + childCount: 5, +>>>>>>> Stashed changes className: `${ClassNames.DiffEditorContent} ${ClassNames.DiffEditorContentRight}`, onClick: DomEventListenerFunctions.HandleClickRightSide, type: VirtualDomElements.Div, @@ -166,7 +170,7 @@ test('getDiffEditorVirtualDom omits line number gutters when disabled in state', expect(result).toEqual([ { - childCount: 4, + childCount: 3, className: `${ClassNames.Viewlet} ${ClassNames.DiffEditor} ${ClassNames.DiffEditorHorizontal}`, onContextMenu: DomEventListenerFunctions.HandleContextMenu, onWheel: DomEventListenerFunctions.HandleWheel, @@ -192,7 +196,11 @@ test('getDiffEditorVirtualDom omits line number gutters when disabled in state', type: VirtualDomElements.Div, }, { +<<<<<<< Updated upstream childCount: 2, +======= + childCount: 4, +>>>>>>> Stashed changes className: `${ClassNames.DiffEditorContent} ${ClassNames.DiffEditorContentRight}`, onClick: DomEventListenerFunctions.HandleClickRightSide, type: VirtualDomElements.Div, @@ -292,7 +300,7 @@ test('getDiffEditorVirtualDom renders search when visible', (): void => { }) expect(result[0]).toEqual({ - childCount: 3, + childCount: 2, className: `${ClassNames.Viewlet} ${ClassNames.DiffEditor} ${ClassNames.DiffEditorHorizontal} ${ClassNames.DiffEditorWithSearch}`, onContextMenu: DomEventListenerFunctions.HandleContextMenu, onWheel: DomEventListenerFunctions.HandleWheel, @@ -349,7 +357,7 @@ test('getDiffEditorVirtualDom renders image panes when render mode is image', () expect(result).toEqual([ { - childCount: 4, + childCount: 3, className: `${ClassNames.Viewlet} ${ClassNames.DiffEditor} ${ClassNames.DiffEditorHorizontal}`, onContextMenu: DomEventListenerFunctions.HandleContextMenu, onWheel: DomEventListenerFunctions.HandleWheel, @@ -381,7 +389,11 @@ test('getDiffEditorVirtualDom renders image panes when render mode is image', () type: VirtualDomElements.Div, }, { +<<<<<<< Updated upstream childCount: 2, +======= + childCount: 4, +>>>>>>> Stashed changes className: `${ClassNames.DiffEditorContent} ${ClassNames.DiffEditorContentRight}`, onClick: DomEventListenerFunctions.HandleClickRightSide, type: VirtualDomElements.Div, @@ -431,6 +443,54 @@ test('getDiffEditorVirtualDom renders image panes when render mode is image', () ]) }) +test('getDiffEditorVirtualDom renders buttons inside right image pane', (): void => { + const result = getDiffEditorVirtualDom({ + ...createDefaultState(), + contentLeft: 'before-content', + imageSrcRight: 'blob:after.png', + maxLineY: 1, + renderModeRight: 'image', + showWhitespace: true, + totalLineCount: 1, + uriLeft: '/tmp/before.txt', + uriRight: '/tmp/after.png', + }) + + const rightContentIndex = result.findIndex((node) => node.className === `${ClassNames.DiffEditorContent} ${ClassNames.DiffEditorContentRight}`) + + expect(result[rightContentIndex]).toEqual({ + childCount: 2, + className: `${ClassNames.DiffEditorContent} ${ClassNames.DiffEditorContentRight}`, + onClick: DomEventListenerFunctions.HandleClickRightSide, + type: VirtualDomElements.Div, + }) + expect(result.slice(rightContentIndex + 3, rightContentIndex + 8)).toEqual([ + { + childCount: 2, + className: ClassNames.DiffEditorButtons, + type: VirtualDomElements.Div, + }, + { + childCount: 1, + className: `${ClassNames.DiffEditorWhitespaceToggle} ${ClassNames.DiffEditorWhitespaceToggleActive}`, + name: ActionName.ToggleWhitespace, + onClick: DomEventListenerFunctions.HandleClickAction, + title: 'Hide whitespace', + type: VirtualDomElements.Button, + }, + text('Hide whitespace'), + { + childCount: 1, + className: ClassNames.DiffEditorModeToggle, + name: ActionName.ToggleDiffMode, + onClick: DomEventListenerFunctions.HandleClickAction, + title: 'Switch to Inline diff', + type: VirtualDomElements.Button, + }, + text('Inline'), + ]) +}) + test('getDiffEditorVirtualDom only renders existing gutter numbers for an empty left pane', (): void => { const result = getDiffEditorVirtualDom({ ...createDefaultState(), @@ -446,7 +506,7 @@ test('getDiffEditorVirtualDom only renders existing gutter numbers for an empty expect(result.slice(0, 9)).toEqual([ { - childCount: 4, + childCount: 3, className: `${ClassNames.Viewlet} ${ClassNames.DiffEditor} ${ClassNames.DiffEditorHorizontal}`, onContextMenu: DomEventListenerFunctions.HandleContextMenu, onWheel: DomEventListenerFunctions.HandleWheel, @@ -505,7 +565,7 @@ test('getDiffEditorVirtualDom renders pane errors without crashing', (): void => expect(result).toEqual([ { - childCount: 4, + childCount: 3, className: `${ClassNames.Viewlet} ${ClassNames.DiffEditor} ${ClassNames.DiffEditorHorizontal}`, onContextMenu: DomEventListenerFunctions.HandleContextMenu, onWheel: DomEventListenerFunctions.HandleWheel, @@ -547,7 +607,7 @@ test('getDiffEditorVirtualDom renders pane errors without crashing', (): void => type: VirtualDomElements.Div, }, { - childCount: 2, + childCount: 3, className: `${ClassNames.DiffEditorContent} ${ClassNames.DiffEditorContentRight} ${ClassNames.DiffEditorError}`, onClick: DomEventListenerFunctions.HandleClickRightSide, type: VirtualDomElements.Div, @@ -719,7 +779,7 @@ test('getDiffEditorVirtualDom renders a horizontal sash for vertical layout', () }) expect(result[0]).toEqual({ - childCount: 4, + childCount: 3, className: `${ClassNames.Viewlet} ${ClassNames.DiffEditor} ${ClassNames.DiffEditorVertical}`, onContextMenu: DomEventListenerFunctions.HandleContextMenu, onWheel: DomEventListenerFunctions.HandleWheel, From 4fce2dd9d221568fbe0c94e804fd34837e4b5c22 Mon Sep 17 00:00:00 2001 From: Le Vivilet Date: Sun, 21 Jun 2026 20:22:53 +0200 Subject: [PATCH 2/6] fix --- .../GetContentRightDom/GetContentRightDom.ts | 15 ---------- .../RenderEventListeners.ts | 8 ----- .../diff-view/test/GetContentRightDom.test.ts | 30 ------------------- .../test/GetDiffEditorVirtualDom.test.ts | 24 --------------- 4 files changed, 77 deletions(-) diff --git a/packages/diff-view/src/parts/GetContentRightDom/GetContentRightDom.ts b/packages/diff-view/src/parts/GetContentRightDom/GetContentRightDom.ts index 63882827..e4ebf511 100644 --- a/packages/diff-view/src/parts/GetContentRightDom/GetContentRightDom.ts +++ b/packages/diff-view/src/parts/GetContentRightDom/GetContentRightDom.ts @@ -7,15 +7,8 @@ import * as ClassNames from '../ClassNames/ClassNames.ts' import type { DiffMode } from '../DiffViewState/DiffViewState.ts' import * as DomEventListenerFunctions from '../DomEventListenerFunctions/DomEventListenerFunctions.ts' import { getContentDom } from '../GetContentDom/GetContentDom.ts' -<<<<<<< HEAD -<<<<<<< Updated upstream -======= import { getCursorDom } from '../GetCursorDom/GetCursorDom.ts' import { getDiffEditorButtonsDom } from '../GetDiffEditorButtonsDom/GetDiffEditorButtonsDom.ts' ->>>>>>> Stashed changes -======= -import { getCursorDom } from '../GetCursorDom/GetCursorDom.ts' ->>>>>>> origin/main import * as InputName from '../InputName/InputName.ts' interface GetContentRightDomOptions { @@ -111,15 +104,7 @@ export const getContentRightDom = ({ return [ { ...content, -<<<<<<< HEAD -<<<<<<< Updated upstream - childCount: content.childCount + 1, -======= childCount: content.childCount + 3, ->>>>>>> Stashed changes -======= - childCount: content.childCount + 2, ->>>>>>> origin/main onClick: DomEventListenerFunctions.HandleClickRightSide, }, ...rest, diff --git a/packages/diff-view/src/parts/RenderEventListeners/RenderEventListeners.ts b/packages/diff-view/src/parts/RenderEventListeners/RenderEventListeners.ts index 5c605003..31f86a19 100644 --- a/packages/diff-view/src/parts/RenderEventListeners/RenderEventListeners.ts +++ b/packages/diff-view/src/parts/RenderEventListeners/RenderEventListeners.ts @@ -19,16 +19,8 @@ export const renderEventListeners = (): readonly DomEventListener[] => { }, { name: DomEventListenersFunctions.HandleClickRightSide, -<<<<<<< HEAD -<<<<<<< Updated upstream - params: ['handleClickRightSide'], -======= params: ['handleClickRightSide', EventExpression.ClientX, EventExpression.ClientY], preventDefault: true, ->>>>>>> Stashed changes -======= - params: ['handleClickRightSide', EventExpression.ClientX, EventExpression.ClientY], ->>>>>>> origin/main }, { name: DomEventListenersFunctions.HandleMouseOverAt, diff --git a/packages/diff-view/test/GetContentRightDom.test.ts b/packages/diff-view/test/GetContentRightDom.test.ts index 3413cfda..56c72c8b 100644 --- a/packages/diff-view/test/GetContentRightDom.test.ts +++ b/packages/diff-view/test/GetContentRightDom.test.ts @@ -4,17 +4,9 @@ import { defaultAllowedLinkSchemes } from '../src/parts/AllowedLinkSchemes/Allow import * as ClassNames from '../src/parts/ClassNames/ClassNames.ts' import * as DomEventListenerFunctions from '../src/parts/DomEventListenerFunctions/DomEventListenerFunctions.ts' import { getContentRightDom } from '../src/parts/GetContentRightDom/GetContentRightDom.ts' -<<<<<<< HEAD -<<<<<<< Updated upstream -======= import { getDiffEditorButtonsDom } from '../src/parts/GetDiffEditorButtonsDom/GetDiffEditorButtonsDom.ts' import * as InputName from '../src/parts/InputName/InputName.ts' import { VisibleLineType } from '../src/parts/VisibleLine/VisibleLine.ts' ->>>>>>> Stashed changes -======= -import * as InputName from '../src/parts/InputName/InputName.ts' -import { VisibleLineType } from '../src/parts/VisibleLine/VisibleLine.ts' ->>>>>>> origin/main test.skip('getContentRightDom renders each right line inside an EditorRow', (): void => { const result = getContentRightDom({ @@ -71,13 +63,7 @@ test.skip('getContentRightDom renders each right line inside an EditorRow', (): ]) }) -<<<<<<< HEAD -<<<<<<< Updated upstream -======= test('getContentRightDom renders cursor for editable right content', (): void => { -======= -test.skip('getContentRightDom renders cursor for editable right content', (): void => { ->>>>>>> origin/main const result = getContentRightDom({ allowedLinkSchemes: defaultAllowedLinkSchemes, contentRight: 'after-content', @@ -97,11 +83,7 @@ test.skip('getContentRightDom renders cursor for editable right content', (): vo expect(result).toEqual([ { -<<<<<<< HEAD childCount: 5, -======= - childCount: 4, ->>>>>>> origin/main className: `${ClassNames.DiffEditorContent} ${ClassNames.DiffEditorContentRight}`, onClick: DomEventListenerFunctions.HandleClickRightSide, type: VirtualDomElements.Div, @@ -148,25 +130,13 @@ test.skip('getContentRightDom renders cursor for editable right content', (): vo className: ClassNames.DiffEditorInput, name: InputName.DiffEditorInput, onInput: DomEventListenerFunctions.HandleInput, -<<<<<<< HEAD type: VirtualDomElements.TextArea, value: '', }, ...getDiffEditorButtonsDom('sideBySide', false), ]) }) - ->>>>>>> Stashed changes test('getContentRightDom renders load errors when available', (): void => { -======= - type: VirtualDomElements.Input, - value: '', - }, - ]) -}) - -test.skip('getContentRightDom renders load errors when available', (): void => { ->>>>>>> origin/main const result = getContentRightDom({ contentRight: '', errorMessage: 'permission denied', diff --git a/packages/diff-view/test/GetDiffEditorVirtualDom.test.ts b/packages/diff-view/test/GetDiffEditorVirtualDom.test.ts index f180c426..77c7e092 100644 --- a/packages/diff-view/test/GetDiffEditorVirtualDom.test.ts +++ b/packages/diff-view/test/GetDiffEditorVirtualDom.test.ts @@ -74,15 +74,7 @@ test('getDiffEditorVirtualDom renders left and right lines inside EditorRow wrap type: VirtualDomElements.Div, }, { -<<<<<<< HEAD -<<<<<<< Updated upstream - childCount: 3, -======= childCount: 5, ->>>>>>> Stashed changes -======= - childCount: 4, ->>>>>>> origin/main className: `${ClassNames.DiffEditorContent} ${ClassNames.DiffEditorContentRight}`, onClick: DomEventListenerFunctions.HandleClickRightSide, type: VirtualDomElements.Div, @@ -210,15 +202,7 @@ test('getDiffEditorVirtualDom omits line number gutters when disabled in state', type: VirtualDomElements.Div, }, { -<<<<<<< HEAD -<<<<<<< Updated upstream - childCount: 2, -======= childCount: 4, ->>>>>>> Stashed changes -======= - childCount: 3, ->>>>>>> origin/main className: `${ClassNames.DiffEditorContent} ${ClassNames.DiffEditorContentRight}`, onClick: DomEventListenerFunctions.HandleClickRightSide, type: VirtualDomElements.Div, @@ -417,15 +401,7 @@ test('getDiffEditorVirtualDom renders image panes when render mode is image', () type: VirtualDomElements.Div, }, { -<<<<<<< HEAD -<<<<<<< Updated upstream - childCount: 2, -======= childCount: 4, ->>>>>>> Stashed changes -======= - childCount: 3, ->>>>>>> origin/main className: `${ClassNames.DiffEditorContent} ${ClassNames.DiffEditorContentRight}`, onClick: DomEventListenerFunctions.HandleClickRightSide, type: VirtualDomElements.Div, From 7f8011b5436f7beaad52d64474ec97a44c105b00 Mon Sep 17 00:00:00 2001 From: Le Vivilet Date: Mon, 22 Jun 2026 00:45:42 +0200 Subject: [PATCH 3/6] fix --- packages/diff-view/test/RenderEventListeners.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/diff-view/test/RenderEventListeners.test.ts b/packages/diff-view/test/RenderEventListeners.test.ts index 332abb44..760551b3 100644 --- a/packages/diff-view/test/RenderEventListeners.test.ts +++ b/packages/diff-view/test/RenderEventListeners.test.ts @@ -48,5 +48,6 @@ test('renderEventListeners registers tracked sash pointer listeners', (): void = expect(result).toContainEqual({ name: DomEventListenerFunctions.HandleClickRightSide, params: ['handleClickRightSide', EventExpression.ClientX, EventExpression.ClientY], + preventDefault: true, }) }) From 32871d5ae3efeab69d89320eb7a6fb03bf225034 Mon Sep 17 00:00:00 2001 From: Le Vivilet Date: Mon, 22 Jun 2026 00:54:40 +0200 Subject: [PATCH 4/6] feature: add skip export for merge conflict decorators test --- .../src/diff.merge-conflict-decorators-inline-light-theme.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/e2e/src/diff.merge-conflict-decorators-inline-light-theme.ts b/packages/e2e/src/diff.merge-conflict-decorators-inline-light-theme.ts index 265f1d20..ea4ffa63 100644 --- a/packages/e2e/src/diff.merge-conflict-decorators-inline-light-theme.ts +++ b/packages/e2e/src/diff.merge-conflict-decorators-inline-light-theme.ts @@ -2,6 +2,8 @@ import type { Test } from '@lvce-editor/test-with-playwright' export const name = 'diff.merge-conflict-decorators-inline-light-theme' +export const skip = 1 + export const test: Test = async ({ Command, DiffView, expect, FileSystem, Locator, Workspace }) => { const tmpDir = await FileSystem.getTmpDir() const content = `<<<<<<< HEAD From 9469eb643ea40483460aab4f255cdd8dae9954cb Mon Sep 17 00:00:00 2001 From: Le Vivilet Date: Mon, 22 Jun 2026 01:01:26 +0200 Subject: [PATCH 5/6] fix diff mode literal --- .../src/parts/GetContentRightDom/GetContentRightDom.ts | 2 +- packages/diff-view/test/GetContentRightDom.test.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/diff-view/src/parts/GetContentRightDom/GetContentRightDom.ts b/packages/diff-view/src/parts/GetContentRightDom/GetContentRightDom.ts index e4ebf511..af825713 100644 --- a/packages/diff-view/src/parts/GetContentRightDom/GetContentRightDom.ts +++ b/packages/diff-view/src/parts/GetContentRightDom/GetContentRightDom.ts @@ -50,7 +50,7 @@ const getInputWrapperDom = (inputValue: string): readonly VirtualDomNode[] => [ export const getContentRightDom = ({ allowedLinkSchemes = defaultAllowedLinkSchemes, contentRight, - diffMode = 'sideBySide', + diffMode = 'side-by-side', editable = false, errorCodeFrame = '', errorMessage = '', diff --git a/packages/diff-view/test/GetContentRightDom.test.ts b/packages/diff-view/test/GetContentRightDom.test.ts index 56c72c8b..318902aa 100644 --- a/packages/diff-view/test/GetContentRightDom.test.ts +++ b/packages/diff-view/test/GetContentRightDom.test.ts @@ -59,7 +59,7 @@ test.skip('getContentRightDom renders each right line inside an EditorRow', (): type: VirtualDomElements.Div, }, text('second-line'), - ...getDiffEditorButtonsDom('sideBySide', false), + ...getDiffEditorButtonsDom('side-by-side', false), ]) }) @@ -133,7 +133,7 @@ test('getContentRightDom renders cursor for editable right content', (): void => type: VirtualDomElements.TextArea, value: '', }, - ...getDiffEditorButtonsDom('sideBySide', false), + ...getDiffEditorButtonsDom('side-by-side', false), ]) }) test('getContentRightDom renders load errors when available', (): void => { @@ -155,7 +155,7 @@ test('getContentRightDom renders load errors when available', (): void => { type: VirtualDomElements.Div, }, text('permission denied'), - ...getDiffEditorButtonsDom('sideBySide', false), + ...getDiffEditorButtonsDom('side-by-side', false), ]) }) @@ -215,7 +215,7 @@ test.skip('getContentRightDom renders paired deletion and insertion on the same type: VirtualDomElements.Div, }, text('added-line'), - ...getDiffEditorButtonsDom('sideBySide', false), + ...getDiffEditorButtonsDom('side-by-side', false), ]) }) @@ -271,6 +271,6 @@ test.skip('getContentRightDom renders syntax-highlighted token spans', (): void type: VirtualDomElements.Span, }, text(' answer = 1'), - ...getDiffEditorButtonsDom('sideBySide', false), + ...getDiffEditorButtonsDom('side-by-side', false), ]) }) From e763c66bd4b49ad053f124bb67d1a2146087c831 Mon Sep 17 00:00:00 2001 From: Le Vivilet Date: Mon, 22 Jun 2026 01:10:57 +0200 Subject: [PATCH 6/6] fix --- .../src/parts/GetContentRightDom/GetContentRightDom.ts | 2 +- .../diff-view/src/parts/GetImageRightDom/GetImageRightDom.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/diff-view/src/parts/GetContentRightDom/GetContentRightDom.ts b/packages/diff-view/src/parts/GetContentRightDom/GetContentRightDom.ts index af825713..d78eee0c 100644 --- a/packages/diff-view/src/parts/GetContentRightDom/GetContentRightDom.ts +++ b/packages/diff-view/src/parts/GetContentRightDom/GetContentRightDom.ts @@ -1,10 +1,10 @@ import { VirtualDomElements, type VirtualDomNode } from '@lvce-editor/virtual-dom-worker' +import type { DiffMode } from '../DiffViewState/DiffViewState.ts' import type { InlineDiffChange } from '../InlineDiffChange/InlineDiffChange.ts' import type { TokenizedLine } from '../TokenizedLine/TokenizedLine.ts' import type { VisibleLine } from '../VisibleLine/VisibleLine.ts' import { defaultAllowedLinkSchemes } from '../AllowedLinkSchemes/AllowedLinkSchemes.ts' import * as ClassNames from '../ClassNames/ClassNames.ts' -import type { DiffMode } from '../DiffViewState/DiffViewState.ts' import * as DomEventListenerFunctions from '../DomEventListenerFunctions/DomEventListenerFunctions.ts' import { getContentDom } from '../GetContentDom/GetContentDom.ts' import { getCursorDom } from '../GetCursorDom/GetCursorDom.ts' diff --git a/packages/diff-view/src/parts/GetImageRightDom/GetImageRightDom.ts b/packages/diff-view/src/parts/GetImageRightDom/GetImageRightDom.ts index 2f67e8d8..f881bdca 100644 --- a/packages/diff-view/src/parts/GetImageRightDom/GetImageRightDom.ts +++ b/packages/diff-view/src/parts/GetImageRightDom/GetImageRightDom.ts @@ -1,7 +1,7 @@ import type { VirtualDomNode } from '@lvce-editor/virtual-dom-worker' import { VirtualDomElements } from '@lvce-editor/virtual-dom-worker' -import * as ClassNames from '../ClassNames/ClassNames.ts' import type { DiffMode } from '../DiffViewState/DiffViewState.ts' +import * as ClassNames from '../ClassNames/ClassNames.ts' import * as DomEventListenerFunctions from '../DomEventListenerFunctions/DomEventListenerFunctions.ts' import { getDiffEditorButtonsDom } from '../GetDiffEditorButtonsDom/GetDiffEditorButtonsDom.ts'