From d0b73b13ac73db820e214d42f2c2562f58010ff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chyeonggkim=E2=80=9D?= <“hyeonggkim@smilegate.com”> Date: Wed, 11 Feb 2026 19:43:00 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20CtLayout01=20=EB=A1=9C=EA=B7=B8=20s?= =?UTF-8?q?taticUrl=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layers/templates/CtLayout01/index.vue | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/layers/templates/CtLayout01/index.vue b/layers/templates/CtLayout01/index.vue index 9f0ba6e..6e46fdb 100644 --- a/layers/templates/CtLayout01/index.vue +++ b/layers/templates/CtLayout01/index.vue @@ -27,6 +27,7 @@ // Configuration const runtimeConfig = useRuntimeConfig() const staticUrl = runtimeConfig.public.staticUrl + const runType = runtimeConfig.public.runType // CSR에서만 fnCustomAction, fnCustomLog, fnCustomVideo 즉시 설정 (HTML 렌더링 전에 필요) // handleCustomAction, handleCustomLog, handleCustomVideo가 정의되기 전이므로 나중에 업데이트됨 @@ -123,12 +124,27 @@ } } + // URL 경로 변환: http/https면 그대로, 상대경로면 STATIC_URL + RUN_TYPE + url 형식으로 변환 + const resolveCustomUrl = (url: string): string => { + if (/^https?:\/\//i.test(url)) { + return url + } + return `${staticUrl}/${runType}${url}` + } + + // HTML 주석에서 URL 추출하는 공통 함수 + const extractCommentUrl = (html: string, key: string): string | null => { + const commentRegex = new RegExp(``, 'i') + const match = html.match(commentRegex) + if (!match || !match[1]) return null + return resolveCustomUrl(match[1].trim()) + } + // HTML 주석에서 customTranslang JSON URL 추출 // 형식: + // 또는: (상대경로) const extractCustomTranslangUrl = (html: string): string | null => { - const commentRegex = //i - const match = html.match(commentRegex) - return match && match[1] ? match[1].trim() : null + return extractCommentUrl(html, 'customTranslang') } // JSON 파일을 fetch해서 i18n에 추가