From 846b8ffafc9ff53d0e7447bc0502de7f05754acd Mon Sep 17 00:00:00 2001 From: wolfcode <37436228+wolf-leo@users.noreply.github.com> Date: Mon, 28 Oct 2024 18:26:26 +0800 Subject: [PATCH] feat(easy-admin): update window open URL for new tab button - Change the URL for the "New tab open" button to use the iframe's content URL - Add fallback to current window URL if iframe content URL cannot be accessed - Improve user experience by opening the correct URL in a new tab Signed-off-by: wolfcode <37436228+wolf-leo@users.noreply.github.com> --- public/static/plugs/easy-admin/easy-admin.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public/static/plugs/easy-admin/easy-admin.js b/public/static/plugs/easy-admin/easy-admin.js index 679a8f7..c7deebb 100644 --- a/public/static/plugs/easy-admin/easy-admin.js +++ b/public/static/plugs/easy-admin/easy-admin.js @@ -1000,9 +1000,17 @@ define(["jquery", "tableSelect"], function ($, tableSelect) { }, success: function (layero, index) { if (window.CONFIG.IFRAME_OPEN_TOP == '1') { + let iframeUrl = `` + try { + let iframeId = $('iframe:eq(0)').attr('id') + let iframe = document.getElementById(iframeId) + iframeUrl = iframe.contentWindow.location.href + } catch (e) { + iframeUrl = location.href + } let _winTopBtn = ` + style="position: absolute;top: 14px;right: 120px;color: #fff;border-color: #fff;" onclick="window.open('${iframeUrl}')"> 新标签页打开 ` $('.layui-layer-iframe').append(_winTopBtn)