feat: search protected notes text
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#notes-column.sn-component.section.notes(aria-label='Notes')
|
#notes-column.sn-component.section.notes(aria-label='Notes')
|
||||||
.content
|
.content
|
||||||
#notes-title-bar.section-title-bar
|
#notes-title-bar.section-title-bar
|
||||||
.padded
|
.p-4.pt-0
|
||||||
.section-title-bar-header
|
.section-title-bar-header
|
||||||
.sk-h2.font-semibold.title {{self.state.panelTitle}}
|
.sk-h2.font-semibold.title {{self.state.panelTitle}}
|
||||||
.sk-button.contrast.wide(
|
.sk-button.contrast.wide(
|
||||||
@@ -19,11 +19,18 @@
|
|||||||
placeholder='Search',
|
placeholder='Search',
|
||||||
select-on-focus='true',
|
select-on-focus='true',
|
||||||
title='Searches notes in the currently selected tag'
|
title='Searches notes in the currently selected tag'
|
||||||
)
|
)
|
||||||
#search-clear-button(
|
#search-clear-button(
|
||||||
ng-click='self.clearFilterText();',
|
ng-click='self.clearFilterText();',
|
||||||
ng-show='self.state.noteFilter.text'
|
ng-show='self.state.noteFilter.text'
|
||||||
) ✕
|
) ✕
|
||||||
|
label.sk-horizontal-group.tight.mt-3
|
||||||
|
input(
|
||||||
|
type="checkbox"
|
||||||
|
ng-checked="self.state.noteFilter.includeProtectedNoteText"
|
||||||
|
ng-on-click="self.onIncludeProtectedNoteTextChange($event)"
|
||||||
|
)
|
||||||
|
p.capitalize Include protected contents
|
||||||
no-account-warning(
|
no-account-warning(
|
||||||
application='self.application'
|
application='self.application'
|
||||||
app-state='self.appState'
|
app-state='self.appState'
|
||||||
|
|||||||
@@ -31,7 +31,10 @@ type NotesState = {
|
|||||||
hideNotePreview?: boolean
|
hideNotePreview?: boolean
|
||||||
hideDate?: boolean
|
hideDate?: boolean
|
||||||
hideTags: boolean
|
hideTags: boolean
|
||||||
noteFilter: { text: string }
|
noteFilter: {
|
||||||
|
text: string;
|
||||||
|
includeProtectedNoteText: boolean;
|
||||||
|
}
|
||||||
mutable: { showMenu: boolean }
|
mutable: { showMenu: boolean }
|
||||||
completedFullSync: boolean
|
completedFullSync: boolean
|
||||||
[PrefKey.TagsPanelWidth]?: number
|
[PrefKey.TagsPanelWidth]?: number
|
||||||
@@ -125,7 +128,10 @@ class NotesViewCtrl extends PureViewCtrl<unknown, NotesState> {
|
|||||||
renderedNotes: [],
|
renderedNotes: [],
|
||||||
renderedNotesTags: [],
|
renderedNotesTags: [],
|
||||||
mutable: { showMenu: false },
|
mutable: { showMenu: false },
|
||||||
noteFilter: { text: '' },
|
noteFilter: {
|
||||||
|
text: '',
|
||||||
|
includeProtectedNoteText: false
|
||||||
|
},
|
||||||
panelTitle: '',
|
panelTitle: '',
|
||||||
completedFullSync: false,
|
completedFullSync: false,
|
||||||
hideTags: true,
|
hideTags: true,
|
||||||
@@ -149,6 +155,18 @@ class NotesViewCtrl extends PureViewCtrl<unknown, NotesState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async onIncludeProtectedNoteTextChange(event: Event) {
|
||||||
|
if (this.state.noteFilter.includeProtectedNoteText) {
|
||||||
|
this.state.noteFilter.includeProtectedNoteText = false;
|
||||||
|
} else {
|
||||||
|
event.preventDefault();
|
||||||
|
if (await this.application.authorizeSearchingProtectedNotesText()) {
|
||||||
|
this.state.noteFilter.includeProtectedNoteText = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.flushUI();
|
||||||
|
}
|
||||||
|
|
||||||
/** @template */
|
/** @template */
|
||||||
public get activeEditorNote() {
|
public get activeEditorNote() {
|
||||||
return this.appState?.getActiveEditor()?.note;
|
return this.appState?.getActiveEditor()?.note;
|
||||||
@@ -330,17 +348,16 @@ class NotesViewCtrl extends PureViewCtrl<unknown, NotesState> {
|
|||||||
private reloadNotesDisplayOptions() {
|
private reloadNotesDisplayOptions() {
|
||||||
const tag = this.appState.selectedTag;
|
const tag = this.appState.selectedTag;
|
||||||
const searchText = this.getState().noteFilter.text.toLowerCase();
|
const searchText = this.getState().noteFilter.text.toLowerCase();
|
||||||
const searchQuery = searchText ? {
|
|
||||||
query: searchText,
|
|
||||||
includeProtectedNoteText: false
|
|
||||||
} : undefined;
|
|
||||||
const criteria = NotesDisplayCriteria.Create({
|
const criteria = NotesDisplayCriteria.Create({
|
||||||
sortProperty: this.state.sortBy! as CollectionSort,
|
sortProperty: this.state.sortBy! as CollectionSort,
|
||||||
sortDirection: this.state.sortReverse! ? 'asc' : 'dsc',
|
sortDirection: this.state.sortReverse! ? 'asc' : 'dsc',
|
||||||
tags: tag ? [tag] : [],
|
tags: tag ? [tag] : [],
|
||||||
includeArchived: this.getState().showArchived!,
|
includeArchived: this.getState().showArchived!,
|
||||||
includePinned: !this.getState().hidePinned!,
|
includePinned: !this.getState().hidePinned!,
|
||||||
searchQuery: searchQuery
|
searchQuery: {
|
||||||
|
query: searchText ?? '',
|
||||||
|
includeProtectedNoteText: this.state.noteFilter.includeProtectedNoteText
|
||||||
|
}
|
||||||
});
|
});
|
||||||
this.application!.setNotesDisplayCriteria(criteria);
|
this.application!.setNotesDisplayCriteria(criteria);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -206,10 +206,6 @@ $footer-height: 32px;
|
|||||||
|
|
||||||
.section-title-bar {
|
.section-title-bar {
|
||||||
|
|
||||||
.padded {
|
|
||||||
padding: 0 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-button {
|
.add-button {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@
|
|||||||
|
|
||||||
#notes-menu-bar {
|
#notes-menu-bar {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-top: 14px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#notes-options-menu {
|
#notes-options-menu {
|
||||||
|
|||||||
@@ -101,6 +101,10 @@ $screen-md-max: ($screen-lg-min - 1) !default;
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mb-0 {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.mt-1 {
|
.mt-1 {
|
||||||
margin-top: .25rem;
|
margin-top: .25rem;
|
||||||
}
|
}
|
||||||
@@ -114,10 +118,17 @@ $screen-md-max: ($screen-lg-min - 1) !default;
|
|||||||
.p-0 {
|
.p-0 {
|
||||||
padding: 0rem;
|
padding: 0rem;
|
||||||
}
|
}
|
||||||
|
.p-4 {
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
.p-5 {
|
.p-5 {
|
||||||
padding: 1.25rem;
|
padding: 1.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pt-0 {
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.px-3 {
|
.px-3 {
|
||||||
padding-left: .75rem;
|
padding-left: .75rem;
|
||||||
padding-right: .75rem;
|
padding-right: .75rem;
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
"@reach/alert-dialog": "^0.13.0",
|
"@reach/alert-dialog": "^0.13.0",
|
||||||
"@reach/dialog": "^0.13.0",
|
"@reach/dialog": "^0.13.0",
|
||||||
"@standardnotes/sncrypto-web": "^1.2.10",
|
"@standardnotes/sncrypto-web": "^1.2.10",
|
||||||
"@standardnotes/snjs": "^2.0.65",
|
"@standardnotes/snjs": "^2.0.67",
|
||||||
"mobx": "^6.1.6",
|
"mobx": "^6.1.6",
|
||||||
"preact": "^10.5.12"
|
"preact": "^10.5.12"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1850,10 +1850,10 @@
|
|||||||
"@standardnotes/sncrypto-common" "^1.2.7"
|
"@standardnotes/sncrypto-common" "^1.2.7"
|
||||||
libsodium-wrappers "^0.7.8"
|
libsodium-wrappers "^0.7.8"
|
||||||
|
|
||||||
"@standardnotes/snjs@^2.0.65":
|
"@standardnotes/snjs@^2.0.67":
|
||||||
version "2.0.65"
|
version "2.0.67"
|
||||||
resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.0.65.tgz#1701e713fa02be0f99db4d0fa3ab516fce656846"
|
resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.0.67.tgz#87e29f40bb5efaa36f30ddc5905164f7dce194d9"
|
||||||
integrity sha512-0CfGVJtt4C+qvBhJfYWwioeQixxwL7LHv/M/bAIoMWaYS9xxFb6/a4y0z/dbEw7ZROx2+KTxgWvZi6qqjRGYhQ==
|
integrity sha512-XCDxlFQCh0zmV3Hc9mjU7ritZ/2Ma5JPoCbDy4CIAlkKdmVL4tu/4jCfRFILM0zpKF/kLsCTbLGdG7TgU/ReKg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@standardnotes/auth" "^2.0.0"
|
"@standardnotes/auth" "^2.0.0"
|
||||||
"@standardnotes/sncrypto-common" "^1.2.9"
|
"@standardnotes/sncrypto-common" "^1.2.9"
|
||||||
|
|||||||
Reference in New Issue
Block a user