mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
fix
This commit is contained in:
parent
071c4893c2
commit
ccfd54fcfe
1 changed files with 9 additions and 27 deletions
|
|
@ -366,16 +366,18 @@ class InlineDiffsService extends Disposable implements IInlineDiffsService {
|
||||||
}
|
}
|
||||||
if (diffZones.length === 0) return
|
if (diffZones.length === 0) return
|
||||||
|
|
||||||
const id2 = this._consistentItemService.addConsistentItemToURI({
|
const consistentItemId = this._consistentItemService.addConsistentItemToURI({
|
||||||
uri,
|
uri,
|
||||||
fn: (editor) => {
|
fn: (editor) => {
|
||||||
const buttonsWidget = new AcceptAllRejectAllWidget({
|
const buttonsWidget = new AcceptAllRejectAllWidget({
|
||||||
editor,
|
editor,
|
||||||
onAccept: () => {
|
onAcceptAll: () => {
|
||||||
|
console.log('ACCEPTING ALL')
|
||||||
this.removeDiffAreas({ uri, behavior: 'accept' })
|
this.removeDiffAreas({ uri, behavior: 'accept' })
|
||||||
this._metricsService.capture('Accept All', {})
|
this._metricsService.capture('Accept All', {})
|
||||||
},
|
},
|
||||||
onReject: () => {
|
onRejectAll: () => {
|
||||||
|
console.log('RE ALL')
|
||||||
this.removeDiffAreas({ uri, behavior: 'reject' })
|
this.removeDiffAreas({ uri, behavior: 'reject' })
|
||||||
this._metricsService.capture('Reject All', {})
|
this._metricsService.capture('Reject All', {})
|
||||||
},
|
},
|
||||||
|
|
@ -385,7 +387,7 @@ class InlineDiffsService extends Disposable implements IInlineDiffsService {
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
return () => { this._consistentItemService.removeConsistentItemFromURI(id2) }
|
return () => { this._consistentItemService.removeConsistentItemFromURI(consistentItemId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -608,26 +610,6 @@ class InlineDiffsService extends Disposable implements IInlineDiffsService {
|
||||||
disposeInThisEditorFns.push(() => { this._consistentItemService.removeConsistentItemFromURI(consistentWidgetId) })
|
disposeInThisEditorFns.push(() => { this._consistentItemService.removeConsistentItemFromURI(consistentWidgetId) })
|
||||||
}
|
}
|
||||||
|
|
||||||
const DELETE_ME = this._consistentItemService.addConsistentItemToURI({
|
|
||||||
uri,
|
|
||||||
fn: (editor) => {
|
|
||||||
const buttonsWidget = new AcceptAllRejectAllWidget({
|
|
||||||
editor,
|
|
||||||
onAccept: () => {
|
|
||||||
this.acceptDiff({ diffid })
|
|
||||||
this._metricsService.capture('Accept Diff', {})
|
|
||||||
},
|
|
||||||
onReject: () => {
|
|
||||||
this.rejectDiff({ diffid })
|
|
||||||
this._metricsService.capture('Reject Diff', {})
|
|
||||||
},
|
|
||||||
})
|
|
||||||
return () => { buttonsWidget.dispose() }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
disposeInThisEditorFns.push(() => { this._consistentItemService.removeConsistentItemFromURI(DELETE_ME) })
|
|
||||||
|
|
||||||
|
|
||||||
const disposeInEditor = () => { disposeInThisEditorFns.forEach(f => f()) }
|
const disposeInEditor = () => { disposeInThisEditorFns.forEach(f => f()) }
|
||||||
return disposeInEditor;
|
return disposeInEditor;
|
||||||
|
|
||||||
|
|
@ -1773,7 +1755,7 @@ class AcceptAllRejectAllWidget extends Widget implements IOverlayWidget {
|
||||||
private readonly editor: ICodeEditor;
|
private readonly editor: ICodeEditor;
|
||||||
private readonly ID: string;
|
private readonly ID: string;
|
||||||
|
|
||||||
constructor({ editor, onAccept, onReject }: { editor: ICodeEditor, onAccept: () => void, onReject: () => void }) {
|
constructor({ editor, onAcceptAll, onRejectAll }: { editor: ICodeEditor, onAcceptAll: () => void, onRejectAll: () => void }) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.ID = editor.getModel()?.uri.fsPath + '';
|
this.ID = editor.getModel()?.uri.fsPath + '';
|
||||||
|
|
@ -1793,7 +1775,7 @@ class AcceptAllRejectAllWidget extends Widget implements IOverlayWidget {
|
||||||
buttons.style.alignItems = 'center';
|
buttons.style.alignItems = 'center';
|
||||||
|
|
||||||
// Style accept button
|
// Style accept button
|
||||||
acceptButton.onclick = () => onAccept;
|
acceptButton.addEventListener('click', onAcceptAll)
|
||||||
acceptButton.textContent = 'Accept All';
|
acceptButton.textContent = 'Accept All';
|
||||||
acceptButton.style.backgroundColor = acceptAllBg;
|
acceptButton.style.backgroundColor = acceptAllBg;
|
||||||
acceptButton.style.border = acceptBorder;
|
acceptButton.style.border = acceptBorder;
|
||||||
|
|
@ -1804,7 +1786,7 @@ class AcceptAllRejectAllWidget extends Widget implements IOverlayWidget {
|
||||||
acceptButton.style.cursor = 'pointer';
|
acceptButton.style.cursor = 'pointer';
|
||||||
|
|
||||||
// Style reject button
|
// Style reject button
|
||||||
rejectButton.onclick = () => onReject;
|
rejectButton.addEventListener('click', onRejectAll)
|
||||||
rejectButton.textContent = 'Reject All';
|
rejectButton.textContent = 'Reject All';
|
||||||
rejectButton.style.backgroundColor = rejectAllBg;
|
rejectButton.style.backgroundColor = rejectAllBg;
|
||||||
rejectButton.style.border = rejectBorder;
|
rejectButton.style.border = rejectBorder;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue