Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 25 additions & 0 deletions src/controllers/CkeditorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,31 @@ public function actionImagePermissions(): Response
]);
}

public function actionImageAlt(): Response
{
$assetId = $this->request->getRequiredBodyParam('assetId');
$siteId = $this->request->getBodyParam('siteId');

$query = Asset::find()
->id($assetId)
->kind('image');

if ($siteId) {
$query->siteId($siteId);
}

$asset = $query->one();

if (!$asset) {
throw new NotFoundHttpException('Image not found');
}

return $this->asJson([
'alt' => $asset->alt,
'siteId' => $asset->siteId,
]);
}

/**
* Return element rendered for the control panel and the IDs of the sites it supports.
*
Expand Down
2 changes: 2 additions & 0 deletions src/helpers/CkeditorConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ final class CkeditorConfig
'WordCount',
],
'@craftcms/ckeditor' => [
'CraftImageTextAlternativeUI',
'CraftImageInsertUI',
'ImageTransform',
'ImageEditor',
Expand All @@ -99,6 +100,7 @@ final class CkeditorConfig
'AutoImage',
'CraftEntries',
'CraftImageInsertUI',
'CraftImageTextAlternativeUI',
'Image',
'ImageCaption',
'ImageStyle',
Expand Down
3 changes: 3 additions & 0 deletions src/translations/en/ckeditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@
'Show as a separate button' => 'Show as a separate button',
'Show word count' => 'Show word count',
'Site: {name}' => 'Site: {name}',
'Sync from asset' => 'Sync from asset',
'The default transform that should be applied when inserting an image.' => 'The default transform that should be applied when inserting an image.',
'The maximum number of words or characters the field is allowed to have.' => 'The maximum number of words or characters the field is allowed to have.',
'The text alternative was already in sync.' => 'The text alternative was already in sync.',
'The text alternative was synced from the asset.' => 'The text alternative was synced from the asset.',
'The text tooltip for the entry creation button.' => 'The text tooltip for the entry creation button.',
'The transforms that should be available when inserting images.' => 'The transforms that should be available when inserting images.',
'The type of column this field should get in the database.' => 'The type of column this field should get in the database.',
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/ckeditor/dist/ckeditor.css

Large diffs are not rendered by default.

Loading
Loading