Skip to content

Commit

Permalink
fix: content navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
ItalloDornelas committed Jul 31, 2024
1 parent c014d85 commit 95bb620
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions src/syncfusion/navigationFields/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ export class IaraSyncfusionNavigationFieldManager extends IaraEditorNavigationFi
if (!content.includes("?")) this._documentEditor.editor.insertText(`?`);
}
this.getBookmarks();
this.insertedBookmark = this.bookmarks.filter(bookmark =>
bookmark.name === `${type}-${bookmarksCount}`)[0];
this.isFirstNextNavigation = true;
this.isFirstPreviousNavigation = true;
this.selectBookmark(`${type}-${bookmarksCount}`, true);
Expand All @@ -101,12 +103,6 @@ export class IaraSyncfusionNavigationFieldManager extends IaraEditorNavigationFi
const editorBookmarks = this._documentEditor.getBookmarks();
this.updateBookmark(editorBookmarks);
this.removeEmptyField(editorBookmarks);
if (this.isFirstNextNavigation || this.isFirstPreviousNavigation) {
this.insertedBookmark = this.bookmarks.filter(
bookmark =>
bookmark.name === editorBookmarks[editorBookmarks.length - 1]
)[0];
}
this.sortByPosition();

if (setColor) this.setColor();
Expand Down Expand Up @@ -483,8 +479,6 @@ export class IaraSyncfusionNavigationFieldManager extends IaraEditorNavigationFi
checkIsSelectedAndUpdatePrevious(
previousIndex: number
): IaraNavigationBookmark {
let selected = this.bookmarks[previousIndex];

const compareCurrentOffsetWithPreviousOffset =
this.currentSelectionOffset.start &&
this.currentSelectionOffset.start ===
Expand All @@ -495,18 +489,10 @@ export class IaraSyncfusionNavigationFieldManager extends IaraEditorNavigationFi
this.currentSelectionOffset.start &&
this.currentSelectionOffset.start === this.nextBookmark.offset.start &&
this.currentSelectionOffset.end === this.nextBookmark.offset.end;

const compareCurrentOffsetWithSelectedOffset =
this.previousBookmark.offset.start &&
this.previousBookmark.name !== selected.name &&
previousIndex !== 0;

if (
compareCurrentOffsetWithPreviousOffset ||
compareCurrentOffsetWithNextOffset ||
compareCurrentOffsetWithSelectedOffset
compareCurrentOffsetWithNextOffset
) {
selected = this.bookmarks[previousIndex - 1];
return previousIndex <= 0
? this.bookmarks[this.bookmarks.length - 1]
: this.bookmarks[previousIndex - 1];
Expand Down

0 comments on commit 95bb620

Please sign in to comment.