@tiptap/core 3.0.0-beta.19 → 3.0.0-beta.21

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.
@@ -0,0 +1,398 @@
1
+ import {
2
+ IdleScheduler
3
+ } from "./chunk-GRT2MR5L.js";
4
+ import {
5
+ nanoid
6
+ } from "./chunk-TH7LERQR.js";
7
+ import "./chunk-PR4QN5HX.js";
8
+
9
+ // ../../node_modules/.pnpm/prosemirror-dev-tools@4.2.0_@babel+core@7.26.0_@babel+template@7.25.9_@types+react@19.1.6_rea_wz3aei26oeuigobt6rwizjq3ci/node_modules/prosemirror-dev-tools/dist/esm/state/json-diff-worker.js
10
+ function _typeof(obj) {
11
+ "@babel/helpers - typeof";
12
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
13
+ return typeof obj2;
14
+ } : function(obj2) {
15
+ return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
16
+ }, _typeof(obj);
17
+ }
18
+ function _regeneratorRuntime() {
19
+ "use strict";
20
+ _regeneratorRuntime = function _regeneratorRuntime2() {
21
+ return exports;
22
+ };
23
+ var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function(obj, key, desc) {
24
+ obj[key] = desc.value;
25
+ }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
26
+ function define(obj, key, value) {
27
+ return Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true }), obj[key];
28
+ }
29
+ try {
30
+ define({}, "");
31
+ } catch (err) {
32
+ define = function define2(obj, key, value) {
33
+ return obj[key] = value;
34
+ };
35
+ }
36
+ function wrap(innerFn, outerFn, self, tryLocsList) {
37
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []);
38
+ return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator;
39
+ }
40
+ function tryCatch(fn, obj, arg) {
41
+ try {
42
+ return { type: "normal", arg: fn.call(obj, arg) };
43
+ } catch (err) {
44
+ return { type: "throw", arg: err };
45
+ }
46
+ }
47
+ exports.wrap = wrap;
48
+ var ContinueSentinel = {};
49
+ function Generator() {
50
+ }
51
+ function GeneratorFunction() {
52
+ }
53
+ function GeneratorFunctionPrototype() {
54
+ }
55
+ var IteratorPrototype = {};
56
+ define(IteratorPrototype, iteratorSymbol, function() {
57
+ return this;
58
+ });
59
+ var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([])));
60
+ NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
61
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
62
+ function defineIteratorMethods(prototype) {
63
+ ["next", "throw", "return"].forEach(function(method) {
64
+ define(prototype, method, function(arg) {
65
+ return this._invoke(method, arg);
66
+ });
67
+ });
68
+ }
69
+ function AsyncIterator(generator, PromiseImpl) {
70
+ function invoke(method, arg, resolve, reject) {
71
+ var record = tryCatch(generator[method], generator, arg);
72
+ if ("throw" !== record.type) {
73
+ var result = record.arg, value = result.value;
74
+ return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function(value2) {
75
+ invoke("next", value2, resolve, reject);
76
+ }, function(err) {
77
+ invoke("throw", err, resolve, reject);
78
+ }) : PromiseImpl.resolve(value).then(function(unwrapped) {
79
+ result.value = unwrapped, resolve(result);
80
+ }, function(error) {
81
+ return invoke("throw", error, resolve, reject);
82
+ });
83
+ }
84
+ reject(record.arg);
85
+ }
86
+ var previousPromise;
87
+ defineProperty(this, "_invoke", { value: function value(method, arg) {
88
+ function callInvokeWithMethodAndArg() {
89
+ return new PromiseImpl(function(resolve, reject) {
90
+ invoke(method, arg, resolve, reject);
91
+ });
92
+ }
93
+ return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
94
+ } });
95
+ }
96
+ function makeInvokeMethod(innerFn, self, context) {
97
+ var state = "suspendedStart";
98
+ return function(method, arg) {
99
+ if ("executing" === state) throw new Error("Generator is already running");
100
+ if ("completed" === state) {
101
+ if ("throw" === method) throw arg;
102
+ return doneResult();
103
+ }
104
+ for (context.method = method, context.arg = arg; ; ) {
105
+ var delegate = context.delegate;
106
+ if (delegate) {
107
+ var delegateResult = maybeInvokeDelegate(delegate, context);
108
+ if (delegateResult) {
109
+ if (delegateResult === ContinueSentinel) continue;
110
+ return delegateResult;
111
+ }
112
+ }
113
+ if ("next" === context.method) context.sent = context._sent = context.arg;
114
+ else if ("throw" === context.method) {
115
+ if ("suspendedStart" === state) throw state = "completed", context.arg;
116
+ context.dispatchException(context.arg);
117
+ } else "return" === context.method && context.abrupt("return", context.arg);
118
+ state = "executing";
119
+ var record = tryCatch(innerFn, self, context);
120
+ if ("normal" === record.type) {
121
+ if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
122
+ return { value: record.arg, done: context.done };
123
+ }
124
+ "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
125
+ }
126
+ };
127
+ }
128
+ function maybeInvokeDelegate(delegate, context) {
129
+ var method = delegate.iterator[context.method];
130
+ if (void 0 === method) {
131
+ if (context.delegate = null, "throw" === context.method) {
132
+ if (delegate.iterator["return"] && (context.method = "return", context.arg = void 0, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
133
+ context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
134
+ }
135
+ return ContinueSentinel;
136
+ }
137
+ var record = tryCatch(method, delegate.iterator, context.arg);
138
+ if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
139
+ var info = record.arg;
140
+ return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = void 0), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
141
+ }
142
+ function pushTryEntry(locs) {
143
+ var entry = { tryLoc: locs[0] };
144
+ 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
145
+ }
146
+ function resetTryEntry(entry) {
147
+ var record = entry.completion || {};
148
+ record.type = "normal", delete record.arg, entry.completion = record;
149
+ }
150
+ function Context(tryLocsList) {
151
+ this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(true);
152
+ }
153
+ function values(iterable) {
154
+ if (iterable) {
155
+ var iteratorMethod = iterable[iteratorSymbol];
156
+ if (iteratorMethod) return iteratorMethod.call(iterable);
157
+ if ("function" == typeof iterable.next) return iterable;
158
+ if (!isNaN(iterable.length)) {
159
+ var i = -1, next = function next2() {
160
+ for (; ++i < iterable.length; ) {
161
+ if (hasOwn.call(iterable, i)) return next2.value = iterable[i], next2.done = false, next2;
162
+ }
163
+ return next2.value = void 0, next2.done = true, next2;
164
+ };
165
+ return next.next = next;
166
+ }
167
+ }
168
+ return { next: doneResult };
169
+ }
170
+ function doneResult() {
171
+ return { value: void 0, done: true };
172
+ }
173
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: true }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: true }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function(genFun) {
174
+ var ctor = "function" == typeof genFun && genFun.constructor;
175
+ return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
176
+ }, exports.mark = function(genFun) {
177
+ return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
178
+ }, exports.awrap = function(arg) {
179
+ return { __await: arg };
180
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
181
+ return this;
182
+ }), exports.AsyncIterator = AsyncIterator, exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
183
+ void 0 === PromiseImpl && (PromiseImpl = Promise);
184
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
185
+ return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
186
+ return result.done ? result.value : iter.next();
187
+ });
188
+ }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function() {
189
+ return this;
190
+ }), define(Gp, "toString", function() {
191
+ return "[object Generator]";
192
+ }), exports.keys = function(val) {
193
+ var object = Object(val), keys = [];
194
+ for (var key in object) {
195
+ keys.push(key);
196
+ }
197
+ return keys.reverse(), function next() {
198
+ for (; keys.length; ) {
199
+ var key2 = keys.pop();
200
+ if (key2 in object) return next.value = key2, next.done = false, next;
201
+ }
202
+ return next.done = true, next;
203
+ };
204
+ }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) {
205
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = void 0, this.done = false, this.delegate = null, this.method = "next", this.arg = void 0, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
206
+ "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = void 0);
207
+ }
208
+ }, stop: function stop() {
209
+ this.done = true;
210
+ var rootRecord = this.tryEntries[0].completion;
211
+ if ("throw" === rootRecord.type) throw rootRecord.arg;
212
+ return this.rval;
213
+ }, dispatchException: function dispatchException(exception) {
214
+ if (this.done) throw exception;
215
+ var context = this;
216
+ function handle(loc, caught) {
217
+ return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = void 0), !!caught;
218
+ }
219
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
220
+ var entry = this.tryEntries[i], record = entry.completion;
221
+ if ("root" === entry.tryLoc) return handle("end");
222
+ if (entry.tryLoc <= this.prev) {
223
+ var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc");
224
+ if (hasCatch && hasFinally) {
225
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, true);
226
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
227
+ } else if (hasCatch) {
228
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, true);
229
+ } else {
230
+ if (!hasFinally) throw new Error("try statement without catch or finally");
231
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
232
+ }
233
+ }
234
+ }
235
+ }, abrupt: function abrupt(type, arg) {
236
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
237
+ var entry = this.tryEntries[i];
238
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
239
+ var finallyEntry = entry;
240
+ break;
241
+ }
242
+ }
243
+ finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
244
+ var record = finallyEntry ? finallyEntry.completion : {};
245
+ return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
246
+ }, complete: function complete(record, afterLoc) {
247
+ if ("throw" === record.type) throw record.arg;
248
+ return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
249
+ }, finish: function finish(finallyLoc) {
250
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
251
+ var entry = this.tryEntries[i];
252
+ if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
253
+ }
254
+ }, "catch": function _catch(tryLoc) {
255
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
256
+ var entry = this.tryEntries[i];
257
+ if (entry.tryLoc === tryLoc) {
258
+ var record = entry.completion;
259
+ if ("throw" === record.type) {
260
+ var thrown = record.arg;
261
+ resetTryEntry(entry);
262
+ }
263
+ return thrown;
264
+ }
265
+ }
266
+ throw new Error("illegal catch attempt");
267
+ }, delegateYield: function delegateYield(iterable, resultName, nextLoc) {
268
+ return this.delegate = { iterator: values(iterable), resultName, nextLoc }, "next" === this.method && (this.arg = void 0), ContinueSentinel;
269
+ } }, exports;
270
+ }
271
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
272
+ try {
273
+ var info = gen[key](arg);
274
+ var value = info.value;
275
+ } catch (error) {
276
+ reject(error);
277
+ return;
278
+ }
279
+ if (info.done) {
280
+ resolve(value);
281
+ } else {
282
+ Promise.resolve(value).then(_next, _throw);
283
+ }
284
+ }
285
+ function _asyncToGenerator(fn) {
286
+ return function() {
287
+ var self = this, args = arguments;
288
+ return new Promise(function(resolve, reject) {
289
+ var gen = fn.apply(self, args);
290
+ function _next(value) {
291
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
292
+ }
293
+ function _throw(err) {
294
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
295
+ }
296
+ _next(void 0);
297
+ });
298
+ };
299
+ }
300
+ function _classCallCheck(instance, Constructor) {
301
+ if (!(instance instanceof Constructor)) {
302
+ throw new TypeError("Cannot call a class as a function");
303
+ }
304
+ }
305
+ function _defineProperties(target, props) {
306
+ for (var i = 0; i < props.length; i++) {
307
+ var descriptor = props[i];
308
+ descriptor.enumerable = descriptor.enumerable || false;
309
+ descriptor.configurable = true;
310
+ if ("value" in descriptor) descriptor.writable = true;
311
+ Object.defineProperty(target, descriptor.key, descriptor);
312
+ }
313
+ }
314
+ function _createClass(Constructor, protoProps, staticProps) {
315
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
316
+ if (staticProps) _defineProperties(Constructor, staticProps);
317
+ Object.defineProperty(Constructor, "prototype", { writable: false });
318
+ return Constructor;
319
+ }
320
+ function _defineProperty(obj, key, value) {
321
+ if (key in obj) {
322
+ Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
323
+ } else {
324
+ obj[key] = value;
325
+ }
326
+ return obj;
327
+ }
328
+ var JsonDiffWorker = /* @__PURE__ */ function() {
329
+ function JsonDiffWorker2(worker) {
330
+ var _this = this;
331
+ _classCallCheck(this, JsonDiffWorker2);
332
+ _defineProperty(this, "queue", /* @__PURE__ */ new Map());
333
+ _defineProperty(this, "scheduler", new IdleScheduler());
334
+ _defineProperty(this, "worker", void 0);
335
+ this.worker = worker;
336
+ this.worker.addEventListener("message", function(e) {
337
+ var deferred = _this.queue.get(e.data.id);
338
+ if (deferred) {
339
+ _this.queue["delete"](e.data.id);
340
+ deferred.resolve(e.data.returns);
341
+ }
342
+ });
343
+ }
344
+ _createClass(JsonDiffWorker2, [{
345
+ key: "diff",
346
+ value: function() {
347
+ var _diff = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(input) {
348
+ var id, deferred;
349
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
350
+ while (1) {
351
+ switch (_context.prev = _context.next) {
352
+ case 0:
353
+ _context.next = 2;
354
+ return this.scheduler.request();
355
+ case 2:
356
+ id = nanoid();
357
+ deferred = createDeferrable();
358
+ this.queue.set(id, deferred);
359
+ this.worker.postMessage({
360
+ method: "diff",
361
+ id,
362
+ args: [input]
363
+ });
364
+ return _context.abrupt("return", deferred);
365
+ case 7:
366
+ case "end":
367
+ return _context.stop();
368
+ }
369
+ }
370
+ }, _callee, this);
371
+ }));
372
+ function diff(_x) {
373
+ return _diff.apply(this, arguments);
374
+ }
375
+ return diff;
376
+ }()
377
+ }]);
378
+ return JsonDiffWorker2;
379
+ }();
380
+ function createDeferrable() {
381
+ var r;
382
+ var p = new Promise(function(resolve) {
383
+ r = resolve;
384
+ });
385
+ p.resolve = function() {
386
+ return r.apply(void 0, arguments);
387
+ };
388
+ return p;
389
+ }
390
+ export {
391
+ JsonDiffWorker
392
+ };
393
+ /*! Bundled license information:
394
+
395
+ prosemirror-dev-tools/dist/esm/state/json-diff-worker.js:
396
+ (*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE *)
397
+ */
398
+ //# sourceMappingURL=json-diff-worker-ET432FKY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/prosemirror-dev-tools@4.2.0_@babel+core@7.26.0_@babel+template@7.25.9_@types+react@19.1.6_rea_wz3aei26oeuigobt6rwizjq3ci/node_modules/prosemirror-dev-tools/dist/esm/state/json-diff-worker.js"],"sourcesContent":["function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nimport { nanoid } from \"nanoid\";\nimport { IdleScheduler } from \"./idle-scheduler\";\nexport var JsonDiffWorker = /*#__PURE__*/function () {\n function JsonDiffWorker(worker) {\n var _this = this;\n _classCallCheck(this, JsonDiffWorker);\n _defineProperty(this, \"queue\", new Map());\n _defineProperty(this, \"scheduler\", new IdleScheduler());\n _defineProperty(this, \"worker\", void 0);\n this.worker = worker;\n this.worker.addEventListener(\"message\", function (e) {\n var deferred = _this.queue.get(e.data.id);\n if (deferred) {\n _this.queue[\"delete\"](e.data.id);\n deferred.resolve(e.data.returns);\n }\n });\n }\n _createClass(JsonDiffWorker, [{\n key: \"diff\",\n value: function () {\n var _diff = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(input) {\n var id, deferred;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return this.scheduler.request();\n case 2:\n id = nanoid();\n deferred = createDeferrable();\n this.queue.set(id, deferred);\n this.worker.postMessage({\n method: \"diff\",\n id: id,\n args: [input]\n });\n return _context.abrupt(\"return\", deferred);\n case 7:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n function diff(_x) {\n return _diff.apply(this, arguments);\n }\n return diff;\n }()\n }]);\n return JsonDiffWorker;\n}();\nfunction createDeferrable() {\n var r;\n var p = new Promise(function (resolve) {\n r = resolve;\n });\n p.resolve = function () {\n return r.apply(void 0, arguments);\n };\n return p;\n}"],"mappings":";;;;;;;;;AAAA,SAAS,QAAQ,KAAK;AAAE;AAA2B,SAAO,UAAU,cAAc,OAAO,UAAU,YAAY,OAAO,OAAO,WAAW,SAAUA,MAAK;AAAE,WAAO,OAAOA;AAAA,EAAK,IAAI,SAAUA,MAAK;AAAE,WAAOA,QAAO,cAAc,OAAO,UAAUA,KAAI,gBAAgB,UAAUA,SAAQ,OAAO,YAAY,WAAW,OAAOA;AAAA,EAAK,GAAG,QAAQ,GAAG;AAAG;AAC/U,SAAS,sBAAsB;AAAE;AAAmK,wBAAsB,SAASC,uBAAsB;AAAE,WAAO;AAAA,EAAS;AAAG,MAAI,UAAU,CAAC,GAAG,KAAK,OAAO,WAAW,SAAS,GAAG,gBAAgB,iBAAiB,OAAO,kBAAkB,SAAU,KAAK,KAAK,MAAM;AAAE,QAAI,GAAG,IAAI,KAAK;AAAA,EAAO,GAAG,UAAU,cAAc,OAAO,SAAS,SAAS,CAAC,GAAG,iBAAiB,QAAQ,YAAY,cAAc,sBAAsB,QAAQ,iBAAiB,mBAAmB,oBAAoB,QAAQ,eAAe;AAAiB,WAAS,OAAO,KAAK,KAAK,OAAO;AAAE,WAAO,OAAO,eAAe,KAAK,KAAK,EAAE,OAAc,YAAY,MAAI,cAAc,MAAI,UAAU,KAAG,CAAC,GAAG,IAAI,GAAG;AAAA,EAAG;AAAE,MAAI;AAAE,WAAO,CAAC,GAAG,EAAE;AAAA,EAAG,SAAS,KAAK;AAAE,aAAS,SAASC,QAAO,KAAK,KAAK,OAAO;AAAE,aAAO,IAAI,GAAG,IAAI;AAAA,IAAO;A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AAS,OAAO;AAChB,uBAAO,KAAK,UAAU,QAAQ;AAAA,cAChC,KAAK;AACH,qBAAK,OAAO;AACZ,2BAAW,iBAAiB;AAC5B,qBAAK,MAAM,IAAI,IAAI,QAAQ;AAC3B,qBAAK,OAAO,YAAY;AAAA,kBACtB,QAAQ;AAAA,kBACR;AAAA,kBACA,MAAM,CAAC,KAAK;AAAA,gBACd,CAAC;AACD,uBAAO,SAAS,OAAO,UAAU,QAAQ;AAAA,cAC3C,KAAK;AAAA,cACL,KAAK;AACH,uBAAO,SAAS,KAAK;AAAA,YACzB;AAAA,UACF;AAAA,QACF,GAAG,SAAS,IAAI;AAAA,MAClB,CAAC,CAAC;AACF,eAAS,KAAK,IAAI;AAChB,eAAO,MAAM,MAAM,MAAM,SAAS;AAAA,MACpC;AACA,aAAO;AAAA,IACT,EAAE;AAAA,EACJ,CAAC,CAAC;AACF,SAAOA;AACT,EAAE;AACF,SAAS,mBAAmB;AAC1B,MAAI;AACJ,MAAI,IAAI,IAAI,QAAQ,SAAU,SAAS;AACrC,QAAI;AAAA,EACN,CAAC;AACD,IAAE,UAAU,WAAY;AACtB,WAAO,EAAE,MAAM,QAAQ,SAAS;AAAA,EAClC;AACA,SAAO;AACT;","names":["obj","_regeneratorRuntime","define","value","next","key","JsonDiffWorker"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/core",
3
3
  "description": "headless rich text editor",
4
- "version": "3.0.0-beta.19",
4
+ "version": "3.0.0-beta.21",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -52,10 +52,12 @@
52
52
  "jsx-dev-runtime"
53
53
  ],
54
54
  "devDependencies": {
55
- "@tiptap/pm": "3.0.0-beta.19"
55
+ "@types/prosemirror-dev-tools": "^3.0.6",
56
+ "prosemirror-dev-tools": "^4.2.0",
57
+ "@tiptap/pm": "3.0.0-beta.21"
56
58
  },
57
59
  "peerDependencies": {
58
- "@tiptap/pm": "3.0.0-beta.19"
60
+ "@tiptap/pm": "3.0.0-beta.21"
59
61
  },
60
62
  "repository": {
61
63
  "type": "git",
package/src/Editor.ts CHANGED
@@ -92,6 +92,7 @@ export class Editor extends EventEmitter<EditorEvents> {
92
92
  enablePasteRules: true,
93
93
  enableCoreExtensions: true,
94
94
  enableContentCheck: false,
95
+ enableDevTools: false,
95
96
  emitContentError: false,
96
97
  onBeforeCreate: () => null,
97
98
  onCreate: () => null,
@@ -186,6 +187,43 @@ export class Editor extends EventEmitter<EditorEvents> {
186
187
  this.css = null
187
188
  }
188
189
 
190
+ /**
191
+ *
192
+ * @returns
193
+ */
194
+ /**
195
+ * Applies ProseMirror dev tools to the editor instance if enabled and running in a browser environment.
196
+ *
197
+ * This method dynamically imports the `prosemirror-dev-tools` package and applies it to the current
198
+ * editor view. If the dev tools are not installed, a warning is logged to the console.
199
+ *
200
+ * @private
201
+ * @remarks
202
+ * - Dev tools are only applied if `this.options.enableDevTools` is `true` and the code is running in a browser.
203
+ * - If the editor view is not available, the dev tools are not applied.
204
+ * - If the `prosemirror-dev-tools` package is missing, a warning is shown in the console.
205
+ *
206
+ * @returns {void}
207
+ */
208
+ private applyDevTools(): void {
209
+ if (typeof window === 'undefined' || !this.options.enableDevTools) {
210
+ return
211
+ }
212
+
213
+ import('prosemirror-dev-tools')
214
+ .then(({ default: apply }) => {
215
+ if (!this.editorView) {
216
+ return
217
+ }
218
+
219
+ apply(this.editorView)
220
+ })
221
+ .catch(() => {
222
+ console.warn('[Tiptap warning]: Devtools are enabled but `prosemirror-dev-tools` is not installed.')
223
+ console.warn("Install 'prosemirror-dev-tools' as a dev dependency to use the dev tools.")
224
+ })
225
+ }
226
+
189
227
  /**
190
228
  * Returns the editor storage.
191
229
  */
@@ -489,6 +527,11 @@ export class Editor extends EventEmitter<EditorEvents> {
489
527
  state: this.editorState,
490
528
  })
491
529
 
530
+ // Apply dev tools if enabled
531
+ if (this.options.enableDevTools) {
532
+ this.applyDevTools()
533
+ }
534
+
492
535
  // `editor.view` is not yet available at this time.
493
536
  // Therefore we will add all plugins and node views directly afterwards.
494
537
  const newState = this.state.reconfigure({
@@ -30,7 +30,7 @@ export const cut: RawCommands['cut'] =
30
30
 
31
31
  tr.insert(newPos, contentSlice.content)
32
32
 
33
- tr.setSelection(new TextSelection(tr.doc.resolve(newPos - 1)))
33
+ tr.setSelection(new TextSelection(tr.doc.resolve(Math.max(newPos - 1, 0))))
34
34
 
35
35
  return true
36
36
  }
package/src/types.ts CHANGED
@@ -363,6 +363,18 @@ export interface EditorOptions {
363
363
  * @default false
364
364
  */
365
365
  emitContentError: boolean
366
+ /**
367
+ * Enable a lazy-loaded Prosemirror DevTools integration.
368
+ *
369
+ * Requires having the `prosemirror-dev-tools` npm package installed.
370
+ * @type boolean
371
+ * @default false
372
+ * @example
373
+ * ```js
374
+ * enableDevTools: true
375
+ * ```
376
+ */
377
+ enableDevTools: boolean
366
378
  /**
367
379
  * Called before the editor is constructed.
368
380
  */