Open
Conversation
e11sy
reviewed
Sep 9, 2025
| <div id="editorjs"></div> | ||
| <script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script> | ||
| <script type="module"> | ||
| import ImageTool from "../src/index.ts"; |
There was a problem hiding this comment.
unexpected change, dev mode should not depend on built files
src/index.ts
Outdated
Comment on lines
85
to
91
| /** | ||
| * Alt text enabled state | ||
| * Null when user has not toggled the alt tune | ||
| * True when user has toggled the alt tune | ||
| * False when user has toggled the alt tune | ||
| */ | ||
| private isAltEnabled: boolean | null = null; |
There was a problem hiding this comment.
why we need to distinguish when user has not toggled the alt tune and when user has toggled the alt tune to false?
maybe we can initialise it with false?
Author
|
Is this good? @e11sy |
neSpecc
reviewed
Sep 10, 2025
Comment on lines
73
to
97
| &__alt { | ||
| visibility: hidden; | ||
| position: absolute; | ||
| bottom: 0; | ||
| left: 0; | ||
| margin-bottom: 10px; | ||
|
|
||
| &[contentEditable="true"][data-placeholder]::before { | ||
| position: absolute !important; | ||
| content: attr(data-placeholder); | ||
| color: #707684; | ||
| font-weight: normal; | ||
| display: none; | ||
| } | ||
|
|
||
| &[contentEditable="true"][data-placeholder]:empty { | ||
| &::before { | ||
| display: block; | ||
| } | ||
|
|
||
| &:focus::before { | ||
| display: none; | ||
| } | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
can we reuse existing input styles and do not duplicate them?
src/index.ts
Outdated
| tunes.push({ | ||
| name: 'alt', | ||
| icon: IconText, | ||
| title: 'With alt text', |
Author
There was a problem hiding this comment.
should it be applied to caption as well?
src/ui.ts
Outdated
|
|
||
| // Add alt attribute for IMG tags | ||
| if (tag === 'IMG') { | ||
| attributes.alt = this.nodes.alt.innerHTML || ''; |
Contributor
There was a problem hiding this comment.
I'd suggest to get textContent instead
neSpecc
reviewed
Sep 11, 2025
src/index.ts
Outdated
Comment on lines
262
to
271
| name: this.api.i18n.t('caption'), | ||
| icon: IconText, | ||
| title: this.api.i18n.t('With caption'), | ||
| toggle: true, | ||
| }); | ||
| } | ||
|
|
||
| if (this.config.features?.alt === 'optional') { | ||
| tunes.push({ | ||
| name: this.api.i18n.t('alt'), |
Contributor
There was a problem hiding this comment.
i18n is not needed for name because it is used only for key name in result JSON, not for the UI.
Leave it for title only.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Problem
This PR resolves #30 by adding support for alt text in the Image Tool. Currently, the Image Tool lacks the ability to add alternative text to images, which is essential for accessibility (WCAG compliance) and improves SEO.
Cause
The Image Tool was missing:
Solution
altfield to ImageToolData interfacealtconfiguration option to FeaturesConfigConfiguration
The alt text feature can be configured via: