Merge branch 'release/3.6.0' into develop
This commit is contained in:
@@ -148,9 +148,7 @@ class AccountMenuCtrl extends PureViewCtrl<unknown, AccountMenuState> {
|
|||||||
async $onInit() {
|
async $onInit() {
|
||||||
super.$onInit();
|
super.$onInit();
|
||||||
this.setState({
|
this.setState({
|
||||||
showSessions:
|
showSessions: await this.application.userCanManageSessions()
|
||||||
this.appState.enableUnfinishedFeatures &&
|
|
||||||
(await this.application.userCanManageSessions()),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const sync = this.appState.sync;
|
const sync = this.appState.sync;
|
||||||
|
|||||||
@@ -124,4 +124,6 @@ export const Strings = {
|
|||||||
: 'password manager';
|
: 'password manager';
|
||||||
return `Your keys are currently stored in your operating system's ${keychainName}. Adding a passcode prevents even your operating system from reading them.`;
|
return `Your keys are currently stored in your operating system's ${keychainName}. Adding a passcode prevents even your operating system from reading them.`;
|
||||||
},
|
},
|
||||||
|
protectingNoteWithoutProtectionSources: 'Access to this note will not be restricted until you set up a passcode or account.',
|
||||||
|
openAccountMenu: 'Open Account Menu'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { STRING_ARCHIVE_LOCKED_ATTEMPT, STRING_SAVING_WHILE_DOCUMENT_HIDDEN, STRING_UNARCHIVE_LOCKED_ATTEMPT } from './../../strings';
|
import { Strings, STRING_ARCHIVE_LOCKED_ATTEMPT, STRING_SAVING_WHILE_DOCUMENT_HIDDEN, STRING_UNARCHIVE_LOCKED_ATTEMPT } from './../../strings';
|
||||||
import { Editor } from '@/ui_models/editor';
|
import { Editor } from '@/ui_models/editor';
|
||||||
import { WebApplication } from '@/ui_models/application';
|
import { WebApplication } from '@/ui_models/application';
|
||||||
import { PanelPuppet, WebDirective } from '@/types';
|
import { PanelPuppet, WebDirective } from '@/types';
|
||||||
@@ -713,15 +713,21 @@ class EditorViewCtrl extends PureViewCtrl<unknown, EditorState> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleProtectNote() {
|
async toggleProtectNote() {
|
||||||
this.saveNote(
|
if (this.note.protected) {
|
||||||
true,
|
void this.application.unprotectNote(this.note);
|
||||||
false,
|
} else {
|
||||||
true,
|
const note = await this.application.protectNote(this.note);
|
||||||
(mutator) => {
|
if (note?.protected && !this.application.hasProtectionSources()) {
|
||||||
mutator.protected = !this.note.protected;
|
if (await confirmDialog({
|
||||||
|
text: Strings.protectingNoteWithoutProtectionSources,
|
||||||
|
confirmButtonText: Strings.openAccountMenu,
|
||||||
|
confirmButtonStyle: 'info',
|
||||||
|
})) {
|
||||||
|
this.appState.accountMenu.setShow(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleNotePreview() {
|
toggleNotePreview() {
|
||||||
|
|||||||
@@ -5,44 +5,54 @@ export function notePassesFilter(
|
|||||||
showArchived: boolean,
|
showArchived: boolean,
|
||||||
hidePinned: boolean,
|
hidePinned: boolean,
|
||||||
filterText: string
|
filterText: string
|
||||||
) {
|
): boolean {
|
||||||
|
|
||||||
const canShowArchived = showArchived;
|
const canShowArchived = showArchived;
|
||||||
const canShowPinned = !hidePinned;
|
const canShowPinned = !hidePinned;
|
||||||
if (
|
if ((note.archived && !canShowArchived) || (note.pinned && !canShowPinned)) {
|
||||||
(note.archived && !canShowArchived) ||
|
|
||||||
(note.pinned && !canShowPinned)
|
|
||||||
) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return noteMatchesQuery(note, filterText);
|
if (note.protected) {
|
||||||
|
const match = noteMatchesQuery(note, filterText);
|
||||||
|
/** Only match title to prevent leaking protected note text */
|
||||||
|
return match === Match.Title || match === Match.TitleAndText;
|
||||||
|
} else {
|
||||||
|
return noteMatchesQuery(note, filterText) !== Match.None;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function noteMatchesQuery(
|
enum Match {
|
||||||
note: SNNote,
|
None = 0,
|
||||||
query: string
|
Title = 1,
|
||||||
) {
|
Text = 2,
|
||||||
|
TitleAndText = Title + Text,
|
||||||
|
Uuid = 5,
|
||||||
|
}
|
||||||
|
|
||||||
|
function noteMatchesQuery(note: SNNote, query: string): Match {
|
||||||
if (query.length === 0) {
|
if (query.length === 0) {
|
||||||
return true;
|
return Match.TitleAndText;
|
||||||
}
|
}
|
||||||
const title = note.safeTitle().toLowerCase();
|
const title = note.safeTitle().toLowerCase();
|
||||||
const text = note.safeText().toLowerCase();
|
const text = note.safeText().toLowerCase();
|
||||||
const lowercaseText = query.toLowerCase();
|
const lowercaseText = query.toLowerCase();
|
||||||
|
const words = lowercaseText.split(' ');
|
||||||
const quotedText = stringBetweenQuotes(lowercaseText);
|
const quotedText = stringBetweenQuotes(lowercaseText);
|
||||||
if (quotedText) {
|
if (quotedText) {
|
||||||
return title.includes(quotedText) || text.includes(quotedText);
|
return (
|
||||||
|
(title.includes(quotedText) ? Match.Title : Match.None) +
|
||||||
|
(text.includes(quotedText) ? Match.Text : Match.None)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (stringIsUuid(lowercaseText)) {
|
if (stringIsUuid(lowercaseText)) {
|
||||||
return note.uuid === lowercaseText;
|
return note.uuid === lowercaseText ? Match.Uuid : Match.None;
|
||||||
}
|
}
|
||||||
const words = lowercaseText.split(" ");
|
|
||||||
const matchesTitle = words.every((word) => {
|
const matchesTitle = words.every((word) => {
|
||||||
return title.indexOf(word) >= 0;
|
return title.indexOf(word) >= 0;
|
||||||
});
|
});
|
||||||
const matchesBody = words.every((word) => {
|
const matchesBody = words.every((word) => {
|
||||||
return text.indexOf(word) >= 0;
|
return text.indexOf(word) >= 0;
|
||||||
});
|
});
|
||||||
return matchesTitle || matchesBody;
|
return (matchesTitle ? Match.Title : 0) + (matchesBody ? Match.Text : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function stringBetweenQuotes(text: string) {
|
function stringBetweenQuotes(text: string) {
|
||||||
|
|||||||
@@ -143,10 +143,12 @@
|
|||||||
.default-preview(
|
.default-preview(
|
||||||
ng-show='!note.preview_html && !note.preview_plain'
|
ng-show='!note.preview_html && !note.preview_plain'
|
||||||
) {{note.text}}
|
) {{note.text}}
|
||||||
.date.faded(ng-show='!self.state.hideDate')
|
.bottom-info.faded(ng-show='!self.state.hideDate || note.protected')
|
||||||
span(ng-show="self.state.sortBy == 'userModifiedDate'")
|
span(ng-if="note.protected")
|
||||||
|
| Protected{{self.state.hideDate ? '' : ' • '}}
|
||||||
|
span(ng-show="!self.state.hideDate && self.state.sortBy == 'userModifiedDate'")
|
||||||
| Modified {{note.updatedAtString || 'Now'}}
|
| Modified {{note.updatedAtString || 'Now'}}
|
||||||
span(ng-show="self.state.sortBy != 'userModifiedDate'")
|
span(ng-show="!self.state.hideDate && self.state.sortBy != 'userModifiedDate'")
|
||||||
| {{note.createdAtString || 'Now'}}
|
| {{note.createdAtString || 'Now'}}
|
||||||
.tags-string(ng-if='!self.state.hideTags && self.state.renderedNotesTags[$index]')
|
.tags-string(ng-if='!self.state.hideTags && self.state.renderedNotesTags[$index]')
|
||||||
.faded {{self.state.renderedNotesTags[$index]}}
|
.faded {{self.state.renderedNotesTags[$index]}}
|
||||||
|
|||||||
@@ -576,12 +576,6 @@ class NotesViewCtrl extends PureViewCtrl<unknown, NotesState> {
|
|||||||
class: 'warning'
|
class: 'warning'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (note.protected) {
|
|
||||||
flags.push({
|
|
||||||
text: "Protected",
|
|
||||||
class: 'success'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (note.locked) {
|
if (note.locked) {
|
||||||
flags.push({
|
flags.push({
|
||||||
text: "Locked",
|
text: "Locked",
|
||||||
|
|||||||
@@ -126,7 +126,7 @@
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
> .date {
|
> .bottom-info {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,7 +156,6 @@
|
|||||||
) Change Password
|
) Change Password
|
||||||
a.sk-a.info.sk-panel-row.condensed(
|
a.sk-a.info.sk-panel-row.condensed(
|
||||||
ng-click="self.openSessionsModal()"
|
ng-click="self.openSessionsModal()"
|
||||||
ng-if="self.state.showSessions"
|
|
||||||
) Manage Sessions
|
) Manage Sessions
|
||||||
.sk-panel-section
|
.sk-panel-section
|
||||||
.sk-panel-section-title Encryption
|
.sk-panel-section-title Encryption
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "standard-notes-web",
|
"name": "standard-notes-web",
|
||||||
"version": "3.5.19",
|
"version": "3.6.0-beta01",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
Reference in New Issue
Block a user