{"versions":{"3.0.11":{"name":"@vervedoc/core","version":"3.0.11","description":"VerveDoc Core 核心编辑器库","author":{"name":"wanghe"},"license":"MIT","type":"module","main":"./dist/core.umd.cjs","module":"./dist/core.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/core.js","require":"./dist/core.umd.cjs"}},"publishConfig":{"access":"public"},"scripts":{"dev":"vite","clean":"node -e \"const fs = require('fs'); if(fs.existsSync('dist')) fs.rmSync('dist', {recursive: true})\"","build":"npm run clean && tsc && vite build","preview":"vite preview","type:check":"tsc --noEmit"},"devDependencies":{"@eslint/js":"^10.0.1","@types/node":"^25.3.3","eslint":"^10.4.0","eslint-plugin-unused-imports":"^4.4.1","typescript":"^5.0.0","typescript-eslint":"^8.59.4","vite":"^6.4.3","vite-plugin-css-injected-by-js":"^3.0.0","vite-plugin-dts":"^4.5.4"},"engines":{"node":">=16.0.0"},"dependencies":{"@vervedoc/docx-editor-commands":"1.0.4","@vervedoc/docx-editor-comment":"1.0.7","@vervedoc/docx-editor-history":"1.0.8","@vervedoc/docx-editor-keymap":"1.0.5","@vervedoc/docx-editor-schema":"1.0.9","@vervedoc/docx-editor-state":"1.0.3","@vervedoc/docx-editor-transform":"1.0.8","@vervedoc/docx-editor-view":"1.0.5","docx":"^9.1.0","jszip":"^3.10.1","vanilla-picker":"^2.12.3"},"gitHead":"29c5d1b8d794ecda1bbbb0e2fd2f27092cd9f953","_id":"@vervedoc/core@3.0.11","_nodeVersion":"25.2.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-f+d+mKAiuuEEqm4xJlwjLv4vMGNjb0l/ZyQXE1KS7kwW9IpLK7KURy0ezZsfty58S7fGzGWkVNEHfPV104lywQ==","shasum":"ebdad7dae659f83d25925dd9ce5f5d2f7d115cba","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@vervedoc/core/-/core-3.0.11.tgz","fileCount":45,"unpackedSize":5185982,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEJm0Mc3P8lbKdf6u8M6502OI7HuWRtXGYsa4TyvaCupAiEA3d2zZQindK9ne02WHXK0qQiyyVrmsTlYv3ZVlWfrVCw="}],"size":1221996},"_npmUser":{"name":"anonymous","email":"1280381827@qq.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"1280381827@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/core_3.0.11_1783671501433_0.502436841409666"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2026-07-10T08:18:21.599Z","publish_time":1783671501599,"_source_registry_name":"default","contributors":[]},"3.0.10":{"name":"@vervedoc/core","version":"3.0.10","author":{"name":"wanghe"},"license":"MIT","_id":"@vervedoc/core@3.0.10","maintainers":[{"name":"anonymous","email":"1280381827@qq.com"}],"dist":{"shasum":"816395a8fee401a3dc816b02d02273feaacaf618","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@vervedoc/core/-/core-3.0.10.tgz","fileCount":45,"integrity":"sha512-Lrv/tFBOcH2rIdYnkqCrQKp+UHIVC0BMWZj/bCcDsiBkaW/4OCLJroSV4/ei+6Be/FxhkfLYHX1UfQNqATOygQ==","signatures":[{"sig":"MEUCIQDlNCdd1DeBERMj2g7sw0e88hoX4CpNHWDazgSfU4B6WQIgEZ2ts+qBcmk+1u4fAUu2pq2FySJa7sQps85qqul/hHg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5167899,"size":1221631},"main":"./dist/core.umd.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/core.js","engines":{"node":">=16.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/core.js","require":"./dist/core.umd.cjs"}},"gitHead":"7cb253c0d13629f8a9874eeb24e633f2e890207d","scripts":{"dev":"vite","build":"npm run clean && tsc && vite build","clean":"node -e \"const fs = require('fs'); if(fs.existsSync('dist')) fs.rmSync('dist', {recursive: true})\"","preview":"vite preview","type:check":"tsc --noEmit"},"_npmUser":{"name":"anonymous","email":"1280381827@qq.com"},"_npmVersion":"11.6.2","description":"VerveDoc Core 核心编辑器库","directories":{},"_nodeVersion":"25.2.1","dependencies":{"docx":"^9.1.0","jszip":"^3.10.1","vanilla-picker":"^2.12.3","@vervedoc/docx-editor-view":"1.0.4","@vervedoc/docx-editor-state":"^1.0.2","@vervedoc/docx-editor-keymap":"^1.0.4","@vervedoc/docx-editor-schema":"^1.0.7","@vervedoc/docx-editor-comment":"^1.0.6","@vervedoc/docx-editor-history":"^1.0.7","@vervedoc/docx-editor-commands":"^1.0.3","@vervedoc/docx-editor-transform":"^1.0.7"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^5.4.10","eslint":"^10.4.0","@eslint/js":"^10.0.1","typescript":"^5.0.0","@types/node":"^25.3.3","vite-plugin-dts":"^4.5.4","typescript-eslint":"^8.59.4","eslint-plugin-unused-imports":"^4.4.1","vite-plugin-css-injected-by-js":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/core_3.0.10_1783394134831_0.542335110816988","host":"s3://npm-registry-packages-npm-production"},"_cnpmcore_publish_time":"2026-07-07T03:15:35.087Z","publish_time":1783394135087,"_source_registry_name":"default","contributors":[]}},"dist-tags":{"latest":"3.0.11"},"name":"@vervedoc/core","time":{"created":"2026-07-10T08:18:33.832Z","modified":"2026-07-10T08:18:35.281Z","3.0.11":"2026-07-10T08:18:21.599Z","3.0.10":"2026-07-07T03:15:35.087Z"},"readme":"# @wanghe1995/docx-editor-core\r\n\r\nDocxEditor 核心编辑器库，提供富文本编辑、表格、图片、列表等功能。\r\n\r\n## 特性\r\n\r\n- 富文本编辑（加粗、斜体、下划线、删除线、高亮等）\r\n- 表格支持（插入、合并、拆分、边框设置等）\r\n- 图片处理（插入、缩放、拖拽、显示模式等）\r\n- 列表功能（有序列表、无序列表、多级列表）\r\n- 页面布局（页眉、页脚、页码、水印、页边距）\r\n- 控件系统（文本控件、日期控件、下拉选择等）\r\n- 历史记录（撤销/重做）\r\n- 搜索替换\r\n- 插件系统（支持扩展功能）\r\n\r\n## 安装\r\n\r\n```bash\r\nnpm install @wanghe1995/docx-editor-core\r\n```\r\n\r\n## 快速开始\r\n\r\n```typescript\r\nimport DocxEditor from '@wanghe1995/docx-editor-core'\r\n\r\n// 获取容器元素\r\nconst container = document.getElementById('editor') as HTMLDivElement\r\n\r\n// 初始化编辑器\r\nconst editor = new DocxEditor(container, {\r\n  main: [\r\n    { value: '欢迎使用 DocxEditor！' }\r\n  ]\r\n})\r\n\r\n// 使用命令 API\r\neditor.command.executeUndo()  // 撤销\r\neditor.command.executeRedo()  // 重做\r\neditor.command.executeBold()  // 加粗\r\n```\r\n\r\n## 配置选项\r\n\r\n```typescript\r\ninterface IEditorOption {\r\n  // 页面设置\r\n  pageMode?: PageMode           // 页面模式：paging（分页）| continuous（连续）\r\n  paperDirection?: PaperDirection // 纸张方向：vertical（纵向）| horizontal（横向）\r\n  width?: number                // 页面宽度（毫米）\r\n  height?: number               // 页面高度（毫米）\r\n  scale?: number                // 缩放比例（0-1）\r\n  \r\n  // 边距设置\r\n  margins?: [number, number, number, number]  // [上, 右, 下, 左]（毫米）\r\n  \r\n  // 页眉页脚\r\n  header?: IHeader              // 页眉配置\r\n  footer?: IFooter              // 页脚配置\r\n  \r\n  // 水印\r\n  watermark?: IWatermark        // 水印配置\r\n  \r\n  // 字体\r\n  defaultFont?: string          // 默认字体\r\n  defaultSize?: number          // 默认字号\r\n  \r\n  // 模式\r\n  mode?: EditorMode             // 编辑模式：edit | readonly | form | print\r\n  \r\n  // 其他\r\n  placeholder?: IPlaceholder    // 占位符配置\r\n  pageNumber?: IPageNumber      // 页码配置\r\n  lineNumber?: ILineNumber      // 行号配置\r\n}\r\n```\r\n\r\n## 数据结构\r\n\r\n### IElement - 元素结构\r\n\r\n```typescript\r\ninterface IElement {\r\n  // 基础属性\r\n  id?: string                   // 元素 ID\r\n  type?: ElementType            // 元素类型\r\n  value: string                 // 文本内容\r\n  \r\n  // 文本样式\r\n  font?: string                 // 字体\r\n  size?: number                 // 字号\r\n  bold?: boolean                // 加粗\r\n  italic?: boolean              // 斜体\r\n  underline?: boolean           // 下划线\r\n  strikeout?: boolean           // 删除线\r\n  color?: string                // 文字颜色\r\n  highlight?: string            // 高亮颜色\r\n  \r\n  // 段落样式\r\n  rowFlex?: RowFlex             // 对齐方式\r\n  rowMargin?: number            // 行距\r\n  \r\n  // 图片属性\r\n  width?: number                // 图片宽度\r\n  height?: number               // 图片高度\r\n  imgDisplay?: ImageDisplay     // 图片显示模式\r\n  \r\n  // 表格属性（type: 'table'）\r\n  trList?: ITr[]                // 表格行列表\r\n  \r\n  // 列表属性\r\n  listType?: ListType           // 列表类型\r\n  listStyle?: ListStyle         // 列表样式\r\n  listId?: string               // 列表组 ID\r\n  \r\n  // 超链接\r\n  url?: string                  // 链接地址\r\n  \r\n  // 控件属性\r\n  control?: IControl            // 控件配置\r\n}\r\n```\r\n\r\n### IEditorData - 编辑器数据\r\n\r\n```typescript\r\ninterface IEditorData {\r\n  header?: IElement[]           // 页眉元素\r\n  main: IElement[]              // 主体内容\r\n  footer?: IElement[]           // 页脚元素\r\n}\r\n```\r\n\r\n## 命令 API\r\n\r\n### 编辑命令\r\n\r\n```typescript\r\n// 撤销/重做\r\neditor.command.executeUndo()\r\neditor.command.executeRedo()\r\n\r\n// 剪切/复制/粘贴\r\neditor.command.executeCut()\r\neditor.command.executeCopy()\r\neditor.command.executePaste()\r\n\r\n// 全选/删除\r\neditor.command.executeSelectAll()\r\neditor.command.executeBackspace()\r\n```\r\n\r\n### 文本格式\r\n\r\n```typescript\r\n// 字体样式\r\neditor.command.executeBold()              // 加粗\r\neditor.command.executeItalic()            // 斜体\r\neditor.command.executeUnderline()         // 下划线\r\neditor.command.executeStrikeout()         // 删除线\r\neditor.command.executeSuperscript()       // 上标\r\neditor.command.executeSubscript()         // 下标\r\n\r\n// 字体设置\r\neditor.command.executeFont('宋体')         // 设置字体\r\neditor.command.executeSize(16)            // 设置字号\r\neditor.command.executeColor('#ff0000')    // 设置颜色\r\neditor.command.executeHighlight('#ffff00') // 设置高亮\r\n```\r\n\r\n### 段落格式\r\n\r\n```typescript\r\n// 对齐方式\r\neditor.command.executeRowFlex(RowFlex.LEFT)    // 左对齐\r\neditor.command.executeRowFlex(RowFlex.CENTER)  // 居中\r\neditor.command.executeRowFlex(RowFlex.RIGHT)   // 右对齐\r\neditor.command.executeRowFlex(RowFlex.JUSTIFY) // 两端对齐\r\n\r\n// 行距\r\neditor.command.executeRowMargin(1.5)           // 设置行距\r\n\r\n// 标题\r\neditor.command.executeTitle(TitleLevel.FIRST)  // 一级标题\r\neditor.command.executeTitle(TitleLevel.SECOND) // 二级标题\r\neditor.command.executeTitle(null)              // 取消标题\r\n```\r\n\r\n### 列表\r\n\r\n```typescript\r\n// 有序列表\r\neditor.command.executeList(ListType.OL, ListStyle.DECIMAL)\r\n\r\n// 无序列表\r\neditor.command.executeList(ListType.UL, ListStyle.DISC)\r\n\r\n// 取消列表\r\neditor.command.executeList(null, null)\r\n```\r\n\r\n### 插入内容\r\n\r\n```typescript\r\n// 插入文本\r\neditor.command.executeInsertElementList([\r\n  { value: '插入的文本' }\r\n])\r\n\r\n// 插入图片\r\neditor.command.executeImage({\r\n  value: 'base64...', // 或图片 URL\r\n  width: 200,\r\n  height: 150\r\n})\r\n\r\n// 插入表格\r\neditor.command.executeInsertTable(3, 4)  // 3行4列\r\n\r\n// 插入分页符\r\neditor.command.executePageBreak()\r\n\r\n// 插入水印\r\neditor.command.executeWatermark({\r\n  data: '机密文件',\r\n  color: '#cccccc',\r\n  size: 60\r\n})\r\n```\r\n\r\n### 表格操作\r\n\r\n```typescript\r\n// 插入行/列\r\neditor.command.executeInsertTableTopRow()    // 上方插入行\r\neditor.command.executeInsertTableBottomRow() // 下方插入行\r\neditor.command.executeInsertTableLeftCol()   // 左侧插入列\r\neditor.command.executeInsertTableRightCol()  // 右侧插入列\r\n\r\n// 删除行/列\r\neditor.command.executeDeleteTableRow()       // 删除行\r\neditor.command.executeDeleteTableCol()       // 删除列\r\n\r\n// 合并/拆分单元格\r\neditor.command.executeMergeTableCell()       // 合并选中单元格\r\neditor.command.executeCancelMergeTableCell() // 取消合并\r\n\r\n// 表格边框\r\neditor.command.executeTableBorderType(TableBorder.ALL)     // 所有边框\r\neditor.command.executeTableBorderType(TableBorder.NONE)    // 无边框\r\neditor.command.executeTableBorderType(TableBorder.OUTSIDE) // 外边框\r\n```\r\n\r\n### 搜索替换\r\n\r\n```typescript\r\n// 搜索\r\nconst result = editor.command.executeSearch('关键词')\r\n\r\n// 替换\r\neditor.command.executeReplace('新文本')\r\n\r\n// 全部替换\r\neditor.command.executeReplaceAll('旧文本', '新文本')\r\n```\r\n\r\n### 获取数据\r\n\r\n```typescript\r\n// 获取编辑器数据\r\nconst data = editor.command.getValue()\r\n\r\n// 获取纯文本\r\nconst text = editor.command.getText()\r\n\r\n// 获取 HTML\r\nconst html = editor.command.getHTML()\r\n\r\n// 获取图片（导出为图片）\r\nconst images = await editor.command.getImage()\r\n```\r\n\r\n## 事件监听\r\n\r\n```typescript\r\n// 内容变化\r\neditor.listener.contentChange = () => {\r\n  console.log('内容已变化')\r\n}\r\n\r\n// 选区变化\r\neditor.listener.rangeStyleChange = (style) => {\r\n  console.log('当前样式:', style)\r\n}\r\n\r\n// 保存事件\r\neditor.listener.saved = () => {\r\n  console.log('已保存')\r\n}\r\n\r\n// 页面变化\r\neditor.listener.pageSizeChange = (pageNo) => {\r\n  console.log('当前页数:', pageNo)\r\n}\r\n```\r\n\r\n## 插件系统\r\n\r\n### 使用插件\r\n\r\n```typescript\r\n// 使用图表插件（需要额外安装 @docuflow/docx-editor-chart）\r\nimport { createChartPlugin } from '@docuflow/docx-editor-chart'\r\nimport * as echarts from 'echarts'\r\n\r\neditor.use(createChartPlugin({ echarts }))\r\n```\r\n\r\n### 自定义右键菜单\r\n\r\n```typescript\r\neditor.register.registerContextMenuList([\r\n  {\r\n    key: 'myMenu',\r\n    name: '自定义菜单',\r\n    when: (context) => true,  // 显示条件\r\n    callback: (command, context) => {\r\n      console.log('点击了自定义菜单')\r\n    }\r\n  }\r\n])\r\n```\r\n\r\n### 自定义快捷键\r\n\r\n```typescript\r\neditor.register.registerShortcutList([\r\n  {\r\n    key: 'mod+shift+c',\r\n    callback: (command) => {\r\n      command.executeCopy()\r\n    }\r\n  }\r\n])\r\n```\r\n\r\n## 销毁\r\n\r\n```typescript\r\n// 销毁编辑器实例\r\neditor.destroy()\r\n```\r\n\r\n## 类型导出\r\n\r\n```typescript\r\nimport {\r\n  // 编辑器类\r\n  DocxEditor,\r\n  Editor,       // DocxEditor 别名\r\n  Command,\r\n  \r\n  // 枚举\r\n  RowFlex,\r\n  VerticalAlign,\r\n  EditorZone,\r\n  EditorMode,\r\n  ElementType,\r\n  ControlType,\r\n  PageMode,\r\n  ImageDisplay,\r\n  KeyMap,\r\n  BlockType,\r\n  PaperDirection,\r\n  TableBorder,\r\n  TitleLevel,\r\n  ListType,\r\n  ListStyle,\r\n  \r\n  // 类型\r\n  IElement,\r\n  IEditorData,\r\n  IEditorOption,\r\n  IEditorResult,\r\n  IWatermark,\r\n  IRange,\r\n  \r\n  // 工具函数\r\n  splitText,\r\n  getElementListByHTML,\r\n  getTextFromElementList\r\n} from '@docuflow/docx-editor-core'\r\n```\r\n\r\n## 浏览器兼容性\r\n\r\n- Chrome 80+\r\n- Firefox 75+\r\n- Safari 13.1+\r\n- Edge 80+\r\n\r\n## License\r\n\r\nMIT","users":{}}