하이퍼링크
문서에서 외부 웹 페이지, 이메일 주소 또는 기타 콘텐츠에 하이퍼 링크 포인트.
플러그인 모드
설치
Shell
pnpm add @univerjs/docs-hyper-link @univerjs/docs-hyper-link-uiShell
npm install @univerjs/docs-hyper-link @univerjs/docs-hyper-link-uiShell
yarn add @univerjs/docs-hyper-link @univerjs/docs-hyper-link-uiShell
bun add @univerjs/docs-hyper-link @univerjs/docs-hyper-link-ui사용법
TypeScript
import { LocaleType, mergeLocales, Univer } from '@univerjs/core'import { UniverDocsHyperLinkPlugin } from '@univerjs/docs-hyper-link'import { UniverDocsHyperLinkUIPlugin } from '@univerjs/docs-hyper-link-ui'import DocsHyperLinkUIKoKR from '@univerjs/docs-hyper-link-ui/locale/ko-KR'import '@univerjs/docs-hyper-link-ui/lib/index.css'const univer = new Univer({ locale: LocaleType.KO_KR, locales: { [LocaleType.KO_KR]: mergeLocales( DocsHyperLinkUIKoKR, ), },})univer.registerPlugin(UniverDocsHyperLinkPlugin)univer.registerPlugin(UniverDocsHyperLinkUIPlugin)모바일 지원
모바일 편집기를 먼저 구성하십시오. 이 페이지의 플러그인 모드 설정에서 동일한 패키지에서 모바일 내보내기로 아래 데스크탑 등록을 대체하고 문서 열기을 수행하십시오. 모델 플러그인, 스타일, 로컬 및 Facade 가져 오기를 유지하고 변형을 등록하지 마십시오.
| 패키지 | 데스크톱 등록 | 모바일 등록 |
|---|---|---|
@univerjs/docs-hyper-link-ui | UniverDocsHyperLinkUIPlugin | UniverDocsHyperLinkMobileUIPlugin |
프리셋 모드
설치
Shell
pnpm add @univerjs/preset-docs-hyper-linkShell
npm install @univerjs/preset-docs-hyper-linkShell
yarn add @univerjs/preset-docs-hyper-linkShell
bun add @univerjs/preset-docs-hyper-link사용법
TypeScript
import { UniverDocsCorePreset } from '@univerjs/preset-docs-core'import UniverPresetDocsCoreKoKR from '@univerjs/preset-docs-core/locales/ko-KR'import { UniverDocsHyperLinkPreset } from '@univerjs/preset-docs-hyper-link'import UniverPresetDocsHyperLinkKoKR from '@univerjs/preset-docs-hyper-link/locales/ko-KR'import { createUniver, LocaleType, mergeLocales } from '@univerjs/presets'import '@univerjs/preset-docs-core/lib/index.css'import '@univerjs/preset-docs-hyper-link/lib/index.css'const { univerAPI } = createUniver({ locale: LocaleType.KO_KR, locales: { [LocaleType.KO_KR]: mergeLocales( UniverPresetDocsCoreKoKR, UniverPresetDocsHyperLinkKoKR, ), }, presets: [ UniverDocsCorePreset(), UniverDocsHyperLinkPreset(), ],})Facade API로 링크 만들고 편집하기
link(text, url)는 연결한 원본을 추가하고 범위를 기록합니다, 그래서 특성 상쇄는 수동으로 산출될 필요가 없습니다. 목적지를 나중에 바꾸기 위하여는, getLinks()에 의해 반환된 범위 ID를 통과하십시오.
TypeScript
const richText = univerAPI .newRichText() .text('Read ') .link('Univer Office SDK documentation', 'https://docs.univer.ai') .text(' for details.')const [link] = richText.getLinks()if (!link) throw new Error('Link was not created')richText.updateLink(link.rangeId, 'https://docs.univer.ai/guides')removeLink(link.rangeId)는 목적지를 제거하고 눈에 보이는 텍스트를 유지합니다.
이 가이드는 어떠셨나요?