From 4bcc339c51e399aac07a4f67a4849a546b613a6d Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Wed, 7 Oct 2026 15:46:46 +0900 Subject: [PATCH] =?UTF-8?q?261007=5F01=5FENH:=20=EC=B9=B4=EC=B9=B4?= =?UTF-8?q?=EC=98=A4=20=EC=95=8C=EB=A6=BC=ED=86=A1=20=EB=AF=B8=EB=A6=AC?= =?UTF-8?q?=EB=B3=B4=EA=B8=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 18 ++++++ package-lock.json | 4 +- package.json | 2 +- registry/components/kri-editor/KriEditor.tsx | 5 ++ .../components/kri-editor/KriEditorKko.tsx | 59 +++++++++++++++++++ registry/components/kri-editor/index.ts | 1 + registry/components/kri-editor/types.ts | 8 ++- registry/components/registry.json | 7 ++- 8 files changed, 99 insertions(+), 5 deletions(-) create mode 100644 registry/components/kri-editor/KriEditorKko.tsx diff --git a/README.md b/README.md index f70087e..e60dca2 100644 --- a/README.md +++ b/README.md @@ -254,3 +254,21 @@ import { KriScatterChart } from '@/components/chart' - `htmlSanitizer`로 서비스의 서버 정책에 맞는 정제 함수를 주입할 수 있습니다. - `getWysiwygCompatibility`가 `compatible: false`를 반환하면 HTML 원문을 유지하고 WYSIWYG 전환을 비활성화합니다. - `smsPreviewSuffix`는 저장 본문에는 포함하지 않고 SMS 미리보기와 바이트 계산에만 반영합니다. + +### 알림톡(KKO) 미리보기 + +```tsx + {}} + kkoTitle={templateTitle} + kkoSenderName="코리아리서치" +/> +``` + +- 편집할 수 없는 읽기 전용 미리보기입니다. `onChange`는 타입상 필수라서 빈 함수를 전달합니다. +- 본문과 제목은 텍스트로만 렌더링하며 공백·개행을 유지합니다. HTML 문자열도 글자 그대로 표시합니다. +- `#{name}`, `[$name]` 같은 변수는 원문 그대로 표시합니다. 값으로 바꿔야 하면 치환한 문자열을 `value`로 전달합니다. +- `kkoHeaderLabel` 기본값은 `알림톡 도착`이고, 본문이 비어 있으면 `placeholder`(기본값 `미리볼 내용이 없습니다.`)를 표시합니다. +- 버튼, 바로연결, 이미지, 아이템 리스트는 표시하지 않습니다. diff --git a/package-lock.json b/package-lock.json index eb439fd..fd3d86a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "kri-ui-registry", - "version": "0.13.1", + "version": "0.14.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "kri-ui-registry", - "version": "0.13.1", + "version": "0.14.0", "devDependencies": { "@tanstack/react-table": "^8.21.3", "@tiptap/extension-color": "^3.27.1", diff --git a/package.json b/package.json index b3be4b4..0630c94 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kri-ui-registry", - "version": "0.13.1", + "version": "0.14.0", "private": true, "description": "KRI internal shadcn UI registry", "scripts": { diff --git a/registry/components/kri-editor/KriEditor.tsx b/registry/components/kri-editor/KriEditor.tsx index df47653..056434f 100644 --- a/registry/components/kri-editor/KriEditor.tsx +++ b/registry/components/kri-editor/KriEditor.tsx @@ -4,6 +4,7 @@ import type { KriEditorProps, KriEditorMode } from "./types"; import { KriEditorHtmlOnly } from "./KriEditorHtmlOnly"; import { KriEditorWysiwyg } from "./KriEditorWysiwyg"; import {KriEditorSms} from "./KriEditorSms"; +import { KriEditorKko } from "./KriEditorKko"; function resolveMode(mode?: KriEditorMode, editorMode?: KriEditorMode): KriEditorMode { return mode ?? editorMode ?? "wysiwyg"; @@ -20,5 +21,9 @@ export function KriEditor(props: KriEditorProps) { return } + if (mode === "kko") { + return ; + } + return ; } diff --git a/registry/components/kri-editor/KriEditorKko.tsx b/registry/components/kri-editor/KriEditorKko.tsx new file mode 100644 index 0000000..07706c3 --- /dev/null +++ b/registry/components/kri-editor/KriEditorKko.tsx @@ -0,0 +1,59 @@ +'use client' + +import { User } from 'lucide-react' +import { cn } from '@/lib/utils' +import type { KriEditorProps } from './types' + +type KkoEditorProps = Omit & { mode: 'kko' } + +export function KriEditorKko({ + label, + value, + placeholder = '미리볼 내용이 없습니다.', + className, + kkoTitle = '', + kkoSenderName = '', + kkoHeaderLabel = '알림톡 도착', +}: KkoEditorProps) { + const body = value ?? '' + + return ( +
+ {label ?
{label}
: null} +
+
+
+ {kkoSenderName ? ( +
{kkoSenderName}
+ ) : null} +
+ {kkoSenderName ? ( +
+ + {kkoSenderName} +
+ ) : null} +
+ +
{kkoHeaderLabel}
+ {kkoTitle ?
{kkoTitle}
: null} + {body.trim() ? ( +
{body}
+ ) : ( +
{placeholder}
+ )} +
+
+
+
+
+
+ ) +} diff --git a/registry/components/kri-editor/index.ts b/registry/components/kri-editor/index.ts index efce1bb..99b77c9 100644 --- a/registry/components/kri-editor/index.ts +++ b/registry/components/kri-editor/index.ts @@ -1,5 +1,6 @@ export { KriEditor } from './KriEditor' export { KriEditorHtmlOnly } from './KriEditorHtmlOnly' +export { KriEditorKko } from './KriEditorKko' export { KriEditorSms } from './KriEditorSms' export { KriEditorWysiwyg } from './KriEditorWysiwyg' export { ToolbarButton as KriEditorToolbarButton } from './toolbar/ToolbarButton' diff --git a/registry/components/kri-editor/types.ts b/registry/components/kri-editor/types.ts index 6429fa1..028d720 100644 --- a/registry/components/kri-editor/types.ts +++ b/registry/components/kri-editor/types.ts @@ -2,7 +2,7 @@ import type { Extensions } from '@tiptap/core' import type { Editor } from '@tiptap/react' import type { ReactNode } from 'react' -export type KriEditorMode = 'wysiwyg' | 'both' | 'html' | 'sms' +export type KriEditorMode = 'wysiwyg' | 'both' | 'html' | 'sms' | 'kko' export type KriEditorUploadResult = string | { url: string } export type KriEditorToolbarFeature = @@ -89,6 +89,12 @@ export type KriEditorProps = { smsHasAttachment?: boolean /** 문자 미리보기의 제목과 본문 사이에 표시할 첨부 이미지 */ smsImages?: KriEditorSmsImage[] + /** 알림톡 미리보기의 강조 제목. 없으면 표시하지 않는다. */ + kkoTitle?: string + /** 알림톡 미리보기의 채널명·발신 프로필 이름. 없으면 표시하지 않는다. */ + kkoSenderName?: string + /** 알림톡 말풍선 상단 문구. 기본값 "알림톡 도착" */ + kkoHeaderLabel?: string toolbar?: KriEditorToolbarConfig | false fontFamilyOptions?: KriEditorFontFamilyOption[] renderToolbarEnd?: (context: KriEditorToolbarContext) => ReactNode diff --git a/registry/components/registry.json b/registry/components/registry.json index 92d623c..5be1e08 100644 --- a/registry/components/registry.json +++ b/registry/components/registry.json @@ -319,7 +319,7 @@ "name": "kri-editor", "type": "registry:component", "title": "KRI Editor", - "description": "WYSIWYG, HTML, SMS 모드와 주입형 이미지 업로드 및 선택형 툴바를 제공하는 편집기입니다.", + "description": "WYSIWYG, HTML, SMS 모드, 알림톡(KKO) 미리보기와 주입형 이미지 업로드 및 선택형 툴바를 제공하는 편집기입니다.", "registryDependencies": [ "button", "dropdown-menu", @@ -359,6 +359,11 @@ "type": "registry:component", "target": "@components/kri-editor/KriEditorHtmlOnly.tsx" }, + { + "path": "kri-editor/KriEditorKko.tsx", + "type": "registry:component", + "target": "@components/kri-editor/KriEditorKko.tsx" + }, { "path": "kri-editor/KriEditorSms.tsx", "type": "registry:component",