rails_modal_manager 1.0.52 → 1.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f5ea3c9a0f748719fffb7a377e31eb8ffa82aa92a51fe5e57d0c9e766757f6bd
|
|
4
|
+
data.tar.gz: 299fa546552e45abccac98ddd60d258b8b24d8a5ffe3b4e8c8e5647df5b63003
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 577924acb8554d70314b4380100d2f6c72ffed2216fb43f78c6197007508e833b35c11f527644cf8ca3e2115cfd06328bb3fa74b7c4eb648336ba3a94587f779
|
|
7
|
+
data.tar.gz: f56d2917b83eab179ec1a54e9cf3654e0c81e3e3fe778d0982279d13c18e859dd069f1d7bf73238c0771ddea72d1dbe0b6d189db039bfc0892ad7bfce414b877
|
|
@@ -26,9 +26,11 @@ function renderButtonHtml(btn) {
|
|
|
26
26
|
const attrs = [`class="${classes.join(" ")}"`]
|
|
27
27
|
if (btn.disabled || btn.loading) attrs.push("disabled")
|
|
28
28
|
if (btn.action) attrs.push(`data-action="${escapeHtml(btn.action)}"`)
|
|
29
|
-
// v1.0.
|
|
30
|
-
//
|
|
31
|
-
|
|
29
|
+
// v1.0.53+: onclick 을 `data-rmm-onclick` 속성에 저장하고 setModalFooter 가
|
|
30
|
+
// 렌더 직후 실제 click listener 로 바인딩. innerHTML 로 박힌 inline `onclick`
|
|
31
|
+
// 은 일부 환경(CSP, 특정 브라우저 파싱) 에서 핸들러로 등록되지 않는 경우가 있어
|
|
32
|
+
// 이 방식으로 확실히 동작시킴.
|
|
33
|
+
if (btn.onclick) attrs.push(`data-rmm-onclick="${escapeHtml(btn.onclick)}"`)
|
|
32
34
|
if (btn.id) attrs.push(`data-button-id="${escapeHtml(btn.id)}"`)
|
|
33
35
|
|
|
34
36
|
return `<button type="button" ${attrs.join(" ")}>${escapeHtml(btn.label || "")}</button>`
|
|
@@ -63,6 +65,20 @@ export function setModalFooter(modal, buttons = [], message = null) {
|
|
|
63
65
|
// 우측 버튼 영역
|
|
64
66
|
right.innerHTML = (buttons || []).map(renderButtonHtml).join("")
|
|
65
67
|
|
|
68
|
+
// v1.0.53+: data-rmm-onclick 속성을 실제 click 이벤트 리스너로 바인딩
|
|
69
|
+
right.querySelectorAll("[data-rmm-onclick]").forEach(function(btn) {
|
|
70
|
+
const code = btn.getAttribute("data-rmm-onclick")
|
|
71
|
+
btn.removeAttribute("data-rmm-onclick")
|
|
72
|
+
btn.addEventListener("click", function() {
|
|
73
|
+
try {
|
|
74
|
+
// 버튼 본인을 `this` 로 전달 (호출측에서 this.dataset 등 접근 가능)
|
|
75
|
+
new Function(code).call(btn)
|
|
76
|
+
} catch (e) {
|
|
77
|
+
console.warn("[rmm-footer] onclick handler error:", e)
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
|
|
66
82
|
// 교체 이벤트 dispatch (앱에서 후처리 원할 경우용)
|
|
67
83
|
footer.dispatchEvent(
|
|
68
84
|
new CustomEvent("rmm-footer:updated", {
|