@ctzhian/tiptap 1.6.21 → 1.6.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -102,7 +102,7 @@ var Reader = function Reader() {
102
102
  }
103
103
  return onUpload;
104
104
  }(),
105
- content: "<p>Hello Tiptap</p><p></p>"
105
+ content: ""
106
106
  }),
107
107
  editor = _useTiptap.editor;
108
108
  return /*#__PURE__*/React.createElement(EditorThemeProvider, {
@@ -1,5 +1,6 @@
1
1
  import { EditorContent } from '@tiptap/react';
2
2
  import React from 'react';
3
+ import { PhotoProvider } from 'react-photo-view';
3
4
  import SelectionText from "../component/CustomBubbleMenu/SelectionText";
4
5
  import CustomDragHandle from "../component/CustomDragHandle";
5
6
  var Editor = function Editor(_ref) {
@@ -7,7 +8,49 @@ var Editor = function Editor(_ref) {
7
8
  menuInDragHandle = _ref.menuInDragHandle,
8
9
  menuInBubbleMenu = _ref.menuInBubbleMenu,
9
10
  onTip = _ref.onTip;
10
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SelectionText, {
11
+ return /*#__PURE__*/React.createElement(PhotoProvider, {
12
+ speed: function speed() {
13
+ return 500;
14
+ },
15
+ maskOpacity: 0.3,
16
+ toolbarRender: function toolbarRender(_ref2) {
17
+ var onScale = _ref2.onScale,
18
+ scale = _ref2.scale,
19
+ rotate = _ref2.rotate,
20
+ onRotate = _ref2.onRotate;
21
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("svg", {
22
+ width: "44",
23
+ height: "44",
24
+ viewBox: "0 0 768 768",
25
+ className: "PhotoView-Slider__toolbarIcon",
26
+ onClick: function onClick() {
27
+ return onScale(scale + 1);
28
+ }
29
+ }, /*#__PURE__*/React.createElement("path", {
30
+ d: "M384 640.5q105 0 180.75-75.75t75.75-180.75-75.75-180.75-180.75-75.75-180.75 75.75-75.75 180.75 75.75 180.75 180.75 75.75zM384 64.5q132 0 225.75 93.75t93.75 225.75-93.75 225.75-225.75 93.75-225.75-93.75-93.75-225.75 93.75-225.75 225.75-93.75zM415.5 223.5v129h129v63h-129v129h-63v-129h-129v-63h129v-129h63z"
31
+ })), /*#__PURE__*/React.createElement("svg", {
32
+ width: "44",
33
+ height: "44",
34
+ viewBox: "0 0 768 768",
35
+ className: "PhotoView-Slider__toolbarIcon",
36
+ onClick: function onClick() {
37
+ return onScale(scale - 1);
38
+ }
39
+ }, /*#__PURE__*/React.createElement("path", {
40
+ d: "M384 640.5q105 0 180.75-75.75t75.75-180.75-75.75-180.75-180.75-75.75-180.75 75.75-75.75 180.75 75.75 180.75 180.75 75.75zM384 64.5q132 0 225.75 93.75t93.75 225.75-93.75 225.75-225.75 93.75-225.75-93.75-93.75-225.75 93.75-225.75 225.75-93.75zM223.5 352.5h321v63h-321v-63z"
41
+ })), /*#__PURE__*/React.createElement("svg", {
42
+ width: "44",
43
+ height: "44",
44
+ viewBox: "0 0 768 768",
45
+ className: "PhotoView-Slider__toolbarIcon",
46
+ onClick: function onClick() {
47
+ return onRotate(rotate + 90);
48
+ }
49
+ }, /*#__PURE__*/React.createElement("path", {
50
+ d: "M565.5 202.5l75-75v225h-225l103.5-103.5c-34.5-34.5-82.5-57-135-57-106.5 0-192 85.5-192 192s85.5 192 192 192c84 0 156-52.5 181.5-127.5h66c-28.5 111-127.5 192-247.5 192-141 0-255-115.5-255-256.5s114-256.5 255-256.5c70.5 0 135 28.5 181.5 75z"
51
+ })));
52
+ }
53
+ }, /*#__PURE__*/React.createElement(SelectionText, {
11
54
  editor: editor,
12
55
  more: menuInBubbleMenu
13
56
  }), /*#__PURE__*/React.createElement(CustomDragHandle, {
@@ -1,5 +1,6 @@
1
1
  import { EditorContent } from "@tiptap/react";
2
2
  import React, { useEffect } from "react";
3
+ import { PhotoProvider } from "react-photo-view";
3
4
  import useTiptap from "../hook";
4
5
  var EditorDiff = function EditorDiff(_ref) {
5
6
  var oldHtml = _ref.oldHtml,
@@ -17,8 +18,50 @@ var EditorDiff = function EditorDiff(_ref) {
17
18
  (_editorRef$editor = editorRef.editor) === null || _editorRef$editor === void 0 || (_editorRef$editor$com = (_editorRef$editor$com2 = _editorRef$editor.commands).hideStructuredDiff) === null || _editorRef$editor$com === void 0 || _editorRef$editor$com.call(_editorRef$editor$com2);
18
19
  };
19
20
  }, [oldHtml, newHtml, editorRef.editor]);
20
- return /*#__PURE__*/React.createElement(EditorContent, {
21
+ return /*#__PURE__*/React.createElement(PhotoProvider, {
22
+ speed: function speed() {
23
+ return 500;
24
+ },
25
+ maskOpacity: 0.3,
26
+ toolbarRender: function toolbarRender(_ref2) {
27
+ var onScale = _ref2.onScale,
28
+ scale = _ref2.scale,
29
+ rotate = _ref2.rotate,
30
+ onRotate = _ref2.onRotate;
31
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("svg", {
32
+ width: "44",
33
+ height: "44",
34
+ viewBox: "0 0 768 768",
35
+ className: "PhotoView-Slider__toolbarIcon",
36
+ onClick: function onClick() {
37
+ return onScale(scale + 1);
38
+ }
39
+ }, /*#__PURE__*/React.createElement("path", {
40
+ d: "M384 640.5q105 0 180.75-75.75t75.75-180.75-75.75-180.75-180.75-75.75-180.75 75.75-75.75 180.75 75.75 180.75 180.75 75.75zM384 64.5q132 0 225.75 93.75t93.75 225.75-93.75 225.75-225.75 93.75-225.75-93.75-93.75-225.75 93.75-225.75 225.75-93.75zM415.5 223.5v129h129v63h-129v129h-63v-129h-129v-63h129v-129h63z"
41
+ })), /*#__PURE__*/React.createElement("svg", {
42
+ width: "44",
43
+ height: "44",
44
+ viewBox: "0 0 768 768",
45
+ className: "PhotoView-Slider__toolbarIcon",
46
+ onClick: function onClick() {
47
+ return onScale(scale - 1);
48
+ }
49
+ }, /*#__PURE__*/React.createElement("path", {
50
+ d: "M384 640.5q105 0 180.75-75.75t75.75-180.75-75.75-180.75-180.75-75.75-180.75 75.75-75.75 180.75 75.75 180.75 180.75 75.75zM384 64.5q132 0 225.75 93.75t93.75 225.75-93.75 225.75-225.75 93.75-225.75-93.75-93.75-225.75 93.75-225.75 225.75-93.75zM223.5 352.5h321v63h-321v-63z"
51
+ })), /*#__PURE__*/React.createElement("svg", {
52
+ width: "44",
53
+ height: "44",
54
+ viewBox: "0 0 768 768",
55
+ className: "PhotoView-Slider__toolbarIcon",
56
+ onClick: function onClick() {
57
+ return onRotate(rotate + 90);
58
+ }
59
+ }, /*#__PURE__*/React.createElement("path", {
60
+ d: "M565.5 202.5l75-75v225h-225l103.5-103.5c-34.5-34.5-82.5-57-135-57-106.5 0-192 85.5-192 192s85.5 192 192 192c84 0 156-52.5 181.5-127.5h66c-28.5 111-127.5 192-247.5 192-141 0-255-115.5-255-256.5s114-256.5 255-256.5c70.5 0 135 28.5 181.5 75z"
61
+ })));
62
+ }
63
+ }, /*#__PURE__*/React.createElement(EditorContent, {
21
64
  editor: editorRef.editor
22
- });
65
+ }));
23
66
  };
24
67
  export default EditorDiff;
@@ -101,7 +101,10 @@ var AlertView = function AlertView(_ref) {
101
101
  }
102
102
  }, variantData.icon), /*#__PURE__*/React.createElement(Box, {
103
103
  sx: {
104
- flex: 1
104
+ flex: 1,
105
+ 'code': {
106
+ bgcolor: attrs.variant === 'default' ? '' : "color-mix(in srgb, ".concat(variantData.color, " 20%, transparent) !important")
107
+ }
105
108
  }
106
109
  }, /*#__PURE__*/React.createElement(NodeViewContent, {
107
110
  as: 'div'
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { ImageAttributes } from ".";
3
2
  import 'react-photo-view/dist/react-photo-view.css';
3
+ import { ImageAttributes } from ".";
4
4
  interface ReadonlyImageProps {
5
5
  attrs: ImageAttributes;
6
6
  }
@@ -1,8 +1,7 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
1
  import { Box } from "@mui/material";
3
2
  import { NodeViewWrapper } from "@tiptap/react";
4
3
  import React from "react";
5
- import { PhotoProvider, PhotoView } from "react-photo-view";
4
+ import { PhotoView } from "react-photo-view";
6
5
  import 'react-photo-view/dist/react-photo-view.css';
7
6
  var ReadonlyImage = function ReadonlyImage(_ref) {
8
7
  var attrs = _ref.attrs;
@@ -16,24 +15,10 @@ var ReadonlyImage = function ReadonlyImage(_ref) {
16
15
  border: '1px solid',
17
16
  borderColor: 'divider',
18
17
  borderRadius: 'var(--mui-shape-borderRadius)',
19
- p: '0.25rem',
20
- '&:hover .image-controls': {
21
- opacity: 1
22
- }
23
- }
24
- }, /*#__PURE__*/React.createElement(PhotoProvider, null, /*#__PURE__*/React.createElement(PhotoView, {
25
- render: function render(props) {
26
- return /*#__PURE__*/React.createElement("img", _extends({}, props.attrs, {
27
- src: attrs.src,
28
- style: {
29
- transformOrigin: '0 0',
30
- transform: 'translate(-50%, -50%)',
31
- backgroundColor: 'hsl(0, 0%, 90%)',
32
- maxWidth: '100%',
33
- maxHeight: '90%'
34
- }
35
- }));
18
+ p: '0.25rem'
36
19
  }
20
+ }, /*#__PURE__*/React.createElement(PhotoView, {
21
+ src: attrs.src
37
22
  }, /*#__PURE__*/React.createElement("img", {
38
23
  src: attrs.src,
39
24
  width: attrs.width,
@@ -45,6 +30,6 @@ var ReadonlyImage = function ReadonlyImage(_ref) {
45
30
  onError: function onError(e) {
46
31
  console.error('Image load error:', e);
47
32
  }
48
- })))));
33
+ }))));
49
34
  };
50
35
  export default ReadonlyImage;
@@ -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,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>;
@@ -1,5 +1,5 @@
1
1
  import { Extension } from '@tiptap/core';
2
2
  export declare const TableExtension: ({ editable }: {
3
3
  editable: boolean;
4
- }) => (import("@tiptap/core").Node<import("@tiptap/extension-table").TableOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-table").TableHeaderOptions, any> | Extension<any, any>)[];
4
+ }) => (Extension<any, any> | import("@tiptap/core").Node<import("@tiptap/extension-table").TableOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-table").TableHeaderOptions, any>)[];
5
5
  export default TableExtension;
package/dist/index.css CHANGED
@@ -392,42 +392,28 @@
392
392
  text-align: left;
393
393
  }
394
394
 
395
- /* 表格数据单元格样式 */
396
395
  .tiptap.ProseMirror table td {
397
396
  background-color: var(--mui-palette-background-default);
398
397
  }
399
398
 
400
- /* 表格悬停时显示所有列边框 - 只在编辑模式下生效 */
401
- .tiptap.ProseMirror[contenteditable="true"] table {
399
+ .tiptap.ProseMirror table {
402
400
  border-left: 1px dotted var(--mui-palette-divider);
403
401
  border-right: 1px dotted var(--mui-palette-divider);
404
402
  }
405
403
 
406
- .tiptap.ProseMirror[contenteditable="true"] table td,
407
- .tiptap.ProseMirror[contenteditable="true"] table th {
404
+ .tiptap.ProseMirror table td,
405
+ .tiptap.ProseMirror table th {
408
406
  border-right-color: var(--mui-palette-divider);
409
407
  border-right-style: dotted;
410
408
  }
411
409
 
412
- .tiptap.ProseMirror[contenteditable="true"] table td:last-child,
413
- .tiptap.ProseMirror[contenteditable="true"] table th:last-child {
410
+ .tiptap.ProseMirror table td:last-child,
411
+ .tiptap.ProseMirror table th:last-child {
414
412
  border-right-color: transparent;
415
413
  }
416
414
 
417
- .tiptap.ProseMirror[contenteditable="false"] table {
418
- border-left: 1px dotted var(--mui-palette-divider);
419
- border-right: 1px dotted var(--mui-palette-divider);
420
- }
421
-
422
- .tiptap.ProseMirror[contenteditable="false"] table td,
423
- .tiptap.ProseMirror[contenteditable="false"] table th {
424
- border-right-color: var(--mui-palette-divider);
425
- border-right-style: dotted;
426
- }
427
-
428
- .tiptap.ProseMirror[contenteditable="false"] table td:last-child,
429
- .tiptap.ProseMirror[contenteditable="false"] table th:last-child {
430
- border-right-color: transparent;
415
+ .tiptap.ProseMirror[contenteditable="true"] table .selectedCell {
416
+ pointer-events: none;
431
417
  }
432
418
 
433
419
  /* 表格选择状态 */
@@ -441,19 +427,8 @@
441
427
  pointer-events: none;
442
428
  position: absolute;
443
429
  z-index: 2;
444
- /* border-radius: 4px; */
445
- /* border: 2px solid var(--mui-palette-primary-main); */
446
- }
447
-
448
- .tiptap.ProseMirror[contenteditable="true"] table .selectedCell {
449
- background-color: color-mix(in srgb, var(--mui-palette-primary-main) 5%, transparent) !important;
450
430
  }
451
431
 
452
- /* 选中单元格的边框样式 - 只改变最外圈边框颜色 */
453
- /* .tiptap.ProseMirror[contenteditable="true"] table .selectedCell {
454
- border-color: var(--mui-palette-primary-main) !important;
455
- } */
456
-
457
432
  /* 表格列调整手柄 */
458
433
  .tiptap.ProseMirror[contenteditable="true"] table .column-resize-handle {
459
434
  background-color: transparent;
@@ -521,17 +496,6 @@
521
496
  }
522
497
  }
523
498
 
524
- .PhotoView-Slider__Backdrop {
525
- background: rgba(33, 34, 45, 0.3) !important;
526
- backdrop-filter: blur(5px);
527
- transition: none !important;
528
- animation-duration: none !important;
529
- }
530
-
531
- .PhotoView-Slider__BannerWrap {
532
- background-color: rgba(33, 34, 45, 0.2) !important;
533
- }
534
-
535
499
  .slash-decoration[data-decoration-content].is-empty {
536
500
  padding: 4px 8px;
537
501
  background-color: var(--mui-palette-background-paper2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctzhian/tiptap",
3
- "version": "1.6.21",
3
+ "version": "1.6.23",
4
4
  "description": "基于 Tiptap 二次开发的编辑器组件",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -81,36 +81,36 @@
81
81
  },
82
82
  "dependencies": {
83
83
  "@floating-ui/dom": "^1.7.2",
84
- "@tiptap/core": "^3.5.3",
85
- "@tiptap/extension-bubble-menu": "^3.5.3",
86
- "@tiptap/extension-code": "^3.5.3",
87
- "@tiptap/extension-code-block-lowlight": "^3.5.3",
88
- "@tiptap/extension-details": "^3.5.3",
89
- "@tiptap/extension-drag-handle-react": "^3.5.3",
90
- "@tiptap/extension-emoji": "^3.5.3",
91
- "@tiptap/extension-file-handler": "^3.5.3",
92
- "@tiptap/extension-highlight": "^3.5.3",
93
- "@tiptap/extension-image": "^3.5.3",
94
- "@tiptap/extension-invisible-characters": "^3.5.3",
95
- "@tiptap/extension-link": "^3.5.3",
96
- "@tiptap/extension-list": "^3.5.3",
97
- "@tiptap/extension-mathematics": "^3.5.3",
98
- "@tiptap/extension-mention": "^3.5.3",
99
- "@tiptap/extension-subscript": "^3.5.3",
100
- "@tiptap/extension-superscript": "^3.5.3",
101
- "@tiptap/extension-table": "^3.5.3",
102
- "@tiptap/extension-table-of-contents": "^3.5.3",
103
- "@tiptap/extension-text-align": "^3.5.3",
104
- "@tiptap/extension-text-style": "^3.5.3",
105
- "@tiptap/extension-unique-id": "^3.5.3",
106
- "@tiptap/extension-youtube": "^3.5.3",
107
- "@tiptap/extensions": "^3.5.3",
108
- "@tiptap/html": "^3.5.3",
109
- "@tiptap/pm": "^3.5.3",
110
- "@tiptap/react": "^3.5.3",
111
- "@tiptap/starter-kit": "^3.5.3",
112
- "@tiptap/static-renderer": "^3.5.3",
113
- "@tiptap/suggestion": "^3.5.3",
84
+ "@tiptap/core": "3.5.3",
85
+ "@tiptap/extension-bubble-menu": "3.5.3",
86
+ "@tiptap/extension-code": "3.5.3",
87
+ "@tiptap/extension-code-block-lowlight": "3.5.3",
88
+ "@tiptap/extension-details": "3.5.3",
89
+ "@tiptap/extension-drag-handle-react": "3.5.3",
90
+ "@tiptap/extension-emoji": "3.5.3",
91
+ "@tiptap/extension-file-handler": "3.5.3",
92
+ "@tiptap/extension-highlight": "3.5.3",
93
+ "@tiptap/extension-image": "3.5.3",
94
+ "@tiptap/extension-invisible-characters": "3.5.3",
95
+ "@tiptap/extension-link": "3.5.3",
96
+ "@tiptap/extension-list": "3.5.3",
97
+ "@tiptap/extension-mathematics": "3.5.3",
98
+ "@tiptap/extension-mention": "3.5.3",
99
+ "@tiptap/extension-subscript": "3.5.3",
100
+ "@tiptap/extension-superscript": "3.5.3",
101
+ "@tiptap/extension-table": "3.5.3",
102
+ "@tiptap/extension-table-of-contents": "3.5.3",
103
+ "@tiptap/extension-text-align": "3.5.3",
104
+ "@tiptap/extension-text-style": "3.5.3",
105
+ "@tiptap/extension-unique-id": "3.5.3",
106
+ "@tiptap/extension-youtube": "3.5.3",
107
+ "@tiptap/extensions": "3.5.3",
108
+ "@tiptap/html": "3.5.3",
109
+ "@tiptap/pm": "3.5.3",
110
+ "@tiptap/react": "3.5.3",
111
+ "@tiptap/starter-kit": "3.5.3",
112
+ "@tiptap/static-renderer": "3.5.3",
113
+ "@tiptap/suggestion": "3.5.3",
114
114
  "diff-match-patch": "^1.0.5",
115
115
  "highlight.js": "^11.11.1",
116
116
  "jszip": "^3.10.1",