@ctzhian/tiptap 1.12.16 → 1.12.17
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/extension/index.js
CHANGED
|
@@ -59,9 +59,6 @@ export var getExtensions = function getExtensions(_ref) {
|
|
|
59
59
|
editable: editable
|
|
60
60
|
})), [TableOfContents({
|
|
61
61
|
onTocUpdate: onTocUpdate
|
|
62
|
-
}), InlineAttachmentExtension({
|
|
63
|
-
onUpload: onUpload,
|
|
64
|
-
onError: onError
|
|
65
62
|
}), ImageExtension({
|
|
66
63
|
onUpload: onUpload,
|
|
67
64
|
onError: onError,
|
|
@@ -119,7 +116,10 @@ export var getExtensions = function getExtensions(_ref) {
|
|
|
119
116
|
}
|
|
120
117
|
}));
|
|
121
118
|
} else {
|
|
122
|
-
defaultExtensions.push.apply(defaultExtensions, [InlineLinkExtension, BlockLinkExtension,
|
|
119
|
+
defaultExtensions.push.apply(defaultExtensions, [InlineLinkExtension, BlockLinkExtension, InlineAttachmentExtension({
|
|
120
|
+
onUpload: onUpload,
|
|
121
|
+
onError: onError
|
|
122
|
+
}), BlockAttachmentExtension({
|
|
123
123
|
onUpload: onUpload,
|
|
124
124
|
onError: onError
|
|
125
125
|
})]);
|
|
@@ -81,11 +81,11 @@ export var InlineAttachmentExtension = function InlineAttachmentExtension(props)
|
|
|
81
81
|
'data-tag': 'attachment'
|
|
82
82
|
}, mergeAttributes(this.options.HTMLAttributes, HTMLAttributes))];
|
|
83
83
|
},
|
|
84
|
-
renderMarkdown: function renderMarkdown(
|
|
85
|
-
var
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
renderMarkdown: function renderMarkdown(node) {
|
|
85
|
+
var _ref2 = node.attrs,
|
|
86
|
+
url = _ref2.url,
|
|
87
|
+
title = _ref2.title;
|
|
88
|
+
if (!url) return '';
|
|
89
89
|
return "<a href=\"".concat(url, "\" target=\"_blank\" download=\"").concat(title, "\">").concat(title, "</a>");
|
|
90
90
|
},
|
|
91
91
|
addKeyboardShortcuts: function addKeyboardShortcuts() {
|
|
@@ -104,8 +104,8 @@ export var InlineAttachmentExtension = function InlineAttachmentExtension(props)
|
|
|
104
104
|
var _this2 = this;
|
|
105
105
|
return {
|
|
106
106
|
setInlineAttachment: function setInlineAttachment(options) {
|
|
107
|
-
return function (
|
|
108
|
-
var commands =
|
|
107
|
+
return function (_ref3) {
|
|
108
|
+
var commands = _ref3.commands;
|
|
109
109
|
return commands.insertContent({
|
|
110
110
|
type: _this2.name,
|
|
111
111
|
attrs: {
|
|
@@ -197,8 +197,8 @@ export var BlockAttachmentExtension = function BlockAttachmentExtension(props) {
|
|
|
197
197
|
}
|
|
198
198
|
}];
|
|
199
199
|
},
|
|
200
|
-
renderHTML: function renderHTML(
|
|
201
|
-
var HTMLAttributes =
|
|
200
|
+
renderHTML: function renderHTML(_ref4) {
|
|
201
|
+
var HTMLAttributes = _ref4.HTMLAttributes;
|
|
202
202
|
return ['div', _objectSpread({
|
|
203
203
|
'data-tag': 'attachment'
|
|
204
204
|
}, mergeAttributes(this.options.HTMLAttributes, HTMLAttributes))];
|
|
@@ -207,8 +207,8 @@ export var BlockAttachmentExtension = function BlockAttachmentExtension(props) {
|
|
|
207
207
|
var _this3 = this;
|
|
208
208
|
return {
|
|
209
209
|
setBlockAttachment: function setBlockAttachment(options) {
|
|
210
|
-
return function (
|
|
211
|
-
var commands =
|
|
210
|
+
return function (_ref5) {
|
|
211
|
+
var commands = _ref5.commands;
|
|
212
212
|
return commands.insertContent({
|
|
213
213
|
type: _this3.name,
|
|
214
214
|
attrs: {
|
|
@@ -137,9 +137,17 @@ export var AudioExtension = function AudioExtension(props) {
|
|
|
137
137
|
var HTMLAttributes = _ref.HTMLAttributes;
|
|
138
138
|
return ['audio', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
|
|
139
139
|
},
|
|
140
|
-
renderMarkdown: function renderMarkdown(
|
|
141
|
-
var
|
|
142
|
-
|
|
140
|
+
renderMarkdown: function renderMarkdown(node) {
|
|
141
|
+
var _ref2 = node.attrs,
|
|
142
|
+
src = _ref2.src,
|
|
143
|
+
title = _ref2.title,
|
|
144
|
+
poster = _ref2.poster,
|
|
145
|
+
controls = _ref2.controls,
|
|
146
|
+
autoplay = _ref2.autoplay,
|
|
147
|
+
loop = _ref2.loop,
|
|
148
|
+
muted = _ref2.muted;
|
|
149
|
+
if (!src) return '';
|
|
150
|
+
return "<audio src=\"".concat(src, "\" ").concat(title ? "title=\"".concat(title, "\"") : '', " ").concat(poster ? "poster=\"".concat(poster, "\"") : '', " ").concat(controls ? 'controls' : '', " ").concat(autoplay ? 'autoplay' : '', " ").concat(loop ? 'loop' : '', " ").concat(muted ? 'muted' : '', "></audio>");
|
|
143
151
|
},
|
|
144
152
|
addCommands: function addCommands() {
|
|
145
153
|
var _this2 = this;
|
|
@@ -1,6 +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 = ["src"]
|
|
3
|
-
_excluded2 = ["src"];
|
|
2
|
+
var _excluded = ["src"];
|
|
4
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; }
|
|
5
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; }
|
|
6
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; }
|
|
@@ -91,19 +90,20 @@ export var IframeExtension = function IframeExtension(props) {
|
|
|
91
90
|
loop: '0'
|
|
92
91
|
}))];
|
|
93
92
|
},
|
|
94
|
-
renderMarkdown: function renderMarkdown(
|
|
95
|
-
var
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
renderMarkdown: function renderMarkdown(node) {
|
|
94
|
+
var _ref3 = node.attrs,
|
|
95
|
+
src = _ref3.src,
|
|
96
|
+
width = _ref3.width,
|
|
97
|
+
height = _ref3.height;
|
|
98
|
+
if (!src || src.trim() === '') return '';
|
|
99
|
+
return "<iframe src=\"".concat(src, "\" ").concat(width ? "width=\"".concat(width, "\"") : '', " ").concat(height ? "height=\"".concat(height, "\"") : '', " frameborder=\"0\" allowfullscreen=\"true\" autoplay=\"0\" loop=\"0\"></iframe>");
|
|
100
100
|
},
|
|
101
101
|
addCommands: function addCommands() {
|
|
102
102
|
var _this = this;
|
|
103
103
|
return {
|
|
104
104
|
setIframe: function setIframe(options) {
|
|
105
|
-
return function (
|
|
106
|
-
var commands =
|
|
105
|
+
return function (_ref4) {
|
|
106
|
+
var commands = _ref4.commands;
|
|
107
107
|
return commands.insertContent({
|
|
108
108
|
type: _this.name,
|
|
109
109
|
attrs: {
|
|
@@ -143,9 +143,17 @@ export var VideoExtension = function VideoExtension(props) {
|
|
|
143
143
|
var HTMLAttributes = _ref.HTMLAttributes;
|
|
144
144
|
return ['video', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
|
|
145
145
|
},
|
|
146
|
-
renderMarkdown: function renderMarkdown(
|
|
147
|
-
var
|
|
148
|
-
|
|
146
|
+
renderMarkdown: function renderMarkdown(node) {
|
|
147
|
+
var _ref2 = node.attrs,
|
|
148
|
+
src = _ref2.src,
|
|
149
|
+
width = _ref2.width,
|
|
150
|
+
controls = _ref2.controls,
|
|
151
|
+
autoplay = _ref2.autoplay,
|
|
152
|
+
loop = _ref2.loop,
|
|
153
|
+
muted = _ref2.muted,
|
|
154
|
+
poster = _ref2.poster;
|
|
155
|
+
if (!src) return '';
|
|
156
|
+
return "<video src=\"".concat(src, "\" ").concat(width ? "width=\"".concat(width, "\"") : '', " ").concat(controls ? 'controls' : '', " ").concat(autoplay ? 'autoplay' : '', " ").concat(loop ? 'loop' : '', " ").concat(muted ? 'muted' : '', " ").concat(poster ? "poster=\"".concat(poster, "\"") : '', "></video>");
|
|
149
157
|
},
|
|
150
158
|
addCommands: function addCommands() {
|
|
151
159
|
var _this2 = this;
|