Example #1
0
 },
 handleAdd() {
   if (this.validateForm()) {
     let url = this.cleanUrl();
     this.props.dispatch(actions.RequestAddTopsite(url, this.state.title));
     this.props.dispatch(actions.NotifyEvent({
       source: "TOP_SITES",
       event: "ADD_TOPSITE"
     }));
     this.props.onClose();
   }
 },
 handleSave() {
   if (this.validateForm()) {
     let url = this.cleanUrl();
     this.props.dispatch(actions.RequestEditTopsite(url, this.state.title, this.props.slotIndex));
     this.props.dispatch(actions.NotifyEvent({
       source: "TOP_SITES",
       event: "EDIT_TOPSITE",
       action_position: this.props.slotIndex
     }));
     this.props.onClose();
   }
 },
 cleanUrl() {
   let url = this.state.url;
   // If we are missing a protocol, prepend http://
   if (!url.startsWith("http")) {
     url = `http://${url}`;
   }
   return url;