fix: sanitize alert string
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
/* eslint-disable prefer-promise-reject-errors */
|
/* eslint-disable prefer-promise-reject-errors */
|
||||||
import { SNAlertService, ButtonType } from '@standardnotes/snjs';
|
import {
|
||||||
|
SNAlertService,
|
||||||
|
ButtonType,
|
||||||
|
sanitizeHtmlString,
|
||||||
|
} from '@standardnotes/snjs';
|
||||||
import { SKAlert } from 'sn-stylekit';
|
import { SKAlert } from 'sn-stylekit';
|
||||||
|
|
||||||
/** @returns a promise resolving to true if the user confirmed, false if they canceled */
|
/** @returns a promise resolving to true if the user confirmed, false if they canceled */
|
||||||
@@ -18,8 +22,8 @@ export function confirmDialog({
|
|||||||
}) {
|
}) {
|
||||||
return new Promise<boolean>((resolve) => {
|
return new Promise<boolean>((resolve) => {
|
||||||
const alert = new SKAlert({
|
const alert = new SKAlert({
|
||||||
title,
|
title: title && sanitizeHtmlString(title),
|
||||||
text,
|
text: sanitizeHtmlString(text),
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
text: cancelButtonText,
|
text: cancelButtonText,
|
||||||
@@ -52,8 +56,8 @@ export function alertDialog({
|
|||||||
}) {
|
}) {
|
||||||
return new Promise<void>((resolve) => {
|
return new Promise<void>((resolve) => {
|
||||||
const alert = new SKAlert({
|
const alert = new SKAlert({
|
||||||
title,
|
title: title && sanitizeHtmlString(title),
|
||||||
text,
|
text: sanitizeHtmlString(text),
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
text: closeButtonText,
|
text: closeButtonText,
|
||||||
@@ -92,7 +96,10 @@ export class AlertService implements SNAlertService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
blockingDialog(text: string, title?: string) {
|
blockingDialog(text: string, title?: string) {
|
||||||
const alert = new SKAlert({ text, title });
|
const alert = new SKAlert({
|
||||||
|
title: title && sanitizeHtmlString(title),
|
||||||
|
text: sanitizeHtmlString(text),
|
||||||
|
});
|
||||||
alert.present();
|
alert.present();
|
||||||
return () => {
|
return () => {
|
||||||
alert.dismiss();
|
alert.dismiss();
|
||||||
|
|||||||
Reference in New Issue
Block a user