1- import { Platform , SNApplication } from '@standardnotes/snjs'
1+ import { escapeHtmlString , Platform , SNApplication } from '@standardnotes/snjs'
22import { getPlatform , isDesktopApplication } from '../Utils'
33
44/** @generic */
@@ -39,9 +39,10 @@ export const STRING_EDIT_LOCKED_ATTEMPT =
3939export const STRING_RESTORE_LOCKED_ATTEMPT =
4040 "This note has editing disabled. If you'd like to restore it to a previous revision, enable editing and try again."
4141export function StringDeleteNote ( title : string , permanently : boolean ) {
42+ const escapedTitle = escapeHtmlString ( title )
4243 return permanently
43- ? `Are you sure you want to permanently delete ${ title } ?`
44- : `Are you sure you want to move ${ title } to the trash?`
44+ ? `Are you sure you want to permanently delete ${ escapedTitle } ?`
45+ : `Are you sure you want to move ${ escapedTitle } to the trash?`
4546}
4647export function StringEmptyTrash ( count : number ) {
4748 return `Are you sure you want to permanently delete ${ count } note(s)?`
@@ -135,17 +136,19 @@ export const StringUtils = {
135136 } ,
136137 deleteNotes ( permanently : boolean , notesCount = 1 , title ?: string ) : string {
137138 if ( notesCount === 1 ) {
139+ const escapedTitle = escapeHtmlString ( title || '' )
138140 return permanently
139- ? `Are you sure you want to permanently delete ${ title } ?`
140- : `Are you sure you want to move ${ title } to the trash?`
141+ ? `Are you sure you want to permanently delete ${ escapedTitle } ?`
142+ : `Are you sure you want to move ${ escapedTitle } to the trash?`
141143 } else {
142144 return permanently
143145 ? 'Are you sure you want to permanently delete these notes?'
144146 : 'Are you sure you want to move these notes to the trash?'
145147 }
146148 } ,
147149 deleteFile ( title : string ) : string {
148- return `Are you sure you want to permanently delete ${ title } ?`
150+ const escapedTitle = escapeHtmlString ( title )
151+ return `Are you sure you want to permanently delete ${ escapedTitle } ?`
149152 } ,
150153 archiveLockedNotesAttempt ( archive : boolean , notesCount = 1 ) : string {
151154 const archiveString = archive ? 'archive' : 'unarchive'
@@ -158,4 +161,12 @@ export const StringUtils = {
158161 ? "This note has editing disabled. If you'd like to delete it, enable editing, and try again."
159162 : "One or more of these notes have editing disabled. If you'd like to delete them, make sure editing is enabled on all of them, and try again."
160163 } ,
164+ deleteTag ( title : string ) : string {
165+ const escapedTitle = escapeHtmlString ( title )
166+ return `Delete tag "${ escapedTitle } "?`
167+ } ,
168+ cannotUploadFile ( name : string ) : string {
169+ const escapedName = escapeHtmlString ( name )
170+ return `Cannot upload file "${ escapedName } "`
171+ } ,
161172}
0 commit comments