Skip to content

Commit

Permalink
Small fixes (#38)
Browse files Browse the repository at this point in the history
* better performance for large table search

* render standard annots properly

* bump `pdf.js` version for better text selection

* remove appdata on uninstall (nsis)

* fixed recursive update problem in tableview

* Update quasar.config.js

* update workflow
HuntFeng authored May 11, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 2fada38 commit ec3e74a
Showing 4 changed files with 24 additions and 15 deletions.
2 changes: 2 additions & 0 deletions quasar.config.js
Original file line number Diff line number Diff line change
@@ -210,6 +210,8 @@ module.exports = configure(function (/* ctx */) {
},
win: {
target: "nsis",
},
nsis: {
deleteAppDataOnUninstall: true,
},
mac: {
1 change: 0 additions & 1 deletion src/components/library/ActionBar.vue
Original file line number Diff line number Diff line change
@@ -131,7 +131,6 @@ const searchText = computed({
return props.searchString;
},
set: debounce((text: string) => {
// searchStart(text);
emit("update:searchString", text);
}, 500),
});
4 changes: 0 additions & 4 deletions src/components/library/TableProjectRow.vue
Original file line number Diff line number Diff line change
@@ -71,8 +71,4 @@ function authorString(authors: Author[]) {
}
return names.join(", ");
}
defineExpose({
authorString,
});
</script>
32 changes: 22 additions & 10 deletions src/components/library/TableView.vue
Original file line number Diff line number Diff line change
@@ -46,7 +46,6 @@
@click="clickProject(props.row, props.rowIndex)"
@dblclick="dblclickProject(props.row)"
@contextmenu="toggleContextMenu(props.row, props.rowIndex)"
ref="projectRow"
></TableProjectRow>

<!-- Expanded Rows -->
@@ -88,7 +87,7 @@
<script setup lang="ts">
// types
import { computed, PropType, ref } from "vue";
import { Project, Note } from "src/backend/database";
import { Project, Note, Author } from "src/backend/database";
import { QTable, QTableColumn } from "quasar";
// components
import TableItemRow from "./TableItemRow.vue";
@@ -113,7 +112,6 @@ const emit = defineEmits([
"update:selectedProject",
]);
const projectRow = ref<typeof TableProjectRow | null>(null);
const isClickingPDF = ref(false);
const showExpansion = ref(false);
const expansionText = ref<string[]>([]);
@@ -138,6 +136,22 @@ const headers = computed(() => {
] as QTableColumn[];
});
/**
* Convert array of author objects to string
* @param authors
*/
function authorString(authors: Author[] | undefined) {
if (!!!authors?.length) return "";
let names = [];
for (let author of authors) {
if (!!!author) continue;
if (!!author.literal) names.push(author.literal);
else names.push(`${author.given} ${author.family}`);
}
return names.join(", ");
}
/**
* Select a row in the table
* @param row
@@ -228,13 +242,11 @@ function searchProject(
}
// search authors
if (projectRow.value) {
let authors = projectRow.value.authorString(row.author);
if (authors.search(re) != -1) {
text = authors.replace(re, `<span class="bg-primary">${terms}</span>`);
expansionText.value.push(`Authors: ${text}`);
return true;
}
let authors = authorString(row.author);
if (authors.search(re) != -1) {
text = authors.replace(re, `<span class="bg-primary">${terms}</span>`);
expansionText.value.push(`Authors: ${text}`);
return true;
}
// search notes

0 comments on commit ec3e74a

Please sign in to comment.