diff --git a/app/imports/api/parenting/nodesToTree.js b/app/imports/api/parenting/nodesToTree.js
index fae36df1..86fbe1c1 100644
--- a/app/imports/api/parenting/nodesToTree.js
+++ b/app/imports/api/parenting/nodesToTree.js
@@ -1,4 +1,4 @@
-import { union, difference, sortBy, findLast } from 'lodash';
+import { union, difference, sortBy, findLast, intersection } from 'lodash';
export function nodeArrayToTree(nodes) {
// Store a dict and list of all the nodes
@@ -83,9 +83,15 @@ export default function nodesToTree({
docs.forEach(doc => {
ancestorIds = union(ancestorIds, doc.ancestors.map(ref => ref.id));
});
- // Remove the IDs of docs we have already found
+ // Get all the docs that are also ancestors and mark them
+ docs.forEach(doc => {
+ if (ancestorIds.includes(doc._id)) {
+ doc._ancestorOfMatchedDocument = true;
+ }
+ });
+ // Remove the ancestor IDs of docs we have already found
ancestorIds = difference(ancestorIds, docIds);
- // Get the docs from the collection, don't worry about `removed` docs,
+ // Get the ancestor docs from the collection, don't worry about `removed` docs,
// if their descendant was not removed, neither are they
ancestors = collection.find({ _id: { $in: ancestorIds } }).map(doc => {
// Mark that the nodes are ancestors of the found nodes
diff --git a/app/imports/api/utility/escapeRegex.js b/app/imports/api/utility/escapeRegex.js
index 8ec4073c..4f0be7de 100644
--- a/app/imports/api/utility/escapeRegex.js
+++ b/app/imports/api/utility/escapeRegex.js
@@ -1,3 +1,3 @@
export default function escapeRegex(string) {
- return string.replace(/[/\-\\^$*+?.()|[\]{}]/g, '');
+ return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
\ No newline at end of file
diff --git a/app/imports/client/ui/components/tree/TreeSearchInput.vue b/app/imports/client/ui/components/tree/TreeSearchInput.vue
index 5abac7e5..ab0f1e40 100644
--- a/app/imports/client/ui/components/tree/TreeSearchInput.vue
+++ b/app/imports/client/ui/components/tree/TreeSearchInput.vue
@@ -1,19 +1,111 @@
-
+
+
+
+
+ mdi-magnify
+
+
+
+
+
+
+ Search
+
+
+
+
+
+
+
+
+ mdi-close
+
+
+
+
+
+
+ mdi-plus
+
+
+
+
+
+ mdi-close
+
+ Clear
+
+
+
+ Find
+
+
+
+
+
diff --git a/app/imports/client/ui/creature/character/characterSheetTabs/TreeTab.vue b/app/imports/client/ui/creature/character/characterSheetTabs/TreeTab.vue
index a133f0b9..23ee01f8 100644
--- a/app/imports/client/ui/creature/character/characterSheetTabs/TreeTab.vue
+++ b/app/imports/client/ui/creature/character/characterSheetTabs/TreeTab.vue
@@ -11,9 +11,14 @@
+
-
+ extraFields = val"
+ />
-
{
+ fields[field] = 1;
+ });
return [
LibraryNodes.find({
'ancestors.id': libraryId,
}, {
sort: { order: 1 },
- fields: LIBRARY_NODE_TREE_FIELDS,
+ fields,
}),
];
});