@ctzhian/tiptap 2.0.0 → 2.1.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.
- package/dist/Editor/demo.js +133 -123
- package/dist/EditorToolbar/index.js +11 -9
- package/dist/asset/css/index.css +5 -7
- package/dist/component/ActionDropdown/index.d.ts +5 -0
- package/dist/component/ActionDropdown/index.js +8 -3
- package/dist/component/FloatingPopover/index.d.ts +2 -2
- package/dist/component/HoverPopover/index.d.ts +2 -0
- package/dist/component/HoverPopover/index.js +22 -3
- package/dist/component/Icons/{expand-horizontal-line.js → expand-horizontal-line-icon.js} +1 -1
- package/dist/component/Icons/index.d.ts +3 -2
- package/dist/component/Icons/index.js +4 -3
- package/dist/extension/component/Alert/index.js +141 -137
- package/dist/extension/component/Flow/Edit.d.ts +1 -1
- package/dist/extension/component/Flow/Edit.js +3 -31
- package/dist/extension/component/Flow/index.js +20 -19
- package/dist/extension/component/Image/index.d.ts +1 -0
- package/dist/extension/component/Image/index.js +16 -2
- package/dist/extension/component/Link/index.js +1 -1
- package/dist/extension/component/TableCellHandleMenu/index.js +60 -3
- package/dist/extension/component/TableHandle/TableHandleMenu.js +1 -1
- package/dist/extension/component/TableSelectionOverlay/index.js +4 -12
- package/dist/extension/component/UploadProgress/index.d.ts +1 -1
- package/dist/extension/component/Video/Insert.js +4 -2
- package/dist/extension/component/Video/Readonly.js +4 -11
- package/dist/extension/component/Video/index.d.ts +2 -1
- package/dist/extension/component/Video/index.js +447 -65
- package/dist/extension/extension/ImeComposition.d.ts +2 -0
- package/dist/extension/extension/ImeComposition.js +145 -0
- package/dist/extension/extension/index.d.ts +1 -0
- package/dist/extension/extension/index.js +1 -0
- package/dist/extension/index.js +2 -2
- package/dist/extension/node/Flow/index.d.ts +0 -3
- package/dist/extension/node/Flow/index.js +7 -4
- package/dist/extension/node/Link/index.js +4 -3
- package/dist/extension/node/Table.js +18 -82
- package/dist/extension/node/TableOfContents/index.d.ts +5 -3
- package/dist/extension/node/TableOfContents/index.js +22 -2
- package/dist/extension/node/Video.d.ts +1 -0
- package/dist/extension/node/Video.js +38 -6
- package/dist/hook/index.js +1 -1
- package/dist/index.css +16 -19
- package/dist/util/index.d.ts +9 -0
- package/dist/util/index.js +26 -0
- package/package.json +1 -1
- /package/dist/component/Icons/{expand-horizontal-line.d.ts → expand-horizontal-line-icon.d.ts} +0 -0
|
@@ -34,6 +34,7 @@ var getCellAtCoordinates = function getCellAtCoordinates(state, view, x, y) {
|
|
|
34
34
|
return cellAround($pos);
|
|
35
35
|
};
|
|
36
36
|
var getSelectionBoundingRect = function getSelectionBoundingRect(view, selection) {
|
|
37
|
+
if (!(selection instanceof CellSelection)) return null;
|
|
37
38
|
var cells = [];
|
|
38
39
|
selection.forEachCell(function (_node, pos) {
|
|
39
40
|
var dom = view.nodeDOM(pos);
|
|
@@ -242,8 +243,7 @@ export var TableSelectionOverlay = function TableSelectionOverlay(_ref2) {
|
|
|
242
243
|
var activeHandleRef = useRef(null);
|
|
243
244
|
var containerRef = useRef(null);
|
|
244
245
|
var _useFloating = useFloating({
|
|
245
|
-
placement: 'top-start'
|
|
246
|
-
strategy: 'absolute'
|
|
246
|
+
placement: 'top-start'
|
|
247
247
|
}),
|
|
248
248
|
refs = _useFloating.refs,
|
|
249
249
|
floatingStyles = _useFloating.floatingStyles,
|
|
@@ -384,14 +384,7 @@ export var TableSelectionOverlay = function TableSelectionOverlay(_ref2) {
|
|
|
384
384
|
}, [editor, updateSelectionRect, updateTableDom]);
|
|
385
385
|
useEffect(function () {
|
|
386
386
|
var c = tableDom === null || tableDom === void 0 ? void 0 : tableDom.querySelector('.table-selection-overlay-container');
|
|
387
|
-
|
|
388
|
-
// Try to find .table-controls as fallback
|
|
389
|
-
var wrapper = tableDom === null || tableDom === void 0 ? void 0 : tableDom.closest('.tableWrapper');
|
|
390
|
-
var controls = wrapper === null || wrapper === void 0 ? void 0 : wrapper.querySelector('.table-controls');
|
|
391
|
-
containerRef.current = controls !== null && controls !== void 0 ? controls : null;
|
|
392
|
-
} else {
|
|
393
|
-
containerRef.current = c;
|
|
394
|
-
}
|
|
387
|
+
containerRef.current = c !== null && c !== void 0 ? c : null;
|
|
395
388
|
}, [tableDom]);
|
|
396
389
|
if (!isVisible || !selectionRect) {
|
|
397
390
|
return null;
|
|
@@ -412,9 +405,8 @@ export var TableSelectionOverlay = function TableSelectionOverlay(_ref2) {
|
|
|
412
405
|
onResizeStart: createResizeHandler
|
|
413
406
|
}));
|
|
414
407
|
};
|
|
415
|
-
var rootElement = containerRef.current || document.body;
|
|
416
408
|
return /*#__PURE__*/React.createElement(FloatingPortal, {
|
|
417
|
-
root:
|
|
409
|
+
root: containerRef.current
|
|
418
410
|
}, /*#__PURE__*/React.createElement("div", {
|
|
419
411
|
ref: refs.setFloating,
|
|
420
412
|
style: _objectSpread(_objectSpread({}, floatingStyles), {}, {
|
|
@@ -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;
|
|
@@ -85,7 +85,8 @@ var InsertVideo = function InsertVideo(_ref) {
|
|
|
85
85
|
autoplay: attrs.autoplay,
|
|
86
86
|
loop: attrs.loop,
|
|
87
87
|
muted: attrs.muted,
|
|
88
|
-
poster: attrs.poster
|
|
88
|
+
poster: attrs.poster,
|
|
89
|
+
align: attrs.align
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
92
|
_context.next = 15;
|
|
@@ -139,7 +140,8 @@ var InsertVideo = function InsertVideo(_ref) {
|
|
|
139
140
|
autoplay: attrs.autoplay,
|
|
140
141
|
loop: attrs.loop,
|
|
141
142
|
muted: attrs.muted,
|
|
142
|
-
poster: attrs.poster
|
|
143
|
+
poster: attrs.poster,
|
|
144
|
+
align: attrs.align
|
|
143
145
|
});
|
|
144
146
|
handleClosePopover();
|
|
145
147
|
_context2.next = 15;
|
|
@@ -8,15 +8,7 @@ var ReadonlyVideo = function ReadonlyVideo(_ref) {
|
|
|
8
8
|
className: "video-wrapper"
|
|
9
9
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
10
10
|
sx: {
|
|
11
|
-
|
|
12
|
-
display: 'inline-block',
|
|
13
|
-
border: '1px solid',
|
|
14
|
-
borderColor: 'divider',
|
|
15
|
-
borderRadius: 'var(--mui-shape-borderRadius)',
|
|
16
|
-
p: '0.25rem',
|
|
17
|
-
'&:hover .video-controls': {
|
|
18
|
-
opacity: 1
|
|
19
|
-
}
|
|
11
|
+
textAlign: attrs.align || undefined
|
|
20
12
|
}
|
|
21
13
|
}, /*#__PURE__*/React.createElement("video", {
|
|
22
14
|
src: attrs.src,
|
|
@@ -25,11 +17,12 @@ var ReadonlyVideo = function ReadonlyVideo(_ref) {
|
|
|
25
17
|
autoPlay: attrs.autoplay,
|
|
26
18
|
loop: attrs.loop,
|
|
27
19
|
muted: attrs.muted,
|
|
28
|
-
width: attrs.width,
|
|
20
|
+
width: attrs.width || undefined,
|
|
29
21
|
style: {
|
|
30
22
|
maxWidth: '100%',
|
|
23
|
+
cursor: 'pointer',
|
|
31
24
|
height: 'auto',
|
|
32
|
-
display: 'block'
|
|
25
|
+
display: 'inline-block'
|
|
33
26
|
},
|
|
34
27
|
onError: function onError(e) {
|
|
35
28
|
_onError === null || _onError === void 0 || _onError(e);
|
|
@@ -3,12 +3,13 @@ import { NodeViewProps } from '@tiptap/react';
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
export interface VideoAttributes {
|
|
5
5
|
src: string;
|
|
6
|
-
width
|
|
6
|
+
width?: number | string | null;
|
|
7
7
|
controls: boolean;
|
|
8
8
|
autoplay: boolean;
|
|
9
9
|
loop: boolean;
|
|
10
10
|
muted: boolean;
|
|
11
11
|
poster: string | null;
|
|
12
|
+
align: 'left' | 'center' | 'right' | null;
|
|
12
13
|
}
|
|
13
14
|
declare const VideoViewWrapper: React.FC<NodeViewProps & EditorFnProps>;
|
|
14
15
|
export default VideoViewWrapper;
|