@ctzhian/tiptap 1.12.20 → 1.12.23
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/Editor/demo.js +1 -1
- package/dist/EditorMarkdown/Toolbar.d.ts +2 -5
- package/dist/EditorMarkdown/Toolbar.js +62 -251
- package/dist/EditorMarkdown/UploadProgress.d.ts +7 -0
- package/dist/EditorMarkdown/UploadProgress.js +85 -0
- package/dist/EditorMarkdown/demo.js +4 -3
- package/dist/EditorMarkdown/index.d.ts +2 -0
- package/dist/EditorMarkdown/index.js +291 -9
- package/dist/EditorMarkdown/util.d.ts +17 -0
- package/dist/EditorMarkdown/util.js +84 -0
- package/dist/component/CustomBubbleMenu/index.js +8 -27
- package/dist/component/CustomDragHandle/index.js +44 -72
- package/dist/component/Icons/emotion-line-icon.d.ts +6 -0
- package/dist/component/Icons/emotion-line-icon.js +13 -0
- package/dist/component/Icons/index.d.ts +1 -0
- package/dist/component/Icons/index.js +1 -0
- package/dist/component/Menu/NestedList.d.ts +1 -1
- package/dist/component/Menu/index.js +4 -1
- package/dist/component/Toolbar/EditorInsert/index.js +90 -80
- package/dist/contants/slash-commands.js +65 -53
- package/dist/extension/component/Attachment/AttachmentContent.js +5 -9
- package/dist/extension/component/EmojiList/index.d.ts +3 -0
- package/dist/extension/component/EmojiList/index.js +380 -32
- package/dist/extension/suggestion/emoji.js +165 -16
- package/dist/index.css +1 -0
- package/dist/type/index.d.ts +2 -1
- package/dist/util/index.d.ts +2 -0
- package/dist/util/index.js +10 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { AttachmentLineIcon, CodeBoxLineIcon, CodeLineIcon, DoubleQuotesLIcon, FunctionsIcon, H1Icon, H2Icon, H3Icon, H4Icon, H5Icon, H6Icon, ImageLineIcon, Information2LineIcon, LinkIcon, ListCheck2Icon, ListOrdered2Icon, ListUnorderedIcon, MenuFold2FillIcon, MovieLineIcon, Music2LineIcon, SeparatorIcon, SquareRootIcon, Table2Icon, TextWrapIcon, WindowFillIcon } from "../component/Icons";
|
|
2
|
+
import { AttachmentLineIcon, CodeBoxLineIcon, CodeLineIcon, DoubleQuotesLIcon, EmotionLineIcon, FunctionsIcon, H1Icon, H2Icon, H3Icon, H4Icon, H5Icon, H6Icon, ImageLineIcon, Information2LineIcon, LinkIcon, ListCheck2Icon, ListOrdered2Icon, ListUnorderedIcon, MenuFold2FillIcon, MovieLineIcon, Music2LineIcon, SeparatorIcon, SquareRootIcon, Table2Icon, TextWrapIcon, WindowFillIcon } from "../component/Icons";
|
|
3
3
|
export var slashCommands = [{
|
|
4
4
|
title: '标题1',
|
|
5
5
|
shortcutKey: ['ctrl', 'alt', '1'],
|
|
@@ -142,8 +142,8 @@ export var slashCommands = [{
|
|
|
142
142
|
editor.chain().focus().deleteRange(range).insertContent('<br />').run();
|
|
143
143
|
}
|
|
144
144
|
}, {
|
|
145
|
-
title: '
|
|
146
|
-
icon: /*#__PURE__*/React.createElement(
|
|
145
|
+
title: '表情',
|
|
146
|
+
icon: /*#__PURE__*/React.createElement(EmotionLineIcon, {
|
|
147
147
|
sx: {
|
|
148
148
|
fontSize: '1rem'
|
|
149
149
|
}
|
|
@@ -151,6 +151,18 @@ export var slashCommands = [{
|
|
|
151
151
|
command: function command(_ref11) {
|
|
152
152
|
var editor = _ref11.editor,
|
|
153
153
|
range = _ref11.range;
|
|
154
|
+
editor.chain().deleteRange(range).insertContentAt(range.from, ' : ').focus(range.from + 2).run();
|
|
155
|
+
}
|
|
156
|
+
}, {
|
|
157
|
+
title: '分割线',
|
|
158
|
+
icon: /*#__PURE__*/React.createElement(SeparatorIcon, {
|
|
159
|
+
sx: {
|
|
160
|
+
fontSize: '1rem'
|
|
161
|
+
}
|
|
162
|
+
}),
|
|
163
|
+
command: function command(_ref12) {
|
|
164
|
+
var editor = _ref12.editor,
|
|
165
|
+
range = _ref12.range;
|
|
154
166
|
editor.chain().focus().deleteRange(range).setHorizontalRule().run();
|
|
155
167
|
}
|
|
156
168
|
}, {
|
|
@@ -161,9 +173,9 @@ export var slashCommands = [{
|
|
|
161
173
|
fontSize: '1rem'
|
|
162
174
|
}
|
|
163
175
|
}),
|
|
164
|
-
command: function command(
|
|
165
|
-
var editor =
|
|
166
|
-
range =
|
|
176
|
+
command: function command(_ref13) {
|
|
177
|
+
var editor = _ref13.editor,
|
|
178
|
+
range = _ref13.range;
|
|
167
179
|
editor.chain().focus().deleteRange(range).toggleBlockquote().run();
|
|
168
180
|
}
|
|
169
181
|
}, {
|
|
@@ -174,9 +186,9 @@ export var slashCommands = [{
|
|
|
174
186
|
fontSize: '1rem'
|
|
175
187
|
}
|
|
176
188
|
}),
|
|
177
|
-
command: function command(
|
|
178
|
-
var editor =
|
|
179
|
-
range =
|
|
189
|
+
command: function command(_ref14) {
|
|
190
|
+
var editor = _ref14.editor,
|
|
191
|
+
range = _ref14.range;
|
|
180
192
|
editor.chain().focus().deleteRange(range).setMark('code').run();
|
|
181
193
|
}
|
|
182
194
|
}, {
|
|
@@ -187,9 +199,9 @@ export var slashCommands = [{
|
|
|
187
199
|
fontSize: '1rem'
|
|
188
200
|
}
|
|
189
201
|
}),
|
|
190
|
-
command: function command(
|
|
191
|
-
var editor =
|
|
192
|
-
range =
|
|
202
|
+
command: function command(_ref15) {
|
|
203
|
+
var editor = _ref15.editor,
|
|
204
|
+
range = _ref15.range;
|
|
193
205
|
editor.chain().focus().deleteRange(range).toggleCodeBlock().run();
|
|
194
206
|
}
|
|
195
207
|
}, {
|
|
@@ -200,9 +212,9 @@ export var slashCommands = [{
|
|
|
200
212
|
fontSize: '1rem'
|
|
201
213
|
}
|
|
202
214
|
}),
|
|
203
|
-
command: function command(
|
|
204
|
-
var editor =
|
|
205
|
-
range =
|
|
215
|
+
command: function command(_ref16) {
|
|
216
|
+
var editor = _ref16.editor,
|
|
217
|
+
range = _ref16.range;
|
|
206
218
|
editor.chain().focus().deleteRange(range).setInlineLink({
|
|
207
219
|
href: ''
|
|
208
220
|
}).run();
|
|
@@ -215,9 +227,9 @@ export var slashCommands = [{
|
|
|
215
227
|
fontSize: '1rem'
|
|
216
228
|
}
|
|
217
229
|
}),
|
|
218
|
-
command: function command(
|
|
219
|
-
var editor =
|
|
220
|
-
range =
|
|
230
|
+
command: function command(_ref17) {
|
|
231
|
+
var editor = _ref17.editor,
|
|
232
|
+
range = _ref17.range;
|
|
221
233
|
editor.chain().focus().deleteRange(range).setDetails().run();
|
|
222
234
|
}
|
|
223
235
|
}, {
|
|
@@ -227,9 +239,9 @@ export var slashCommands = [{
|
|
|
227
239
|
fontSize: '1rem'
|
|
228
240
|
}
|
|
229
241
|
}),
|
|
230
|
-
command: function command(
|
|
231
|
-
var editor =
|
|
232
|
-
range =
|
|
242
|
+
command: function command(_ref18) {
|
|
243
|
+
var editor = _ref18.editor,
|
|
244
|
+
range = _ref18.range;
|
|
233
245
|
editor.chain().focus().deleteRange(range).setIframe({
|
|
234
246
|
src: '',
|
|
235
247
|
width: 760,
|
|
@@ -244,10 +256,10 @@ export var slashCommands = [{
|
|
|
244
256
|
fontSize: '1rem'
|
|
245
257
|
}
|
|
246
258
|
}),
|
|
247
|
-
command: function command(
|
|
248
|
-
var editor =
|
|
249
|
-
range =
|
|
250
|
-
attrs =
|
|
259
|
+
command: function command(_ref19) {
|
|
260
|
+
var editor = _ref19.editor,
|
|
261
|
+
range = _ref19.range,
|
|
262
|
+
attrs = _ref19.attrs;
|
|
251
263
|
editor.chain().focus().deleteRange(range).insertTable({
|
|
252
264
|
rows: attrs.rows || 3,
|
|
253
265
|
cols: attrs.cols || 4,
|
|
@@ -261,10 +273,10 @@ export var slashCommands = [{
|
|
|
261
273
|
fontSize: '1rem'
|
|
262
274
|
}
|
|
263
275
|
}),
|
|
264
|
-
command: function command(
|
|
265
|
-
var editor =
|
|
266
|
-
range =
|
|
267
|
-
attrs =
|
|
276
|
+
command: function command(_ref20) {
|
|
277
|
+
var editor = _ref20.editor,
|
|
278
|
+
range = _ref20.range,
|
|
279
|
+
attrs = _ref20.attrs;
|
|
268
280
|
editor.chain().focus().deleteRange(range).toggleAlert({
|
|
269
281
|
type: (attrs === null || attrs === void 0 ? void 0 : attrs.type) || 'icon',
|
|
270
282
|
variant: (attrs === null || attrs === void 0 ? void 0 : attrs.variant) || 'info'
|
|
@@ -277,9 +289,9 @@ export var slashCommands = [{
|
|
|
277
289
|
fontSize: '1rem'
|
|
278
290
|
}
|
|
279
291
|
}),
|
|
280
|
-
command: function command(
|
|
281
|
-
var editor =
|
|
282
|
-
range =
|
|
292
|
+
command: function command(_ref21) {
|
|
293
|
+
var editor = _ref21.editor,
|
|
294
|
+
range = _ref21.range;
|
|
283
295
|
editor.chain().focus().deleteRange(range).setDetails().run();
|
|
284
296
|
}
|
|
285
297
|
}, {
|
|
@@ -289,9 +301,9 @@ export var slashCommands = [{
|
|
|
289
301
|
fontSize: '1rem'
|
|
290
302
|
}
|
|
291
303
|
}),
|
|
292
|
-
command: function command(
|
|
293
|
-
var editor =
|
|
294
|
-
range =
|
|
304
|
+
command: function command(_ref22) {
|
|
305
|
+
var editor = _ref22.editor,
|
|
306
|
+
range = _ref22.range;
|
|
295
307
|
editor.chain().focus().deleteRange(range).toggleCodeBlock().run();
|
|
296
308
|
}
|
|
297
309
|
}, {
|
|
@@ -301,9 +313,9 @@ export var slashCommands = [{
|
|
|
301
313
|
fontSize: '1rem'
|
|
302
314
|
}
|
|
303
315
|
}),
|
|
304
|
-
command: function command(
|
|
305
|
-
var editor =
|
|
306
|
-
range =
|
|
316
|
+
command: function command(_ref23) {
|
|
317
|
+
var editor = _ref23.editor,
|
|
318
|
+
range = _ref23.range;
|
|
307
319
|
editor.chain().focus().deleteRange(range).setInlineMath({
|
|
308
320
|
latex: ''
|
|
309
321
|
}).run();
|
|
@@ -315,9 +327,9 @@ export var slashCommands = [{
|
|
|
315
327
|
fontSize: '1rem'
|
|
316
328
|
}
|
|
317
329
|
}),
|
|
318
|
-
command: function command(
|
|
319
|
-
var editor =
|
|
320
|
-
range =
|
|
330
|
+
command: function command(_ref24) {
|
|
331
|
+
var editor = _ref24.editor,
|
|
332
|
+
range = _ref24.range;
|
|
321
333
|
editor.chain().focus().deleteRange(range).setBlockMath({
|
|
322
334
|
latex: ''
|
|
323
335
|
}).run();
|
|
@@ -329,9 +341,9 @@ export var slashCommands = [{
|
|
|
329
341
|
fontSize: '1rem'
|
|
330
342
|
}
|
|
331
343
|
}),
|
|
332
|
-
command: function command(
|
|
333
|
-
var editor =
|
|
334
|
-
range =
|
|
344
|
+
command: function command(_ref25) {
|
|
345
|
+
var editor = _ref25.editor,
|
|
346
|
+
range = _ref25.range;
|
|
335
347
|
editor.chain().focus().deleteRange(range).setImage({
|
|
336
348
|
src: '',
|
|
337
349
|
width: 760
|
|
@@ -344,9 +356,9 @@ export var slashCommands = [{
|
|
|
344
356
|
fontSize: '1rem'
|
|
345
357
|
}
|
|
346
358
|
}),
|
|
347
|
-
command: function command(
|
|
348
|
-
var editor =
|
|
349
|
-
range =
|
|
359
|
+
command: function command(_ref26) {
|
|
360
|
+
var editor = _ref26.editor,
|
|
361
|
+
range = _ref26.range;
|
|
350
362
|
editor.chain().focus().deleteRange(range).setVideo({
|
|
351
363
|
src: '',
|
|
352
364
|
width: 760
|
|
@@ -359,9 +371,9 @@ export var slashCommands = [{
|
|
|
359
371
|
fontSize: '1rem'
|
|
360
372
|
}
|
|
361
373
|
}),
|
|
362
|
-
command: function command(
|
|
363
|
-
var editor =
|
|
364
|
-
range =
|
|
374
|
+
command: function command(_ref27) {
|
|
375
|
+
var editor = _ref27.editor,
|
|
376
|
+
range = _ref27.range;
|
|
365
377
|
editor.chain().focus().deleteRange(range).setAudio({
|
|
366
378
|
src: ''
|
|
367
379
|
}).run();
|
|
@@ -373,9 +385,9 @@ export var slashCommands = [{
|
|
|
373
385
|
fontSize: '1rem'
|
|
374
386
|
}
|
|
375
387
|
}),
|
|
376
|
-
command: function command(
|
|
377
|
-
var editor =
|
|
378
|
-
range =
|
|
388
|
+
command: function command(_ref28) {
|
|
389
|
+
var editor = _ref28.editor,
|
|
390
|
+
range = _ref28.range;
|
|
379
391
|
editor.chain().focus().deleteRange(range).setInlineAttachment({
|
|
380
392
|
url: '',
|
|
381
393
|
title: '',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
import {
|
|
2
|
+
import { Download2LineIcon } from "../../../component/Icons";
|
|
3
3
|
import { Box, Stack } from "@mui/material";
|
|
4
4
|
import React from "react";
|
|
5
5
|
/**
|
|
@@ -75,15 +75,11 @@ export var AttachmentContent = function AttachmentContent(_ref) {
|
|
|
75
75
|
}, !editable && {
|
|
76
76
|
'data-title': attrs.title,
|
|
77
77
|
'data-type': type
|
|
78
|
-
}), /*#__PURE__*/React.createElement(
|
|
78
|
+
}), /*#__PURE__*/React.createElement(Download2LineIcon, {
|
|
79
79
|
sx: {
|
|
80
80
|
fontSize: '2rem',
|
|
81
|
-
cursor: 'grab',
|
|
82
81
|
color: attrs.url === 'error' ? 'error.main' : 'primary.main',
|
|
83
|
-
alignSelf: 'center'
|
|
84
|
-
':active': {
|
|
85
|
-
cursor: 'grabbing'
|
|
86
|
-
}
|
|
82
|
+
alignSelf: 'center'
|
|
87
83
|
}
|
|
88
84
|
}), /*#__PURE__*/React.createElement(Stack, {
|
|
89
85
|
sx: {
|
|
@@ -117,7 +113,7 @@ export var AttachmentContent = function AttachmentContent(_ref) {
|
|
|
117
113
|
alignItems: 'center',
|
|
118
114
|
gap: 0.5
|
|
119
115
|
}
|
|
120
|
-
}, /*#__PURE__*/React.createElement(
|
|
116
|
+
}, /*#__PURE__*/React.createElement(Download2LineIcon, {
|
|
121
117
|
sx: {
|
|
122
118
|
fontSize: '0.875rem',
|
|
123
119
|
cursor: 'grab',
|
|
@@ -127,7 +123,7 @@ export var AttachmentContent = function AttachmentContent(_ref) {
|
|
|
127
123
|
cursor: 'grabbing'
|
|
128
124
|
}
|
|
129
125
|
}
|
|
130
|
-
}), attrs.title) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
126
|
+
}), attrs.title) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Download2LineIcon, {
|
|
131
127
|
sx: {
|
|
132
128
|
fontSize: '0.875rem',
|
|
133
129
|
cursor: 'grab',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
1
2
|
import { EmojiItem } from '@tiptap/extension-emoji';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
export type EmojiListProps = {
|
|
@@ -5,6 +6,8 @@ export type EmojiListProps = {
|
|
|
5
6
|
command: (props: {
|
|
6
7
|
name: string;
|
|
7
8
|
}) => void;
|
|
9
|
+
query?: string;
|
|
10
|
+
editor?: Editor;
|
|
8
11
|
};
|
|
9
12
|
export type EmojiListRef = {
|
|
10
13
|
onKeyDown: (props: {
|