@ctzhian/tiptap 1.6.12 → 1.6.14

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.
@@ -7,7 +7,8 @@ import 'react-photo-view/dist/react-photo-view.css';
7
7
  var ReadonlyImage = function ReadonlyImage(_ref) {
8
8
  var attrs = _ref.attrs;
9
9
  return /*#__PURE__*/React.createElement(NodeViewWrapper, {
10
- className: "image-wrapper"
10
+ className: "image-wrapper",
11
+ contentEditable: false
11
12
  }, /*#__PURE__*/React.createElement(Box, {
12
13
  component: 'span',
13
14
  sx: {
@@ -223,6 +223,7 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
223
223
  return /*#__PURE__*/React.createElement(NodeViewWrapper, {
224
224
  className: "image-wrapper ".concat(selected ? 'ProseMirror-selectednode' : ''),
225
225
  as: 'span',
226
+ contentEditable: false,
226
227
  'data-drag-handle': false
227
228
  }, /*#__PURE__*/React.createElement(Box, {
228
229
  component: 'span',
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  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; }
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- import { mergeAttributes, Node } from '@tiptap/core';
7
+ import { InputRule, mergeAttributes, Node } from '@tiptap/core';
8
8
  import { ReactNodeViewRenderer } from '@tiptap/react';
9
9
  import AudioViewWrapper from "../component/Audio";
10
10
  export var AudioExtension = function AudioExtension(props) {
@@ -164,22 +164,26 @@ export var AudioExtension = function AudioExtension(props) {
164
164
  },
165
165
  addInputRules: function addInputRules() {
166
166
  var _this3 = this;
167
- return [
168
- // Auto-embed audio URLs
169
- {
167
+ return [new InputRule({
170
168
  find: /^https?:\/\/.*\.(mp3|wav|ogg|m4a|flac|aac|wma|webm)$/,
171
169
  handler: function handler(_ref3) {
172
- var state = _ref3.state,
173
- range = _ref3.range,
174
- match = _ref3.match;
170
+ var range = _ref3.range,
171
+ match = _ref3.match,
172
+ commands = _ref3.commands;
175
173
  var from = range.from,
176
174
  to = range.to;
177
175
  var audioUrl = match[0];
178
- state.tr.replaceWith(from, to, _this3.type.create({
179
- src: audioUrl
180
- }));
176
+ commands.insertContentAt({
177
+ from: from,
178
+ to: to
179
+ }, {
180
+ type: _this3.name,
181
+ attrs: {
182
+ src: audioUrl
183
+ }
184
+ });
181
185
  }
182
- }];
186
+ })];
183
187
  },
184
188
  addNodeView: function addNodeView() {
185
189
  return ReactNodeViewRenderer(function (renderProps) {
@@ -1,5 +1,5 @@
1
1
  import { Extension } from '@tiptap/core';
2
2
  export declare const TableExtension: ({ editable }: {
3
3
  editable: boolean;
4
- }) => (Extension<any, any> | import("@tiptap/core").Node<import("@tiptap/extension-table").TableOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-table").TableHeaderOptions, any>)[];
4
+ }) => (import("@tiptap/core").Node<import("@tiptap/extension-table").TableOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-table").TableHeaderOptions, any> | Extension<any, any>)[];
5
5
  export default TableExtension;
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  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; }
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- import { mergeAttributes, Node } from '@tiptap/core';
7
+ import { InputRule, mergeAttributes, Node } from '@tiptap/core';
8
8
  import { ReactNodeViewRenderer } from '@tiptap/react';
9
9
  import VideoViewWrapper from "../component/Video";
10
10
  export var VideoExtension = function VideoExtension(props) {
@@ -165,22 +165,26 @@ export var VideoExtension = function VideoExtension(props) {
165
165
  },
166
166
  addInputRules: function addInputRules() {
167
167
  var _this3 = this;
168
- return [
169
- // Auto-embed video URLs
170
- {
168
+ return [new InputRule({
171
169
  find: /^https?:\/\/.*\.(mp4|webm|ogg|mov|m4v|avi|wmv|flv|mkv|mpg|mpeg|m4p|m4v|m4b|m4r|m4a)$/,
172
170
  handler: function handler(_ref3) {
173
- var state = _ref3.state,
174
- range = _ref3.range,
175
- match = _ref3.match;
171
+ var range = _ref3.range,
172
+ match = _ref3.match,
173
+ commands = _ref3.commands;
176
174
  var from = range.from,
177
175
  to = range.to;
178
176
  var videoUrl = match[0];
179
- state.tr.replaceWith(from, to, _this3.type.create({
180
- src: videoUrl
181
- }));
177
+ commands.insertContentAt({
178
+ from: from,
179
+ to: to
180
+ }, {
181
+ type: _this3.name,
182
+ attrs: {
183
+ src: videoUrl
184
+ }
185
+ });
182
186
  }
183
- }];
187
+ })];
184
188
  },
185
189
  addNodeView: function addNodeView() {
186
190
  return ReactNodeViewRenderer(function (renderProps) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctzhian/tiptap",
3
- "version": "1.6.12",
3
+ "version": "1.6.14",
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.3.0",
85
- "@tiptap/extension-bubble-menu": "^3.3.0",
86
- "@tiptap/extension-code": "^3.4.3",
87
- "@tiptap/extension-code-block-lowlight": "^3.3.0",
88
- "@tiptap/extension-details": "^3.3.0",
89
- "@tiptap/extension-drag-handle-react": "^3.3.0",
90
- "@tiptap/extension-emoji": "^3.3.0",
91
- "@tiptap/extension-file-handler": "^3.3.0",
92
- "@tiptap/extension-highlight": "^3.3.0",
93
- "@tiptap/extension-image": "^3.3.0",
94
- "@tiptap/extension-invisible-characters": "^3.3.0",
95
- "@tiptap/extension-link": "^3.3.0",
96
- "@tiptap/extension-list": "^3.3.0",
97
- "@tiptap/extension-mathematics": "^3.3.0",
98
- "@tiptap/extension-mention": "^3.3.0",
99
- "@tiptap/extension-subscript": "^3.3.0",
100
- "@tiptap/extension-superscript": "^3.3.0",
101
- "@tiptap/extension-table": "^3.3.0",
102
- "@tiptap/extension-table-of-contents": "^3.3.0",
103
- "@tiptap/extension-text-align": "^3.3.0",
104
- "@tiptap/extension-text-style": "^3.3.0",
105
- "@tiptap/extension-unique-id": "^3.3.0",
106
- "@tiptap/extension-youtube": "^3.3.0",
107
- "@tiptap/extensions": "^3.3.0",
108
- "@tiptap/html": "^3.3.0",
109
- "@tiptap/pm": "^3.3.0",
110
- "@tiptap/react": "^3.3.0",
111
- "@tiptap/starter-kit": "^3.3.0",
112
- "@tiptap/static-renderer": "^3.3.0",
113
- "@tiptap/suggestion": "^3.3.0",
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",