Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: make only a few elements selectable (fixes streetwriters/notesnook#391)

thecodrr56050dd37b59
diff --git a/apps/web/src/app.css b/apps/web/src/app.css
index 41bc31a96..040dc7fb8 100644
--- a/apps/web/src/app.css
+++ b/apps/web/src/app.css
@@ -70,7 +70,16 @@
url("./assets/fonts/open-sans-v20-latin-700italic.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
-.unselectable {
+.selectable {
+ -webkit-touch-callout: text;
+ -webkit-user-select: text;
+ -khtml-user-select: text;
+ -moz-user-select: text;
+ -ms-user-select: text;
+ user-select: text;
+}
+
+* {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
diff --git a/apps/web/src/components/announcements/body.js b/apps/web/src/components/announcements/body.js
index 79fbfc61d..0717d89c5 100644
--- a/apps/web/src/components/announcements/body.js
+++ b/apps/web/src/components/announcements/body.js
@@ -156,7 +156,7 @@ function Description({ item }) {
function Text({ value, ...restProps }) {
return (
- <RebassText variant={"body"} {...restProps}>
+ <RebassText className="selectable" variant={"body"} {...restProps}>
{value}
</RebassText>
);
diff --git a/apps/web/src/components/attachment/index.js b/apps/web/src/components/attachment/index.js
index 77eff2fa6..a57486c05 100644
--- a/apps/web/src/components/attachment/index.js
+++ b/apps/web/src/components/attachment/index.js
@@ -118,7 +118,9 @@ function Attachment({ item, isCompact, index }) {
<Text mr={1}>{attachment.noteIds.length} notes</Text>
)}
{attachment.metadata.hash && (
- <Text mr={0}>{attachment.metadata.hash}</Text>
+ <Text className="selectable" mr={0}>
+ {attachment.metadata.hash}
+ </Text>
)}
</Flex>
</Flex>
diff --git a/apps/web/src/components/dialogs/recovery-key-dialog.js b/apps/web/src/components/dialogs/recovery-key-dialog.js
index d8d49fe96..7d202e160 100644
--- a/apps/web/src/components/dialogs/recovery-key-dialog.js
+++ b/apps/web/src/components/dialogs/recovery-key-dialog.js
@@ -27,6 +27,7 @@ function RecoveryKeyDialog(props) {
<Dialog
isOpen={true}
title="Backup your recovery key"
+ width={400}
positiveButton={{
text: "I have backed up my key",
onClick: () => {
@@ -48,6 +49,7 @@ function RecoveryKeyDialog(props) {
to recover your data.
</Text>
<Text
+ className="selectable"
mt={2}
bg="bgSecondary"
p={2}
diff --git a/apps/web/src/components/editor/footer.js b/apps/web/src/components/editor/footer.js
index bdec48357..b7b075233 100644
--- a/apps/web/src/components/editor/footer.js
+++ b/apps/web/src/components/editor/footer.js
@@ -33,6 +33,7 @@ function EditorFooter() {
return (
<Flex alignItems="center">
<Text
+ className="selectable"
data-test-id="editor-word-count"
variant="subBody"
color="bgSecondaryText"
@@ -40,7 +41,12 @@ function EditorFooter() {
>
{totalWords + " words"}
</Text>
- <Text variant="subBody" color="bgSecondaryText" mr={2}>
+ <Text
+ className="selectable"
+ variant="subBody"
+ color="bgSecondaryText"
+ mr={2}
+ >
{formatDate(dateEdited || Date.now())}
</Text>
{SaveStateIcon && <SaveStateIcon size={13} color="bgSecondaryText" />}
diff --git a/apps/web/src/components/list-item/index.js b/apps/web/src/components/list-item/index.js
index 54cb18cbb..d2d89a40b 100644
--- a/apps/web/src/components/list-item/index.js
+++ b/apps/web/src/components/list-item/index.js
@@ -8,7 +8,7 @@ import { useMenuTrigger } from "../../hooks/use-menu";
import Config from "../../utils/config";
import { db } from "../../common/db";
import * as clipboard from "clipboard-polyfill/text";
-import { useRef } from "react";
+import { useEffect, useRef } from "react";
function debugMenuItems(type) {
if (!type) return [];
@@ -58,6 +58,12 @@ function ListItem(props) {
const selectItem = useSelectionStore((store) => store.selectItem);
+ useEffect(() => {
+ return () => {
+ selectionStore.toggleSelectionMode(false);
+ };
+ }, []);
+
return (
<Flex
ref={listItemRef}
diff --git a/apps/web/src/components/properties/index.js b/apps/web/src/components/properties/index.js
index 301dd19f9..eab8d64b6 100644
--- a/apps/web/src/components/properties/index.js
+++ b/apps/web/src/components/properties/index.js
@@ -155,7 +155,11 @@ function Properties() {
<Text variant="body" color="fontTertiary">
{item.label}
</Text>
- <Text variant="body" color="fontTertiary">
+ <Text
+ className="selectable"
+ variant="body"
+ color="fontTertiary"
+ >
{item.value(session[item.key])}
</Text>
</Flex>
diff --git a/apps/web/src/components/status-bar/index.js b/apps/web/src/components/status-bar/index.js
index 9f300baf4..e6c9ee074 100644
--- a/apps/web/src/components/status-bar/index.js
+++ b/apps/web/src/components/status-bar/index.js
@@ -55,7 +55,7 @@ function StatusBar() {
size={7}
color={user.isEmailConfirmed ? "success" : "warn"}
/>
- <Text variant="subBody" color="bgSecondaryText" ml={1}>
+ <Text className="selectable" variant="subBody" color="bgSecondaryText" ml={1}>
{user.email}
{user.isEmailConfirmed ? "" : " (not verified)"}
</Text>
diff --git a/apps/web/src/views/settings.js b/apps/web/src/views/settings.js
index 2b172a9af..9e88d812a 100644
--- a/apps/web/src/views/settings.js
+++ b/apps/web/src/views/settings.js
@@ -270,9 +270,14 @@ function Settings(props) {
showToast("success", "You have been logged out.");
}
}}
+ sx={{ ":hover": { borderColor: "error" } }}
+ bg="errorBg"
+ mx={-2}
+ px={2}
>
<Tip
text="Logout"
+ color="error"
tip="Log out of your account and clear all data."
/>
</Button>