@ctzhian/tiptap 1.12.14 → 1.12.16
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/EditorToolbar/index.js +1 -3
- package/dist/asset/css/index.css +1 -10
- package/dist/component/CustomDragHandle/index.js +0 -1
- package/dist/component/Toolbar/EditorInsert/index.d.ts +1 -2
- package/dist/component/Toolbar/EditorInsert/index.js +5 -12
- package/dist/extension/component/Link/Markdown.js +9 -16
- package/dist/extension/index.js +8 -8
- package/dist/extension/node/Attachment.js +13 -6
- package/dist/extension/node/Iframe.js +11 -3
- package/package.json +1 -1
|
@@ -7,7 +7,6 @@ import { hasMarksInSelection } from "../util";
|
|
|
7
7
|
var EditorToolbar = function EditorToolbar(_ref) {
|
|
8
8
|
var editor = _ref.editor,
|
|
9
9
|
menuInToolbarMore = _ref.menuInToolbarMore;
|
|
10
|
-
var isMarkdown = editor.options.contentType === 'markdown';
|
|
11
10
|
var _useEditorState = useEditorState({
|
|
12
11
|
editor: editor,
|
|
13
12
|
selector: function selector(ctx) {
|
|
@@ -88,8 +87,7 @@ var EditorToolbar = function EditorToolbar(_ref) {
|
|
|
88
87
|
},
|
|
89
88
|
className: isAiWriting ? 'tool-active' : ''
|
|
90
89
|
}), /*#__PURE__*/React.createElement(EditorInsert, {
|
|
91
|
-
editor: editor
|
|
92
|
-
isMarkdown: isMarkdown
|
|
90
|
+
editor: editor
|
|
93
91
|
}), /*#__PURE__*/React.createElement(Divider, {
|
|
94
92
|
orientation: "vertical",
|
|
95
93
|
flexItem: true,
|
package/dist/asset/css/index.css
CHANGED
|
@@ -175,15 +175,6 @@
|
|
|
175
175
|
margin: 20px 0;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
/* .tiptap.ProseMirror .mark-link {
|
|
179
|
-
line-height: 22px;
|
|
180
|
-
vertical-align: middle;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.tiptap.ProseMirror .mark-link a {
|
|
184
|
-
line-height: 1;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
178
|
.tiptap.ProseMirror .mark-link a:hover {
|
|
188
179
|
text-decoration: underline;
|
|
189
|
-
}
|
|
180
|
+
}
|
|
@@ -98,7 +98,6 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
98
98
|
more = _ref3.more,
|
|
99
99
|
onTip = _ref3.onTip;
|
|
100
100
|
var theme = useTheme();
|
|
101
|
-
var isMarkdown = editor.options.contentType === 'markdown';
|
|
102
101
|
var _useState = useState({
|
|
103
102
|
editor: editor,
|
|
104
103
|
node: null,
|
|
@@ -2,7 +2,6 @@ import { Editor } from '@tiptap/react';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
interface EditorInsertProps {
|
|
4
4
|
editor: Editor;
|
|
5
|
-
isMarkdown: boolean;
|
|
6
5
|
}
|
|
7
|
-
declare const EditorInsert: ({ editor
|
|
6
|
+
declare const EditorInsert: ({ editor }: EditorInsertProps) => React.JSX.Element;
|
|
8
7
|
export default EditorInsert;
|
|
@@ -1,9 +1,3 @@
|
|
|
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; }
|
|
7
1
|
import { getShortcutKeyText } from "../../../util";
|
|
8
2
|
import { Typography } from '@mui/material';
|
|
9
3
|
import React from 'react';
|
|
@@ -12,8 +6,7 @@ import Menu from "../../Menu";
|
|
|
12
6
|
import ToolbarItem from "../Item";
|
|
13
7
|
import TableSizePicker from "../TableSizePicker";
|
|
14
8
|
var EditorInsert = function EditorInsert(_ref) {
|
|
15
|
-
var editor = _ref.editor
|
|
16
|
-
isMarkdown = _ref.isMarkdown;
|
|
9
|
+
var editor = _ref.editor;
|
|
17
10
|
return /*#__PURE__*/React.createElement(Menu, {
|
|
18
11
|
width: 224,
|
|
19
12
|
context: /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
@@ -95,7 +88,7 @@ var EditorInsert = function EditorInsert(_ref) {
|
|
|
95
88
|
}
|
|
96
89
|
})
|
|
97
90
|
}]
|
|
98
|
-
}
|
|
91
|
+
}, {
|
|
99
92
|
label: '文件',
|
|
100
93
|
key: 'file',
|
|
101
94
|
icon: /*#__PURE__*/React.createElement(Folder2LineIcon, {
|
|
@@ -168,7 +161,7 @@ var EditorInsert = function EditorInsert(_ref) {
|
|
|
168
161
|
});
|
|
169
162
|
}
|
|
170
163
|
}]
|
|
171
|
-
}
|
|
164
|
+
}, {
|
|
172
165
|
customLabel: /*#__PURE__*/React.createElement(Typography, {
|
|
173
166
|
sx: {
|
|
174
167
|
px: 1,
|
|
@@ -407,7 +400,7 @@ var EditorInsert = function EditorInsert(_ref) {
|
|
|
407
400
|
});
|
|
408
401
|
}
|
|
409
402
|
}]
|
|
410
|
-
}
|
|
403
|
+
}, {
|
|
411
404
|
customLabel: /*#__PURE__*/React.createElement(Typography, {
|
|
412
405
|
sx: {
|
|
413
406
|
px: 1,
|
|
@@ -432,7 +425,7 @@ var EditorInsert = function EditorInsert(_ref) {
|
|
|
432
425
|
height: 400
|
|
433
426
|
});
|
|
434
427
|
}
|
|
435
|
-
}]
|
|
428
|
+
}]
|
|
436
429
|
});
|
|
437
430
|
};
|
|
438
431
|
export default EditorInsert;
|
|
@@ -39,30 +39,23 @@ var LinkViewWrapper = function LinkViewWrapper(_ref) {
|
|
|
39
39
|
onClick: handleClick,
|
|
40
40
|
style: {
|
|
41
41
|
color: theme.palette.primary.main,
|
|
42
|
-
cursor: 'pointer'
|
|
43
|
-
display: 'inline-flex',
|
|
44
|
-
alignItems: 'center',
|
|
45
|
-
gap: '2px',
|
|
46
|
-
verticalAlign: '-0.125em',
|
|
47
|
-
lineHeight: 1
|
|
42
|
+
cursor: 'pointer'
|
|
48
43
|
}
|
|
49
44
|
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
45
|
+
component: "span",
|
|
50
46
|
sx: {
|
|
51
|
-
width: '
|
|
52
|
-
height: '
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
width: '16px',
|
|
48
|
+
height: '16px',
|
|
49
|
+
bgcolor: '#FFFFFF',
|
|
50
|
+
display: 'inline-flex',
|
|
51
|
+
verticalAlign: '-0.125em',
|
|
52
|
+
marginRight: '2px'
|
|
55
53
|
},
|
|
56
54
|
src: favicon
|
|
57
55
|
}, /*#__PURE__*/React.createElement(ChromeIcon, {
|
|
58
56
|
sx: {
|
|
59
57
|
fontSize: '1rem',
|
|
60
|
-
|
|
61
|
-
color: 'primary.main',
|
|
62
|
-
alignSelf: 'center',
|
|
63
|
-
':active': {
|
|
64
|
-
cursor: 'grabbing'
|
|
65
|
-
}
|
|
58
|
+
color: 'primary.main'
|
|
66
59
|
}
|
|
67
60
|
})));
|
|
68
61
|
};
|
package/dist/extension/index.js
CHANGED
|
@@ -44,7 +44,10 @@ export var getExtensions = function getExtensions(_ref) {
|
|
|
44
44
|
color: 'var(--mui-palette-primary-main)',
|
|
45
45
|
width: 2
|
|
46
46
|
}
|
|
47
|
-
}), TextStyleKit, CodeExtension, ListExtension, EmojiExtension, AlertExtension, CustomSubscript, DetailsExtension, CustomSuperscript, DetailsContentExtension, DetailsSummaryExtension, CodeBlockLowlightExtension, InlineUploadProgressExtension, YamlFormat, CustomHorizontalRule,
|
|
47
|
+
}), TextStyleKit, CodeExtension, ListExtension, EmojiExtension, AlertExtension, CustomSubscript, DetailsExtension, CustomSuperscript, DetailsContentExtension, DetailsSummaryExtension, CodeBlockLowlightExtension, InlineUploadProgressExtension, YamlFormat, CustomHorizontalRule, IframeExtension({
|
|
48
|
+
onError: onError,
|
|
49
|
+
onValidateUrl: onValidateUrl
|
|
50
|
+
}), VideoExtension({
|
|
48
51
|
onUpload: onUpload,
|
|
49
52
|
onError: onError,
|
|
50
53
|
onValidateUrl: onValidateUrl
|
|
@@ -56,6 +59,9 @@ export var getExtensions = function getExtensions(_ref) {
|
|
|
56
59
|
editable: editable
|
|
57
60
|
})), [TableOfContents({
|
|
58
61
|
onTocUpdate: onTocUpdate
|
|
62
|
+
}), InlineAttachmentExtension({
|
|
63
|
+
onUpload: onUpload,
|
|
64
|
+
onError: onError
|
|
59
65
|
}), ImageExtension({
|
|
60
66
|
onUpload: onUpload,
|
|
61
67
|
onError: onError,
|
|
@@ -113,13 +119,7 @@ export var getExtensions = function getExtensions(_ref) {
|
|
|
113
119
|
}
|
|
114
120
|
}));
|
|
115
121
|
} else {
|
|
116
|
-
defaultExtensions.push.apply(defaultExtensions, [InlineLinkExtension, BlockLinkExtension,
|
|
117
|
-
onError: onError,
|
|
118
|
-
onValidateUrl: onValidateUrl
|
|
119
|
-
}), BlockAttachmentExtension({
|
|
120
|
-
onUpload: onUpload,
|
|
121
|
-
onError: onError
|
|
122
|
-
}), InlineAttachmentExtension({
|
|
122
|
+
defaultExtensions.push.apply(defaultExtensions, [InlineLinkExtension, BlockLinkExtension, BlockAttachmentExtension({
|
|
123
123
|
onUpload: onUpload,
|
|
124
124
|
onError: onError
|
|
125
125
|
})]);
|
|
@@ -81,6 +81,13 @@ export var InlineAttachmentExtension = function InlineAttachmentExtension(props)
|
|
|
81
81
|
'data-tag': 'attachment'
|
|
82
82
|
}, mergeAttributes(this.options.HTMLAttributes, HTMLAttributes))];
|
|
83
83
|
},
|
|
84
|
+
renderMarkdown: function renderMarkdown(_ref2) {
|
|
85
|
+
var HTMLAttributes = _ref2.HTMLAttributes;
|
|
86
|
+
var _ref3 = HTMLAttributes,
|
|
87
|
+
url = _ref3.url,
|
|
88
|
+
title = _ref3.title;
|
|
89
|
+
return "<a href=\"".concat(url, "\" target=\"_blank\" download=\"").concat(title, "\">").concat(title, "</a>");
|
|
90
|
+
},
|
|
84
91
|
addKeyboardShortcuts: function addKeyboardShortcuts() {
|
|
85
92
|
var _this = this;
|
|
86
93
|
return {
|
|
@@ -97,8 +104,8 @@ export var InlineAttachmentExtension = function InlineAttachmentExtension(props)
|
|
|
97
104
|
var _this2 = this;
|
|
98
105
|
return {
|
|
99
106
|
setInlineAttachment: function setInlineAttachment(options) {
|
|
100
|
-
return function (
|
|
101
|
-
var commands =
|
|
107
|
+
return function (_ref4) {
|
|
108
|
+
var commands = _ref4.commands;
|
|
102
109
|
return commands.insertContent({
|
|
103
110
|
type: _this2.name,
|
|
104
111
|
attrs: {
|
|
@@ -190,8 +197,8 @@ export var BlockAttachmentExtension = function BlockAttachmentExtension(props) {
|
|
|
190
197
|
}
|
|
191
198
|
}];
|
|
192
199
|
},
|
|
193
|
-
renderHTML: function renderHTML(
|
|
194
|
-
var HTMLAttributes =
|
|
200
|
+
renderHTML: function renderHTML(_ref5) {
|
|
201
|
+
var HTMLAttributes = _ref5.HTMLAttributes;
|
|
195
202
|
return ['div', _objectSpread({
|
|
196
203
|
'data-tag': 'attachment'
|
|
197
204
|
}, mergeAttributes(this.options.HTMLAttributes, HTMLAttributes))];
|
|
@@ -200,8 +207,8 @@ export var BlockAttachmentExtension = function BlockAttachmentExtension(props) {
|
|
|
200
207
|
var _this3 = this;
|
|
201
208
|
return {
|
|
202
209
|
setBlockAttachment: function setBlockAttachment(options) {
|
|
203
|
-
return function (
|
|
204
|
-
var commands =
|
|
210
|
+
return function (_ref6) {
|
|
211
|
+
var commands = _ref6.commands;
|
|
205
212
|
return commands.insertContent({
|
|
206
213
|
type: _this3.name,
|
|
207
214
|
attrs: {
|
|
@@ -1,5 +1,6 @@
|
|
|
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 = ["src"]
|
|
2
|
+
var _excluded = ["src"],
|
|
3
|
+
_excluded2 = ["src"];
|
|
3
4
|
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
5
|
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
6
|
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; }
|
|
@@ -90,12 +91,19 @@ export var IframeExtension = function IframeExtension(props) {
|
|
|
90
91
|
loop: '0'
|
|
91
92
|
}))];
|
|
92
93
|
},
|
|
94
|
+
renderMarkdown: function renderMarkdown(_ref3) {
|
|
95
|
+
var HTMLAttributes = _ref3.HTMLAttributes;
|
|
96
|
+
var _ref4 = HTMLAttributes,
|
|
97
|
+
src = _ref4.src,
|
|
98
|
+
rest = _objectWithoutProperties(_ref4, _excluded2);
|
|
99
|
+
return "<iframe ".concat(rest.src ? "src=\"".concat(rest.src, "\"") : '', " ").concat(rest.width ? "width=\"".concat(rest.width, "\"") : '', " ").concat(rest.height ? "height=\"".concat(rest.height, "\"") : '', " frameborder=\"0\" allowfullscreen=\"true\" autoplay=\"0\" loop=\"0\"></iframe>");
|
|
100
|
+
},
|
|
93
101
|
addCommands: function addCommands() {
|
|
94
102
|
var _this = this;
|
|
95
103
|
return {
|
|
96
104
|
setIframe: function setIframe(options) {
|
|
97
|
-
return function (
|
|
98
|
-
var commands =
|
|
105
|
+
return function (_ref5) {
|
|
106
|
+
var commands = _ref5.commands;
|
|
99
107
|
return commands.insertContent({
|
|
100
108
|
type: _this.name,
|
|
101
109
|
attrs: {
|