Skip to content

Commit

Permalink
Merge pull request #23 from iiz00/develop
Browse files Browse the repository at this point in the history
Fixed jumping to outline elements in Reading view
  • Loading branch information
iiz00 committed Mar 8, 2024
2 parents 618fe65 + 0bf947a commit eb29fdf
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 15 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ If you like my plugin, I would appreciate it if you could buy me a cup of coffee
[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/iiz00)<br><br>

## Changelog
- 0.5.1
- Fixed
- Fixed a problem in Reading view where clicking on an outline element would not jump to that position properly. Now the position of the outline element is highlighted when you jump to it.
- 0.5.0
- New function
- Canvas support
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "multiple-notes-outline",
"name": "Multiple Notes Outline",
"version": "0.5.0",
"version": "0.5.1",
"minAppVersion": "1.5.8",
"description": "Add custom views which show outlines of multiple notes with headings, links, tags and list items.",
"author": "iiz",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "multiple-notes-outline",
"version": "0.5.0",
"version": "0.5.1",
"description": "Add custom views which shows outline of multiple notes at once",
"main": "main.js",
"scripts": {
Expand Down
29 changes: 16 additions & 13 deletions src/constructDOM.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1254,18 +1254,21 @@ export function constructOutlineDOM (file:TFile, info:FileInfo, data: OutlineDat
export function scrollToElement(line: number, col: number, app: App): void {
const view = app.workspace.getActiveViewOfType(MarkdownView);
if (view) {
view.editor.focus();
view.editor.setCursor (line, col);
view.editor.scrollIntoView( {
from: {
line: line,
ch:0
},
to: {
line: line,
ch:0
}
}, true);
//view.editor.focus();
// view.editor.setCursor (line, col);
// view.editor.scrollIntoView( {
// from: {
// line: line,
// ch:0
// },
// to: {
// line: line,
// ch:0
// }
// }, true);
// view.editor.scrollTo(5);
// view.previewMode.applyScroll(line);
view.setEphemeralState({line});
}
}

Expand All @@ -1290,7 +1293,7 @@ function attachFileInfo (targetEl: HTMLElement, status: FileStatus, info: FileIn
if (firsttagIndex >= 0){
targetEl.dataset.subinfo = data[firsttagIndex].displayText;
}
}
}
break;
case 'none':
break;
Expand Down
6 changes: 6 additions & 0 deletions src/fileView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ export class MultipleNotesOutlineView extends ItemView {

// ファイル修正、削除、リネームなどの際の自動更新
private async autoRefresh(){
const startTime = performance.now();

if (!(this.flagChanged || this.flagRegetTarget || this.flagSaveSettings)){
return;
}
Expand Down Expand Up @@ -390,6 +392,10 @@ export class MultipleNotesOutlineView extends ItemView {
this.flagRegetTarget = false;
this.flagChanged = false;
this.flagSaveSettings = false;
const endTime = performance.now();
if (this.settings.showDebugInfo){
console.log('Multiple Notes Outline: time required to auto refresh, file view: ', endTime - startTime);
}
}

// リフレッシュセンター
Expand Down

0 comments on commit eb29fdf

Please sign in to comment.