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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<p-messages *ngIf="codePanelData && !isLoading && isDiffView && !codePanelData?.hasDiff" [(value)]="noDiffInContentMessage" [closable]="false" />
<div *ngIf="codePanelRowSource;" class="viewport {{languageSafeName!}}" (click)="onCodePanelItemClick($event)">
<div *uiScroll="let item of codePanelRowSource; let index = index" class="code-line" [attr.data-node-id]="item.nodeIdHashed"
[attr.data-row-position-in-group]="item.rowPositionInGroup" [ngClass]="getRowClassObject(item)">
[attr.data-row-position-in-group]="item.rowPositionInGroup" [attr.data-row-type]="item.type" [ngClass]="getRowClassObject(item)">
<ng-container *ngIf="item.type === CodePanelRowDatatype.CodeLine || item.type === CodePanelRowDatatype.Documentation">
<div class="line-actions">
<span *ngIf="showLineNumbers" class="line-number first">{{item.lineNumber}}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,10 @@ export class CodePanelComponent implements OnChanges{
}

toggleNodeComments(target: Element) {
const nodeIdHashed = target.closest('.code-line')!.getAttribute('data-node-id');
const rowPositionInGroup = parseInt(target.closest('.code-line')!.getAttribute('data-row-position-in-group')!, 10);
const codeLine = target.closest('.code-line')!;
const nodeIdHashed = codeLine.getAttribute('data-node-id');
const rowPositionInGroup = parseInt(codeLine.getAttribute('data-row-position-in-group')!, 10);
const rowType = codeLine.getAttribute('data-row-type')!;
const existingCommentThread = this.codePanelData?.nodeMetaData[nodeIdHashed!]?.commentThread;
const exisitngCodeLine = this.codePanelData?.nodeMetaData[nodeIdHashed!]?.codeLines[rowPositionInGroup];

Expand All @@ -161,7 +163,7 @@ export class CodePanelComponent implements OnChanges{
commentThreadRow.associatedRowPositionInGroup = rowPositionInGroup;
this.codePanelData!.nodeMetaData[nodeIdHashed!].commentThread = {};
this.codePanelData!.nodeMetaData[nodeIdHashed!].commentThread[rowPositionInGroup] = commentThreadRow;
this.insertItemsIntoScroller([commentThreadRow], nodeIdHashed!, rowPositionInGroup);
this.insertItemsIntoScroller([commentThreadRow], nodeIdHashed!, rowType, rowPositionInGroup);
}
else {
for (let i = 0; i < this.codePanelRowData.length; i++) {
Expand All @@ -175,11 +177,13 @@ export class CodePanelComponent implements OnChanges{
}

async toggleNodeDocumentation(target: Element) {
const nodeIdHashed = target.closest(".code-line")!.getAttribute('data-node-id');
const codeLine = target.closest('.code-line')!;
const nodeIdHashed = codeLine.getAttribute('data-node-id');
const rowType = codeLine.getAttribute('data-row-type')!;

if (target.classList.contains('bi-arrow-up-square')) {
const documentationData = this.codePanelData?.nodeMetaData[nodeIdHashed!]?.documentation;
await this.insertItemsIntoScroller(documentationData!, nodeIdHashed!, -1, "toggleDocumentationClasses", "bi-arrow-up-square", "bi-arrow-down-square");
await this.insertItemsIntoScroller(documentationData!, nodeIdHashed!, rowType,-1, "toggleDocumentationClasses", "bi-arrow-up-square", "bi-arrow-down-square");
target.classList.remove('bi-arrow-up-square')
target.classList.add('bi-arrow-down-square');
} else if (target.classList.contains('bi-arrow-down-square')) {
Expand Down Expand Up @@ -241,8 +245,8 @@ export class CodePanelComponent implements OnChanges{
this.loadCodePanelViewPort();
}

async insertItemsIntoScroller(itemsToInsert: CodePanelRowData[], nodeIdhashed: string, insertPosition : number,
propertyToChange?: string, iconClassToremove?: string, iconClassToAdd?: string) {
async insertItemsIntoScroller(itemsToInsert: CodePanelRowData[], nodeIdhashed: string, targetRowType: string,
insertPosition : number, propertyToChange?: string, iconClassToremove?: string, iconClassToAdd?: string) {
await this.codePanelRowSource?.adapter?.relax();

let preData = [];
Expand All @@ -259,7 +263,7 @@ export class CodePanelComponent implements OnChanges{
break;
}

if (insertPosition == this.codePanelRowData[nodeIndex].rowPositionInGroup) {
if (insertPosition == this.codePanelRowData[nodeIndex].rowPositionInGroup && this.codePanelRowData[nodeIndex].type === targetRowType) {
insertPositionFound = true;
}
}
Expand Down