diff --git a/src/components/IFrameWidget/editor.tsx b/src/components/IFrameWidget/editor.tsx index 1c05ac23..283acd04 100644 --- a/src/components/IFrameWidget/editor.tsx +++ b/src/components/IFrameWidget/editor.tsx @@ -28,6 +28,7 @@ class IFrameWidgetEditor extends Component { super(props); this.state = this.props.props; this.save = this.save.bind(this); + this.delete = this.delete.bind(this); } save(e: MouseEvent) { @@ -35,6 +36,13 @@ class IFrameWidgetEditor extends Component { set(ref(db, `/widgets/${this.props.id}/props`), this.state); } + delete(e: MouseEvent) { + e.preventDefault(); + if (confirm('本当に削除してよろしいですか?')) { + set(ref(db, `/widgets/${this.props.id}`), null); + } + } + render() { return (
@@ -191,6 +199,15 @@ class IFrameWidgetEditor extends Component { > Save +
); diff --git a/src/components/TextWidget/editor.tsx b/src/components/TextWidget/editor.tsx index 46db1a8f..badbf5fe 100644 --- a/src/components/TextWidget/editor.tsx +++ b/src/components/TextWidget/editor.tsx @@ -88,6 +88,7 @@ class TextWidgetEditor extends Component { super(props); this.state = this.props.props; this.save = this.save.bind(this); + this.delete = this.delete.bind(this); } save(e: MouseEvent) { @@ -95,6 +96,13 @@ class TextWidgetEditor extends Component { set(ref(db, `/widgets/${this.props.id}/props`), this.state); } + delete(e: MouseEvent) { + e.preventDefault(); + if (confirm('本当に削除してよろしいですか?')) { + set(ref(db, `/widgets/${this.props.id}`), null); + } + } + render() { return (
@@ -339,6 +347,15 @@ class TextWidgetEditor extends Component { > Save +
); diff --git a/src/components/TimeWidget/editor.tsx b/src/components/TimeWidget/editor.tsx index 1f6e4ddb..d1f7f0bf 100644 --- a/src/components/TimeWidget/editor.tsx +++ b/src/components/TimeWidget/editor.tsx @@ -33,6 +33,7 @@ class TimeWidgetEditor extends Component { super(props); this.state = this.props.props; this.save = this.save.bind(this); + this.delete = this.delete.bind(this); } save(e: MouseEvent) { @@ -40,6 +41,13 @@ class TimeWidgetEditor extends Component { set(ref(db, `/widgets/${this.props.id}/props`), this.state); } + delete(e: MouseEvent) { + e.preventDefault(); + if (confirm('本当に削除してよろしいですか?')) { + set(ref(db, `/widgets/${this.props.id}`), null); + } + } + render() { return (
@@ -85,6 +93,15 @@ class TimeWidgetEditor extends Component { > Save +
);