diff --git a/app/assets/javascripts/components/NotesOptions.tsx b/app/assets/javascripts/components/NotesOptions.tsx
index 4cd446792..48273e1b3 100644
--- a/app/assets/javascripts/components/NotesOptions.tsx
+++ b/app/assets/javascripts/components/NotesOptions.tsx
@@ -8,7 +8,7 @@ import {
DisclosureButton,
DisclosurePanel,
} from '@reach/disclosure';
-import { SNNote } from '@standardnotes/snjs/dist/@types';
+import { SNApplication, SNNote } from '@standardnotes/snjs/dist/@types';
import { WebApplication } from '@/ui_models/application';
import { KeyboardModifier } from '@/services/ioService';
import { FunctionComponent } from 'preact';
@@ -35,6 +35,20 @@ const DeletePermanentlyButton = ({
);
+const getWordCount = (text: string) => {
+ if (text.trim().length === 0) {
+ return 0;
+ }
+ return text.split(/\s+/).length;
+};
+
+const getParagraphCount = (text: string) => {
+ if (text.trim().length === 0) {
+ return 0;
+ }
+ return text.replace(/\n$/gm, '').split(/\n/).length;
+};
+
const countNoteAttributes = (text: string) => {
try {
JSON.parse(text);
@@ -44,12 +58,9 @@ const countNoteAttributes = (text: string) => {
paragraphs: 'N/A',
};
} catch {
- const removeTags = text.replace(/<[^>]*>/g," ").replace(/\s+/g, ' ').trim();
- text = removeTags;
-
const characters = text.length;
- const words = text.split(" ")?.length;
- const paragraphs = text.replace(/\n$/gm, '').split(/\n/).length;
+ const words = getWordCount(text);
+ const paragraphs = getParagraphCount(text);
return {
characters,
@@ -73,7 +84,7 @@ const formatDate = (date: Date | undefined) => {
return `${date.toDateString()} ${date.toLocaleTimeString()}`;
};
-const NoteAttributes: FunctionComponent<{ note: SNNote }> = ({ note }) => {
+const NoteAttributes: FunctionComponent<{ application: SNApplication, note: SNNote }> = ({ application, note }) => {
const { words, characters, paragraphs } = useMemo(
() => countNoteAttributes(note.text),
[note.text]
@@ -94,9 +105,12 @@ const NoteAttributes: FunctionComponent<{ note: SNNote }> = ({ note }) => {
[note.created_at]
);
+ const editor = application.componentManager.editorForNote(note);
+ const format = editor?.package_info?.file_type || 'txt';
+
return (
- {typeof words === 'number' ? (
+ {typeof words === 'number' && (format === 'txt' || format === 'md') ? (
<>
{words} words · {characters} characters · {paragraphs} paragraphs
@@ -473,7 +487,7 @@ export const NotesOptions = observer(
{notes.length === 1 ? (
<>
-
+
>
) : null}
>
diff --git a/app/assets/javascripts/components/QuickSettingsMenu/QuickSettingsMenu.tsx b/app/assets/javascripts/components/QuickSettingsMenu/QuickSettingsMenu.tsx
index 003aa8e1d..c9d0fc86d 100644
--- a/app/assets/javascripts/components/QuickSettingsMenu/QuickSettingsMenu.tsx
+++ b/app/assets/javascripts/components/QuickSettingsMenu/QuickSettingsMenu.tsx
@@ -180,15 +180,16 @@ const QuickSettingsMenu: FunctionComponent
= observer(
}
};
- const handleQuickSettingsKeyDown: JSXInternal.KeyboardEventHandler =
- (event) => {
- quickSettingsKeyDownHandler(
- closeQuickSettingsMenu,
- event,
- quickSettingsMenuRef,
- themesMenuOpen
- );
- };
+ const handleQuickSettingsKeyDown: JSXInternal.KeyboardEventHandler<
+ HTMLDivElement
+ > = (event) => {
+ quickSettingsKeyDownHandler(
+ closeQuickSettingsMenu,
+ event,
+ quickSettingsMenuRef,
+ themesMenuOpen
+ );
+ };
const handlePanelKeyDown: React.KeyboardEventHandler = (
event
@@ -222,54 +223,56 @@ const QuickSettingsMenu: FunctionComponent = observer(
Quick Settings
-
-
-
-
- Themes
-
-
-
-
-
- Themes
-
-
- {themes.map((theme) => (
-
+
+ Themes
+
+
+
+
+
+ Themes
+
+
- ))}
-
-
+ ref={defaultThemeButtonRef}
+ >
+
+ Default
+
+ {themes.map((theme) => (
+
+ ))}
+
+
+ ) : null}
{toggleableComponents.map((component) => (
{
private $rootScope: ng.IRootScopeService;
- private themes: SNTheme[] = [];
- private toggleableComponents: SNComponent[] = [];
private showSyncResolution = false;
private unregisterComponent: any;
private rootScopeListener2: any;
@@ -76,8 +73,6 @@ class FooterViewCtrl extends PureViewCtrl<
deinit() {
for (const remove of this.observerRemovers) remove();
this.observerRemovers.length = 0;
- this.themes.length = 0;
- this.toggleableComponents.length = 0;
this.unregisterComponent();
this.unregisterComponent = undefined;
this.rootScopeListener2();
@@ -276,30 +271,6 @@ class FooterViewCtrl extends PureViewCtrl<
return !theme.errorDecrypting;
}
);
-
- this.observerRemovers.push(
- this.application.streamItems(ContentType.Theme, async () => {
- const themes = this.application.getDisplayableItems(
- ContentType.Theme
- ) as SNTheme[];
- this.themes = themes;
- })
- );
-
- this.observerRemovers.push(
- this.application.streamItems(ContentType.Component, async () => {
- const toggleableComponents = (
- this.application.getDisplayableItems(
- ContentType.Component
- ) as SNComponent[]
- ).filter((component) =>
- [ComponentArea.EditorStack, ComponentArea.TagsList].includes(
- component.area
- )
- );
- this.toggleableComponents = toggleableComponents;
- })
- );
}
registerComponentHandler() {
@@ -400,11 +371,7 @@ class FooterViewCtrl extends PureViewCtrl<
quickSettingsPressed() {
this.appState.accountMenu.closeAccountMenu();
- if (this.themes.length > 0 || this.toggleableComponents.length > 0) {
- this.appState.quickSettingsMenu.toggle();
- } else {
- this.appState.preferences.openPreferences();
- }
+ this.appState.quickSettingsMenu.toggle();
}
toggleSyncResolutionMenu() {
diff --git a/app/assets/stylesheets/_sn.scss b/app/assets/stylesheets/_sn.scss
index 445b598fa..d15fd11d5 100644
--- a/app/assets/stylesheets/_sn.scss
+++ b/app/assets/stylesheets/_sn.scss
@@ -71,6 +71,8 @@
.sn-dropdown-popover {
z-index: 3001;
+ max-height: 40%;
+ overflow: auto;
&[data-reach-listbox-popover] {
background: var(--sn-stylekit-background-color);
diff --git a/package.json b/package.json
index 59d6228cb..988b47cb0 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "standard-notes-web",
- "version": "3.9.7",
+ "version": "3.9.8",
"license": "AGPL-3.0-or-later",
"repository": {
"type": "git",
@@ -83,9 +83,9 @@
"@reach/checkbox": "^0.16.0",
"@reach/dialog": "^0.16.2",
"@reach/listbox": "^0.16.2",
- "@standardnotes/features": "1.10.1",
+ "@standardnotes/features": "1.10.2",
"@standardnotes/sncrypto-web": "1.5.3",
- "@standardnotes/snjs": "2.19.6",
+ "@standardnotes/snjs": "2.20.1",
"mobx": "^6.3.5",
"mobx-react-lite": "^3.2.2",
"preact": "^10.5.15",
diff --git a/yarn.lock b/yarn.lock
index 9db293f3a..4594c405f 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2587,10 +2587,10 @@
dependencies:
"@standardnotes/auth" "^3.8.1"
-"@standardnotes/features@1.10.1", "@standardnotes/features@^1.10.1":
- version "1.10.1"
- resolved "https://registry.yarnpkg.com/@standardnotes/features/-/features-1.10.1.tgz#5b5a59d2d69751ca040a270d04a08662b1591bfc"
- integrity sha512-fN7WyR8jeaAsDWkm4a6SSz3JZeaNfL+CkmWAYqxRI5XoXZlWy+kBVaYWaGe7vI4T6ncwdhxRTjE7mirG4PEQ6g==
+"@standardnotes/features@1.10.2", "@standardnotes/features@^1.10.2":
+ version "1.10.2"
+ resolved "https://registry.yarnpkg.com/@standardnotes/features/-/features-1.10.2.tgz#a0783f66c00e21cb7692edc0cea95ec25a0253a5"
+ integrity sha512-Zh6EMjli4mL6jlXEhMyU3qYIKFJj5kuhbxtHXiErUGIDy+s1hHY+THFFO53Jdga2+8wgcATWlmSBY7dieVA8uA==
dependencies:
"@standardnotes/auth" "3.8.3"
"@standardnotes/common" "^1.2.1"
@@ -2614,15 +2614,15 @@
buffer "^6.0.3"
libsodium-wrappers "^0.7.9"
-"@standardnotes/snjs@2.19.6":
- version "2.19.6"
- resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.19.6.tgz#a7bf568944f87ee83e39083ef6facc2ba0d56255"
- integrity sha512-OlImG2UHHgf4zo5QmMeeKb9xNoRWUVaxLdzfhpV95PQShp8Nrl4zsxrDKehh9d6zN5dM/iaxF897cI6bT9D1uw==
+"@standardnotes/snjs@2.20.1":
+ version "2.20.1"
+ resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.20.1.tgz#4813adbfd16a1c373357bd4c7ece3085abf142b4"
+ integrity sha512-wJILt7YerLFaZTKoIZaCkqSuvpVWoVKqCVjP0KNHrMknnbgMHZygHqrb9sr57JL1AcNCkAULEFS/kev2GYTG3Q==
dependencies:
"@standardnotes/auth" "^3.8.1"
"@standardnotes/common" "^1.2.1"
"@standardnotes/domain-events" "^2.5.1"
- "@standardnotes/features" "^1.10.1"
+ "@standardnotes/features" "^1.10.2"
"@standardnotes/settings" "^1.2.1"
"@standardnotes/sncrypto-common" "^1.5.2"