This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div className="col-xl-4 col-lg-4 col-md-12 mb-5 mt-5 col-sm-12 d-flex justify-content-center align-items-baseline"> | |
| <br /> | |
| {this.state.outputFileName ? ( | |
| <button | |
| type="button" | |
| className=" btn btn-dark" | |
| onClick={e => this.click(e)} | |
| > | |
| Compress | |
| </button> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| handle = e => { | |
| const imageFile = e.target.files[0]; | |
| this.setState({ | |
| originalLink: URL.createObjectURL(imageFile), | |
| originalImage: imageFile, | |
| outputFileName: imageFile.name, | |
| uploadImage: true | |
| }); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div className="d-flex justify-content-center"> | |
| <input | |
| type="file" | |
| accept="image/*" | |
| className="mt-2 btn btn-dark w-75" | |
| onChange={e => this.handle(e)} | |
| /> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, {useState} from "react"; | |
| function App(){ | |
| const[data, setData] = useState(null); | |
| const[print, setPrint] = useState(false); | |
| function getData(val){ | |
| if(!val) return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getData(val){ | |
| if(!val) return; | |
| const URL_REGEX = /(((https?:\/\/)|(www\.))[^\s]+)/g; | |
| let textSubject = val.target.value; | |
| return setData(textSubject.replace(URL_REGEX, (url)=>{ | |
| let hyperLink = url; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| return( | |
| <div> | |
| { | |
| print? | |
| <h1> | |
| <div dangerouslySetInnerHTML={{ __html: data }} /> | |
| </h1> | |
| :null | |
| } | |
| <input type="text" onChange={getData}></input> |
NewerOlder