kc-plate-editor 0.5.6 → 0.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,11 +8,19 @@
8
8
 
9
9
  | 版本 | 状态 | 说明 |
10
10
  |------|------|------|
11
- | v0.5.6 | ✅ 最新版本 | 增强上传配置灵活性 |
11
+ | v0.5.8 | ✅ 最新版本 | 内容格式转换优化(官方 API) |
12
+ | v0.5.6 | ✅ 稳定版本 | 增强上传配置灵活性 |
12
13
  | v0.5.5 | ✅ 稳定版本 | 快捷键保存、本地存储、目录跳转优化 |
13
- | v0.5.4 | ✅ 稳定版本 | 滚动和布局优化 |
14
14
  | v0.5.0 | ✅ 已发布私服 | 基础稳定版本 |
15
15
 
16
+ ### v0.5.8 更新内容
17
+
18
+ - **内容格式转换** - 基于 Plate.js 官方 API 实现 JSON/HTML/Markdown 互转
19
+ - **统一内容接口** - 新增 `getContentAs()` 和 `setContentFrom()` 方法
20
+ - **官方 serializeHtml** - HTML 序列化使用官方静态渲染 API
21
+ - **官方 MarkdownPlugin** - Markdown 转换使用官方 `@platejs/markdown`
22
+ - **代码清理** - 移除旧的 DOM 清理方案,统一使用官方 API
23
+
16
24
  ### v0.5.6 更新内容
17
25
 
18
26
  - **增强上传配置** - 新增 `UploadConfig` 详细配置接口
@@ -2,6 +2,7 @@ import { Value } from 'platejs';
2
2
  import { TPlateEditor } from 'platejs/react';
3
3
  import { EditorPluginKit } from '../../types/plugin-types';
4
4
  import { ToolbarConfig, ToolbarAlign } from '../../types/toolbar-config';
5
+ import { HtmlSerializeOptions } from '../../lib/content-converter';
5
6
  import { EditorMode, WordCountResult, OutlineItem, FindOptions, ReplaceOptions, MatchPosition } from '../../types/editor-types';
6
7
  import * as React from 'react';
7
8
  /**
@@ -116,10 +117,25 @@ export interface PlateEditorRef {
116
117
  getMarkdown: () => string;
117
118
  /** 从 Markdown 加载内容 */
118
119
  setMarkdown: (markdown: string) => void;
119
- /** 导出为 HTML 文件 */
120
- getHtml: () => Promise<string>;
120
+ /**
121
+ * 导出为 HTML 格式
122
+ * @param options 序列化选项
123
+ * @returns HTML 字符串
124
+ */
125
+ getHtml: (options?: HtmlSerializeOptions) => Promise<string>;
121
126
  /** 从 HTML 加载内容 */
122
127
  setHtml: (html: string) => void;
128
+ /**
129
+ * 获取指定格式的内容
130
+ * @param format 内容格式:'json' | 'html' | 'markdown'
131
+ */
132
+ getContentAs: (format: 'json' | 'html' | 'markdown') => Promise<string | Value>;
133
+ /**
134
+ * 从指定格式加载内容
135
+ * @param content 内容字符串或 JSON
136
+ * @param format 内容格式:'json' | 'html' | 'markdown'
137
+ */
138
+ setContentFrom: (content: string | Value, format: 'json' | 'html' | 'markdown') => void;
123
139
  /** 获取纯文本内容 */
124
140
  getText: () => string;
125
141
  /** 检查编辑器是否为空 */
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const fl=require("./index-BDYrl3fS.js");/*! *****************************************************************************
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const fl=require("./index-ZtTcrgdr.js");/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -1,4 +1,4 @@
1
- import { g as Xu } from "./index-D8ZvqcZ1.mjs";
1
+ import { g as Xu } from "./index-DbSGAc09.mjs";
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4