@ctzhian/tiptap 1.7.5-beta.3 → 1.8.1
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 +35 -32
- package/dist/EditorToolbar/index.js +3 -11
- package/dist/component/CustomBubbleMenu/index.js +10 -20
- package/dist/component/CustomDragHandle/index.js +25 -20
- package/dist/component/Toolbar/EditorInsert/index.d.ts +2 -1
- package/dist/component/Toolbar/EditorInsert/index.js +14 -7
- package/dist/extension/component/Link/Insert.d.ts +1 -1
- package/dist/extension/component/Link/Insert.js +4 -4
- package/dist/extension/component/Link/index.js +6 -5
- package/dist/extension/component/UploadProgress/index.d.ts +1 -1
- package/dist/extension/index.d.ts +1 -1
- package/dist/extension/index.js +65 -59
- package/dist/extension/node/FileHandler.d.ts +1 -1
- package/dist/extension/node/Link/index.js +19 -0
- package/dist/hook/index.d.ts +1 -1
- package/dist/hook/index.js +21 -15
- package/dist/type/index.d.ts +5 -2
- package/package.json +1 -1
package/dist/Editor/demo.js
CHANGED
|
@@ -9,9 +9,13 @@ import "../index.css";
|
|
|
9
9
|
var Reader = function Reader() {
|
|
10
10
|
var _useTiptap = useTiptap({
|
|
11
11
|
editable: true,
|
|
12
|
+
// mode: 'markdown',
|
|
12
13
|
exclude: ['invisibleCharacters'],
|
|
13
14
|
onSave: function onSave(editor) {
|
|
14
|
-
console.log(
|
|
15
|
+
console.log('============= markdown =============');
|
|
16
|
+
console.log(editor.getMarkdown());
|
|
17
|
+
console.log('============= html =============');
|
|
18
|
+
console.log(editor.getHTML());
|
|
15
19
|
editor.commands.setContent(editor.getHTML());
|
|
16
20
|
},
|
|
17
21
|
onAiWritingGetSuggestion: function () {
|
|
@@ -37,35 +41,31 @@ var Reader = function Reader() {
|
|
|
37
41
|
return onAiWritingGetSuggestion;
|
|
38
42
|
}(),
|
|
39
43
|
// onTocUpdate: handleTocUpdate,
|
|
40
|
-
onMentionFilter:
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
// onMentionFilter: async ({ query }: { query: string }) => {
|
|
45
|
+
// return new Promise((resolve) => {
|
|
46
|
+
// resolve([
|
|
47
|
+
// 'Winona Ryder',
|
|
48
|
+
// 'Molly Ringwald',
|
|
49
|
+
// 'Ally Sheedy',
|
|
50
|
+
// 'Debbie Harry',
|
|
51
|
+
// 'Olivia Newton-John',
|
|
52
|
+
// 'Elton John',
|
|
53
|
+
// 'Michael J. Fox',
|
|
54
|
+
// 'Axl Rose',
|
|
55
|
+
// 'Emilio Estevez',
|
|
56
|
+
// 'Ralph Macchio',
|
|
57
|
+
// 'Rob Lowe',
|
|
58
|
+
// 'Jennifer Grey',
|
|
59
|
+
// ].filter(item => item.toLowerCase().startsWith(query.toLowerCase()))
|
|
60
|
+
// .slice(0, 5))
|
|
61
|
+
// })
|
|
62
|
+
// },
|
|
63
|
+
onUpload: function () {
|
|
64
|
+
var _onUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(file, onProgress) {
|
|
43
65
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
44
66
|
while (1) switch (_context2.prev = _context2.next) {
|
|
45
67
|
case 0:
|
|
46
|
-
query = _ref2.query;
|
|
47
68
|
return _context2.abrupt("return", new Promise(function (resolve) {
|
|
48
|
-
resolve(['Winona Ryder', 'Molly Ringwald', 'Ally Sheedy', 'Debbie Harry', 'Olivia Newton-John', 'Elton John', 'Michael J. Fox', 'Axl Rose', 'Emilio Estevez', 'Ralph Macchio', 'Rob Lowe', 'Jennifer Grey'].filter(function (item) {
|
|
49
|
-
return item.toLowerCase().startsWith(query.toLowerCase());
|
|
50
|
-
}).slice(0, 5));
|
|
51
|
-
}));
|
|
52
|
-
case 2:
|
|
53
|
-
case "end":
|
|
54
|
-
return _context2.stop();
|
|
55
|
-
}
|
|
56
|
-
}, _callee2);
|
|
57
|
-
}));
|
|
58
|
-
function onMentionFilter(_x2) {
|
|
59
|
-
return _onMentionFilter.apply(this, arguments);
|
|
60
|
-
}
|
|
61
|
-
return onMentionFilter;
|
|
62
|
-
}(),
|
|
63
|
-
onUpload: function () {
|
|
64
|
-
var _onUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(file, onProgress) {
|
|
65
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
66
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
67
|
-
case 0:
|
|
68
|
-
return _context3.abrupt("return", new Promise(function (resolve) {
|
|
69
69
|
var progress = 0;
|
|
70
70
|
var interval = setInterval(function () {
|
|
71
71
|
progress += Math.random() * 20;
|
|
@@ -93,16 +93,16 @@ var Reader = function Reader() {
|
|
|
93
93
|
}));
|
|
94
94
|
case 1:
|
|
95
95
|
case "end":
|
|
96
|
-
return
|
|
96
|
+
return _context2.stop();
|
|
97
97
|
}
|
|
98
|
-
},
|
|
98
|
+
}, _callee2);
|
|
99
99
|
}));
|
|
100
|
-
function onUpload(
|
|
100
|
+
function onUpload(_x2, _x3) {
|
|
101
101
|
return _onUpload.apply(this, arguments);
|
|
102
102
|
}
|
|
103
103
|
return onUpload;
|
|
104
104
|
}(),
|
|
105
|
-
content: "<blockquote><p>\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</p></blockquote><audio src=\"/static-file/323483d4-f74a-4d2f-beb4-591dc4da2624/240c283e-7c08-47f5-a0a9-708346e887fe.mp4\" poster=\"/static-file/4f149d6f-dc3b-4b2b-9c30-4c74cfb61030/219e2d4d-cc69-4549-81a5-7787580ffcce.jpeg\" controls=\"true\"></audio><hr><h1 id=\"62b48c1c-70cd-4231-bb98-06a50856fd68\">\u8FD9\u662F\u4E00\u6BB5\u4E00\u7EA7\u6807\u9898</h1><p><span style=\"background-color: rgb(255, 204, 188);\">\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F<code>\u6709\u6548</code>\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A 123203^<sup>1313 </sup>\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981<sub>1</sub>\u3002</span></p><p style=\"text-align: center;\"><img src=\"/static-file/1bc14ef9-751a-4ddb-88d8-ed012bc311d4/d1caf813-9d82-439c-810b-5a27f01ddde3.webp\" width=\"180\"></p><ol class=\"ordered-list\" data-type=\"orderedList\"><li><p>\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</p></li><li><p>\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C<code>\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981</code>\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</p><ol class=\"ordered-list\" data-type=\"orderedList\"><li><p><span style=\"color: rgb(246, 78, 84);\">\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</span>\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C<a target=\"_blank\" type=\"icon\" href=\"https://www.baidu.com\" title=\"\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\">\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981</a>\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002<strong>\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801</strong>\uFF0C<span style=\"background-color: rgb(248, 187, 208);\">\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981</span>\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0<u>\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587</u>\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</p></li><li><p>\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C<a target=\"_blank\" type=\"text\" href=\"http://localhost:5173/doc/editor/0198ea54-7b17-753d-ba0b-ede4145645b5\" title=\"\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\">\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981</a>\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002<span style=\"background-color: rgb(220, 237, 200);\">\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801</span>\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002<span data-latex=\"int_{-infty}^{infty} e^{-x^2} dx = sqrt{pi}\" data-type=\"inline-math\"></span>\u3002</p></li><li><p>\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C<span style=\"background-color: rgb(220, 237, 200);\">\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C</span>\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</p></li></ol></li><li><p>\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185<span style=\"color: rgb(130, 221, 175);\">\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709</span>\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002<s>\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C</s>\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002<span style=\"color: rgb(115, 181, 240);\">\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</span>\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</p></li></ol><h2 id=\"f983b68f-31d3-4997-95e9-206cccf67ca7\">\u8FD9\u4E2A\u662F\u4E00\u4E2A\u4E8C\u7EA7\u6807\u9898</h2><div data-id=\"alert_glbsomkw6q\" data-variant=\"info\" data-type=\"icon\" data-node=\"alert\"><p>\u4E8C\u7EA7\u6807\u9898\u7684\u8B66\u544A\u63D0\u793A\u6846\uFF0C\u5355\u884C\u5185\u5BB9\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</p></div><p><span style=\"color: rgb(63, 68, 65);\"><em>\u53D1\u751F\u7684\u53D1\u4E86\u5723\u8BDE\u8282\u9022\u5C71\u5F00\u8DEF\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</em></span></p><video class=\"video-wrapper\" src=\"/static-file/aa8fc65a-bea8-4106-a653-619e4daf5367/b9c9ca65-7412-4e09-b739-ed6f9360d8e0.mp4\" controls=\"true\" width=\"1375\"></video><h2 id=\"e3ceabee-1c6b-42dd-92a3-65a530b42cd8\">\u8FD8\u662F\u4E00\u4E2A\u4E8C\u7EA7\u6807\u9898\uFF01</h2><p>\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</p><details class=\"cq-details\" open=\"\"><summary class=\"cq-details-summary\">\u6298\u53E0\u9762\u677F\u6807\u9898\uFF1A\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</summary><div class=\"cq-details-content\" data-type=\"detailsContent\"><h6 id=\"059a31bb-de5b-42a3-a035-6afcb537c83d\">\u516D\u7EA7\u6807\u9898 H6</h6><p>\u6B64\u5904\u4E3A\u5185\u5BB9\u533A\u57DF\uFF0C\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</p><p><img src=\"/static-file/9134bd1e-8568-48b0-88f9-42027a98c200/84fec93d-43d3-4891-a9a7-244a201cf738.gif\" width=\"300\"><img src=\"/static-file/634d2b46-feef-455d-92f2-07f97073db98/16467c5e-7509-4707-a97b-3bdfaf270b97.gif\" width=\"300\"><img src=\"/static-file/39e7c942-194f-4149-a735-9584d664b691/e1ec5a4a-fdc5-43ae-b13f-bf9000598690.gif\" width=\"300\"></p><hr><h6 id=\"1690714a-8b2b-4294-8b04-8bc1158269b2\">\u516D\u7EA7\u6807\u9898 h6</h6><p><span style=\"background-color: rgb(231, 189, 255);\">\u5427\u5566\u5427\u963F\u91CC\u6B64\u5904\u4E3A\u5185\u5BB9\u533A\u57DF\uFF0C</span><span style=\"background-color: rgb(255, 224, 178);\">\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C</span><span style=\"background-color: rgb(248, 187, 208);\">\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</span><span style=\"background-color: rgb(240, 236, 179);\">\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C</span><span style=\"background-color: rgb(255, 204, 188);\">\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</span>\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C<span style=\"background-color: rgb(179, 229, 252);\">\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</span>\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C<span style=\"background-color: rgb(200, 230, 201);\">\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</span>\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C<span style=\"background-color: rgb(187, 222, 251);\">\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</span>\u6B64\u5904\u4E3A\u5185\u5BB9\u533A\u57DF\uFF0C<span style=\"background-color: rgb(220, 237, 200);\">\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C</span>\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C<span style=\"background-color: rgba(42, 123, 83, 0.67); color: rgb(255, 255, 255);\">\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981</span>\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C</p><div data-tag=\"attachment\" url=\"\" title=\"\" size=\"0\" data-url=\"/static-file/cb70d61c-3aeb-43b9-ad5f-128974eff555/db4b6a53-730d-461a-8488-11b7e528d7dd.md\" data-title=\"\u96F7\u6C60\u793E\u533A\u7248\u81EA\u52A8SSL.md\" data-size=\"2.85 KB\"></div><div data-tag=\"attachment\" url=\"\" title=\"\" size=\"0\" data-url=\"/static-file/14d6c511-e942-4664-92eb-32b6b8ee0ccf/ad8e0b68-cf19-4fb9-becc-cb10333c7d03.md\" data-title=\"\u8EAB\u4EFD\u8BA4\u8BC1 - CAS.md\" data-size=\"2.79 KB\"></div><p>\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002<span style=\"vertical-align: bottom; font-size: 24px;\">\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C</span>\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002<span style=\"vertical-align: top; font-size: 10px;\">\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</span>\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6B64\u5904\u4E3A\u5185\u5BB9\u533A\u57DF\uFF0C\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</p><iframe class=\"iframe-wrapper\" width=\"1261\" height=\"743\" src=\"https://47.104.180.36:2443/\" frameborder=\"0\" allowfullscreen=\"true\" autoplay=\"0\" loop=\"0\"></iframe><p>\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6B64\u5904\u4E3A\u5185\u5BB9\u533A\u57DF\uFF0C\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C</p><div data-tag=\"attachment\" url=\"\" title=\"\" size=\"0\" data-url=\"/static-file/e919dac5-f275-468e-b52b-ca7dc4b46030/270b9ee9-bc19-4dbe-b619-e04186fbc09d.md\" data-title=\"\u767E\u5DDD\u7F51\u7AD9\u76D1\u6D4B.md\" data-size=\"1.14 KB\"></div><p>\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</p><div class=\"tableWrapper\"><table style=\"width: 1146px;\"><colgroup><col style=\"width: 571px;\"><col style=\"width: 165px;\"><col style=\"width: 196px;\"><col style=\"width: 214px;\"></colgroup><tbody><tr class=\"table-row\"><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" colwidth=\"571\"><p style=\"text-align: center;\">fasdjklf</p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" colwidth=\"165\"><p style=\"text-align: center;\">fsdajkl</p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" colwidth=\"196\"><p style=\"text-align: center;\">fjklsdajfl</p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" colwidth=\"214\"><p style=\"text-align: center;\">fjdsakljk</p></th></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" colwidth=\"571\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p style=\"text-align: center;\">\u53D1\u5927\u5BB6\u6492\u5FEB\u4E50\u98DE\u673A\u554A\u6536\u5230\u5566\u5F00\u53D1\u5EFA\u8BBE\u5361\u5FB7\u7F57\u592B\u5C31\u554A\u6570\u91CF\u7684\u98DE\u673A\u963F\u91CC\u65AF\u987F\u8FDB\u6765\u770B</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"165\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p style=\"text-align: center;\">12</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"196\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p style=\"text-align: center;\">2342</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"214\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p style=\"text-align: center;\">239</p></td></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" colwidth=\"571\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p style=\"text-align: center;\">\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002\u6587\u6863\u5185\u5BB9\u4E3A\u65E0\u610F\u4E49\u4E71\u7801\uFF0C\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981\u3002</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"165\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p style=\"text-align: center;\">2332</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"196\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p style=\"text-align: center;\">232</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"214\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p style=\"text-align: center;\">9438</p></td></tr></tbody></table></div></div></details><h2 id=\"84cd9c21-dd66-418b-997d-1c9024e23d99\">\u53C8\u4E00\u4E2A\u4E8C\u7EA7\u6807\u9898</h2><h3 id=\"f21105ce-61ff-4542-98e6-9a6bbe1c3350\">\u4E09\u7EA7\u6807\u9898 1\uFF1A\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981</h3><div data-latex=\"int_{-infty}^{infty} e^{-x^2} dx = sqrt{pi}\" data-type=\"block-math\"></div><h3 id=\"b8e6c105-1131-4c69-9251-256679f6bcca\">\u4E09\u7EA7\u6807\u9898 2\uFF1A\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981</h3><pre><code><!doctype html>\n<html lang=\"en\">\n\n<head>\n <meta charset=\"UTF-8\" />\n <link rel=\"icon\" type=\"image/svg+xml\" href=\"/logo.png\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>PandaWiki</title>\n <link rel=\"stylesheet\" href=\"/panda-wiki.css\">\n</head>\n\n<body>\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/src/main.tsx\"></script>\n</body>\n\n</html></code></pre><h3 id=\"c3c5e4b3-1827-4583-8099-0d1ff0c87af6\">\u4E09\u7EA7\u6807\u9898 3\uFF1A\u65E0\u6CD5\u751F\u6210\u6709\u6548\u6458\u8981</h3><div class=\"tableWrapper\"><table style=\"width: 1739px;\"><colgroup><col style=\"width: 188px;\"><col style=\"width: 207px;\"><col style=\"width: 162px;\"><col style=\"width: 198px;\"><col style=\"width: 202px;\"><col style=\"width: 141px;\"><col style=\"width: 132px;\"><col style=\"width: 172px;\"><col style=\"width: 178px;\"><col style=\"width: 159px;\"></colgroup><tbody><tr class=\"table-row\"><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" colwidth=\"188\"><p>\u5C06\u5723\u8BDE\u5FEB\u4E50</p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" colwidth=\"207\"><p>\u98DE\u673A\u5566\u6DF1\u523B\u7684\u53D1</p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" colwidth=\"162\"><p>\u98DE\u673A\u901F\u5EA6\u5FEB\u5566 </p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" colwidth=\"198\"><p>\u53D1\u6492\u5C3D\u91CF\u5206\u5F00\u7684</p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" colwidth=\"202\"><p>\u98DE\u673A\u7684\u5FEB\u4E50\u6492</p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" colwidth=\"141\"><p>\u98DE\u673A\u6536\u5230\u4E86\u5361</p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" colwidth=\"132\"><p>\u98DE\u673A\u7684\u65F6\u7A7A\u8DDD\u79BB</p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" colwidth=\"172\"><p>\u53D1\u5927\u6C34\u5566\u5FEB\u5C31\u53D1\u751F\u4E86\u7A7A\u95F4\u6D6A\u8D39</p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" colwidth=\"178\"><p>\u98DE\u673A\u7684\u7D22\u79D1\u6D1B\u592B\u5C31\u6765\u5237\u5361\u89E3\u653E\u5FEB\u4E50\u6492</p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" colwidth=\"159\"><p>\u53D1\u751F\u5C3D\u91CF\u5FEB\u70B9</p></th></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" colwidth=\"188\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u53D1\u6EF4\u6F0F\u5F0F\u5496\u5561\u673A\u963F\u91CC\u98DE\u673A\u6EF4\u6F0F\u5F0F\u5496\u5561\u673A\u6536\u5230\u4E86</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"207\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u98DE\u673A\u5566\u5F00\u59CB\u51CF\u80A5\u4E86\u4E0A\u98DE\u673A\u4E86\u6492\u98DE\u673A\u963F\u675C\u91CC\u65AF\u98DE\u673A\u4E86</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"162\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u53D1\u4E86\u5FEB\u4E09\u5927\u89E3\u653E\u4E86</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"198\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u53D1\u5230\u4E86\u6492\u770B\u89E3\u653E\u8DEF\u53E3</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"202\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u53D1\u4E86\u770B\u5230\u6492\u5A07\u53D1\u6765\u7684\u5FEB\u6492\u89E3\u653E\u62C9\u5361\u5723\u8BDE\u8282\u53D1\u4E86\u7761\u89C9\u4E86</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"141\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u53D1\u4E86\u5C31\u770B\u5230\u6492\u5A07\u53D1\u4E86\u5FEB</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"132\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u8FDB\u6765\u770B\u53D1\u5566\u6DF1\u523B\u7684\u89E3\u653E</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"172\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u53D1\u4E86\u5C31\u5F00\u59CB\u6253</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"178\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u53D1\u4E86\u5361\u5723\u8BDE\u8282\u53D1\u5566\u65F6\u4EE3\u5CF0\u5CFB\u7684\u62C9\u5361\u4E0A\u98DE\u673A\u4E86</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"159\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u8DEF\u53E3\u53D1\u6492\u51E0\u70B9\u4E86\u5496\u5561</p></td></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" colwidth=\"188\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u53D1\u4E86\u624B\u673A\u5361\u7684\u89E3\u653E\u5566\u5723\u8BDE\u8282\u53D1\u4E86\u5FEB\u6492\u98DE\u673A\u963F\u91CC\u4E0A\u98DE\u673A\u554A\u4E0A\u6765\u7684\u5FEB</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"207\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u53D1\u4E86\u5FEB\u5927\u6C34\u89E3\u653E\u8DEF\u53E3</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"162\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u5C31\u53D1\u4E86\u770B\u5230\u6492\u5A07\u5FEB\u75AF\u4E86\u5723\u8BDE\u8282\u53D1\u4E86\u6492\u53D1</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"198\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u4E86\u98DE\u673A\u7684\u6492\u5F00\u5C31\u53D1\u4E86\u75AF\u4E86</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"202\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u5F17\u8428\u7684\u5FEB\u4E50\u98DE\u673A\u4E86\u5723\u8BDE\u8282\u53D1\u4E86\u6492\u5927\u89E3\u653E\u4E86</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"141\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u53D1\u6492\u5C3D\u91CF\u5FEB\u70B9</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"132\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u98DE\u673A\u5566\u6DF1\u523B\u7684</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"172\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u4E66\u6CD5\u5BB6</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"178\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u98DE\u673A\u4E0A\u770B\u5566\u5927\u5BB6</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"159\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u53D1\u5230\u624B\u673A\u5361</p></td></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" colwidth=\"188\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u98DE\u673A\u770B\u5566\u5723\u8BDE\u8282\u53D1</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"207\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u89E3\u653E\u5566\u6DF1\u523B</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"162\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u526F\u4E66\u8BB0</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"198\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u53D1\u751F\u7B80\u5355\u5566\u5FEB\u653E\u5047\u4E86\u7684\u6492</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"202\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u53D1\u751F\u7684\u63A5\u53E3</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"141\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u6492\u5230\u5BB6\u4E50\u798F</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"132\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u53D1\u6492\u5C3D\u91CF\u5FEB</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"172\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u53D1\u6492\u6765\u7684\u5FEB\u653E\u5047\u4E86\u5FEB\u6492\u5927\u5E45\u62C9\u5347\u8DEF\u53E3\u98DE\u673A\u554A\u6536\u5230\u4E86</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"178\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u53D1\u6492\u8DEF\u53E3\u5C31\u5230</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"159\" data-background-color=\"transparent\" style=\"background-color: transparent;\"><p>\u53D1\u6492\u7684\u5FEB\u4E50\u98DE\u673A\u963F\u91CC\u65AF\u987F\u5F00\u98DE\u673A\u5927\u6C34\u8DEF\u53E3\u98DE\u673A\u554A\u4E0A\u4E86</p></td></tr></tbody></table></div><p></p>"
|
|
105
|
+
content: '# 标题1\n\n<a target="_blank" type="icon" href="http://localhost:8000/components/editor" title="发生的发">发生的发</a>\n\n## 标题2\n标题*斜体*\n标题**加粗**\n标题~~删除线~~\n标题`代码`\n标题^上标^,标题~下标~\n标题==高亮==飞机的撒路口[fasldkfjasldkjf](http://localhost:8000/components/editor)'
|
|
106
106
|
}),
|
|
107
107
|
editor = _useTiptap.editor;
|
|
108
108
|
return /*#__PURE__*/React.createElement(EditorThemeProvider, {
|
|
@@ -110,9 +110,12 @@ var Reader = function Reader() {
|
|
|
110
110
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
111
111
|
variant: "contained",
|
|
112
112
|
onClick: function onClick() {
|
|
113
|
-
editor.commands.
|
|
114
|
-
|
|
113
|
+
editor.commands.insertContent('# 标题1\n\n<a target="_blank" type="icon" href="http://localhost:8000/components/editor" title="发生的发">发生的发</a>\n\n## 标题2\n标题*斜体*\n标题**加粗**\n标题~~删除线~~\n标题`代码`\n标题^上标^,标题~下标~\n标题==高亮==', {
|
|
114
|
+
contentType: 'markdown'
|
|
115
115
|
});
|
|
116
|
+
// editor.commands.setContent('# 标题1\n## 标题2\n标题*斜体*\n标题**加粗**\n标题~~删除线~~\n标题`代码`\n标题^上标^,标题~下标~\n标题==高亮==', {
|
|
117
|
+
// contentType: 'markdown'
|
|
118
|
+
// })
|
|
116
119
|
}
|
|
117
120
|
}, "\u6D4B\u8BD5\u4E00\u4E0B"), /*#__PURE__*/React.createElement(Box, {
|
|
118
121
|
sx: {
|
|
@@ -7,6 +7,7 @@ import { hasMarksInSelection } from "../util";
|
|
|
7
7
|
var EditorToolbar = function EditorToolbar(_ref) {
|
|
8
8
|
var editor = _ref.editor,
|
|
9
9
|
menuInToolbarMore = _ref.menuInToolbarMore;
|
|
10
|
+
var isMarkdown = editor.options.contentType === 'markdown';
|
|
10
11
|
var _useEditorState = useEditorState({
|
|
11
12
|
editor: editor,
|
|
12
13
|
selector: function selector(ctx) {
|
|
@@ -15,18 +16,13 @@ var EditorToolbar = function EditorToolbar(_ref) {
|
|
|
15
16
|
isUndo: (_ctx$editor$can$chain = ctx.editor.can().chain().undo().run()) !== null && _ctx$editor$can$chain !== void 0 ? _ctx$editor$can$chain : false,
|
|
16
17
|
isRedo: (_ctx$editor$can$chain2 = ctx.editor.can().chain().redo().run()) !== null && _ctx$editor$can$chain2 !== void 0 ? _ctx$editor$can$chain2 : false,
|
|
17
18
|
isFormat: hasMarksInSelection(ctx.editor.state),
|
|
18
|
-
isQuote: ctx.editor.isActive('blockquote'),
|
|
19
19
|
isBold: ctx.editor.isActive('bold'),
|
|
20
20
|
isItalic: ctx.editor.isActive('italic'),
|
|
21
21
|
isStrike: ctx.editor.isActive('strike'),
|
|
22
22
|
isUnderline: ctx.editor.isActive('underline'),
|
|
23
23
|
isSuperscript: ctx.editor.isActive('superscript'),
|
|
24
24
|
isSubscript: ctx.editor.isActive('subscript'),
|
|
25
|
-
isDetails: ctx.editor.isActive('details'),
|
|
26
|
-
isTable: ctx.editor.isActive('table'),
|
|
27
25
|
isLink: ctx.editor.isActive('link'),
|
|
28
|
-
isAlert: ctx.editor.isActive('alert'),
|
|
29
|
-
isIframe: ctx.editor.isActive('iframe'),
|
|
30
26
|
isHighlight: ctx.editor.isActive('highlight'),
|
|
31
27
|
isAiWriting: !!((_ctx$editor$storage = ctx.editor.storage) !== null && _ctx$editor$storage !== void 0 && (_ctx$editor$storage = _ctx$editor$storage.aiWriting) !== null && _ctx$editor$storage !== void 0 && _ctx$editor$storage.enabled)
|
|
32
28
|
};
|
|
@@ -35,18 +31,13 @@ var EditorToolbar = function EditorToolbar(_ref) {
|
|
|
35
31
|
isUndo = _useEditorState.isUndo,
|
|
36
32
|
isRedo = _useEditorState.isRedo,
|
|
37
33
|
isFormat = _useEditorState.isFormat,
|
|
38
|
-
isQuote = _useEditorState.isQuote,
|
|
39
34
|
isBold = _useEditorState.isBold,
|
|
40
35
|
isItalic = _useEditorState.isItalic,
|
|
41
36
|
isStrike = _useEditorState.isStrike,
|
|
42
37
|
isUnderline = _useEditorState.isUnderline,
|
|
43
38
|
isSuperscript = _useEditorState.isSuperscript,
|
|
44
39
|
isSubscript = _useEditorState.isSubscript,
|
|
45
|
-
isDetails = _useEditorState.isDetails,
|
|
46
|
-
isTable = _useEditorState.isTable,
|
|
47
40
|
isLink = _useEditorState.isLink,
|
|
48
|
-
isAlert = _useEditorState.isAlert,
|
|
49
|
-
isIframe = _useEditorState.isIframe,
|
|
50
41
|
isAiWriting = _useEditorState.isAiWriting,
|
|
51
42
|
isHighlight = _useEditorState.isHighlight;
|
|
52
43
|
return /*#__PURE__*/React.createElement(Box, {
|
|
@@ -97,7 +88,8 @@ var EditorToolbar = function EditorToolbar(_ref) {
|
|
|
97
88
|
},
|
|
98
89
|
className: isAiWriting ? 'tool-active' : ''
|
|
99
90
|
}), /*#__PURE__*/React.createElement(EditorInsert, {
|
|
100
|
-
editor: editor
|
|
91
|
+
editor: editor,
|
|
92
|
+
isMarkdown: isMarkdown
|
|
101
93
|
}), /*#__PURE__*/React.createElement(Divider, {
|
|
102
94
|
orientation: "vertical",
|
|
103
95
|
flexItem: true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BoldIcon, CodeLineIcon, EraserLineIcon, ItalicIcon,
|
|
1
|
+
import { BoldIcon, CodeLineIcon, EraserLineIcon, ItalicIcon, MarkPenLineIcon, StrikethroughIcon, UnderlineIcon } from "../Icons";
|
|
2
2
|
import { hasMarksInSelection } from "../../util";
|
|
3
|
-
import { Paper, Stack } from '@mui/material';
|
|
3
|
+
import { Divider, Paper, Stack } from '@mui/material';
|
|
4
4
|
import { useEditorState } from '@tiptap/react';
|
|
5
5
|
import { BubbleMenu } from '@tiptap/react/menus';
|
|
6
6
|
import React from 'react';
|
|
@@ -175,6 +175,14 @@ var CustomBubbleMenu = function CustomBubbleMenu(_ref) {
|
|
|
175
175
|
return editor.chain().focus().toggleCode().run();
|
|
176
176
|
},
|
|
177
177
|
className: isCode ? "tool-active" : ""
|
|
178
|
+
}), /*#__PURE__*/React.createElement(Divider, {
|
|
179
|
+
orientation: "vertical",
|
|
180
|
+
flexItem: true,
|
|
181
|
+
sx: {
|
|
182
|
+
mx: 0.5,
|
|
183
|
+
height: 20,
|
|
184
|
+
alignSelf: 'center'
|
|
185
|
+
}
|
|
178
186
|
}), /*#__PURE__*/React.createElement(ToolbarItem
|
|
179
187
|
// tip='文本格式化'
|
|
180
188
|
, {
|
|
@@ -187,24 +195,6 @@ var CustomBubbleMenu = function CustomBubbleMenu(_ref) {
|
|
|
187
195
|
return editor.chain().focus().unsetAllMarks().run();
|
|
188
196
|
},
|
|
189
197
|
disabled: !hasAnyMarks
|
|
190
|
-
}), /*#__PURE__*/React.createElement(ToolbarItem
|
|
191
|
-
// tip='插入链接'
|
|
192
|
-
, {
|
|
193
|
-
icon: /*#__PURE__*/React.createElement(LinkIcon, {
|
|
194
|
-
sx: {
|
|
195
|
-
fontSize: '1rem'
|
|
196
|
-
}
|
|
197
|
-
}),
|
|
198
|
-
onClick: function onClick() {
|
|
199
|
-
var selection = editor.state.selection;
|
|
200
|
-
var start = selection.from;
|
|
201
|
-
var end = selection.to;
|
|
202
|
-
var text = editor.state.doc.textBetween(start, end, '');
|
|
203
|
-
editor.chain().focus().setInlineLink({
|
|
204
|
-
href: '',
|
|
205
|
-
title: text
|
|
206
|
-
}).run();
|
|
207
|
-
}
|
|
208
198
|
}), more === null || more === void 0 ? void 0 : more.map(function (item) {
|
|
209
199
|
return /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
210
200
|
key: item.key,
|
|
@@ -23,6 +23,7 @@ import { Box, Divider, Stack, Typography, useTheme } from '@mui/material';
|
|
|
23
23
|
import DragHandle from '@tiptap/extension-drag-handle-react';
|
|
24
24
|
import { Fragment, Slice } from '@tiptap/pm/model';
|
|
25
25
|
import { NodeSelection } from '@tiptap/pm/state';
|
|
26
|
+
import { useEditorState } from '@tiptap/react';
|
|
26
27
|
import React, { useCallback, useState } from 'react';
|
|
27
28
|
import { convertNodeAt, downloadFiles, filterResourcesByType, getAllResources, getShortcutKeyText, hasMarksInSelection } from "../../util";
|
|
28
29
|
import Menu from "../Menu";
|
|
@@ -97,31 +98,28 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
97
98
|
more = _ref3.more,
|
|
98
99
|
onTip = _ref3.onTip;
|
|
99
100
|
var theme = useTheme();
|
|
100
|
-
var
|
|
101
|
-
|
|
102
|
-
showFormat = _useState2[0],
|
|
103
|
-
setShowFormat = _useState2[1];
|
|
104
|
-
var _useState3 = useState({
|
|
101
|
+
var isMarkdown = editor.options.contentType === 'markdown';
|
|
102
|
+
var _useState = useState({
|
|
105
103
|
editor: editor,
|
|
106
104
|
node: null,
|
|
107
105
|
pos: -1
|
|
108
106
|
}),
|
|
109
|
-
|
|
110
|
-
current =
|
|
111
|
-
setCurrent =
|
|
112
|
-
var
|
|
107
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
108
|
+
current = _useState2[0],
|
|
109
|
+
setCurrent = _useState2[1];
|
|
110
|
+
var _useState3 = useState({
|
|
113
111
|
videos: [],
|
|
114
112
|
audios: [],
|
|
115
113
|
images: [],
|
|
116
114
|
attachments: []
|
|
117
115
|
}),
|
|
116
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
117
|
+
resources = _useState4[0],
|
|
118
|
+
setResources = _useState4[1];
|
|
119
|
+
var _useState5 = useState(null),
|
|
118
120
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
var _useState7 = useState(null),
|
|
122
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
123
|
-
currentNode = _useState8[0],
|
|
124
|
-
setCurrentNode = _useState8[1];
|
|
121
|
+
currentNode = _useState6[0],
|
|
122
|
+
setCurrentNode = _useState6[1];
|
|
125
123
|
var THEME_TEXT_COLOR = [{
|
|
126
124
|
label: '默认色',
|
|
127
125
|
value: theme.palette.text.primary
|
|
@@ -257,10 +255,17 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
257
255
|
images: images,
|
|
258
256
|
attachments: attachments
|
|
259
257
|
});
|
|
260
|
-
var hasMarks = hasMarksInSelection(current.editor.state);
|
|
261
|
-
setShowFormat(!hasMarks);
|
|
262
258
|
}
|
|
263
259
|
}, [current.pos, current.node]);
|
|
260
|
+
var _useEditorState = useEditorState({
|
|
261
|
+
editor: editor,
|
|
262
|
+
selector: function selector(ctx) {
|
|
263
|
+
return {
|
|
264
|
+
hasMarks: hasMarksInSelection(ctx.editor.state)
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
}),
|
|
268
|
+
hasMarks = _useEditorState.hasMarks;
|
|
264
269
|
return /*#__PURE__*/React.createElement(DragHandle, {
|
|
265
270
|
editor: editor,
|
|
266
271
|
onNodeChange: updateNodeChange
|
|
@@ -1067,7 +1072,7 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
1067
1072
|
current.editor.commands.toggleBlockquote();
|
|
1068
1073
|
}
|
|
1069
1074
|
}
|
|
1070
|
-
}
|
|
1075
|
+
}].concat(_toConsumableArray(!isMarkdown ? [{
|
|
1071
1076
|
label: '警告提示',
|
|
1072
1077
|
selected: ((_current$node14 = current.node) === null || _current$node14 === void 0 ? void 0 : _current$node14.type.name) === 'alert',
|
|
1073
1078
|
key: 'convert-to-alert',
|
|
@@ -1097,7 +1102,7 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
1097
1102
|
});
|
|
1098
1103
|
}
|
|
1099
1104
|
}
|
|
1100
|
-
}]
|
|
1105
|
+
}] : []))
|
|
1101
1106
|
}] : []), _toConsumableArray(currentNode !== null && currentNode !== void 0 && currentNode.download && ((_current$node15 = current.node) !== null && _current$node15 !== void 0 && _current$node15.attrs.src || (_current$node16 = current.node) !== null && _current$node16 !== void 0 && _current$node16.attrs.src) ? [{
|
|
1102
1107
|
label: "\u4E0B\u8F7D".concat(currentNode === null || currentNode === void 0 ? void 0 : currentNode.label),
|
|
1103
1108
|
key: 'download',
|
|
@@ -1379,7 +1384,7 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
1379
1384
|
}
|
|
1380
1385
|
return onClick;
|
|
1381
1386
|
}()
|
|
1382
|
-
}] : []))), _toConsumableArray(more ? more : []), _toConsumableArray(
|
|
1387
|
+
}] : []))), _toConsumableArray(more ? more : []), _toConsumableArray(hasMarks ? [{
|
|
1383
1388
|
label: '文本格式化',
|
|
1384
1389
|
key: 'format',
|
|
1385
1390
|
icon: /*#__PURE__*/React.createElement(EraserLineIcon, {
|
|
@@ -2,6 +2,7 @@ import { Editor } from '@tiptap/react';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
interface EditorInsertProps {
|
|
4
4
|
editor: Editor;
|
|
5
|
+
isMarkdown: boolean;
|
|
5
6
|
}
|
|
6
|
-
declare const EditorInsert: ({ editor }: EditorInsertProps) => React.JSX.Element;
|
|
7
|
+
declare const EditorInsert: ({ editor, isMarkdown }: EditorInsertProps) => React.JSX.Element;
|
|
7
8
|
export default EditorInsert;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
1
7
|
import { getShortcutKeyText } from "../../../util";
|
|
2
8
|
import { Typography } from '@mui/material';
|
|
3
9
|
import React from 'react';
|
|
@@ -6,7 +12,8 @@ import Menu from "../../Menu";
|
|
|
6
12
|
import ToolbarItem from "../Item";
|
|
7
13
|
import TableSizePicker from "../TableSizePicker";
|
|
8
14
|
var EditorInsert = function EditorInsert(_ref) {
|
|
9
|
-
var editor = _ref.editor
|
|
15
|
+
var editor = _ref.editor,
|
|
16
|
+
isMarkdown = _ref.isMarkdown;
|
|
10
17
|
return /*#__PURE__*/React.createElement(Menu, {
|
|
11
18
|
width: 224,
|
|
12
19
|
context: /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
@@ -88,7 +95,7 @@ var EditorInsert = function EditorInsert(_ref) {
|
|
|
88
95
|
}
|
|
89
96
|
})
|
|
90
97
|
}]
|
|
91
|
-
}
|
|
98
|
+
}].concat(_toConsumableArray(!isMarkdown ? [{
|
|
92
99
|
label: '文件',
|
|
93
100
|
key: 'file',
|
|
94
101
|
icon: /*#__PURE__*/React.createElement(Folder2LineIcon, {
|
|
@@ -161,7 +168,7 @@ var EditorInsert = function EditorInsert(_ref) {
|
|
|
161
168
|
});
|
|
162
169
|
}
|
|
163
170
|
}]
|
|
164
|
-
}, {
|
|
171
|
+
}] : []), [{
|
|
165
172
|
customLabel: /*#__PURE__*/React.createElement(Typography, {
|
|
166
173
|
sx: {
|
|
167
174
|
px: 1,
|
|
@@ -216,7 +223,7 @@ var EditorInsert = function EditorInsert(_ref) {
|
|
|
216
223
|
onClick: function onClick() {
|
|
217
224
|
return editor.chain().focus().setDetails().run();
|
|
218
225
|
}
|
|
219
|
-
}, {
|
|
226
|
+
}], _toConsumableArray(!isMarkdown ? [{
|
|
220
227
|
label: '警告提示',
|
|
221
228
|
key: 'highlight',
|
|
222
229
|
icon: /*#__PURE__*/React.createElement(Information2LineIcon, {
|
|
@@ -300,7 +307,7 @@ var EditorInsert = function EditorInsert(_ref) {
|
|
|
300
307
|
}).run();
|
|
301
308
|
}
|
|
302
309
|
}]
|
|
303
|
-
}, {
|
|
310
|
+
}] : []), [{
|
|
304
311
|
customLabel: /*#__PURE__*/React.createElement(Typography, {
|
|
305
312
|
sx: {
|
|
306
313
|
px: 1,
|
|
@@ -400,7 +407,7 @@ var EditorInsert = function EditorInsert(_ref) {
|
|
|
400
407
|
});
|
|
401
408
|
}
|
|
402
409
|
}]
|
|
403
|
-
}, {
|
|
410
|
+
}], _toConsumableArray(!isMarkdown ? [{
|
|
404
411
|
customLabel: /*#__PURE__*/React.createElement(Typography, {
|
|
405
412
|
sx: {
|
|
406
413
|
px: 1,
|
|
@@ -425,7 +432,7 @@ var EditorInsert = function EditorInsert(_ref) {
|
|
|
425
432
|
height: 400
|
|
426
433
|
});
|
|
427
434
|
}
|
|
428
|
-
}]
|
|
435
|
+
}] : []))
|
|
429
436
|
});
|
|
430
437
|
};
|
|
431
438
|
export default EditorInsert;
|
|
@@ -6,5 +6,5 @@ interface InsertLinkProps extends Partial<NodeViewProps> {
|
|
|
6
6
|
attrs: LinkAttributes;
|
|
7
7
|
editor: Editor;
|
|
8
8
|
}
|
|
9
|
-
declare const InsertLink: ({ updateAttributes, deleteNode,
|
|
9
|
+
declare const InsertLink: ({ updateAttributes, deleteNode, attrs, editor }: InsertLinkProps) => React.JSX.Element;
|
|
10
10
|
export default InsertLink;
|
|
@@ -12,9 +12,9 @@ import React, { useEffect, useState } from "react";
|
|
|
12
12
|
var InsertLink = function InsertLink(_ref) {
|
|
13
13
|
var updateAttributes = _ref.updateAttributes,
|
|
14
14
|
deleteNode = _ref.deleteNode,
|
|
15
|
-
selected = _ref.selected,
|
|
16
15
|
attrs = _ref.attrs,
|
|
17
16
|
editor = _ref.editor;
|
|
17
|
+
var isMarkdown = editor.options.contentType === 'markdown';
|
|
18
18
|
var _useState = useState(attrs.title || ''),
|
|
19
19
|
_useState2 = _slicedToArray(_useState, 2),
|
|
20
20
|
title = _useState2[0],
|
|
@@ -23,7 +23,7 @@ var InsertLink = function InsertLink(_ref) {
|
|
|
23
23
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
24
24
|
href = _useState4[0],
|
|
25
25
|
setHref = _useState4[1];
|
|
26
|
-
var _useState5 = useState(attrs.type || 'icon'),
|
|
26
|
+
var _useState5 = useState(isMarkdown ? 'text' : attrs.type || 'icon'),
|
|
27
27
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
28
28
|
type = _useState6[0],
|
|
29
29
|
setType = _useState6[1];
|
|
@@ -157,7 +157,7 @@ var InsertLink = function InsertLink(_ref) {
|
|
|
157
157
|
return setTitle(e.target.value);
|
|
158
158
|
},
|
|
159
159
|
placeholder: "\u94FE\u63A5\u6807\u9898\uFF08\u53EF\u9009\uFF09"
|
|
160
|
-
})), /*#__PURE__*/React.createElement(FormControl, {
|
|
160
|
+
})), !isMarkdown && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormControl, {
|
|
161
161
|
component: "fieldset"
|
|
162
162
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
163
163
|
direction: 'row',
|
|
@@ -233,7 +233,7 @@ var InsertLink = function InsertLink(_ref) {
|
|
|
233
233
|
size: "small"
|
|
234
234
|
}),
|
|
235
235
|
label: "\u5F53\u524D\u7A97\u53E3"
|
|
236
|
-
})))), /*#__PURE__*/React.createElement(Stack, {
|
|
236
|
+
}))))), /*#__PURE__*/React.createElement(Stack, {
|
|
237
237
|
direction: "row",
|
|
238
238
|
gap: 1
|
|
239
239
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -24,6 +24,7 @@ var LinkViewWrapper = function LinkViewWrapper(_ref) {
|
|
|
24
24
|
updateAttributes = _ref.updateAttributes,
|
|
25
25
|
deleteNode = _ref.deleteNode,
|
|
26
26
|
selected = _ref.selected;
|
|
27
|
+
var isMarkdown = editor.options.contentType === 'markdown';
|
|
27
28
|
var attrs = node.attrs;
|
|
28
29
|
var _useState = useState(attrs.title || ''),
|
|
29
30
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -295,7 +296,7 @@ var LinkViewWrapper = function LinkViewWrapper(_ref) {
|
|
|
295
296
|
}),
|
|
296
297
|
tip: "\u53D6\u6D88\u94FE\u63A5",
|
|
297
298
|
onClick: handleDeleteLink
|
|
298
|
-
}), /*#__PURE__*/React.createElement(Divider, {
|
|
299
|
+
}), !isMarkdown && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
|
|
299
300
|
orientation: "vertical",
|
|
300
301
|
flexItem: true,
|
|
301
302
|
sx: {
|
|
@@ -372,7 +373,7 @@ var LinkViewWrapper = function LinkViewWrapper(_ref) {
|
|
|
372
373
|
});
|
|
373
374
|
},
|
|
374
375
|
className: type === 'block' ? 'tool-active' : ''
|
|
375
|
-
}))), /*#__PURE__*/React.createElement(FloatingPopover, {
|
|
376
|
+
})))), /*#__PURE__*/React.createElement(FloatingPopover, {
|
|
376
377
|
open: Boolean(anchorEl),
|
|
377
378
|
anchorEl: anchorEl,
|
|
378
379
|
onClose: handleClosePopover,
|
|
@@ -425,7 +426,7 @@ var LinkViewWrapper = function LinkViewWrapper(_ref) {
|
|
|
425
426
|
return setTitle(e.target.value);
|
|
426
427
|
},
|
|
427
428
|
placeholder: "\u94FE\u63A5\u6807\u9898\uFF08\u53EF\u9009\uFF09"
|
|
428
|
-
})), /*#__PURE__*/React.createElement(FormControl, {
|
|
429
|
+
})), !isMarkdown && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormControl, {
|
|
429
430
|
component: "fieldset"
|
|
430
431
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
431
432
|
direction: 'row',
|
|
@@ -495,7 +496,7 @@ var LinkViewWrapper = function LinkViewWrapper(_ref) {
|
|
|
495
496
|
size: "small"
|
|
496
497
|
}),
|
|
497
498
|
label: "\u5F53\u524D\u7A97\u53E3"
|
|
498
|
-
})))), /*#__PURE__*/React.createElement(Stack, {
|
|
499
|
+
}))))), /*#__PURE__*/React.createElement(Stack, {
|
|
499
500
|
direction: "row",
|
|
500
501
|
gap: 1
|
|
501
502
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -509,6 +510,6 @@ var LinkViewWrapper = function LinkViewWrapper(_ref) {
|
|
|
509
510
|
fullWidth: true,
|
|
510
511
|
onClick: handleSave,
|
|
511
512
|
disabled: !href.trim()
|
|
512
|
-
}, "\
|
|
513
|
+
}, "\u4FEE\u6539\u94FE\u63A5")))));
|
|
513
514
|
};
|
|
514
515
|
export default LinkViewWrapper;
|
|
@@ -7,6 +7,6 @@ export interface UploadProgressAttributes {
|
|
|
7
7
|
tempId: string;
|
|
8
8
|
}
|
|
9
9
|
export declare const getFileIcon: (fileType: string) => React.JSX.Element;
|
|
10
|
-
export declare const getFileTypeText: (fileType: string) => "
|
|
10
|
+
export declare const getFileTypeText: (fileType: string) => "音频" | "图片" | "视频" | "文件";
|
|
11
11
|
declare const UploadProgressView: React.FC<NodeViewProps>;
|
|
12
12
|
export default UploadProgressView;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { GetExtensionsProps } from '../type';
|
|
2
|
-
export declare const getExtensions: ({ limit, exclude, extensions: extensionsProps, youtube, editable, mentionItems, onMentionFilter, onUpload, onError, onTocUpdate, onAiWritingGetSuggestion, }: GetExtensionsProps) => any;
|
|
2
|
+
export declare const getExtensions: ({ contentType, limit, exclude, extensions: extensionsProps, youtube, editable, mentionItems, onMentionFilter, onUpload, onError, onTocUpdate, onAiWritingGetSuggestion, }: GetExtensionsProps) => any;
|
package/dist/extension/index.js
CHANGED
|
@@ -18,7 +18,8 @@ import { AiWritingExtension, SlashCommands, StructuredDiffExtension } from "./ex
|
|
|
18
18
|
import { CodeExtension } from "./mark/Code";
|
|
19
19
|
import { AlertExtension, AudioExtension, BlockAttachmentExtension, BlockLinkExtension, CodeBlockLowlightExtension, CustomBlockMathExtension, CustomInlineMathExtension, DetailsContentExtension, DetailsExtension, DetailsSummaryExtension, EmojiExtension, FileHandlerExtension, IframeExtension, ImageExtension, Indent, InlineAttachmentExtension, InlineLinkExtension, InlineUploadProgressExtension, ListExtension, MentionExtension, TableExtension, TableOfContents, UploadProgressExtension, VerticalAlign, VideoExtension, YoutubeExtension } from "./node";
|
|
20
20
|
export var getExtensions = function getExtensions(_ref) {
|
|
21
|
-
var
|
|
21
|
+
var contentType = _ref.contentType,
|
|
22
|
+
limit = _ref.limit,
|
|
22
23
|
exclude = _ref.exclude,
|
|
23
24
|
extensionsProps = _ref.extensions,
|
|
24
25
|
youtube = _ref.youtube,
|
|
@@ -42,28 +43,26 @@ export var getExtensions = function getExtensions(_ref) {
|
|
|
42
43
|
color: 'var(--mui-palette-primary-main)',
|
|
43
44
|
width: 2
|
|
44
45
|
}
|
|
46
|
+
}), Subscript, Superscript, TextStyleKit, CodeExtension, ListExtension, EmojiExtension, DetailsExtension, InlineLinkExtension, DetailsContentExtension, DetailsSummaryExtension, CodeBlockLowlightExtension].concat(_toConsumableArray(TableExtension({
|
|
47
|
+
editable: editable
|
|
48
|
+
})), [TableOfContents({
|
|
49
|
+
onTocUpdate: onTocUpdate
|
|
50
|
+
}), ImageExtension({
|
|
51
|
+
onUpload: onUpload,
|
|
52
|
+
onError: onError
|
|
53
|
+
}), CustomBlockMathExtension({
|
|
54
|
+
onError: onError
|
|
55
|
+
}), CustomInlineMathExtension({
|
|
56
|
+
onError: onError
|
|
57
|
+
}), Highlight.configure({
|
|
58
|
+
multicolor: true
|
|
59
|
+
}), CharacterCount.configure({
|
|
60
|
+
limit: limit !== null && limit !== void 0 ? limit : null
|
|
45
61
|
}), TextAlign.configure({
|
|
46
62
|
types: ['heading', 'paragraph']
|
|
47
63
|
}), VerticalAlign.configure({
|
|
48
64
|
types: ['textStyle'],
|
|
49
65
|
defaultAlignment: null
|
|
50
|
-
}), TextStyleKit.configure({
|
|
51
|
-
backgroundColor: {
|
|
52
|
-
types: ['textStyle']
|
|
53
|
-
}
|
|
54
|
-
}), ListExtension, CodeBlockLowlightExtension, CharacterCount.configure({
|
|
55
|
-
limit: limit !== null && limit !== void 0 ? limit : null
|
|
56
|
-
}), Subscript, Superscript, Indent.configure({
|
|
57
|
-
types: ['paragraph', 'heading', 'blockquote', 'alert', 'codeBlock', 'horizontalRule', 'orderedList', 'bulletList', 'taskList', 'taskItem', 'listItem', 'details', 'detailsContent', 'detailsSummary', 'table', 'image', 'video', 'audio', 'iframe', 'blockAttachment', 'inlineAttachment', 'blockLink', 'blockMath', 'inlineMath'],
|
|
58
|
-
maxLevel: 8,
|
|
59
|
-
indentPx: 32
|
|
60
|
-
}), CodeExtension, AlertExtension, Highlight.configure({
|
|
61
|
-
multicolor: true
|
|
62
|
-
}), Markdown.configure({
|
|
63
|
-
indentation: {
|
|
64
|
-
style: 'space',
|
|
65
|
-
size: 2
|
|
66
|
-
}
|
|
67
66
|
}), Placeholder.configure({
|
|
68
67
|
emptyNodeClass: 'custom-placeholder-node',
|
|
69
68
|
showOnlyWhenEditable: true,
|
|
@@ -90,46 +89,42 @@ export var getExtensions = function getExtensions(_ref) {
|
|
|
90
89
|
}
|
|
91
90
|
return '';
|
|
92
91
|
}
|
|
93
|
-
}), InlineLinkExtension, BlockLinkExtension, DetailsExtension, DetailsContentExtension, DetailsSummaryExtension].concat(_toConsumableArray(TableExtension({
|
|
94
|
-
editable: editable
|
|
95
|
-
})), [TableOfContents({
|
|
96
|
-
onTocUpdate: onTocUpdate
|
|
97
|
-
}), CustomInlineMathExtension({
|
|
98
|
-
onError: onError
|
|
99
|
-
}), CustomBlockMathExtension({
|
|
100
|
-
onError: onError
|
|
101
|
-
}), IframeExtension({
|
|
102
|
-
onError: onError
|
|
103
|
-
}), VideoExtension({
|
|
104
|
-
onUpload: onUpload,
|
|
105
|
-
onError: onError
|
|
106
|
-
}), AudioExtension({
|
|
107
|
-
onUpload: onUpload,
|
|
108
|
-
onError: onError
|
|
109
|
-
}), ImageExtension({
|
|
110
|
-
onUpload: onUpload,
|
|
111
|
-
onError: onError
|
|
112
|
-
}), InlineUploadProgressExtension, InlineAttachmentExtension({
|
|
113
|
-
onUpload: onUpload,
|
|
114
|
-
onError: onError
|
|
115
|
-
}), BlockAttachmentExtension({
|
|
116
|
-
onUpload: onUpload,
|
|
117
|
-
onError: onError
|
|
118
92
|
})]);
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
93
|
+
if (contentType === 'markdown') {
|
|
94
|
+
defaultExtensions.push(Markdown.configure({
|
|
95
|
+
indentation: {
|
|
96
|
+
style: 'space',
|
|
97
|
+
size: 2
|
|
98
|
+
},
|
|
99
|
+
markedOptions: {
|
|
100
|
+
gfm: true,
|
|
101
|
+
breaks: false,
|
|
102
|
+
pedantic: false
|
|
103
|
+
}
|
|
104
|
+
}));
|
|
105
|
+
} else {
|
|
106
|
+
defaultExtensions.push.apply(defaultExtensions, [AlertExtension, BlockLinkExtension, InlineUploadProgressExtension, IframeExtension({
|
|
107
|
+
onError: onError
|
|
108
|
+
}), VideoExtension({
|
|
109
|
+
onUpload: onUpload,
|
|
110
|
+
onError: onError
|
|
111
|
+
}), AudioExtension({
|
|
112
|
+
onUpload: onUpload,
|
|
113
|
+
onError: onError
|
|
114
|
+
}), BlockAttachmentExtension({
|
|
115
|
+
onUpload: onUpload,
|
|
116
|
+
onError: onError
|
|
117
|
+
}), InlineAttachmentExtension({
|
|
118
|
+
onUpload: onUpload,
|
|
119
|
+
onError: onError
|
|
120
|
+
})]);
|
|
129
121
|
}
|
|
130
|
-
if (!(exclude !== null && exclude !== void 0 && exclude.includes('
|
|
131
|
-
|
|
132
|
-
|
|
122
|
+
if (!(exclude !== null && exclude !== void 0 && exclude.includes('indent'))) {
|
|
123
|
+
defaultExtensions.push(Indent.configure({
|
|
124
|
+
types: ['paragraph', 'heading', 'blockquote', 'alert', 'codeBlock', 'horizontalRule', 'orderedList', 'bulletList', 'taskList', 'taskItem', 'listItem', 'details', 'detailsContent', 'detailsSummary', 'table', 'image', 'video', 'audio', 'iframe', 'blockAttachment', 'inlineAttachment', 'blockLink', 'blockMath', 'inlineMath'],
|
|
125
|
+
maxLevel: 8,
|
|
126
|
+
indentPx: 32
|
|
127
|
+
}));
|
|
133
128
|
}
|
|
134
129
|
if (editable) {
|
|
135
130
|
// 编辑模式
|
|
@@ -141,6 +136,9 @@ export var getExtensions = function getExtensions(_ref) {
|
|
|
141
136
|
var UploadProgress = UploadProgressExtension;
|
|
142
137
|
defaultExtensions.push(UploadProgress);
|
|
143
138
|
}
|
|
139
|
+
if (!(exclude !== null && exclude !== void 0 && exclude.includes('invisibleCharacters'))) {
|
|
140
|
+
defaultExtensions.push(InvisibleCharacters);
|
|
141
|
+
}
|
|
144
142
|
if (!(exclude !== null && exclude !== void 0 && exclude.includes('slashCommands'))) {
|
|
145
143
|
defaultExtensions.push(SlashCommands);
|
|
146
144
|
}
|
|
@@ -149,15 +147,23 @@ export var getExtensions = function getExtensions(_ref) {
|
|
|
149
147
|
onAiWritingGetSuggestion: onAiWritingGetSuggestion
|
|
150
148
|
}));
|
|
151
149
|
}
|
|
152
|
-
if (!(exclude !== null && exclude !== void 0 && exclude.includes('invisibleCharacters'))) {
|
|
153
|
-
defaultExtensions.push(InvisibleCharacters);
|
|
154
|
-
}
|
|
155
150
|
} else {
|
|
156
151
|
// 只读模式
|
|
157
152
|
if (!(exclude !== null && exclude !== void 0 && exclude.includes('structuredDiff'))) {
|
|
158
153
|
defaultExtensions.push(StructuredDiffExtension);
|
|
159
154
|
}
|
|
160
155
|
}
|
|
156
|
+
if (!(exclude !== null && exclude !== void 0 && exclude.includes('mention')) && (mentionItems && mentionItems.length > 0 || onMentionFilter)) {
|
|
157
|
+
var Mention = MentionExtension({
|
|
158
|
+
mentionItems: mentionItems,
|
|
159
|
+
onMentionFilter: onMentionFilter
|
|
160
|
+
});
|
|
161
|
+
defaultExtensions.push(Mention);
|
|
162
|
+
}
|
|
163
|
+
if (!(exclude !== null && exclude !== void 0 && exclude.includes('youtube'))) {
|
|
164
|
+
var Youtube = YoutubeExtension(youtube);
|
|
165
|
+
defaultExtensions.push(Youtube);
|
|
166
|
+
}
|
|
161
167
|
if (extensionsProps && extensionsProps.length > 0) {
|
|
162
168
|
defaultExtensions.push.apply(defaultExtensions, _toConsumableArray(extensionsProps));
|
|
163
169
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { UploadFunction } from "../../type";
|
|
2
2
|
export declare const FileHandlerExtension: (props: {
|
|
3
3
|
onUpload?: UploadFunction;
|
|
4
|
-
}) => import("@tiptap/core").Extension<Omit<import("@tiptap/extension-file-handler").FileHandlePluginOptions, "
|
|
4
|
+
}) => import("@tiptap/core").Extension<Omit<import("@tiptap/extension-file-handler").FileHandlePluginOptions, "editor" | "key">, any>;
|
|
@@ -199,6 +199,25 @@ export var InlineLinkExtension = Node.create({
|
|
|
199
199
|
}
|
|
200
200
|
return ['a', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), title];
|
|
201
201
|
},
|
|
202
|
+
markdownTokenName: 'link',
|
|
203
|
+
parseMarkdown: function parseMarkdown(token, helpers) {
|
|
204
|
+
var content = helpers.parseInline(token.tokens || []);
|
|
205
|
+
return {
|
|
206
|
+
type: 'inlineLink',
|
|
207
|
+
attrs: {
|
|
208
|
+
href: token.href,
|
|
209
|
+
title: token.title || null,
|
|
210
|
+
type: 'text'
|
|
211
|
+
},
|
|
212
|
+
content: content
|
|
213
|
+
};
|
|
214
|
+
},
|
|
215
|
+
renderMarkdown: function renderMarkdown(node, h) {
|
|
216
|
+
var _node$attrs, _node$attrs2;
|
|
217
|
+
var href = ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.href) || '';
|
|
218
|
+
var text = ((_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.title) || h.renderChildren(node) || '';
|
|
219
|
+
return "[".concat(text, "](").concat(href, ")");
|
|
220
|
+
},
|
|
202
221
|
addCommands: function addCommands() {
|
|
203
222
|
var _this3 = this;
|
|
204
223
|
return {
|
package/dist/hook/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { UseTiptapProps, UseTiptapReturn } from "../type";
|
|
2
2
|
import { UseEditorOptions } from '@tiptap/react';
|
|
3
|
-
declare const useTiptap: ({ exclude, extensions: extensionsProps, mentionItems, onMentionFilter, onSave, onError, onUpload, onTocUpdate, onAiWritingGetSuggestion, editable, ...options }: UseTiptapProps & UseEditorOptions) => UseTiptapReturn;
|
|
3
|
+
declare const useTiptap: ({ exclude, extensions: extensionsProps, mentionItems, onMentionFilter, onSave, onError, onUpload, onTocUpdate, onAiWritingGetSuggestion, editable, contentType, ...options }: UseTiptapProps & UseEditorOptions) => UseTiptapReturn;
|
|
4
4
|
export default useTiptap;
|
package/dist/hook/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["exclude", "extensions", "mentionItems", "onMentionFilter", "onSave", "onError", "onUpload", "onTocUpdate", "onAiWritingGetSuggestion", "editable"];
|
|
2
|
+
var _excluded = ["exclude", "extensions", "mentionItems", "onMentionFilter", "onSave", "onError", "onUpload", "onTocUpdate", "onAiWritingGetSuggestion", "editable", "contentType"];
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -23,8 +23,10 @@ var useTiptap = function useTiptap(_ref) {
|
|
|
23
23
|
onAiWritingGetSuggestion = _ref.onAiWritingGetSuggestion,
|
|
24
24
|
_ref$editable = _ref.editable,
|
|
25
25
|
editable = _ref$editable === void 0 ? true : _ref$editable,
|
|
26
|
+
contentType = _ref.contentType,
|
|
26
27
|
options = _objectWithoutProperties(_ref, _excluded);
|
|
27
28
|
var extensions = getExtensions({
|
|
29
|
+
contentType: contentType,
|
|
28
30
|
exclude: exclude,
|
|
29
31
|
extensions: extensionsProps,
|
|
30
32
|
editable: editable,
|
|
@@ -35,10 +37,12 @@ var useTiptap = function useTiptap(_ref) {
|
|
|
35
37
|
onTocUpdate: onTocUpdate,
|
|
36
38
|
onAiWritingGetSuggestion: onAiWritingGetSuggestion
|
|
37
39
|
});
|
|
38
|
-
var editor = useEditor(_objectSpread(_objectSpread({
|
|
40
|
+
var editor = useEditor(_objectSpread(_objectSpread(_objectSpread({
|
|
39
41
|
editable: editable,
|
|
40
42
|
extensions: extensions
|
|
41
|
-
},
|
|
43
|
+
}, contentType === 'markdown' ? {
|
|
44
|
+
contentType: 'markdown'
|
|
45
|
+
} : {}), options), {}, {
|
|
42
46
|
editorProps: {
|
|
43
47
|
handleKeyDown: function handleKeyDown(view, event) {
|
|
44
48
|
// 编辑模式下保存
|
|
@@ -67,12 +71,11 @@ var useTiptap = function useTiptap(_ref) {
|
|
|
67
71
|
}
|
|
68
72
|
},
|
|
69
73
|
onCreate: function onCreate(_ref2) {
|
|
74
|
+
var _options$onCreate;
|
|
70
75
|
var currentEditor = _ref2.editor;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
+
(_options$onCreate = options.onCreate) === null || _options$onCreate === void 0 || _options$onCreate.call(options, {
|
|
77
|
+
editor: currentEditor
|
|
78
|
+
});
|
|
76
79
|
// 处理数学公式 - 延迟执行确保文档完全准备好
|
|
77
80
|
setTimeout(function () {
|
|
78
81
|
try {
|
|
@@ -97,6 +100,16 @@ var useTiptap = function useTiptap(_ref) {
|
|
|
97
100
|
}));
|
|
98
101
|
return {
|
|
99
102
|
editor: editor,
|
|
103
|
+
getMarkdown: function getMarkdown() {
|
|
104
|
+
if (contentType === 'markdown') {
|
|
105
|
+
return editor.getMarkdown();
|
|
106
|
+
}
|
|
107
|
+
if (!editor) return '';
|
|
108
|
+
return renderToMarkdown({
|
|
109
|
+
extensions: editor.extensionManager.extensions,
|
|
110
|
+
content: editor.getJSON()
|
|
111
|
+
});
|
|
112
|
+
},
|
|
100
113
|
getText: function getText() {
|
|
101
114
|
return (editor === null || editor === void 0 ? void 0 : editor.getText()) || '';
|
|
102
115
|
},
|
|
@@ -105,13 +118,6 @@ var useTiptap = function useTiptap(_ref) {
|
|
|
105
118
|
},
|
|
106
119
|
getJSON: function getJSON() {
|
|
107
120
|
return (editor === null || editor === void 0 ? void 0 : editor.getJSON()) || null;
|
|
108
|
-
},
|
|
109
|
-
getMarkdownByJSON: function getMarkdownByJSON() {
|
|
110
|
-
if (!editor) return '';
|
|
111
|
-
return renderToMarkdown({
|
|
112
|
-
extensions: editor.extensionManager.extensions,
|
|
113
|
-
content: editor.getJSON()
|
|
114
|
-
});
|
|
115
121
|
}
|
|
116
122
|
};
|
|
117
123
|
};
|
package/dist/type/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { PopoverOrigin, SxProps, Theme } from '@mui/material';
|
|
3
3
|
import { Editor, Extension } from '@tiptap/core';
|
|
4
4
|
import { YoutubeOptions } from '@tiptap/extension-youtube';
|
|
5
|
+
import { UseEditorOptions } from '@tiptap/react';
|
|
5
6
|
export type { Editor } from '@tiptap/react';
|
|
6
7
|
export interface MenuItem {
|
|
7
8
|
label?: React.ReactNode;
|
|
@@ -94,13 +95,15 @@ export type ExtensionRelativeProps = MentionExtensionProps & EditorFnProps & {
|
|
|
94
95
|
export type UseTiptapProps = {
|
|
95
96
|
onSave?: (editor: Editor) => void;
|
|
96
97
|
} & ExtensionRelativeProps;
|
|
97
|
-
export type GetExtensionsProps = ExtensionRelativeProps
|
|
98
|
+
export type GetExtensionsProps = ExtensionRelativeProps & {
|
|
99
|
+
contentType?: UseEditorOptions['contentType'];
|
|
100
|
+
};
|
|
98
101
|
export type UseTiptapReturn = {
|
|
99
102
|
editor: Editor;
|
|
103
|
+
getMarkdown: () => string;
|
|
100
104
|
getText: () => string;
|
|
101
105
|
getHTML: () => string;
|
|
102
106
|
getJSON: () => any;
|
|
103
|
-
getMarkdownByJSON: () => string;
|
|
104
107
|
};
|
|
105
108
|
export interface SlashCommandItem {
|
|
106
109
|
title: string;
|