Skip to content

Feat: auto-create the link block when a non-image link is pasted #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
34bb8e0
feat: add auto-preview on paste
antoineol Jun 25, 2023
6c5a987
fix: linting
antoineol Jun 25, 2023
2f296ac
feat: auto-open the block settings after auto-link
antoineol Jun 25, 2023
406e7ed
fix: close settings when removing the preview
antoineol Jun 25, 2023
ec2da3b
fix: also close settings when falling back to text
antoineol Jun 25, 2023
cf65ed0
feat(videoLinks): prevent embed link on videos
Dindonneau Dec 11, 2023
3621d8a
feat(videoLinkRegex): handle dailymotion regex
Dindonneau Dec 18, 2023
71758af
chore(embedLink): new Layout
Dindonneau Dec 21, 2023
3808274
Merge pull request #1 from graphcomment/dev
Dindonneau Dec 21, 2023
5756d89
chore(description): grey color fro description
Dindonneau Dec 21, 2023
28cbda1
chore(comments): remove commented code
Dindonneau Dec 21, 2023
f855711
Merge pull request #2 from graphcomment/newEmbedLinkLayout
Dindonneau Dec 21, 2023
45696ff
new embed link layout
Dindonneau Dec 21, 2023
d0df27e
feat(index.css): highlightedEmbed
Dindonneau Jul 1, 2024
8ef9fa1
Merge pull request #4 from graphcomment/highlightedEmbed
Dindonneau Jul 1, 2024
c9413f7
Merge pull request #5 from graphcomment/dev
Dindonneau Jul 1, 2024
689734e
hotfix(index.css): fix flex direction when highlighted
Dindonneau Jul 1, 2024
5d26ebe
Merge pull request #6 from graphcomment/hotfix/flexfix
Dindonneau Jul 1, 2024
0c7e713
Merge pull request #7 from graphcomment/dev
Dindonneau Jul 1, 2024
6166955
hotfix(index.css): fix missing closing block
Dindonneau Jul 1, 2024
72eb28d
Merge pull request #8 from graphcomment/lastHighlightFix
Dindonneau Jul 1, 2024
855dafa
Merge pull request #9 from graphcomment/dev
Dindonneau Jul 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ const editor = EditorJS({
class: LinkTool,
config: {
endpoint: 'http://localhost:8008/fetchUrl', // Your backend endpoint for url data fetching,
createOnPaste: true, // true to catch non-image pasted links and create a preview automatically
key: 'linkTool', // Required if createOnPaste is true - must match the tool key
}
}
},
Expand All @@ -71,6 +73,8 @@ Link Tool supports these configuration parameters:
| ---------|-------------|------------------------------------------------|
| endpoint | `string` | **Required:** the endpoint for link data fetching. |
| headers | `object` | **Optional:** the headers used in the GET request. |
| createOnPaste | `boolean` | **Optional:** true to catch non-image pasted links and create a preview automatically. |
| key | `string` | **Optional:** Required if createOnPaste is true - must match the tool key. |

## Output data

Expand Down
94 changes: 51 additions & 43 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,27 @@
background-color: #fff3f6;
border-color: #f3e0e0;
color: #a95a5a;
box-shadow: inset 0 1px 3px 0 rgba(146, 62, 62, .05);
box-shadow: inset 0 1px 3px 0 rgba(146, 62, 62, 0.05);
}
}
}

&[contentEditable=true][data-placeholder]::before{
&[contentEditable="true"][data-placeholder]::before {
position: absolute;
content: attr(data-placeholder);
color: #707684;
font-weight: normal;
opacity: 0;
}

&[contentEditable=true][data-placeholder]:empty {

&[contentEditable="true"][data-placeholder]:empty {
&::before {
opacity: 1;
}

&:focus::before {
opacity: 0;
}
opacity: 0;
}
}
}

Expand All @@ -63,29 +62,22 @@
}

&__content {
display: block;
padding: 25px;
border-radius: 2px;
box-shadow: 0 0 0 2px #fff;
display: flex;
column-gap: 10px;
padding: 10px;
border-radius: 5px;
color: initial !important;
text-decoration: none !important;

&::after {
content: "";
clear: both;
display: table;
}

&--rendered {
background: #fff;
border: 1px solid rgba(201, 201, 204, 0.48);
box-shadow: 0 1px 3px rgba(0,0,0, .1);
border-radius: 6px;
border: 1px solid #e9e9e9;
border-radius: 5px;
will-change: filter;
animation: link-in 450ms 1 cubic-bezier(0.215, 0.61, 0.355, 1);

&:hover {
box-shadow: 0 0 3px rgba(0,0,0, .16);
box-shadow: 0 0 3px rgba(0, 0, 0, 0.16);
}
}
}
Expand All @@ -94,41 +86,57 @@
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
margin: 0 0 0 30px;
width: 65px;
height: 65px;
border-radius: 3px;
float: right;
min-width: 80px;
height: 80px;
aspect-ratio: 1/1;
border-radius: 5px;
}

&__infos {
overflow: hidden;
flex: 1;
}

&__title {
font-size: 17px;
font-size: 15px;
font-weight: 600;
line-height: 1.5em;
margin: 0 0 10px 0;

+ ^&__anchor {
margin-top: 25px;
}
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

&__description {
margin: 0 0 20px 0;
font-size: 15px;
line-height: 1.55em;
font-size: 13px;
color: #595959;
line-height: 1.25;
height: 2rem;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
-webkit-line-clamp: 2;
}

&__anchor {
display: block;
font-size: 15px;
line-height: 1em;
color: #888 !important;
border: 0 !important;
padding: 0 !important;
font-size: 13px;
color: #f44545;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

&.highlight {
.link-tool {
&__content {
flex-direction: column;
}

&__image {
flex-direction: column;
width: 100%;
height: auto;
aspect-ratio: 4/3;
}
}
}
}

Expand Down
Loading