tiptap-editor-custom-stg 1.0.13 → 1.0.15
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/dist/index.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +10 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +37 -37
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _tiptap_extension_table from '@tiptap/extension-table';
|
|
3
|
+
import * as _tiptap_extensions from '@tiptap/extensions';
|
|
4
|
+
import * as _tiptap_extension_text_align from '@tiptap/extension-text-align';
|
|
5
|
+
import * as _tiptap_extension_superscript from '@tiptap/extension-superscript';
|
|
6
|
+
import * as _tiptap_extension_text_style from '@tiptap/extension-text-style';
|
|
7
|
+
import * as _tiptap_extension_image from '@tiptap/extension-image';
|
|
8
|
+
import * as _tiptap_starter_kit from '@tiptap/starter-kit';
|
|
4
9
|
import * as _tiptap_core from '@tiptap/core';
|
|
5
10
|
import { Extension } from '@tiptap/core';
|
|
6
11
|
|
|
@@ -31,7 +36,7 @@ interface TiptapEditorProps {
|
|
|
31
36
|
|
|
32
37
|
declare const TiptapEditor: React.FC<TiptapEditorProps>;
|
|
33
38
|
|
|
34
|
-
declare const createTiptapExtensions: (placeholder?: string) => (_tiptap_core.Extension<any, any> | _tiptap_core.Mark<
|
|
39
|
+
declare const createTiptapExtensions: (placeholder?: string) => (_tiptap_core.Extension<any, any> | _tiptap_core.Extension<_tiptap_starter_kit.StarterKitOptions, any> | _tiptap_core.Node<_tiptap_extension_image.ImageOptions, any> | _tiptap_core.Mark<_tiptap_extension_text_style.TextStyleOptions, any> | _tiptap_core.Extension<_tiptap_extension_text_style.FontFamilyOptions, any> | _tiptap_core.Mark<_tiptap_extension_superscript.SuperscriptExtensionOptions, any> | _tiptap_core.Extension<_tiptap_extension_text_align.TextAlignOptions, any> | _tiptap_core.Extension<_tiptap_extensions.PlaceholderOptions, any> | _tiptap_core.Node<_tiptap_extension_table.TableOptions, any> | _tiptap_core.Node<_tiptap_extension_table.TableRowOptions, any>)[];
|
|
35
40
|
|
|
36
41
|
declare module '@tiptap/core' {
|
|
37
42
|
interface Commands<ReturnType> {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _tiptap_extension_table from '@tiptap/extension-table';
|
|
3
|
+
import * as _tiptap_extensions from '@tiptap/extensions';
|
|
4
|
+
import * as _tiptap_extension_text_align from '@tiptap/extension-text-align';
|
|
5
|
+
import * as _tiptap_extension_superscript from '@tiptap/extension-superscript';
|
|
6
|
+
import * as _tiptap_extension_text_style from '@tiptap/extension-text-style';
|
|
7
|
+
import * as _tiptap_extension_image from '@tiptap/extension-image';
|
|
8
|
+
import * as _tiptap_starter_kit from '@tiptap/starter-kit';
|
|
4
9
|
import * as _tiptap_core from '@tiptap/core';
|
|
5
10
|
import { Extension } from '@tiptap/core';
|
|
6
11
|
|
|
@@ -31,7 +36,7 @@ interface TiptapEditorProps {
|
|
|
31
36
|
|
|
32
37
|
declare const TiptapEditor: React.FC<TiptapEditorProps>;
|
|
33
38
|
|
|
34
|
-
declare const createTiptapExtensions: (placeholder?: string) => (_tiptap_core.Extension<any, any> | _tiptap_core.Mark<
|
|
39
|
+
declare const createTiptapExtensions: (placeholder?: string) => (_tiptap_core.Extension<any, any> | _tiptap_core.Extension<_tiptap_starter_kit.StarterKitOptions, any> | _tiptap_core.Node<_tiptap_extension_image.ImageOptions, any> | _tiptap_core.Mark<_tiptap_extension_text_style.TextStyleOptions, any> | _tiptap_core.Extension<_tiptap_extension_text_style.FontFamilyOptions, any> | _tiptap_core.Mark<_tiptap_extension_superscript.SuperscriptExtensionOptions, any> | _tiptap_core.Extension<_tiptap_extension_text_align.TextAlignOptions, any> | _tiptap_core.Extension<_tiptap_extensions.PlaceholderOptions, any> | _tiptap_core.Node<_tiptap_extension_table.TableOptions, any> | _tiptap_core.Node<_tiptap_extension_table.TableRowOptions, any>)[];
|
|
35
40
|
|
|
36
41
|
declare module '@tiptap/core' {
|
|
37
42
|
interface Commands<ReturnType> {
|
package/dist/index.js
CHANGED
|
@@ -48,8 +48,6 @@ var import_react3 = require("@tiptap/react");
|
|
|
48
48
|
// src/extensions.ts
|
|
49
49
|
var import_starter_kit = __toESM(require("@tiptap/starter-kit"));
|
|
50
50
|
var import_extension_image = __toESM(require("@tiptap/extension-image"));
|
|
51
|
-
var import_extension_link = __toESM(require("@tiptap/extension-link"));
|
|
52
|
-
var import_extension_underline = __toESM(require("@tiptap/extension-underline"));
|
|
53
51
|
var import_extension_text_style3 = require("@tiptap/extension-text-style");
|
|
54
52
|
var import_extension_font_family = __toESM(require("@tiptap/extension-font-family"));
|
|
55
53
|
var import_extension_color = require("@tiptap/extension-color");
|
|
@@ -158,14 +156,14 @@ var BackgroundColor = import_core2.Extension.create({
|
|
|
158
156
|
// src/extensions.ts
|
|
159
157
|
var createTiptapExtensions = (placeholder = "Enter content here...") => [
|
|
160
158
|
import_starter_kit.default.configure({
|
|
161
|
-
heading: { levels: [1, 2, 3, 4, 5, 6] }
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
159
|
+
heading: { levels: [1, 2, 3, 4, 5, 6] },
|
|
160
|
+
// StarterKit v3 自带 Link / Underline,这里直接配置,避免重复注册扩展
|
|
161
|
+
link: {
|
|
162
|
+
openOnClick: false,
|
|
163
|
+
autolink: true,
|
|
164
|
+
HTMLAttributes: { rel: "noopener noreferrer" }
|
|
165
|
+
}
|
|
167
166
|
}),
|
|
168
|
-
import_extension_underline.default,
|
|
169
167
|
import_extension_image.default.configure({ inline: false, allowBase64: true }),
|
|
170
168
|
import_extension_text_style3.TextStyle,
|
|
171
169
|
FontSize,
|
|
@@ -1111,7 +1109,7 @@ var TiptapEditor = ({
|
|
|
1111
1109
|
if (!initializedRef.current) {
|
|
1112
1110
|
initializedRef.current = true;
|
|
1113
1111
|
if (content && content !== editor.getHTML()) {
|
|
1114
|
-
editor.commands.setContent(content || "", false);
|
|
1112
|
+
editor.commands.setContent(content || "", { emitUpdate: false });
|
|
1115
1113
|
lastEmittedContentRef.current = content;
|
|
1116
1114
|
}
|
|
1117
1115
|
return;
|
|
@@ -1126,7 +1124,7 @@ var TiptapEditor = ({
|
|
|
1126
1124
|
return;
|
|
1127
1125
|
}
|
|
1128
1126
|
if (content !== editor.getHTML()) {
|
|
1129
|
-
editor.commands.setContent(content || "", false);
|
|
1127
|
+
editor.commands.setContent(content || "", { emitUpdate: false });
|
|
1130
1128
|
lastEmittedContentRef.current = content || "";
|
|
1131
1129
|
}
|
|
1132
1130
|
}, [content, editor]);
|
|
@@ -1137,7 +1135,7 @@ var TiptapEditor = ({
|
|
|
1137
1135
|
(0, import_react2.useEffect)(() => {
|
|
1138
1136
|
if (!editor || !onRegisterReset) return;
|
|
1139
1137
|
const handleReset = (newContent) => {
|
|
1140
|
-
editor.commands.setContent(newContent || "", false);
|
|
1138
|
+
editor.commands.setContent(newContent || "", { emitUpdate: false });
|
|
1141
1139
|
};
|
|
1142
1140
|
const unregister = onRegisterReset(handleReset);
|
|
1143
1141
|
return () => {
|