fix: 退出全屏按钮适配导航 (#1541)

Reviewed-on: daoyoucloud/tachybase#1541
Reviewed-by: sealday <zhanglin@daoyoucloud.com>
Co-authored-by: wjh <wwwjh0710@163.com>
Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
wjh 2024-09-18 16:43:15 +08:00 committed by sealday
parent 26c53003e7
commit 7cd0a044c5
2 changed files with 8 additions and 5 deletions

View File

@ -98,6 +98,8 @@ const checkedAutoPage = (position, message, t) => {
if (!sibling.classList.contains('autoPage')) { if (!sibling.classList.contains('autoPage')) {
const element = document.elementFromPoint(position?.x, position?.y); const element = document.elementFromPoint(position?.x, position?.y);
const blockElement = element.closest('.ant-card'); const blockElement = element.closest('.ant-card');
const navbar = document.querySelector('.ant-layout-header');
const navbarHeight = navbar.getBoundingClientRect();
if (blockElement) { if (blockElement) {
//需要展示的区块 //需要展示的区块
const copyBlockElement = blockElement.cloneNode(true); const copyBlockElement = blockElement.cloneNode(true);
@ -107,17 +109,17 @@ const checkedAutoPage = (position, message, t) => {
copyBlockElement.style.backgroundColor = '#ffffff'; copyBlockElement.style.backgroundColor = '#ffffff';
const autoNode = document.createElement('div'); const autoNode = document.createElement('div');
autoNode.style.marginTop = '2.5%'; autoNode.style.marginTop = `${navbarHeight.height}px`;
autoNode.style.width = '100%'; autoNode.style.width = '100%';
autoNode.className = 'autoPage'; autoNode.className = 'autoPage';
//退出按钮 //退出按钮
const exitNode = document.createElement('div'); const exitNode = document.createElement('div');
exitNode.style.width = '100%'; exitNode.style.width = '100%';
exitNode.style.height = '3vh'; exitNode.style.height = '4vh';
exitNode.style.textAlign = 'center'; exitNode.style.textAlign = 'center';
exitNode.style.lineHeight = '3vh'; exitNode.style.lineHeight = '4vh';
exitNode.style.backgroundColor = '#e6e6e6'; exitNode.style.backgroundColor = '#e6e6e6';
exitNode.textContent = '退出全屏'; exitNode.textContent = `${t('Exit Full Screen')}`;
autoNode.appendChild(exitNode); autoNode.appendChild(exitNode);
autoNode.appendChild(copyBlockElement); autoNode.appendChild(copyBlockElement);
autoNode.addEventListener('click', () => { autoNode.addEventListener('click', () => {

View File

@ -956,5 +956,6 @@
"Disable Right Menu":"禁用右键菜单", "Disable Right Menu":"禁用右键菜单",
"Full Screen":"切换全屏", "Full Screen":"切换全屏",
"Designer Mode":"设计者模式", "Designer Mode":"设计者模式",
"There are no full screen blocks available at the current location":"当前位置没有可全屏区块" "There are no full screen blocks available at the current location":"当前位置没有可全屏区块",
"Exit Full Screen":"退出全屏"
} }