@ctzhian/tiptap 1.13.8 → 1.13.9

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.
@@ -6,7 +6,7 @@ import { Editor, EditorThemeProvider, EditorToolbar, useTiptap } from "./..";
6
6
  import { Box } from '@mui/material';
7
7
  import React from 'react';
8
8
  import "../index.css";
9
- var defaultContent = "";
9
+ var defaultContent = "#### tiptap \n[tiptap notion patch](https://tiptap.dev/docs/ui-components/templates/notion-like-editor)";
10
10
  var Reader = function Reader() {
11
11
  var handleTocUpdate = function handleTocUpdate(toc) {
12
12
  console.log('toc', toc);
@@ -14,6 +14,7 @@ var Reader = function Reader() {
14
14
  var _useTiptap = useTiptap({
15
15
  editable: true,
16
16
  exclude: ['invisibleCharacters'],
17
+ contentType: 'markdown',
17
18
  onError: function onError(error) {
18
19
  alert(error.message);
19
20
  },
@@ -66,11 +67,8 @@ var Reader = function Reader() {
66
67
  return onValidateUrl;
67
68
  }(),
68
69
  onSave: function onSave(editor) {
69
- var value = editor.getHTML();
70
+ var value = editor.getMarkdown();
70
71
  console.log(value);
71
- editor.chain().focus().setContent(value, {
72
- contentType: 'html'
73
- }).run();
74
72
  },
75
73
  onAiWritingGetSuggestion: function () {
76
74
  var _onAiWritingGetSuggestion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
@@ -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(isMarkdown ? 'text' : attrs.type || 'icon'),
26
+ var _useState5 = useState(attrs.type || 'icon'),
27
27
  _useState6 = _slicedToArray(_useState5, 2),
28
28
  type = _useState6[0],
29
29
  setType = _useState6[1];
@@ -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;
@@ -372,15 +372,15 @@ export var InlineLinkExtension = Node.create({
372
372
  parseMarkdown: function parseMarkdown(token, helpers) {
373
373
  return helpers.createNode('inlineLink', {
374
374
  href: token.href || '',
375
- title: token.title || null,
375
+ title: token.text || '',
376
376
  type: 'icon',
377
377
  target: '_blank'
378
378
  }, [helpers.createTextNode(token.text || '')]);
379
379
  },
380
- renderMarkdown: function renderMarkdown(node, h) {
381
- var _node$attrs;
380
+ renderMarkdown: function renderMarkdown(node) {
381
+ var _node$attrs, _node$attrs2, _node$attrs3;
382
382
  var href = ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.href) || '';
383
- var text = h.renderChildren(node);
383
+ var text = ((_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.title) || ((_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.href) || '';
384
384
  return "[".concat(text, "](").concat(href, ")");
385
385
  },
386
386
  addNodeView: function addNodeView() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctzhian/tiptap",
3
- "version": "1.13.8",
3
+ "version": "1.13.9",
4
4
  "description": "基于 Tiptap 二次开发的编辑器组件",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -81,38 +81,38 @@
81
81
  },
82
82
  "dependencies": {
83
83
  "@floating-ui/dom": "^1.7.2",
84
- "@tiptap/core": "^3.10.7",
85
- "@tiptap/extension-bubble-menu": "^3.10.7",
86
- "@tiptap/extension-code": "^3.10.7",
87
- "@tiptap/extension-code-block-lowlight": "^3.10.7",
88
- "@tiptap/extension-details": "^3.10.7",
89
- "@tiptap/extension-drag-handle-react": "^3.10.7",
90
- "@tiptap/extension-emoji": "^3.10.7",
91
- "@tiptap/extension-file-handler": "^3.10.7",
92
- "@tiptap/extension-highlight": "^3.10.7",
93
- "@tiptap/extension-horizontal-rule": "^3.10.7",
94
- "@tiptap/extension-image": "^3.10.7",
95
- "@tiptap/extension-invisible-characters": "^3.10.7",
96
- "@tiptap/extension-link": "^3.10.7",
97
- "@tiptap/extension-list": "^3.10.7",
98
- "@tiptap/extension-mathematics": "^3.10.7",
99
- "@tiptap/extension-mention": "^3.10.7",
100
- "@tiptap/extension-subscript": "^3.10.7",
101
- "@tiptap/extension-superscript": "^3.10.7",
102
- "@tiptap/extension-table": "^3.10.7",
103
- "@tiptap/extension-table-of-contents": "^3.10.7",
104
- "@tiptap/extension-text-align": "^3.10.7",
105
- "@tiptap/extension-text-style": "^3.10.7",
106
- "@tiptap/extension-unique-id": "^3.10.7",
107
- "@tiptap/extension-youtube": "^3.10.7",
108
- "@tiptap/extensions": "^3.10.7",
109
- "@tiptap/html": "^3.10.7",
110
- "@tiptap/markdown": "^3.10.7",
111
- "@tiptap/pm": "^3.10.7",
112
- "@tiptap/react": "^3.10.7",
113
- "@tiptap/starter-kit": "^3.10.7",
114
- "@tiptap/static-renderer": "^3.10.7",
115
- "@tiptap/suggestion": "^3.10.7",
84
+ "@tiptap/core": "^3.11.0",
85
+ "@tiptap/extension-bubble-menu": "^3.11.0",
86
+ "@tiptap/extension-code": "^3.11.0",
87
+ "@tiptap/extension-code-block-lowlight": "^3.11.0",
88
+ "@tiptap/extension-details": "^3.11.0",
89
+ "@tiptap/extension-drag-handle-react": "^3.11.0",
90
+ "@tiptap/extension-emoji": "^3.11.0",
91
+ "@tiptap/extension-file-handler": "^3.11.0",
92
+ "@tiptap/extension-highlight": "^3.11.0",
93
+ "@tiptap/extension-horizontal-rule": "^3.11.0",
94
+ "@tiptap/extension-image": "^3.11.0",
95
+ "@tiptap/extension-invisible-characters": "^3.11.0",
96
+ "@tiptap/extension-link": "^3.11.0",
97
+ "@tiptap/extension-list": "^3.11.0",
98
+ "@tiptap/extension-mathematics": "^3.11.0",
99
+ "@tiptap/extension-mention": "^3.11.0",
100
+ "@tiptap/extension-subscript": "^3.11.0",
101
+ "@tiptap/extension-superscript": "^3.11.0",
102
+ "@tiptap/extension-table": "^3.11.0",
103
+ "@tiptap/extension-table-of-contents": "^3.11.0",
104
+ "@tiptap/extension-text-align": "^3.11.0",
105
+ "@tiptap/extension-text-style": "^3.11.0",
106
+ "@tiptap/extension-unique-id": "^3.11.0",
107
+ "@tiptap/extension-youtube": "^3.11.0",
108
+ "@tiptap/extensions": "^3.11.0",
109
+ "@tiptap/html": "^3.11.0",
110
+ "@tiptap/markdown": "^3.11.0",
111
+ "@tiptap/pm": "^3.11.0",
112
+ "@tiptap/react": "^3.11.0",
113
+ "@tiptap/starter-kit": "^3.11.0",
114
+ "@tiptap/static-renderer": "^3.11.0",
115
+ "@tiptap/suggestion": "^3.11.0",
116
116
  "ace-builds": "^1.43.4",
117
117
  "core-js": "^3.46.0",
118
118
  "diff-match-patch": "^1.0.5",