build: v1.0.7 release (^.^)YYa!!

This commit is contained in:
Michael Yang 2024-06-13 09:28:08 +08:00
parent 517dd3da7c
commit c28588e310
8 changed files with 2825 additions and 2825 deletions

View File

@ -1,5 +1,15 @@
# AiEditor ChangeLog
## v1.0.7 20240613:
- 新增AiModel 添加 chatWithPayload 方法用于传入自定义的 ai 参数信息
- 新增:源码编辑的功能菜单,及其配置。感谢 @jx
- 新增:添加是否可以对整个编辑器拖拽放大缩小的开关配置
- 优化:优化 a 标签在暗色主题下的样式问题,感谢 @lwleen
- 优化:编辑的滚动条样式,感谢 @lwleen
- 优化:移除无用的配置 cbName 和 cbUrl
## v1.0.6 20240607:
- 新增AI 大模型新增对 Openai 和 暗月之面 的支持
- 新增:编辑元素新增对 Figure 和 Figcaption 元素的支持

218
dist/index.cjs vendored

File diff suppressed because one or more lines are too long

15
dist/index.d.ts vendored
View File

@ -78,8 +78,6 @@ export declare type AiEditorOptions = {
i18n?: Record<string, Record<string, string>>;
placeholder?: string;
theme?: "light" | "dark";
cbName?: string;
cbUrl?: string;
onMentionQuery?: (query: string) => any[] | Promise<any[]>;
onCreateBefore?: (editor: AiEditor, extensions: Extensions) => void | Extensions;
onDestroy?: (editor: AiEditor) => void;
@ -87,6 +85,7 @@ export declare type AiEditorOptions = {
onChange?: (editor: AiEditor) => void;
onSave?: (editor: AiEditor) => boolean;
toolbarKeys?: (string | CustomMenu)[];
draggable?: boolean;
textSelectionBubbleMenu?: {
enable?: boolean;
elementTagName?: string;
@ -176,11 +175,12 @@ declare interface AiMessageListener {
}
declare abstract class AiModel {
editor: Editor;
editor: InnerEditor;
globalConfig: AiGlobalConfig;
aiModelName: string;
aiModelConfig: AiModelConfig;
constructor(editor: Editor, globalConfig: AiGlobalConfig, aiModelName: string);
protected constructor(editor: InnerEditor, globalConfig: AiGlobalConfig, aiModelName: string);
chatWithPayload(payload: any, listener: AiMessageListener): void;
chat(selectedText: string, prompt: string, listener: AiMessageListener): void;
/**
* URL
@ -206,7 +206,7 @@ declare interface AiModelFactory {
export declare class AiModelManager {
private static models;
static init(editor: Editor, globalConfig: AiGlobalConfig): void;
static init(editor: InnerEditor, globalConfig: AiGlobalConfig): void;
static get(modelName: string): AiModel;
static set(modelName: string, aiModel: AiModel): void;
}
@ -223,7 +223,8 @@ export declare interface CustomMenu {
declare class Footer extends HTMLElement implements AiEditorEvent {
count: number;
constructor();
draggable: boolean;
initDraggable(draggable?: boolean): void;
updateCharacters(): void;
onCreate(props: EditorEvents["create"], _: AiEditorOptions): void;
onTransaction(props: EditorEvents["transaction"]): void;
@ -251,7 +252,7 @@ export declare interface NameAndValue {
}
export declare class SparkAiModel extends AiModel {
constructor(editor: Editor, globalConfig: AiGlobalConfig);
constructor(editor: InnerEditor, globalConfig: AiGlobalConfig);
createAiClient(url: string, listener: AiMessageListener): AiClient;
wrapPayload(promptMessage: string): string;
private getDomain;

5393
dist/index.js vendored

File diff suppressed because one or more lines are too long

2
dist/style.css vendored

File diff suppressed because one or more lines are too long

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "aieditor",
"version": "1.0.6",
"version": "1.0.7",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "aieditor",
"version": "1.0.6",
"version": "1.0.7",
"license": "LGPL",
"dependencies": {
"@tiptap/core": "^2.4.0",

View File

@ -1,7 +1,7 @@
{
"name": "aieditor",
"author": "yangfuhai",
"version": "1.0.6",
"version": "1.0.7",
"type": "module",
"keywords": [
"editor",

View File

@ -41,11 +41,7 @@ import {FigcaptionExt} from "../extensions/FigcaptionExt.ts";
export const getExtensions = (editor: AiEditor, options: AiEditorOptions): Extensions => {
// the Collaboration extension comes with its own history handling
const ret: Extensions = options.cbName && options.cbUrl ? [StarterKit.configure({
history: false,
codeBlock: false,
heading: false,
})] : [StarterKit.configure({
const ret: Extensions = [StarterKit.configure({
codeBlock: false,
heading: false,
})];