Use iframe instead of popup window to display editor components in mobile

This commit is contained in:
Kijin Sung 2025-05-14 01:09:59 +09:00
parent 833cf111bd
commit f6313d44d9
5 changed files with 50 additions and 2 deletions

View file

@ -210,7 +210,25 @@ function openComponent(component_name, editor_sequence, manual_url) {
if(typeof(manual_url)!="undefined" && manual_url) popup_url += "&manual_url="+escape(manual_url);
if(typeof(current_mid)!="undefined" && current_mid) popup_url += "&mid="+escape(current_mid);
popopen(popup_url, 'editorComponent');
if (navigator.userAgent.match(/mobile/i)) {
openComponentInIframe(popup_url);
} else {
popopen(popup_url, 'editorComponent');
}
}
function openComponentInIframe(popup_url) {
var iframe_sequence = String(Date.now()) + Math.round(Math.random() * 1000000);
var iframe = document.createElement('iframe');
popup_url += '&iframe_sequence=' + iframe_sequence;
iframe.setAttribute('id', 'editor_iframe_' + iframe_sequence);
iframe.setAttribute('src', popup_url);
iframe.setAttribute('width', '100%');
iframe.setAttribute('height', '100%');
iframe.setAttribute('frameborder', '0');
iframe.setAttribute('scrolling', 'no');
iframe.setAttribute('style', 'position:fixed; top:0; left:0; width:100%; height:100%; z-index:999999999; background-color: #fff; overflow-y:auto');
$(document.body).append(iframe);
}
// 더블클릭 이벤트 발생시에 본문내에 포함된 컴포넌트를 찾는 함수