Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ const isTitleEllipsized = (node) => {

return textHeight > nodeHeight;
};
const getContainer = (tooltipNode) => {
const { tooltipContainerSelector } = tooltipNode.dataset;
const container = tooltipNode.closest(tooltipContainerSelector);

return container ?? doc.body;
};
const initializeTooltip = (tooltipNode, hasEllipsisStyle) => {
const { delayShow, delayHide } = tooltipNode.dataset;
const delay = {
Expand All @@ -134,9 +140,7 @@ const initializeTooltip = (tooltipNode, hasEllipsisStyle) => {
const placement = tooltipNode.dataset.tooltipPlacement ?? 'bottom';
const trigger = tooltipNode.dataset.tooltipTrigger ?? 'hover';
const useHtml = tooltipNode.dataset.tooltipUseHtml !== undefined;
const container = tooltipNode.dataset.tooltipContainerSelector
? tooltipNode.closest(tooltipNode.dataset.tooltipContainerSelector)
: 'body';
const container = getContainer(tooltipNode);
const iframe = document.querySelector(tooltipNode.dataset.tooltipIframeSelector);

new bootstrap.Tooltip(tooltipNode, {
Expand Down
2 changes: 2 additions & 0 deletions src/lib/Menu/Action/VersionListActionMenuBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ private function createEditDraftAction(
bool $isDraftConflict = false
): ItemInterface {
$parameters['attributes']['class'] = self::IBEXA_BTN_CONTENT_DRAFT_EDIT_CLASS;
$parameters['attributes']['data-tooltip-container-selector'] = '.ibexa-modal';

if ($isDraftConflict) {
return $this->createDraftEditLinkAction($versionInfo, self::ITEM_EDIT_DRAFT, $parameters, $locationId);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/Menu/Action/BaseActionMenuBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected function assertActionItemSame(
self::assertSame($url, $actionItem->getUri());
self::assertSame($itemName, $actionItem->getLabel());
self::assertSame($extras, $actionItem->getExtras());
self::assertSame($attributes, $actionItem->getAttributes());
self::assertEquals($attributes, $actionItem->getAttributes());
}

protected function createVersionInfo(int $status = ApiVersionInfo::STATUS_DRAFT): ApiVersionInfo
Expand Down
20 changes: 16 additions & 4 deletions tests/lib/Menu/Action/VersionListActionMenuBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ public function provideDataForTestBuildVersionListActionMenu(): iterable
self::EDIT_ACTION_ITEM_EXTRAS,
array_merge(
self::EDIT_ACTION_ITEM_ATTRIBUTES,
['data-content-draft-edit-url' => '/content/edit/draft/1/1/eng-GB']
[
'data-tooltip-container-selector' => '.ibexa-modal',
'data-content-draft-edit-url' => '/content/edit/draft/1/1/eng-GB',
]
),
];

Expand All @@ -118,7 +121,10 @@ public function provideDataForTestBuildVersionListActionMenu(): iterable
self::EDIT_ACTION_ITEM_EXTRAS,
array_merge(
self::EDIT_ACTION_ITEM_ATTRIBUTES,
['data-content-draft-edit-url' => '/content/edit/draft/1/1/eng-GB/5']
[
'data-content-draft-edit-url' => '/content/edit/draft/1/1/eng-GB/5',
'data-tooltip-container-selector' => '.ibexa-modal',
]
),
];

Expand All @@ -130,7 +136,10 @@ public function provideDataForTestBuildVersionListActionMenu(): iterable
self::ITEM_EDIT_DRAFT,
'/content/edit/draft/1/1/eng-GB',
self::EDIT_ACTION_ITEM_EXTRAS,
['class' => self::IBEXA_BTN_CONTENT_DRAFT_EDIT_CLASS],
[
'class' => self::IBEXA_BTN_CONTENT_DRAFT_EDIT_CLASS,
'data-tooltip-container-selector' => '.ibexa-modal',
],
];

yield 'Restore version action item' => [
Expand Down Expand Up @@ -166,7 +175,10 @@ public function testAddUserUpdateItemAction(): void
self::EDIT_ACTION_ITEM_EXTRAS,
array_merge(
self::EDIT_ACTION_ITEM_ATTRIBUTES,
['data-content-draft-edit-url' => '/user/update/1/1/eng-GB']
[
'data-tooltip-container-selector' => '.ibexa-modal',
'data-content-draft-edit-url' => '/user/update/1/1/eng-GB',
]
)
);
}
Expand Down
Loading