diff --git a/app/assets/icons/ic-warning.svg b/app/assets/icons/ic-warning.svg new file mode 100644 index 000000000..0495ae3e8 --- /dev/null +++ b/app/assets/icons/ic-warning.svg @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/app/assets/javascripts/components/Icon.tsx b/app/assets/javascripts/components/Icon.tsx index 8928b6d3d..209dc5488 100644 --- a/app/assets/javascripts/components/Icon.tsx +++ b/app/assets/javascripts/components/Icon.tsx @@ -62,6 +62,7 @@ import UnarchiveIcon from '../../icons/ic-unarchive.svg'; import UnpinIcon from '../../icons/ic-pin-off.svg'; import UserIcon from '../../icons/ic-user.svg'; import UserSwitch from '../../icons/ic-user-switch.svg'; +import WarningIcon from '../../icons/ic-warning.svg'; import WindowIcon from '../../icons/ic-window.svg'; import { FunctionalComponent } from 'preact'; @@ -133,6 +134,7 @@ const ICONS = { unarchive: UnarchiveIcon, unpin: UnpinIcon, user: UserIcon, + warning: WarningIcon, window: WindowIcon, }; diff --git a/app/assets/javascripts/components/NoteView/NoteView.tsx b/app/assets/javascripts/components/NoteView/NoteView.tsx index 789d21b5a..d89b807e2 100644 --- a/app/assets/javascripts/components/NoteView/NoteView.tsx +++ b/app/assets/javascripts/components/NoteView/NoteView.tsx @@ -672,9 +672,7 @@ export class NoteView extends PureComponent { this.application.alertService.alert(STRING_DELETE_LOCKED_ATTEMPT); return; } - const title = this.note.safeTitle().length - ? `'${this.note.title}'` - : 'this note'; + const title = this.note.title.length ? `'${this.note.title}'` : 'this note'; const text = StringDeleteNote(title, permanently); if ( await confirmDialog({ diff --git a/app/assets/javascripts/components/NotesContextMenu.tsx b/app/assets/javascripts/components/NotesContextMenu.tsx index 7e2680223..9b8e63ed4 100644 --- a/app/assets/javascripts/components/NotesContextMenu.tsx +++ b/app/assets/javascripts/components/NotesContextMenu.tsx @@ -37,7 +37,7 @@ export const NotesContextMenu = observer(({ application, appState }: Props) => { return contextMenuOpen ? (
+
{typeof words === 'number' && (format === 'txt' || format === 'md') ? ( <>
@@ -185,6 +186,24 @@ const SpellcheckOptions: FunctionComponent<{ ); }; +const NOTE_SIZE_WARNING_THRESHOLD = 0.5 * BYTES_IN_ONE_MEGABYTE; + +const NoteSizeWarning: FunctionComponent<{ + note: SNNote; +}> = ({ note }) => + new Blob([note.text]).size > NOTE_SIZE_WARNING_THRESHOLD ? ( +
+ +
+ This note may have trouble syncing to the mobile application due to its + size. +
+
+ ) : null; + export const NotesOptions = observer( ({ application, @@ -570,6 +589,7 @@ export const NotesOptions = observer(
+ ) : null} diff --git a/app/assets/javascripts/components/NotesOptionsPanel.tsx b/app/assets/javascripts/components/NotesOptionsPanel.tsx index 72097cbbc..260608c26 100644 --- a/app/assets/javascripts/components/NotesOptionsPanel.tsx +++ b/app/assets/javascripts/components/NotesOptionsPanel.tsx @@ -86,7 +86,7 @@ export const NotesOptionsPanel = observer( ...position, maxHeight, }} - className="sn-dropdown sn-dropdown--animated min-w-80 max-h-120 max-w-xs flex flex-col py-2 overflow-y-auto fixed" + className="sn-dropdown sn-dropdown--animated min-w-80 max-h-120 max-w-xs flex flex-col pt-2 overflow-y-auto fixed" onBlur={closeOnBlur} > {open && ( diff --git a/app/assets/javascripts/ui_models/app_state/notes_state.ts b/app/assets/javascripts/ui_models/app_state/notes_state.ts index df192d03a..b0093e5eb 100644 --- a/app/assets/javascripts/ui_models/app_state/notes_state.ts +++ b/app/assets/javascripts/ui_models/app_state/notes_state.ts @@ -314,7 +314,7 @@ export class NotesState { let noteTitle = undefined; if (this.selectedNotesCount === 1) { const selectedNote = Object.values(this.selectedNotes)[0]; - noteTitle = selectedNote.safeTitle().length + noteTitle = selectedNote.title.length ? `'${selectedNote.title}'` : 'this note'; } diff --git a/app/assets/javascripts/views/constants.ts b/app/assets/javascripts/views/constants.ts index dd83ea727..c2f6a61d5 100644 --- a/app/assets/javascripts/views/constants.ts +++ b/app/assets/javascripts/views/constants.ts @@ -9,3 +9,5 @@ export const MAX_MENU_SIZE_MULTIPLIER = 30; export const FOCUSABLE_BUT_NOT_TABBABLE = -1; export const NOTES_LIST_SCROLL_THRESHOLD = 200; + +export const BYTES_IN_ONE_MEGABYTE = 1000000; diff --git a/app/assets/stylesheets/_sn.scss b/app/assets/stylesheets/_sn.scss index 34d54f0c8..952075a9c 100644 --- a/app/assets/stylesheets/_sn.scss +++ b/app/assets/stylesheets/_sn.scss @@ -514,6 +514,11 @@ padding-bottom: 0.625rem; } +.py-3\.5 { + padding-top: 0.875rem; + padding-bottom: 0.875rem; +} + .py-9 { padding-top: 2.25rem; padding-bottom: 2.25rem; @@ -835,6 +840,10 @@ } } +.flex-shrink-0 { + flex-shrink: 0; +} + .dimmed { opacity: .5; cursor: default; @@ -844,3 +853,7 @@ .hide-if-last-child:last-child { display: none; } + +.bg-note-size-warning { + background-color: rgba(235, 173, 0, 0.08); +} diff --git a/package.json b/package.json index ea6e4f311..eba71f912 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "@reach/tooltip": "^0.16.2", "@standardnotes/components": "1.5.0", "@standardnotes/features": "1.27.0", - "@standardnotes/snjs": "2.51.1", + "@standardnotes/snjs": "2.51.2", "@standardnotes/settings": "^1.11.3", "@standardnotes/sncrypto-web": "1.6.2", "mobx": "^6.3.5", diff --git a/yarn.lock b/yarn.lock index d9d413900..55f085594 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2650,10 +2650,10 @@ buffer "^6.0.3" libsodium-wrappers "^0.7.9" -"@standardnotes/snjs@2.51.1": - version "2.51.1" - resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.51.1.tgz#404f0a407b0c0eb19ac847081336c1ce9deeee5f" - integrity sha512-Aeeh++8nEg/FdV4Pxjbm9XmeLNRM57V+mvtVt08U8O+k11XndfjZIDWmPaOfcRBqQtBx47NcvxbXagABz2XSqA== +"@standardnotes/snjs@2.51.2": + version "2.51.2" + resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.51.2.tgz#9804e27071a8d139bf72095d94231a1e29a61593" + integrity sha512-sxS/QnDnOqUx88Mv8BVR2sd4UAvrBQj0Daa9rH5+INryY5qkLdlTod6MqDfxy+MRkyioVpDAE+yYuBJbcPyqQw== dependencies: "@standardnotes/auth" "^3.15.3" "@standardnotes/common" "^1.8.0"