Skip to content

Commit e97cfd6

Browse files
committed
highlight links in text-ocr
1 parent 7f74b63 commit e97cfd6

File tree

5 files changed

+26
-3
lines changed

5 files changed

+26
-3
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "text-to-image-pro",
3-
"version": "2.0.4",
3+
"version": "2.0.5",
44
"description": "",
55
"homepage": "https://fxnoob.github.io/image-to-text-landing",
66
"scripts": {
@@ -70,6 +70,7 @@
7070
"@tailwindcss/ui": "^0.5.0",
7171
"array-contains": "^0.0.1",
7272
"firebase": "^8.4.3",
73+
"linkifyjs": "^3.0.0-beta.3",
7374
"lottie-react-web": "^2.1.4",
7475
"pdfjs-dist": "2.5.207",
7576
"prop-types": "^15.7.2",

src/option-page/components/Home.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
import React from "react";
2+
import Linkify from "linkifyjs/react";
23
import Share from "./Share";
34
import Promotion from "./Promotion";
45
import constants from "../../../constants";
56
import chromeService from "../../services/chromeService";
67
import { getExtensionStoreLink, isGoogleChrome } from "../../services/helper";
78
const extUrl = getExtensionStoreLink();
9+
const options = {
10+
target: {
11+
url: "_blank",
12+
},
13+
};
814
export default function OCRCard(props) {
915
const [copied, setCopied] = React.useState(false);
1016
const [playing, togglePlay] = React.useState(false);
@@ -215,7 +221,9 @@ export default function OCRCard(props) {
215221
}}
216222
class="prose text-gray-500 mx-auto lg:max-w-none lg:row-start-1 lg:col-start-1"
217223
>
218-
{ocrText}
224+
<Linkify tagName="p" options={options}>
225+
{ocrText}
226+
</Linkify>
219227
</div>
220228
<hr style={{ marginTop: "2rem" }} />
221229
<div

src/option-page/components/Pdf.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useCallback, useRef } from "react";
22
import ArrowLeftICon from "@material-ui/icons/KeyboardBackspace";
33
import ArrowRightICon from "@material-ui/icons/ArrowRightAlt";
4+
import Linkify from "linkifyjs/react";
45
import pdfService from "../../services/pdfService";
56
import { useDropzone } from "react-dropzone";
67
import Share from "./Share";
@@ -9,6 +10,11 @@ import chromeService from "../../services/chromeService";
910
import messagePassing from "../../services/messagePassing";
1011
import { getExtensionStoreLink, isGoogleChrome } from "../../services/helper";
1112
import pdf from "../../services/pdfService";
13+
const options = {
14+
target: {
15+
url: "_blank",
16+
},
17+
};
1218
const extUrl = getExtensionStoreLink();
1319
let canvas = null;
1420
export default function PdfCard() {
@@ -356,7 +362,9 @@ export default function PdfCard() {
356362
}}
357363
className="prose text-gray-500 mx-auto lg:max-w-none lg:row-start-1 lg:col-start-1"
358364
>
359-
{ocrText}
365+
<Linkify tagName="p" options={options}>
366+
{ocrText}
367+
</Linkify>
360368
</div>
361369
<hr style={{ marginTop: "2rem" }} />
362370
<div

src/option-page/option.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4+
<title>IMAGE TO TEXT (OCR)</title>
45
<link rel="stylesheet" href="/style.css" />
56
</head>
67
<body>

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5566,6 +5566,11 @@ linkify-it@^2.0.0:
55665566
dependencies:
55675567
uc.micro "^1.0.1"
55685568

5569+
linkifyjs@^3.0.0-beta.3:
5570+
version "3.0.0-beta.3"
5571+
resolved "https://registry.yarnpkg.com/linkifyjs/-/linkifyjs-3.0.0-beta.3.tgz#40697995d7ecf85c464924a30b9e98b1cd6fb253"
5572+
integrity sha512-aXq4WJs91NsETo5f9dQrt8Vx+OxAvzJAtR8lLgpum8PDjtCgstycwYbIkAjDGRV/YF1LlKKdbWyOpgMYgwgOvQ==
5573+
55695574
load-json-file@^1.0.0:
55705575
version "1.1.0"
55715576
resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0"

0 commit comments

Comments
 (0)