CDN으로 Web SDK 가져오기

완전한 HTML 예제를 먼저 실행하고, 그 후에 자신의 페이지로 복사합니다. 그것은 형식을 가진 편집 가능한 스프레드 시트가 필요한 신뢰할 수 있는, 스타일, 언어 팩 및 Facade 등록을 포함합니다.

편집 가능한 시트 체험

  1. 예제 열기 또는 아래 HTML을 내려받아 index.html로 저장하세요.
  2. 인터넷 접속을 가진 현대 브라우저에 있는 파일을 여십시오. 공구 또는 서버가 요구되지 않습니다. 공용영역과 표본 자료는 영어로 있습니다.
  3. 노트북 행은 36를 합계합니다. 3에서 4에 그것의 양을 바꾸고, 합계는 48가 됩니다. 다른 세포는 또한 편집될 수 있고, 변화는 undone일 수 있습니다.
HTML 다운로드

전체 HTML 예제

UniverUIPlugin

  • container
    string | HTMLElement
    편집기를 마운트할 DOM 요소 또는 요소 ID입니다.

예를 들어 React **18.3.1 UMD(미국)**를로드합니다. React 객체는 jsx 또는 jsxs, Univer UMD 번들을 제공하지 않습니다. 아래 두 줄 다리는 공공 React.createElement API를 통해 항목 점수를 모두 제공하지 않아야합니다. 패키지 관리자를 통해 설치하면 빌드 도구가 react/jsx-runtime을 해결하므로 UMD 설정으로 UMD를 설정해야합니다.

의존성 순서에 있는 jsDelivr에서 자원 짐. 요청이 실패한 경우에, 예는 unpkg에 동일한 버전을 발송하고 그 후에 계속합니다. 두 공급자가 실패하면, 그것은 자원이 적재될 수 없는 보고를 멈추고 보고합니다.

HTML
<!doctype html><html lang="ko-KR">  <head>    <meta charset="UTF-8" />    <meta name="viewport" content="width=device-width, initial-scale=1.0" />    <title>Univer Sheets CDN 예제</title>    <style>      html,      body,      #root,      #app {        padding: 0;        margin: 0;        height: 100%;      }    </style>  </head>  <body>    <div id="app"><p role="status" style="padding: 24px; font-family: system-ui">Univer 로딩 중…</p></div>    <script>      const cdnBases = ['https://cdn.jsdelivr.net/npm/', 'https://unpkg.com/']      const app = document.getElementById('app')      async function loadResource(path, tag = 'script') {        for (const base of cdnBases) {          const element = document.createElement(tag)          const url = base + path          element.crossOrigin = 'anonymous'          if (tag === 'link') {            element.rel = 'stylesheet'            element.href = url          } else {            element.src = url          }          try {            await new Promise((resolve, reject) => {              element.onload = () => resolve()              element.onerror = () => reject(new Error(url))              document.head.appendChild(element)            })            return          } catch {            element.remove()          }        }        throw new Error(`Could not load ${path} from ${cdnBases.join(' or ')}`)      }      const styles = [        '@univerjs/design@1.6.2/lib/index.css',        '@univerjs/ui@1.6.2/lib/index.css',        '@univerjs/docs-ui@1.6.2/lib/index.css',        '@univerjs/sheets-ui@1.6.2/lib/index.css',        '@univerjs/sheets-formula-ui@1.6.2/lib/index.css',        '@univerjs/sheets-numfmt-ui@1.6.2/lib/index.css',      ]      const reactScripts = [        'react@18.3.1/umd/react.production.min.js',        'react-dom@18.3.1/umd/react-dom.production.min.js',      ]      const sdkScripts = [        'rxjs@7.8.2/dist/bundles/rxjs.umd.min.js',        '@wendellhu/redi@1.1.3/dist/umd/index.js',        '@wendellhu/redi@1.1.3/dist/umd/react-bindings/index.js',        '@univerjs/themes@1.6.2/lib/umd/index.js',        '@univerjs/protocol@1.6.2/lib/umd/index.js',        '@univerjs/core@1.6.2/lib/umd/index.js',        '@univerjs/network@1.6.2/lib/umd/index.js',        '@univerjs/rpc@1.6.2/lib/umd/index.js',        '@univerjs/design@1.6.2/lib/umd/index.js',        '@univerjs/engine-render@1.6.2/lib/umd/index.js',        '@univerjs/engine-formula@1.6.2/lib/umd/index.js',        '@univerjs/drawing@1.6.2/lib/umd/index.js',        '@univerjs/telemetry@1.6.2/lib/umd/index.js',        '@univerjs/ui@1.6.2/lib/umd/index.js',        '@univerjs/docs@1.6.2/lib/umd/index.js',        '@univerjs/docs-ui@1.6.2/lib/umd/index.js',        '@univerjs/sheets@1.6.2/lib/umd/index.js',        '@univerjs/sheets-ui@1.6.2/lib/umd/index.js',        '@univerjs/sheets-formula@1.6.2/lib/umd/index.js',        '@univerjs/sheets-formula-ui@1.6.2/lib/umd/index.js',        '@univerjs/sheets-numfmt@1.6.2/lib/umd/index.js',        '@univerjs/sheets-numfmt-ui@1.6.2/lib/umd/index.js',        '@univerjs/core@1.6.2/lib/umd/facade.js',        '@univerjs/engine-formula@1.6.2/lib/umd/facade.js',        '@univerjs/ui@1.6.2/lib/umd/facade.js',        '@univerjs/docs@1.6.2/lib/umd/facade.js',        '@univerjs/docs-ui@1.6.2/lib/umd/facade.js',        '@univerjs/sheets@1.6.2/lib/umd/facade.js',        '@univerjs/sheets-ui@1.6.2/lib/umd/facade.js',        '@univerjs/sheets-formula@1.6.2/lib/umd/facade.js',        '@univerjs/sheets-numfmt@1.6.2/lib/umd/facade.js',        '@univerjs/design@1.6.2/lib/umd/locale/ko-KR.js',        '@univerjs/ui@1.6.2/lib/umd/locale/ko-KR.js',        '@univerjs/sheets@1.6.2/lib/umd/locale/ko-KR.js',        '@univerjs/sheets-ui@1.6.2/lib/umd/locale/ko-KR.js',        '@univerjs/docs-ui@1.6.2/lib/umd/locale/ko-KR.js',        '@univerjs/sheets-formula-ui@1.6.2/lib/umd/locale/ko-KR.js',        '@univerjs/sheets-numfmt-ui@1.6.2/lib/umd/locale/ko-KR.js',      ]      // Fetch ahead in parallel; main() still executes scripts in dependency order.      for (const [as, paths] of [        ['style', styles],        ['script', [...reactScripts, ...sdkScripts]],      ]) {        for (const path of paths) {          const preload = document.createElement('link')          preload.rel = 'preload'          preload.as = as          preload.crossOrigin = 'anonymous'          preload.href = cdnBases[0] + path          preload.onerror = () => {            preload.onerror = null            preload.href = cdnBases[1] + path          }          document.head.appendChild(preload)        }      }      async function main() {        for (const path of styles) await loadResource(path, 'link')        for (const path of reactScripts) await loadResource(path)        // Bridge the React 18 UMD global to the JSX runtime expected by Univer UMD bundles.        React.jsx = (type, props, key) => React.createElement(type, key === undefined ? props : { ...props, key })        React.jsxs = React.jsx        for (const path of sdkScripts) await loadResource(path)        app.textContent = ''        const { Univer, LocaleType, mergeLocales, UniverInstanceType } = UniverCore        const { FUniver } = UniverCoreFacade        const { UniverRenderEnginePlugin } = UniverEngineRender        const { UniverFormulaEnginePlugin } = UniverEngineFormula        const { UniverUIPlugin } = UniverUi        const { UniverSheetsPlugin } = UniverSheets        const { UniverSheetsUIPlugin } = UniverSheetsUi        const { UniverDocsPlugin } = UniverDocs        const { UniverDocsUIPlugin } = UniverDocsUi        const { UniverSheetsFormulaPlugin } = UniverSheetsFormula        const { UniverSheetsFormulaUIPlugin } = UniverSheetsFormulaUi        const { UniverSheetsNumfmtPlugin } = UniverSheetsNumfmt        const { UniverSheetsNumfmtUIPlugin } = UniverSheetsNumfmtUi        const univer = new Univer({          locale: LocaleType.KO_KR,          locales: {            [LocaleType.KO_KR]: mergeLocales(              UniverDesignKoKR,              UniverUiKoKR,              UniverSheetsKoKR,              UniverSheetsUiKoKR,              UniverDocsUiKoKR,              UniverSheetsFormulaUiKoKR,              UniverSheetsNumfmtUiKoKR,            ),          },        })        univer.registerPlugin(UniverRenderEnginePlugin)        univer.registerPlugin(UniverFormulaEnginePlugin)        univer.registerPlugin(UniverUIPlugin, {          container: 'app',        })        univer.registerPlugin(UniverDocsPlugin)        univer.registerPlugin(UniverDocsUIPlugin)        univer.registerPlugin(UniverSheetsPlugin)        univer.registerPlugin(UniverSheetsUIPlugin)        univer.registerPlugin(UniverSheetsFormulaPlugin)        univer.registerPlugin(UniverSheetsFormulaUIPlugin)        univer.registerPlugin(UniverSheetsNumfmtPlugin)        univer.registerPlugin(UniverSheetsNumfmtUIPlugin)        univer.createUnit(UniverInstanceType.UNIVER_SHEET, {})        const univerAPI = FUniver.newAPI(univer)        window.univerAPI = univerAPI        univerAPI          .getActiveWorkbook()          .getActiveSheet()          .getRange('A1:D3')          .setValues([            ['품목', '수량', '단가', '합계'],            ['노트', 3, 12, '=B2*C2'],            ['펜', 5, 2, '=B3*C3'],          ])      }      main().catch((error) => {        console.error(error)        app.setAttribute('role', 'alert')        app.style.cssText =          'padding: 24px; box-sizing: border-box; white-space: pre-wrap; overflow-wrap: anywhere; font: 14px/1.5 system-ui'        app.textContent =          '예제 로딩에 실패했습니다. 네트워크를 확인한 뒤 페이지를 새로 고치세요.' + '\n' + error.message      })    </script>  </body></html>

네임스페이스 규칙

UMD 스크립트는 모듈 수출을 글로벌 객체로 노출합니다. 초기화 코드는 플러그인과 Facade API에 액세스하려면 이러한 이름을 사용합니다.

패키지 또는 진입점전역 이름
@univerjs/coreUniverCore
@univerjs/docs-uiUniverDocsUi
@univerjs/core/facadeUniverCoreFacade
@univerjs/docs-ui/locale/en-USUniverDocsUiEnUS

버전 일치

Univer 패키지는 1.6.2, React 및 ReactDOM을 18.3.1로 핀으로 꼿고, RxJS에서 7.8.2에 RxJS를 곱합니다. 업그레이드할 때, Facade, CSS 및 Locale 파일을 포함한 모든 Univer URL을 업데이트합니다. 기존 응용 프로그램 번들을 따라 이러한 라이브러리의 두 번째 복사본을로드하지 마십시오.

문제 해결

증상확인할 사항
ITelemetryService로드 @univerjs/telemetry 먼저, 다음 @univerjs/sheets-ui, 그것은 그것에 따라. 의존성 목록에서 항목을 제거하지 마십시오.
FDocument@univerjs/docs-ui/facade 전에 @univerjs/docs/facade를로드하십시오. 시트는 또한 Docs 텍스트 엔진을 사용합니다.
[redi], t is not a function완전한 예에서 시작하면 각 종속의 사본을 유지하고 모든 버전이 정렬됩니다. 브라우저 네트워크 패널에서 실패한 요청을 확인하십시오.
빈 에디터컨테이너를 명시한 높이를 부여합니다. 네트워크 또는 CSP가 CDN을 차단하면, 패키지 관리자 통합에 의존하거나 스위치를 호스트합니다.

이미 React 또는 Vue 응용 프로그램이있는 경우 대신 Package-manager 통합를 사용하십시오. 패키지 관리자는 신뢰할 수를 처리하고 긴 스크립트 목록을 유지하지 않도록합니다.

이 가이드는 어떠셨나요?

© 2026 DreamNum Co., Ltd.