@ctzhian/tiptap 2.1.11 → 2.1.13
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 +2 -2
- package/dist/asset/css/index.css +3 -1
- package/dist/component/Icons/bilibili-line-icon.d.ts +6 -0
- package/dist/component/Icons/bilibili-line-icon.js +13 -0
- package/dist/component/Icons/index.d.ts +1 -0
- package/dist/component/Icons/index.js +1 -0
- package/dist/component/Toolbar/EditorInsert/index.js +20 -3
- package/dist/contants/enums.d.ts +5 -0
- package/dist/contants/enums.js +24 -0
- package/dist/contants/slash-commands.js +117 -119
- package/dist/extension/component/Iframe/Insert.d.ts +4 -2
- package/dist/extension/component/Iframe/Insert.js +12 -14
- package/dist/extension/component/Iframe/Readonly.d.ts +2 -1
- package/dist/extension/component/Iframe/Readonly.js +14 -5
- package/dist/extension/component/Iframe/index.js +389 -171
- package/dist/extension/component/SlashCommandsList/index.js +1 -1
- package/dist/extension/component/TableCellHandleMenu/index.js +13 -1
- package/dist/extension/component/TableExtendButton/index.js +2 -2
- package/dist/extension/component/TableHandle/TableHandleMenu.js +13 -1
- package/dist/extension/component/TableSelectionOverlay/index.js +1 -1
- package/dist/extension/node/CodeBlockLowlight.js +0 -1
- package/dist/extension/node/FileHandler.d.ts +1 -1
- package/dist/extension/node/Iframe.d.ts +3 -1
- package/dist/extension/node/Iframe.js +51 -8
- package/dist/extension/node/Table.js +18 -22
- package/dist/extension/node/TableHandler/plugin.js +1 -1
- package/dist/index.css +1 -1
- package/dist/util/index.d.ts +1 -0
- package/dist/util/index.js +8 -0
- package/package.json +1 -1
|
@@ -25,7 +25,7 @@ var SlashCommandsList = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
25
25
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
26
26
|
direction: 'row',
|
|
27
27
|
flexWrap: 'wrap'
|
|
28
|
-
}, items.slice(0,
|
|
28
|
+
}, items.slice(0, 16).map(function (item, index) {
|
|
29
29
|
return /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
30
30
|
key: index,
|
|
31
31
|
shortcutKey: (item === null || item === void 0 ? void 0 : item.shortcutKey) || [],
|
|
@@ -13,7 +13,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
13
13
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
14
14
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
15
15
|
import { Menu } from "../../../component";
|
|
16
|
-
import { AlignBottomIcon, AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, AlignTopIcon, ArrowDownSLineIcon, BrushLineIcon, MergeCellsVerticalIcon, MoreLineIcon, SplitCellsVerticalIcon } from "../../../component/Icons";
|
|
16
|
+
import { AlignBottomIcon, AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, AlignTopIcon, ArrowDownSLineIcon, BrushLineIcon, DeleteLineIcon, MergeCellsVerticalIcon, MoreLineIcon, SplitCellsVerticalIcon } from "../../../component/Icons";
|
|
17
17
|
import { DeleteBack2LineIcon } from "../../../component/Icons/delete-back-2-line-icon";
|
|
18
18
|
import { getThemeTextBgColor, getThemeTextColor } from "../../../contants/enums";
|
|
19
19
|
import { Box, Divider, Typography } from '@mui/material';
|
|
@@ -429,6 +429,18 @@ export var TableCellHandleMenu = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
429
429
|
};
|
|
430
430
|
}
|
|
431
431
|
}()
|
|
432
|
+
}, {
|
|
433
|
+
key: 'delete-table',
|
|
434
|
+
label: '删除表格',
|
|
435
|
+
icon: /*#__PURE__*/React.createElement(DeleteLineIcon, {
|
|
436
|
+
sx: {
|
|
437
|
+
fontSize: '1rem'
|
|
438
|
+
}
|
|
439
|
+
}),
|
|
440
|
+
onClick: function onClick() {
|
|
441
|
+
if (!editor) return;
|
|
442
|
+
editor.chain().focus().deleteTable().run();
|
|
443
|
+
}
|
|
432
444
|
});
|
|
433
445
|
return menuItems;
|
|
434
446
|
}, [editor, theme, editorState]);
|
|
@@ -48,9 +48,9 @@ export var TableExtendRowColumnButton = function TableExtendRowColumnButton(_ref
|
|
|
48
48
|
runPreservingCursor(editor, function () {
|
|
49
49
|
selectLastCell(editor, state.block, state.blockPos, orientation);
|
|
50
50
|
if (isRowOrientation) {
|
|
51
|
-
editor.
|
|
51
|
+
editor.chain().focus().addRowAfter().run();
|
|
52
52
|
} else {
|
|
53
|
-
editor.
|
|
53
|
+
editor.chain().focus().addColumnAfter().run();
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
}, [editor, isRowOrientation, orientation, state]);
|
|
@@ -15,7 +15,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
15
15
|
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; }
|
|
16
16
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
17
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
-
import { AlignBottomIcon, AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, AlignTopIcon, ArrowDownSLineIcon, BrushLineIcon, DeleteColumnIcon, DeleteRowIcon, FileCopyLineIcon, InsertColumnLeftIcon, InsertColumnRightIcon, InsertRowBottomIcon, InsertRowTopIcon, LayoutLeft2LineIcon, LayoutTop2LineIcon } from "../../../component/Icons";
|
|
18
|
+
import { AlignBottomIcon, AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, AlignTopIcon, ArrowDownSLineIcon, BrushLineIcon, DeleteColumnIcon, DeleteLineIcon, DeleteRowIcon, FileCopyLineIcon, InsertColumnLeftIcon, InsertColumnRightIcon, InsertRowBottomIcon, InsertRowTopIcon, LayoutLeft2LineIcon, LayoutTop2LineIcon } from "../../../component/Icons";
|
|
19
19
|
import { DeleteBack2LineIcon } from "../../../component/Icons/delete-back-2-line-icon";
|
|
20
20
|
import { getThemeTextBgColor, getThemeTextColor } from "../../../contants/enums";
|
|
21
21
|
import { Box, Divider, Typography, useTheme } from '@mui/material';
|
|
@@ -592,6 +592,18 @@ export var TableHandleMenu = function TableHandleMenu(_ref) {
|
|
|
592
592
|
editor.chain().focus().deleteColumn().run();
|
|
593
593
|
}
|
|
594
594
|
}
|
|
595
|
+
}, {
|
|
596
|
+
key: 'delete-table',
|
|
597
|
+
label: '删除表格',
|
|
598
|
+
icon: /*#__PURE__*/React.createElement(DeleteLineIcon, {
|
|
599
|
+
sx: {
|
|
600
|
+
fontSize: '1rem'
|
|
601
|
+
}
|
|
602
|
+
}),
|
|
603
|
+
onClick: function onClick() {
|
|
604
|
+
if (!editor || typeof tablePos !== 'number' || !tableNode) return;
|
|
605
|
+
editor.chain().focus().deleteTable().run();
|
|
606
|
+
}
|
|
595
607
|
});
|
|
596
608
|
return menuItems;
|
|
597
609
|
}, [editor, orientation, isFirstRowOrColumn, isHeader, selectRowOrColumn, canDuplicate, duplicateRowOrColumn]);
|
|
@@ -382,7 +382,7 @@ export var TableSelectionOverlay = function TableSelectionOverlay(_ref2) {
|
|
|
382
382
|
};
|
|
383
383
|
}, [editor, updateSelectionRect, updateTableDom]);
|
|
384
384
|
useEffect(function () {
|
|
385
|
-
var c = tableDom === null || tableDom === void 0 ? void 0 : tableDom.querySelector('.table-selection-overlay-container');
|
|
385
|
+
var c = tableDom === null || tableDom === void 0 ? void 0 : tableDom.querySelector(':scope > .tableWrapper > .table-selection-overlay-container');
|
|
386
386
|
containerRef.current = c !== null && c !== void 0 ? c : null;
|
|
387
387
|
}, [tableDom]);
|
|
388
388
|
if (!isVisible || !selectionRect || !editor || !editor.isEditable) {
|
|
@@ -11,7 +11,6 @@ import { ReactNodeViewRenderer } from "@tiptap/react";
|
|
|
11
11
|
import { all, createLowlight } from 'lowlight';
|
|
12
12
|
import CodeBlockView from "../component/CodeBlock";
|
|
13
13
|
var lowlight = createLowlight(all);
|
|
14
|
-
console.log(lowlight.listLanguages());
|
|
15
14
|
var CustomCodeBlock = CodeBlockLowlight.configure({
|
|
16
15
|
enableTabIndentation: true,
|
|
17
16
|
tabSize: 1,
|
|
@@ -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, "
|
|
4
|
+
}) => import("@tiptap/core").Extension<Omit<import("@tiptap/extension-file-handler").FileHandlePluginOptions, "key" | "editor">, any>;
|
|
@@ -4,9 +4,11 @@ declare module '@tiptap/core' {
|
|
|
4
4
|
interface Commands<ReturnType> {
|
|
5
5
|
iframe: {
|
|
6
6
|
setIframe: (options: {
|
|
7
|
+
type?: 'iframe' | 'bilibili';
|
|
7
8
|
src: string;
|
|
8
|
-
width?: number;
|
|
9
|
+
width?: number | string;
|
|
9
10
|
height?: number;
|
|
11
|
+
align?: 'left' | 'center' | 'right';
|
|
10
12
|
}) => ReturnType;
|
|
11
13
|
};
|
|
12
14
|
}
|
|
@@ -35,10 +35,15 @@ export var IframeExtension = function IframeExtension(props) {
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
width: {
|
|
38
|
-
default:
|
|
38
|
+
default: '100%',
|
|
39
39
|
parseHTML: function parseHTML(element) {
|
|
40
40
|
var width = element.getAttribute('width');
|
|
41
|
-
|
|
41
|
+
if (width) {
|
|
42
|
+
if (width.endsWith('%')) return width;
|
|
43
|
+
var numWidth = parseInt(width, 10);
|
|
44
|
+
return isNaN(numWidth) ? '100%' : numWidth;
|
|
45
|
+
}
|
|
46
|
+
return '100%';
|
|
42
47
|
},
|
|
43
48
|
renderHTML: function renderHTML(attributes) {
|
|
44
49
|
return {
|
|
@@ -57,6 +62,29 @@ export var IframeExtension = function IframeExtension(props) {
|
|
|
57
62
|
height: attributes.height
|
|
58
63
|
};
|
|
59
64
|
}
|
|
65
|
+
},
|
|
66
|
+
type: {
|
|
67
|
+
default: 'iframe',
|
|
68
|
+
parseHTML: function parseHTML(element) {
|
|
69
|
+
return element.getAttribute('data-type');
|
|
70
|
+
},
|
|
71
|
+
renderHTML: function renderHTML(attributes) {
|
|
72
|
+
return {
|
|
73
|
+
'data-type': attributes.type
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
align: {
|
|
78
|
+
default: null,
|
|
79
|
+
parseHTML: function parseHTML(element) {
|
|
80
|
+
return element.getAttribute('data-align');
|
|
81
|
+
},
|
|
82
|
+
renderHTML: function renderHTML(attributes) {
|
|
83
|
+
if (!attributes.align) return {};
|
|
84
|
+
return {
|
|
85
|
+
'data-align': attributes.align
|
|
86
|
+
};
|
|
87
|
+
}
|
|
60
88
|
}
|
|
61
89
|
};
|
|
62
90
|
},
|
|
@@ -67,12 +95,24 @@ export var IframeExtension = function IframeExtension(props) {
|
|
|
67
95
|
if (!(dom instanceof HTMLElement)) return false;
|
|
68
96
|
var src = dom.getAttribute('src');
|
|
69
97
|
if (!src) return false;
|
|
70
|
-
var
|
|
98
|
+
var widthAttr = dom.getAttribute('width');
|
|
99
|
+
var width = '100%';
|
|
100
|
+
if (widthAttr) {
|
|
101
|
+
// 如果是百分比,保留字符串格式
|
|
102
|
+
if (widthAttr.endsWith('%')) {
|
|
103
|
+
width = widthAttr;
|
|
104
|
+
} else {
|
|
105
|
+
// 否则解析为数字
|
|
106
|
+
var numWidth = parseInt(widthAttr, 10);
|
|
107
|
+
width = isNaN(numWidth) ? '100%' : numWidth;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
71
110
|
var height = dom.getAttribute('height') ? parseInt(dom.getAttribute('height'), 10) : dom.style.height ? parseInt(dom.style.height, 10) : 400;
|
|
72
111
|
return {
|
|
73
112
|
src: src,
|
|
74
113
|
width: width,
|
|
75
|
-
height: height
|
|
114
|
+
height: height,
|
|
115
|
+
align: dom.getAttribute('data-align') || dom.getAttribute('align')
|
|
76
116
|
};
|
|
77
117
|
}
|
|
78
118
|
}];
|
|
@@ -94,9 +134,10 @@ export var IframeExtension = function IframeExtension(props) {
|
|
|
94
134
|
var _ref3 = node.attrs,
|
|
95
135
|
src = _ref3.src,
|
|
96
136
|
width = _ref3.width,
|
|
97
|
-
height = _ref3.height
|
|
137
|
+
height = _ref3.height,
|
|
138
|
+
align = _ref3['data-align'];
|
|
98
139
|
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>");
|
|
140
|
+
return "<iframe src=\"".concat(src, "\" ").concat(width ? "width=\"".concat(width, "\"") : '', " ").concat(height ? "height=\"".concat(height, "\"") : '', " ").concat(align ? "data-align=\"".concat(align, "\"") : '', " frameborder=\"0\" allowfullscreen=\"true\" autoplay=\"0\" loop=\"0\"></iframe>");
|
|
100
141
|
},
|
|
101
142
|
addCommands: function addCommands() {
|
|
102
143
|
var _this = this;
|
|
@@ -107,9 +148,11 @@ export var IframeExtension = function IframeExtension(props) {
|
|
|
107
148
|
return commands.insertContent({
|
|
108
149
|
type: _this.name,
|
|
109
150
|
attrs: {
|
|
151
|
+
type: options.type || 'iframe',
|
|
110
152
|
src: options.src,
|
|
111
|
-
width: options.width ||
|
|
112
|
-
height: options.height || 400
|
|
153
|
+
width: options.width || '100%',
|
|
154
|
+
height: options.height || 400,
|
|
155
|
+
align: options.align || null
|
|
113
156
|
}
|
|
114
157
|
});
|
|
115
158
|
};
|
|
@@ -116,8 +116,8 @@ export var TableExtension = function TableExtension(_ref) {
|
|
|
116
116
|
key: "ignoreMutation",
|
|
117
117
|
value: function ignoreMutation(mutation) {
|
|
118
118
|
var target = mutation.target;
|
|
119
|
-
var
|
|
120
|
-
return !
|
|
119
|
+
var isInsideThisTable = this.innerTableContainer.contains(target);
|
|
120
|
+
return !isInsideThisTable || _get(_getPrototypeOf(TiptapTableView.prototype), "ignoreMutation", this).call(this, mutation);
|
|
121
121
|
}
|
|
122
122
|
}]);
|
|
123
123
|
return TiptapTableView;
|
|
@@ -127,27 +127,23 @@ export var TableExtension = function TableExtension(_ref) {
|
|
|
127
127
|
};
|
|
128
128
|
},
|
|
129
129
|
renderHTML: function renderHTML(_ref5) {
|
|
130
|
-
var _this$parent;
|
|
131
130
|
var node = _ref5.node,
|
|
132
131
|
HTMLAttributes = _ref5.HTMLAttributes;
|
|
133
|
-
var
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
var firstRow = node.content.firstChild;
|
|
133
|
+
var colCount = firstRow ? firstRow.childCount : 0;
|
|
134
|
+
var style = "--default-cell-min-width: 100px; min-width: ".concat(colCount * 100, "px;");
|
|
135
|
+
var attrs = _objectSpread(_objectSpread({}, HTMLAttributes), {}, {
|
|
136
|
+
style: HTMLAttributes.style ? "".concat(HTMLAttributes.style, " ").concat(style) : style
|
|
136
137
|
});
|
|
137
|
-
var
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
class: 'table-controls'
|
|
143
|
-
}], ['div', {
|
|
144
|
-
class: 'table-selection-overlay-container'
|
|
145
|
-
}]];
|
|
146
|
-
return wrapper;
|
|
138
|
+
var cols = [];
|
|
139
|
+
for (var i = 0; i < colCount; i++) {
|
|
140
|
+
cols.push(['col', {}]);
|
|
141
|
+
}
|
|
142
|
+
return ['table', attrs, ['colgroup', {}].concat(cols), ['tbody', 0]];
|
|
147
143
|
},
|
|
148
144
|
addCommands: function addCommands() {
|
|
149
|
-
var _this$
|
|
150
|
-
return _objectSpread(_objectSpread({}, (_this$
|
|
145
|
+
var _this$parent;
|
|
146
|
+
return _objectSpread(_objectSpread({}, (_this$parent = this.parent) === null || _this$parent === void 0 ? void 0 : _this$parent.call(this)), {}, {
|
|
151
147
|
cancelSelection: function cancelSelection() {
|
|
152
148
|
return function (_ref6) {
|
|
153
149
|
var state = _ref6.state,
|
|
@@ -201,8 +197,8 @@ export var TableExtension = function TableExtension(_ref) {
|
|
|
201
197
|
allowTableNodeSelection: editable
|
|
202
198
|
}), TableHeader.extend({
|
|
203
199
|
addAttributes: function addAttributes() {
|
|
204
|
-
var _this$
|
|
205
|
-
return _objectSpread(_objectSpread({}, (_this$
|
|
200
|
+
var _this$parent2;
|
|
201
|
+
return _objectSpread(_objectSpread({}, (_this$parent2 = this.parent) === null || _this$parent2 === void 0 ? void 0 : _this$parent2.call(this)), {}, {
|
|
206
202
|
bgcolor: {
|
|
207
203
|
default: null,
|
|
208
204
|
parseHTML: function parseHTML(element) {
|
|
@@ -279,8 +275,8 @@ export var TableExtension = function TableExtension(_ref) {
|
|
|
279
275
|
}
|
|
280
276
|
}), TableCell.extend({
|
|
281
277
|
addAttributes: function addAttributes() {
|
|
282
|
-
var _this$
|
|
283
|
-
return _objectSpread(_objectSpread({}, (_this$
|
|
278
|
+
var _this$parent3;
|
|
279
|
+
return _objectSpread(_objectSpread({}, (_this$parent3 = this.parent) === null || _this$parent3 === void 0 ? void 0 : _this$parent3.call(this)), {}, {
|
|
284
280
|
bgcolor: {
|
|
285
281
|
default: null,
|
|
286
282
|
parseHTML: function parseHTML(element) {
|
|
@@ -313,7 +313,7 @@ var TableHandleView = /*#__PURE__*/function () {
|
|
|
313
313
|
this.tablePos = blockInfo.pos;
|
|
314
314
|
this.tableId = blockInfo.node.attrs.id;
|
|
315
315
|
var wrapper = safeClosest(around.domNode, '.tableWrapper');
|
|
316
|
-
var widgetContainer = wrapper === null || wrapper === void 0 ? void 0 : wrapper.querySelector('.table-controls');
|
|
316
|
+
var widgetContainer = wrapper === null || wrapper === void 0 ? void 0 : wrapper.querySelector(':scope > .table-controls');
|
|
317
317
|
|
|
318
318
|
// Hovering around the table (outside cells)
|
|
319
319
|
if (around.type === 'wrapper') {
|
package/dist/index.css
CHANGED
|
@@ -381,6 +381,7 @@
|
|
|
381
381
|
position: relative;
|
|
382
382
|
vertical-align: top;
|
|
383
383
|
transition: all 0.2s ease-in-out;
|
|
384
|
+
min-width: var(--default-cell-min-width, 100px);
|
|
384
385
|
}
|
|
385
386
|
|
|
386
387
|
.tiptap.ProseMirror table tbody tr:first-child th,
|
|
@@ -447,7 +448,6 @@
|
|
|
447
448
|
overflow-x: auto;
|
|
448
449
|
overflow-y: hidden;
|
|
449
450
|
position: relative;
|
|
450
|
-
margin: 20px 0;
|
|
451
451
|
}
|
|
452
452
|
|
|
453
453
|
.tiptap.ProseMirror[contenteditable="true"] .tableWrapper {
|
package/dist/util/index.d.ts
CHANGED
package/dist/util/index.js
CHANGED
|
@@ -88,4 +88,12 @@ export var getLinkAttributesWithSelectedText = function getLinkAttributesWithSel
|
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
return {};
|
|
91
|
+
};
|
|
92
|
+
export var extractSrcFromIframe = function extractSrcFromIframe(input) {
|
|
93
|
+
var trimmed = input.trim();
|
|
94
|
+
var iframeMatch = trimmed.match(/<iframe[^>]*\ssrc\s*=\s*["']([^"']+)["'][^>]*>/i) || trimmed.match(/<iframe[^>]*\ssrc\s*=\s*([^\s>]+)[^>]*>/i);
|
|
95
|
+
if (iframeMatch && iframeMatch[1]) {
|
|
96
|
+
return iframeMatch[1].trim();
|
|
97
|
+
}
|
|
98
|
+
return trimmed;
|
|
91
99
|
};
|