@ctzhian/tiptap 1.7.5-beta.2 → 1.8.0

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.
@@ -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(editor.getHTML(), editor.getMarkdown());
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: function () {
41
- var _onMentionFilter = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
42
- var query;
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 _context3.stop();
96
+ return _context2.stop();
97
97
  }
98
- }, _callee3);
98
+ }, _callee2);
99
99
  }));
100
- function onUpload(_x3, _x4) {
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&nbsp;</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>&lt;!doctype html&gt;\n&lt;html lang=\"en\"&gt;\n\n&lt;head&gt;\n &lt;meta charset=\"UTF-8\" /&gt;\n &lt;link rel=\"icon\" type=\"image/svg+xml\" href=\"/logo.png\" /&gt;\n &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /&gt;\n &lt;title&gt;PandaWiki&lt;/title&gt;\n &lt;link rel=\"stylesheet\" href=\"/panda-wiki.css\"&gt;\n&lt;/head&gt;\n\n&lt;body&gt;\n &lt;div id=\"root\"&gt;&lt;/div&gt;\n &lt;script type=\"module\" src=\"/src/main.tsx\"&gt;&lt;/script&gt;\n&lt;/body&gt;\n\n&lt;/html&gt;</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&nbsp;</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.extendMarkRange('code', {
114
- multiselect: true
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: {
@@ -1,68 +1,45 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure 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 _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; }
5
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
1
  import { Box, Divider, Stack } from '@mui/material';
8
- import React, { useEffect, useState } from 'react';
2
+ import { useEditorState } from '@tiptap/react';
3
+ import React from 'react';
9
4
  import { AiGenerate2Icon, ArrowGoBackLineIcon, ArrowGoForwardLineIcon, BoldIcon, EraserLineIcon, ItalicIcon, LinkIcon, MarkPenLineIcon, StrikethroughIcon, SubscriptIcon, SuperscriptIcon, UnderlineIcon } from "../component/Icons";
10
5
  import { EditorAlignSelect, EditorFontBgColor, EditorFontColor, EditorFontSize, EditorHeading, EditorInsert, EditorListSelect, EditorMore, EditorVerticalAlignSelect, ToolbarItem } from "../component/Toolbar";
6
+ import { hasMarksInSelection } from "../util";
11
7
  var EditorToolbar = function EditorToolbar(_ref) {
12
8
  var editor = _ref.editor,
13
9
  menuInToolbarMore = _ref.menuInToolbarMore;
14
- var _useState = useState({
15
- undo: false,
16
- redo: false,
17
- format: false,
18
- quote: false,
19
- bold: false,
20
- italic: false,
21
- strike: false,
22
- underline: false,
23
- superscript: false,
24
- subscript: false,
25
- details: false,
26
- table: false,
27
- link: false,
28
- alert: false,
29
- iframe: false,
30
- aiWriting: false,
31
- highlight: false
10
+ var isMarkdown = editor.options.contentType === 'markdown';
11
+ var _useEditorState = useEditorState({
12
+ editor: editor,
13
+ selector: function selector(ctx) {
14
+ var _ctx$editor$can$chain, _ctx$editor$can$chain2, _ctx$editor$storage;
15
+ return {
16
+ isUndo: (_ctx$editor$can$chain = ctx.editor.can().chain().undo().run()) !== null && _ctx$editor$can$chain !== void 0 ? _ctx$editor$can$chain : false,
17
+ isRedo: (_ctx$editor$can$chain2 = ctx.editor.can().chain().redo().run()) !== null && _ctx$editor$can$chain2 !== void 0 ? _ctx$editor$can$chain2 : false,
18
+ isFormat: hasMarksInSelection(ctx.editor.state),
19
+ isBold: ctx.editor.isActive('bold'),
20
+ isItalic: ctx.editor.isActive('italic'),
21
+ isStrike: ctx.editor.isActive('strike'),
22
+ isUnderline: ctx.editor.isActive('underline'),
23
+ isSuperscript: ctx.editor.isActive('superscript'),
24
+ isSubscript: ctx.editor.isActive('subscript'),
25
+ isLink: ctx.editor.isActive('link'),
26
+ isHighlight: ctx.editor.isActive('highlight'),
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)
28
+ };
29
+ }
32
30
  }),
33
- _useState2 = _slicedToArray(_useState, 2),
34
- active = _useState2[0],
35
- setActive = _useState2[1];
36
- var updateSelection = function updateSelection() {
37
- var _editor$can$chain$und, _editor$can$chain$red, _editor$can$chain$uns, _editor$storage;
38
- setActive({
39
- undo: (_editor$can$chain$und = editor.can().chain().undo().run()) !== null && _editor$can$chain$und !== void 0 ? _editor$can$chain$und : false,
40
- redo: (_editor$can$chain$red = editor.can().chain().redo().run()) !== null && _editor$can$chain$red !== void 0 ? _editor$can$chain$red : false,
41
- format: (_editor$can$chain$uns = editor.can().chain().unsetAllMarks().run()) !== null && _editor$can$chain$uns !== void 0 ? _editor$can$chain$uns : false,
42
- quote: editor.isActive('blockquote'),
43
- bold: editor.isActive('bold'),
44
- italic: editor.isActive('italic'),
45
- strike: editor.isActive('strike'),
46
- underline: editor.isActive('underline'),
47
- superscript: editor.isActive('superscript'),
48
- subscript: editor.isActive('subscript'),
49
- details: editor.isActive('details'),
50
- table: editor.isActive('table'),
51
- link: editor.isActive('link'),
52
- alert: editor.isActive('alert'),
53
- iframe: editor.isActive('iframe'),
54
- aiWriting: !!((_editor$storage = editor.storage) !== null && _editor$storage !== void 0 && (_editor$storage = _editor$storage.aiWriting) !== null && _editor$storage !== void 0 && _editor$storage.enabled),
55
- highlight: editor.isActive('highlight')
56
- });
57
- };
58
- useEffect(function () {
59
- editor.on('selectionUpdate', updateSelection);
60
- editor.on('transaction', updateSelection);
61
- return function () {
62
- editor.off('selectionUpdate', updateSelection);
63
- editor.off('transaction', updateSelection);
64
- };
65
- }, [editor]);
31
+ isUndo = _useEditorState.isUndo,
32
+ isRedo = _useEditorState.isRedo,
33
+ isFormat = _useEditorState.isFormat,
34
+ isBold = _useEditorState.isBold,
35
+ isItalic = _useEditorState.isItalic,
36
+ isStrike = _useEditorState.isStrike,
37
+ isUnderline = _useEditorState.isUnderline,
38
+ isSuperscript = _useEditorState.isSuperscript,
39
+ isSubscript = _useEditorState.isSubscript,
40
+ isLink = _useEditorState.isLink,
41
+ isAiWriting = _useEditorState.isAiWriting,
42
+ isHighlight = _useEditorState.isHighlight;
66
43
  return /*#__PURE__*/React.createElement(Box, {
67
44
  className: "editor-toolbar"
68
45
  }, /*#__PURE__*/React.createElement(Stack, {
@@ -107,11 +84,12 @@ var EditorToolbar = function EditorToolbar(_ref) {
107
84
  }
108
85
  }),
109
86
  onClick: function onClick() {
110
- return editor.chain().focus().setAiWriting(!active.aiWriting).run();
87
+ return editor.chain().focus().setAiWriting(!isAiWriting).run();
111
88
  },
112
- className: active.aiWriting ? 'tool-active' : ''
89
+ className: isAiWriting ? 'tool-active' : ''
113
90
  }), /*#__PURE__*/React.createElement(EditorInsert, {
114
- editor: editor
91
+ editor: editor,
92
+ isMarkdown: isMarkdown
115
93
  }), /*#__PURE__*/React.createElement(Divider, {
116
94
  orientation: "vertical",
117
95
  flexItem: true,
@@ -131,7 +109,7 @@ var EditorToolbar = function EditorToolbar(_ref) {
131
109
  onClick: function onClick() {
132
110
  return editor.chain().focus().undo().run();
133
111
  },
134
- disabled: !active.undo
112
+ disabled: !isUndo
135
113
  }), /*#__PURE__*/React.createElement(ToolbarItem, {
136
114
  tip: '重做',
137
115
  shortcutKey: ['ctrl', 'Y'],
@@ -143,7 +121,7 @@ var EditorToolbar = function EditorToolbar(_ref) {
143
121
  onClick: function onClick() {
144
122
  return editor.chain().focus().redo().run();
145
123
  },
146
- disabled: !active.redo
124
+ disabled: !isRedo
147
125
  }), /*#__PURE__*/React.createElement(ToolbarItem, {
148
126
  tip: '清除格式',
149
127
  icon: /*#__PURE__*/React.createElement(EraserLineIcon, {
@@ -151,7 +129,7 @@ var EditorToolbar = function EditorToolbar(_ref) {
151
129
  fontSize: '1rem'
152
130
  }
153
131
  }),
154
- disabled: !active.format,
132
+ disabled: !isFormat,
155
133
  onClick: function onClick() {
156
134
  return editor.chain().focus().unsetAllMarks().run();
157
135
  }
@@ -186,7 +164,7 @@ var EditorToolbar = function EditorToolbar(_ref) {
186
164
  onClick: function onClick() {
187
165
  return editor.chain().focus().toggleBold().run();
188
166
  },
189
- className: active.bold ? 'tool-active' : ''
167
+ className: isBold ? 'tool-active' : ''
190
168
  }), /*#__PURE__*/React.createElement(ToolbarItem, {
191
169
  tip: '斜体',
192
170
  shortcutKey: ['ctrl', 'I'],
@@ -198,7 +176,7 @@ var EditorToolbar = function EditorToolbar(_ref) {
198
176
  onClick: function onClick() {
199
177
  return editor.chain().focus().toggleItalic().run();
200
178
  },
201
- className: active.italic ? 'tool-active' : ''
179
+ className: isItalic ? 'tool-active' : ''
202
180
  }), /*#__PURE__*/React.createElement(ToolbarItem, {
203
181
  tip: '删除线',
204
182
  shortcutKey: ['ctrl', 'shift', 'S'],
@@ -210,7 +188,7 @@ var EditorToolbar = function EditorToolbar(_ref) {
210
188
  onClick: function onClick() {
211
189
  return editor.chain().focus().toggleStrike().run();
212
190
  },
213
- className: active.strike ? 'tool-active' : ''
191
+ className: isStrike ? 'tool-active' : ''
214
192
  }), /*#__PURE__*/React.createElement(ToolbarItem, {
215
193
  tip: '下划线',
216
194
  shortcutKey: ['ctrl', 'U'],
@@ -222,7 +200,7 @@ var EditorToolbar = function EditorToolbar(_ref) {
222
200
  onClick: function onClick() {
223
201
  return editor.chain().focus().toggleUnderline().run();
224
202
  },
225
- className: active.underline ? 'tool-active' : ''
203
+ className: isUnderline ? 'tool-active' : ''
226
204
  }), /*#__PURE__*/React.createElement(ToolbarItem, {
227
205
  tip: '高亮',
228
206
  shortcutKey: ['ctrl', 'shift', 'H'],
@@ -234,7 +212,7 @@ var EditorToolbar = function EditorToolbar(_ref) {
234
212
  onClick: function onClick() {
235
213
  return editor.chain().focus().toggleHighlight().run();
236
214
  },
237
- className: active.highlight ? 'tool-active' : ''
215
+ className: isHighlight ? 'tool-active' : ''
238
216
  }), /*#__PURE__*/React.createElement(ToolbarItem, {
239
217
  tip: '上标',
240
218
  shortcutKey: ['ctrl', '.'],
@@ -246,7 +224,7 @@ var EditorToolbar = function EditorToolbar(_ref) {
246
224
  onClick: function onClick() {
247
225
  return editor.chain().focus().toggleSuperscript().run();
248
226
  },
249
- className: active.superscript ? 'tool-active' : ''
227
+ className: isSuperscript ? 'tool-active' : ''
250
228
  }), /*#__PURE__*/React.createElement(ToolbarItem, {
251
229
  tip: '下标',
252
230
  shortcutKey: ['ctrl', ','],
@@ -258,7 +236,7 @@ var EditorToolbar = function EditorToolbar(_ref) {
258
236
  onClick: function onClick() {
259
237
  return editor.chain().focus().toggleSubscript().run();
260
238
  },
261
- className: active.subscript ? 'tool-active' : ''
239
+ className: isSubscript ? 'tool-active' : ''
262
240
  }), /*#__PURE__*/React.createElement(EditorFontColor, {
263
241
  editor: editor
264
242
  }), /*#__PURE__*/React.createElement(EditorFontBgColor, {
@@ -291,7 +269,7 @@ var EditorToolbar = function EditorToolbar(_ref) {
291
269
  title: text
292
270
  }).run();
293
271
  },
294
- className: active.link ? 'tool-active' : ''
272
+ className: isLink ? 'tool-active' : ''
295
273
  }), /*#__PURE__*/React.createElement(EditorAlignSelect, {
296
274
  editor: editor
297
275
  }), /*#__PURE__*/React.createElement(EditorVerticalAlignSelect, {
@@ -1,6 +1,6 @@
1
- import { BoldIcon, CodeLineIcon, EraserLineIcon, ItalicIcon, LinkIcon, MarkPenLineIcon, StrikethroughIcon, UnderlineIcon } from "../Icons";
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';
@@ -48,7 +48,7 @@ var CustomBubbleMenu = function CustomBubbleMenu(_ref) {
48
48
  isUnderline: ctx.editor.isActive('underline'),
49
49
  isCode: ctx.editor.isActive('code'),
50
50
  isHighlight: ctx.editor.isActive('highlight'),
51
- hasAnyMarks: ctx.editor.state.selection.empty ? ctx.editor.state.selection.$from.marks().length > 0 : hasMarksInSelection(ctx.editor.state)
51
+ hasAnyMarks: hasMarksInSelection(ctx.editor.state)
52
52
  // isSuperscript: ctx.editor.isActive('superscript'),
53
53
  // isSubscript: ctx.editor.isActive('subscript'),
54
54
  };
@@ -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 _useState = useState(true),
101
- _useState2 = _slicedToArray(_useState, 2),
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
- _useState4 = _slicedToArray(_useState3, 2),
110
- current = _useState4[0],
111
- setCurrent = _useState4[1];
112
- var _useState5 = useState({
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
- resources = _useState6[0],
120
- setResources = _useState6[1];
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(showFormat ? [{
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, selected, attrs, editor }: InsertLinkProps) => React.JSX.Element;
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
- }, "\u63D2\u5165\u94FE\u63A5")))));
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;
@@ -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 limit = _ref.limit,
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 (!(exclude !== null && exclude !== void 0 && exclude.includes('emoji'))) {
120
- var Emoji = EmojiExtension;
121
- defaultExtensions.push(Emoji);
122
- }
123
- if (!(exclude !== null && exclude !== void 0 && exclude.includes('mention')) && (mentionItems && mentionItems.length > 0 || onMentionFilter)) {
124
- var Mention = MentionExtension({
125
- mentionItems: mentionItems,
126
- onMentionFilter: onMentionFilter
127
- });
128
- defaultExtensions.push(Mention);
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('youtube'))) {
131
- var Youtube = YoutubeExtension(youtube);
132
- defaultExtensions.push(Youtube);
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, "key" | "editor">, any>;
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 {
@@ -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;
@@ -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
- }, options), {}, {
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
- if (options.onCreate) {
72
- options.onCreate({
73
- editor: currentEditor
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
  };
@@ -84,7 +84,9 @@ export type MentionExtensionProps = {
84
84
  query: string;
85
85
  }) => Promise<MentionItems>;
86
86
  };
87
+ export type ModeType = 'rich-text' | 'markdown' | 'diff';
87
88
  export type ExtensionRelativeProps = MentionExtensionProps & EditorFnProps & {
89
+ contentType?: ModeType;
88
90
  limit?: number | null;
89
91
  exclude?: string[];
90
92
  extensions?: Extension[];
@@ -97,10 +99,10 @@ export type UseTiptapProps = {
97
99
  export type GetExtensionsProps = ExtensionRelativeProps;
98
100
  export type UseTiptapReturn = {
99
101
  editor: Editor;
102
+ getMarkdown: () => string;
100
103
  getText: () => string;
101
104
  getHTML: () => string;
102
105
  getJSON: () => any;
103
- getMarkdownByJSON: () => string;
104
106
  };
105
107
  export interface SlashCommandItem {
106
108
  title: string;
@@ -16,6 +16,9 @@ export var insertNodeAfterPosition = function insertNodeAfterPosition(editor, po
16
16
  editor.chain().focus().insertContentAt(pos, nodeContent).run();
17
17
  };
18
18
  export var hasMarksInSelection = function hasMarksInSelection(state) {
19
+ if (state.selection.empty) {
20
+ return false;
21
+ }
19
22
  var _state$selection = state.selection,
20
23
  from = _state$selection.from,
21
24
  to = _state$selection.to;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctzhian/tiptap",
3
- "version": "1.7.5-beta.2",
3
+ "version": "1.8.0",
4
4
  "description": "基于 Tiptap 二次开发的编辑器组件",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",