@bagelink/vue 0.0.589 → 0.0.596
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/components/Drop.vue.d.ts +34 -0
- package/dist/components/Drop.vue.d.ts.map +1 -0
- package/dist/components/FileUploader.vue.d.ts +60 -0
- package/dist/components/FileUploader.vue.d.ts.map +1 -0
- package/dist/components/form/ItemRef.vue.d.ts +1 -0
- package/dist/components/form/ItemRef.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectField.vue.d.ts +1 -4
- package/dist/components/form/inputs/SelectField.vue.d.ts.map +1 -1
- package/dist/index.cjs +649 -424
- package/dist/index.mjs +649 -424
- package/package.json +11 -11
- package/dist/components/Popover.vue.d.ts +0 -10
- package/dist/components/Popover.vue.d.ts.map +0 -1
- package/dist/types/materialIcon.d.ts +0 -2
- package/dist/types/materialIcon.d.ts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -110,12 +110,21 @@ function getPaddingObject(padding) {
|
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
112
|
function rectToClientRect$1(rect) {
|
|
113
|
+
const {
|
|
114
|
+
x: x2,
|
|
115
|
+
y: y2,
|
|
116
|
+
width,
|
|
117
|
+
height
|
|
118
|
+
} = rect;
|
|
113
119
|
return {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
width,
|
|
121
|
+
height,
|
|
122
|
+
top: y2,
|
|
123
|
+
left: x2,
|
|
124
|
+
right: x2 + width,
|
|
125
|
+
bottom: y2 + height,
|
|
126
|
+
x: x2,
|
|
127
|
+
y: y2
|
|
119
128
|
};
|
|
120
129
|
}
|
|
121
130
|
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
@@ -286,9 +295,10 @@ async function detectOverflow$1(state2, options) {
|
|
|
286
295
|
strategy
|
|
287
296
|
}));
|
|
288
297
|
const rect = elementContext === "floating" ? {
|
|
289
|
-
...rects.floating,
|
|
290
298
|
x: x2,
|
|
291
|
-
y: y2
|
|
299
|
+
y: y2,
|
|
300
|
+
width: rects.floating.width,
|
|
301
|
+
height: rects.floating.height
|
|
292
302
|
} : rects.reference;
|
|
293
303
|
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
294
304
|
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
@@ -499,10 +509,12 @@ const flip$2 = function(options) {
|
|
|
499
509
|
return {};
|
|
500
510
|
}
|
|
501
511
|
const side = getSide$1(placement);
|
|
512
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
502
513
|
const isBasePlacement = getSide$1(initialPlacement) === initialPlacement;
|
|
503
514
|
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
504
515
|
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement$1(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
505
|
-
|
|
516
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
|
|
517
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
506
518
|
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
507
519
|
}
|
|
508
520
|
const placements2 = [initialPlacement, ...fallbackPlacements];
|
|
@@ -539,8 +551,16 @@ const flip$2 = function(options) {
|
|
|
539
551
|
if (!resetPlacement) {
|
|
540
552
|
switch (fallbackStrategy) {
|
|
541
553
|
case "bestFit": {
|
|
542
|
-
var _overflowsData$
|
|
543
|
-
const placement2 = (_overflowsData$
|
|
554
|
+
var _overflowsData$filter2;
|
|
555
|
+
const placement2 = (_overflowsData$filter2 = overflowsData.filter((d2) => {
|
|
556
|
+
if (hasFallbackAxisSideDirection) {
|
|
557
|
+
const currentSideAxis = getSideAxis(d2.placement);
|
|
558
|
+
return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
|
|
559
|
+
// reading directions favoring greater width.
|
|
560
|
+
currentSideAxis === "y";
|
|
561
|
+
}
|
|
562
|
+
return true;
|
|
563
|
+
}).map((d2) => [d2.placement, d2.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a2, b2) => a2[1] - b2[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
544
564
|
if (placement2) {
|
|
545
565
|
resetPlacement = placement2;
|
|
546
566
|
}
|
|
@@ -735,16 +755,16 @@ const size = function(options) {
|
|
|
735
755
|
widthSide = side;
|
|
736
756
|
heightSide = alignment === "end" ? "top" : "bottom";
|
|
737
757
|
}
|
|
738
|
-
const
|
|
739
|
-
const
|
|
758
|
+
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
759
|
+
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
760
|
+
const overflowAvailableHeight = min$3(height - overflow[heightSide], maximumClippingHeight);
|
|
761
|
+
const overflowAvailableWidth = min$3(width - overflow[widthSide], maximumClippingWidth);
|
|
740
762
|
const noShift = !state2.middlewareData.shift;
|
|
741
763
|
let availableHeight = overflowAvailableHeight;
|
|
742
764
|
let availableWidth = overflowAvailableWidth;
|
|
743
765
|
if (isYAxis) {
|
|
744
|
-
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
745
766
|
availableWidth = alignment || noShift ? min$3(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
|
|
746
767
|
} else {
|
|
747
|
-
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
748
768
|
availableHeight = alignment || noShift ? min$3(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
|
|
749
769
|
}
|
|
750
770
|
if (noShift && !alignment) {
|
|
@@ -3381,7 +3401,6 @@ const defaults$1 = {
|
|
|
3381
3401
|
utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
|
|
3382
3402
|
defaults$1.headers[method] = {};
|
|
3383
3403
|
});
|
|
3384
|
-
const defaults$2 = defaults$1;
|
|
3385
3404
|
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
3386
3405
|
"age",
|
|
3387
3406
|
"authorization",
|
|
@@ -3643,11 +3662,10 @@ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
|
|
3643
3662
|
};
|
|
3644
3663
|
});
|
|
3645
3664
|
utils$1.freezeMethods(AxiosHeaders);
|
|
3646
|
-
const AxiosHeaders$1 = AxiosHeaders;
|
|
3647
3665
|
function transformData(fns, response) {
|
|
3648
|
-
const config = this || defaults$
|
|
3666
|
+
const config = this || defaults$1;
|
|
3649
3667
|
const context = response || config;
|
|
3650
|
-
const headers = AxiosHeaders
|
|
3668
|
+
const headers = AxiosHeaders.from(context.headers);
|
|
3651
3669
|
let data2 = context.data;
|
|
3652
3670
|
utils$1.forEach(fns, function transform(fn3) {
|
|
3653
3671
|
data2 = fn3.call(config, data2, headers.normalize(), response ? response.status : void 0);
|
|
@@ -3846,7 +3864,7 @@ function buildFullPath(baseURL, requestedURL) {
|
|
|
3846
3864
|
}
|
|
3847
3865
|
return requestedURL;
|
|
3848
3866
|
}
|
|
3849
|
-
const headersToObject = (thing) => thing instanceof AxiosHeaders
|
|
3867
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
|
|
3850
3868
|
function mergeConfig(config1, config2) {
|
|
3851
3869
|
config2 = config2 || {};
|
|
3852
3870
|
const config = {};
|
|
@@ -3927,7 +3945,7 @@ function mergeConfig(config1, config2) {
|
|
|
3927
3945
|
const resolveConfig = (config) => {
|
|
3928
3946
|
const newConfig = mergeConfig({}, config);
|
|
3929
3947
|
let { data: data2, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
3930
|
-
newConfig.headers = headers = AxiosHeaders
|
|
3948
|
+
newConfig.headers = headers = AxiosHeaders.from(headers);
|
|
3931
3949
|
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
|
|
3932
3950
|
if (auth) {
|
|
3933
3951
|
headers.set(
|
|
@@ -3960,7 +3978,7 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
|
|
|
3960
3978
|
return new Promise(function dispatchXhrRequest(resolve, reject3) {
|
|
3961
3979
|
const _config = resolveConfig(config);
|
|
3962
3980
|
let requestData = _config.data;
|
|
3963
|
-
const requestHeaders = AxiosHeaders
|
|
3981
|
+
const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
|
|
3964
3982
|
let { responseType } = _config;
|
|
3965
3983
|
let onCanceled;
|
|
3966
3984
|
function done() {
|
|
@@ -3978,7 +3996,7 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
|
|
|
3978
3996
|
if (!request) {
|
|
3979
3997
|
return;
|
|
3980
3998
|
}
|
|
3981
|
-
const responseHeaders = AxiosHeaders
|
|
3999
|
+
const responseHeaders = AxiosHeaders.from(
|
|
3982
4000
|
"getAllResponseHeaders" in request && request.getAllResponseHeaders()
|
|
3983
4001
|
);
|
|
3984
4002
|
const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
|
|
@@ -4294,7 +4312,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
|
|
|
4294
4312
|
return await new Promise((resolve, reject3) => {
|
|
4295
4313
|
settle(resolve, reject3, {
|
|
4296
4314
|
data: responseData,
|
|
4297
|
-
headers: AxiosHeaders
|
|
4315
|
+
headers: AxiosHeaders.from(response.headers),
|
|
4298
4316
|
status: response.status,
|
|
4299
4317
|
statusText: response.statusText,
|
|
4300
4318
|
config,
|
|
@@ -4376,7 +4394,7 @@ function throwIfCancellationRequested(config) {
|
|
|
4376
4394
|
}
|
|
4377
4395
|
function dispatchRequest(config) {
|
|
4378
4396
|
throwIfCancellationRequested(config);
|
|
4379
|
-
config.headers = AxiosHeaders
|
|
4397
|
+
config.headers = AxiosHeaders.from(config.headers);
|
|
4380
4398
|
config.data = transformData.call(
|
|
4381
4399
|
config,
|
|
4382
4400
|
config.transformRequest
|
|
@@ -4384,7 +4402,7 @@ function dispatchRequest(config) {
|
|
|
4384
4402
|
if (["post", "put", "patch"].indexOf(config.method) !== -1) {
|
|
4385
4403
|
config.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
4386
4404
|
}
|
|
4387
|
-
const adapter = adapters.getAdapter(config.adapter || defaults$
|
|
4405
|
+
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
|
|
4388
4406
|
return adapter(config).then(function onAdapterResolution(response) {
|
|
4389
4407
|
throwIfCancellationRequested(config);
|
|
4390
4408
|
response.data = transformData.call(
|
|
@@ -4392,7 +4410,7 @@ function dispatchRequest(config) {
|
|
|
4392
4410
|
config.transformResponse,
|
|
4393
4411
|
response
|
|
4394
4412
|
);
|
|
4395
|
-
response.headers = AxiosHeaders
|
|
4413
|
+
response.headers = AxiosHeaders.from(response.headers);
|
|
4396
4414
|
return response;
|
|
4397
4415
|
}, function onAdapterRejection(reason) {
|
|
4398
4416
|
if (!isCancel(reason)) {
|
|
@@ -4403,7 +4421,7 @@ function dispatchRequest(config) {
|
|
|
4403
4421
|
config.transformResponse,
|
|
4404
4422
|
reason.response
|
|
4405
4423
|
);
|
|
4406
|
-
reason.response.headers = AxiosHeaders
|
|
4424
|
+
reason.response.headers = AxiosHeaders.from(reason.response.headers);
|
|
4407
4425
|
}
|
|
4408
4426
|
}
|
|
4409
4427
|
return Promise.reject(reason);
|
|
@@ -4542,7 +4560,7 @@ class Axios {
|
|
|
4542
4560
|
delete headers[method];
|
|
4543
4561
|
}
|
|
4544
4562
|
);
|
|
4545
|
-
config.headers = AxiosHeaders
|
|
4563
|
+
config.headers = AxiosHeaders.concat(contextHeaders, headers);
|
|
4546
4564
|
const requestInterceptorChain = [];
|
|
4547
4565
|
let synchronousRequestInterceptors = true;
|
|
4548
4566
|
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
@@ -4626,7 +4644,6 @@ utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method)
|
|
|
4626
4644
|
Axios.prototype[method] = generateHTTPMethod();
|
|
4627
4645
|
Axios.prototype[method + "Form"] = generateHTTPMethod(true);
|
|
4628
4646
|
});
|
|
4629
|
-
const Axios$1 = Axios;
|
|
4630
4647
|
class CancelToken {
|
|
4631
4648
|
constructor(executor) {
|
|
4632
4649
|
if (typeof executor !== "function") {
|
|
@@ -4713,7 +4730,6 @@ class CancelToken {
|
|
|
4713
4730
|
};
|
|
4714
4731
|
}
|
|
4715
4732
|
}
|
|
4716
|
-
const CancelToken$1 = CancelToken;
|
|
4717
4733
|
function spread(callback) {
|
|
4718
4734
|
return function wrap2(arr) {
|
|
4719
4735
|
return callback.apply(null, arr);
|
|
@@ -4790,21 +4806,20 @@ const HttpStatusCode = {
|
|
|
4790
4806
|
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
|
4791
4807
|
HttpStatusCode[value] = key;
|
|
4792
4808
|
});
|
|
4793
|
-
const HttpStatusCode$1 = HttpStatusCode;
|
|
4794
4809
|
function createInstance(defaultConfig2) {
|
|
4795
|
-
const context = new Axios
|
|
4796
|
-
const instance = bind$2(Axios
|
|
4797
|
-
utils$1.extend(instance, Axios
|
|
4810
|
+
const context = new Axios(defaultConfig2);
|
|
4811
|
+
const instance = bind$2(Axios.prototype.request, context);
|
|
4812
|
+
utils$1.extend(instance, Axios.prototype, context, { allOwnKeys: true });
|
|
4798
4813
|
utils$1.extend(instance, context, null, { allOwnKeys: true });
|
|
4799
4814
|
instance.create = function create(instanceConfig) {
|
|
4800
4815
|
return createInstance(mergeConfig(defaultConfig2, instanceConfig));
|
|
4801
4816
|
};
|
|
4802
4817
|
return instance;
|
|
4803
4818
|
}
|
|
4804
|
-
const axios$1 = createInstance(defaults$
|
|
4805
|
-
axios$1.Axios = Axios
|
|
4819
|
+
const axios$1 = createInstance(defaults$1);
|
|
4820
|
+
axios$1.Axios = Axios;
|
|
4806
4821
|
axios$1.CanceledError = CanceledError;
|
|
4807
|
-
axios$1.CancelToken = CancelToken
|
|
4822
|
+
axios$1.CancelToken = CancelToken;
|
|
4808
4823
|
axios$1.isCancel = isCancel;
|
|
4809
4824
|
axios$1.VERSION = VERSION;
|
|
4810
4825
|
axios$1.toFormData = toFormData;
|
|
@@ -4816,10 +4831,10 @@ axios$1.all = function all(promises) {
|
|
|
4816
4831
|
axios$1.spread = spread;
|
|
4817
4832
|
axios$1.isAxiosError = isAxiosError;
|
|
4818
4833
|
axios$1.mergeConfig = mergeConfig;
|
|
4819
|
-
axios$1.AxiosHeaders = AxiosHeaders
|
|
4834
|
+
axios$1.AxiosHeaders = AxiosHeaders;
|
|
4820
4835
|
axios$1.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
4821
4836
|
axios$1.getAdapter = adapters.getAdapter;
|
|
4822
|
-
axios$1.HttpStatusCode = HttpStatusCode
|
|
4837
|
+
axios$1.HttpStatusCode = HttpStatusCode;
|
|
4823
4838
|
axios$1.default = axios$1;
|
|
4824
4839
|
var __defProp = Object.defineProperty;
|
|
4825
4840
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -5063,7 +5078,10 @@ class Bagel {
|
|
|
5063
5078
|
this._setAuthorization();
|
|
5064
5079
|
const formData = new FormData();
|
|
5065
5080
|
formData.append("file", file);
|
|
5066
|
-
|
|
5081
|
+
let url = "/static_files/upload";
|
|
5082
|
+
if (options == null ? void 0 : options.topic)
|
|
5083
|
+
url = `/static_files/upload?topic=${options.topic}`;
|
|
5084
|
+
const { data: data2 } = await axios.post(url, formData, {
|
|
5067
5085
|
headers: {
|
|
5068
5086
|
"Content-Type": "multipart/form-data"
|
|
5069
5087
|
},
|
|
@@ -6032,7 +6050,7 @@ function toValue(r2) {
|
|
|
6032
6050
|
const isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
6033
6051
|
typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
6034
6052
|
function getLifeCycleTarget(target) {
|
|
6035
|
-
return
|
|
6053
|
+
return getCurrentInstance();
|
|
6036
6054
|
}
|
|
6037
6055
|
function tryOnMounted(fn3, sync = true, target) {
|
|
6038
6056
|
const instance = getLifeCycleTarget();
|
|
@@ -17268,12 +17286,7 @@ function eachDayOfInterval(interval, options) {
|
|
|
17268
17286
|
const endTime = reversed ? +startDate : +endDate;
|
|
17269
17287
|
const currentDate = reversed ? endDate : startDate;
|
|
17270
17288
|
currentDate.setHours(0, 0, 0, 0);
|
|
17271
|
-
let step =
|
|
17272
|
-
if (!step) return [];
|
|
17273
|
-
if (step < 0) {
|
|
17274
|
-
step = -step;
|
|
17275
|
-
reversed = !reversed;
|
|
17276
|
-
}
|
|
17289
|
+
let step = 1;
|
|
17277
17290
|
const dates = [];
|
|
17278
17291
|
while (+currentDate <= endTime) {
|
|
17279
17292
|
dates.push(toDate(currentDate));
|
|
@@ -17296,12 +17309,7 @@ function eachQuarterOfInterval(interval, options) {
|
|
|
17296
17309
|
let reversed = +startDate > +endDate;
|
|
17297
17310
|
const endTime = reversed ? +startOfQuarter(startDate) : +startOfQuarter(endDate);
|
|
17298
17311
|
let currentDate = reversed ? startOfQuarter(endDate) : startOfQuarter(startDate);
|
|
17299
|
-
let step =
|
|
17300
|
-
if (!step) return [];
|
|
17301
|
-
if (step < 0) {
|
|
17302
|
-
step = -step;
|
|
17303
|
-
reversed = !reversed;
|
|
17304
|
-
}
|
|
17312
|
+
let step = 1;
|
|
17305
17313
|
const dates = [];
|
|
17306
17314
|
while (+currentDate <= endTime) {
|
|
17307
17315
|
dates.push(toDate(currentDate));
|
|
@@ -26147,10 +26155,8 @@ function isScrolledPast(el, elSide, parentSide) {
|
|
|
26147
26155
|
var parent = getParentAutoScrollElement(el, true), elSideVal = getRect(el)[elSide];
|
|
26148
26156
|
while (parent) {
|
|
26149
26157
|
var parentSideVal = getRect(parent)[parentSide], visible = void 0;
|
|
26150
|
-
|
|
26158
|
+
{
|
|
26151
26159
|
visible = elSideVal >= parentSideVal;
|
|
26152
|
-
} else {
|
|
26153
|
-
visible = elSideVal <= parentSideVal;
|
|
26154
26160
|
}
|
|
26155
26161
|
if (!visible) return parent;
|
|
26156
26162
|
if (parent === getWindowScrollingElement()) break;
|
|
@@ -29525,7 +29531,7 @@ class Fragment {
|
|
|
29525
29531
|
/**
|
|
29526
29532
|
Find the index and inner offset corresponding to a given relative
|
|
29527
29533
|
position in this fragment. The result object will be reused
|
|
29528
|
-
(overwritten) the next time the function is called.
|
|
29534
|
+
(overwritten) the next time the function is called. @internal
|
|
29529
29535
|
*/
|
|
29530
29536
|
findIndex(pos, round2 = -1) {
|
|
29531
29537
|
if (pos == 0)
|
|
@@ -29731,7 +29737,9 @@ let Mark$1 = class Mark2 {
|
|
|
29731
29737
|
let type3 = schema.marks[json.type];
|
|
29732
29738
|
if (!type3)
|
|
29733
29739
|
throw new RangeError(`There is no mark type ${json.type} in this schema`);
|
|
29734
|
-
|
|
29740
|
+
let mark = type3.create(json.attrs);
|
|
29741
|
+
type3.checkAttrs(mark.attrs);
|
|
29742
|
+
return mark;
|
|
29735
29743
|
}
|
|
29736
29744
|
/**
|
|
29737
29745
|
Test whether two sets of marks are identical.
|
|
@@ -29865,8 +29873,6 @@ function removeRange(content, from2, to2) {
|
|
|
29865
29873
|
function insertInto(content, dist, insert, parent) {
|
|
29866
29874
|
let { index: index2, offset: offset2 } = content.findIndex(dist), child = content.maybeChild(index2);
|
|
29867
29875
|
if (offset2 == dist || child.isText) {
|
|
29868
|
-
if (parent && !parent.canReplace(index2, index2, insert))
|
|
29869
|
-
return null;
|
|
29870
29876
|
return content.cut(0, dist).append(insert).append(content.cut(dist));
|
|
29871
29877
|
}
|
|
29872
29878
|
let inner = insertInto(child.content, dist - offset2 - 1, insert);
|
|
@@ -30228,17 +30234,28 @@ class ResolvedPos {
|
|
|
30228
30234
|
@internal
|
|
30229
30235
|
*/
|
|
30230
30236
|
static resolveCached(doc2, pos) {
|
|
30231
|
-
|
|
30232
|
-
|
|
30233
|
-
|
|
30234
|
-
|
|
30237
|
+
let cache = resolveCache.get(doc2);
|
|
30238
|
+
if (cache) {
|
|
30239
|
+
for (let i2 = 0; i2 < cache.elts.length; i2++) {
|
|
30240
|
+
let elt = cache.elts[i2];
|
|
30241
|
+
if (elt.pos == pos)
|
|
30242
|
+
return elt;
|
|
30243
|
+
}
|
|
30244
|
+
} else {
|
|
30245
|
+
resolveCache.set(doc2, cache = new ResolveCache());
|
|
30235
30246
|
}
|
|
30236
|
-
let result2 =
|
|
30237
|
-
|
|
30247
|
+
let result2 = cache.elts[cache.i] = ResolvedPos.resolve(doc2, pos);
|
|
30248
|
+
cache.i = (cache.i + 1) % resolveCacheSize;
|
|
30238
30249
|
return result2;
|
|
30239
30250
|
}
|
|
30240
30251
|
}
|
|
30241
|
-
|
|
30252
|
+
class ResolveCache {
|
|
30253
|
+
constructor() {
|
|
30254
|
+
this.elts = [];
|
|
30255
|
+
this.i = 0;
|
|
30256
|
+
}
|
|
30257
|
+
}
|
|
30258
|
+
const resolveCacheSize = 12, resolveCache = /* @__PURE__ */ new WeakMap();
|
|
30242
30259
|
class NodeRange {
|
|
30243
30260
|
/**
|
|
30244
30261
|
Construct a node range. `$from` and `$to` should point into the
|
|
@@ -30624,13 +30641,17 @@ let Node$3 = class Node2 {
|
|
|
30624
30641
|
}
|
|
30625
30642
|
/**
|
|
30626
30643
|
Check whether this node and its descendants conform to the
|
|
30627
|
-
schema, and raise
|
|
30644
|
+
schema, and raise an exception when they do not.
|
|
30628
30645
|
*/
|
|
30629
30646
|
check() {
|
|
30630
30647
|
this.type.checkContent(this.content);
|
|
30648
|
+
this.type.checkAttrs(this.attrs);
|
|
30631
30649
|
let copy2 = Mark$1.none;
|
|
30632
|
-
for (let i2 = 0; i2 < this.marks.length; i2++)
|
|
30633
|
-
|
|
30650
|
+
for (let i2 = 0; i2 < this.marks.length; i2++) {
|
|
30651
|
+
let mark = this.marks[i2];
|
|
30652
|
+
mark.type.checkAttrs(mark.attrs);
|
|
30653
|
+
copy2 = mark.addToSet(copy2);
|
|
30654
|
+
}
|
|
30634
30655
|
if (!Mark$1.sameSet(copy2, this.marks))
|
|
30635
30656
|
throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m2) => m2.type.name)}`);
|
|
30636
30657
|
this.content.forEach((node) => node.check());
|
|
@@ -30656,7 +30677,7 @@ let Node$3 = class Node2 {
|
|
|
30656
30677
|
static fromJSON(schema, json) {
|
|
30657
30678
|
if (!json)
|
|
30658
30679
|
throw new RangeError("Invalid input for Node.fromJSON");
|
|
30659
|
-
let marks =
|
|
30680
|
+
let marks = void 0;
|
|
30660
30681
|
if (json.marks) {
|
|
30661
30682
|
if (!Array.isArray(json.marks))
|
|
30662
30683
|
throw new RangeError("Invalid mark data for Node.fromJSON");
|
|
@@ -30668,7 +30689,9 @@ let Node$3 = class Node2 {
|
|
|
30668
30689
|
return schema.text(json.text, marks);
|
|
30669
30690
|
}
|
|
30670
30691
|
let content = Fragment.fromJSON(schema, json.content);
|
|
30671
|
-
|
|
30692
|
+
let node = schema.nodeType(json.type).create(json.attrs, content, marks);
|
|
30693
|
+
node.type.checkAttrs(node.attrs);
|
|
30694
|
+
return node;
|
|
30672
30695
|
}
|
|
30673
30696
|
};
|
|
30674
30697
|
Node$3.prototype.text = void 0;
|
|
@@ -31150,6 +31173,16 @@ function computeAttrs(attrs, value) {
|
|
|
31150
31173
|
}
|
|
31151
31174
|
return built;
|
|
31152
31175
|
}
|
|
31176
|
+
function checkAttrs(attrs, values3, type3, name) {
|
|
31177
|
+
for (let name2 in values3)
|
|
31178
|
+
if (!(name2 in attrs))
|
|
31179
|
+
throw new RangeError(`Unsupported attribute ${name2} for ${type3} of type ${name2}`);
|
|
31180
|
+
for (let name2 in attrs) {
|
|
31181
|
+
let attr = attrs[name2];
|
|
31182
|
+
if (attr.validate)
|
|
31183
|
+
attr.validate(values3[name2]);
|
|
31184
|
+
}
|
|
31185
|
+
}
|
|
31153
31186
|
function initAttrs(attrs) {
|
|
31154
31187
|
let result2 = /* @__PURE__ */ Object.create(null);
|
|
31155
31188
|
if (attrs)
|
|
@@ -31279,7 +31312,7 @@ let NodeType$1 = class NodeType2 {
|
|
|
31279
31312
|
}
|
|
31280
31313
|
/**
|
|
31281
31314
|
Returns true if the given fragment is valid content for this node
|
|
31282
|
-
type
|
|
31315
|
+
type.
|
|
31283
31316
|
*/
|
|
31284
31317
|
validContent(content) {
|
|
31285
31318
|
let result2 = this.contentMatch.matchFragment(content);
|
|
@@ -31300,6 +31333,12 @@ let NodeType$1 = class NodeType2 {
|
|
|
31300
31333
|
throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);
|
|
31301
31334
|
}
|
|
31302
31335
|
/**
|
|
31336
|
+
@internal
|
|
31337
|
+
*/
|
|
31338
|
+
checkAttrs(attrs) {
|
|
31339
|
+
checkAttrs(this.attrs, attrs, "node", this.name);
|
|
31340
|
+
}
|
|
31341
|
+
/**
|
|
31303
31342
|
Check whether the given mark type is allowed in this node.
|
|
31304
31343
|
*/
|
|
31305
31344
|
allowsMarkType(markType) {
|
|
@@ -31349,10 +31388,19 @@ let NodeType$1 = class NodeType2 {
|
|
|
31349
31388
|
return result2;
|
|
31350
31389
|
}
|
|
31351
31390
|
};
|
|
31391
|
+
function validateType(type3) {
|
|
31392
|
+
let types = type3.split("|");
|
|
31393
|
+
return (value) => {
|
|
31394
|
+
let name = value === null ? "null" : typeof value;
|
|
31395
|
+
if (types.indexOf(name) < 0)
|
|
31396
|
+
throw new RangeError(`Expected value of type ${types}, got ${name}`);
|
|
31397
|
+
};
|
|
31398
|
+
}
|
|
31352
31399
|
class Attribute {
|
|
31353
31400
|
constructor(options) {
|
|
31354
31401
|
this.hasDefault = Object.prototype.hasOwnProperty.call(options, "default");
|
|
31355
31402
|
this.default = options.default;
|
|
31403
|
+
this.validate = typeof options.validate == "string" ? validateType(options.validate) : options.validate;
|
|
31356
31404
|
}
|
|
31357
31405
|
get isRequired() {
|
|
31358
31406
|
return !this.hasDefault;
|
|
@@ -31411,6 +31459,12 @@ class MarkType {
|
|
|
31411
31459
|
return set2[i2];
|
|
31412
31460
|
}
|
|
31413
31461
|
/**
|
|
31462
|
+
@internal
|
|
31463
|
+
*/
|
|
31464
|
+
checkAttrs(attrs) {
|
|
31465
|
+
checkAttrs(this.attrs, attrs, "mark", this.name);
|
|
31466
|
+
}
|
|
31467
|
+
/**
|
|
31414
31468
|
Queries whether a given mark type is
|
|
31415
31469
|
[excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.
|
|
31416
31470
|
*/
|
|
@@ -31423,6 +31477,7 @@ class Schema {
|
|
|
31423
31477
|
Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
|
|
31424
31478
|
*/
|
|
31425
31479
|
constructor(spec) {
|
|
31480
|
+
this.linebreakReplacement = null;
|
|
31426
31481
|
this.cached = /* @__PURE__ */ Object.create(null);
|
|
31427
31482
|
let instanceSpec = this.spec = {};
|
|
31428
31483
|
for (let prop3 in spec)
|
|
@@ -31436,6 +31491,13 @@ class Schema {
|
|
|
31436
31491
|
let type3 = this.nodes[prop3], contentExpr = type3.spec.content || "", markExpr = type3.spec.marks;
|
|
31437
31492
|
type3.contentMatch = contentExprCache[contentExpr] || (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));
|
|
31438
31493
|
type3.inlineContent = type3.contentMatch.inlineContent;
|
|
31494
|
+
if (type3.spec.linebreakReplacement) {
|
|
31495
|
+
if (this.linebreakReplacement)
|
|
31496
|
+
throw new RangeError("Multiple linebreak nodes defined");
|
|
31497
|
+
if (!type3.isInline || !type3.isLeaf)
|
|
31498
|
+
throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
|
|
31499
|
+
this.linebreakReplacement = type3;
|
|
31500
|
+
}
|
|
31439
31501
|
type3.markSet = markExpr == "_" ? null : markExpr ? gatherMarks(this, markExpr.split(" ")) : markExpr == "" || !type3.inlineContent ? [] : null;
|
|
31440
31502
|
}
|
|
31441
31503
|
for (let prop3 in this.marks) {
|
|
@@ -31520,6 +31582,12 @@ function gatherMarks(schema, marks) {
|
|
|
31520
31582
|
}
|
|
31521
31583
|
return found2;
|
|
31522
31584
|
}
|
|
31585
|
+
function isTagRule(rule) {
|
|
31586
|
+
return rule.tag != null;
|
|
31587
|
+
}
|
|
31588
|
+
function isStyleRule(rule) {
|
|
31589
|
+
return rule.style != null;
|
|
31590
|
+
}
|
|
31523
31591
|
class DOMParser {
|
|
31524
31592
|
/**
|
|
31525
31593
|
Create a parser that targets the given schema, using the given
|
|
@@ -31530,11 +31598,16 @@ class DOMParser {
|
|
|
31530
31598
|
this.rules = rules;
|
|
31531
31599
|
this.tags = [];
|
|
31532
31600
|
this.styles = [];
|
|
31601
|
+
let matchedStyles = this.matchedStyles = [];
|
|
31533
31602
|
rules.forEach((rule) => {
|
|
31534
|
-
if (rule
|
|
31603
|
+
if (isTagRule(rule)) {
|
|
31535
31604
|
this.tags.push(rule);
|
|
31536
|
-
else if (rule
|
|
31605
|
+
} else if (isStyleRule(rule)) {
|
|
31606
|
+
let prop3 = /[^=]*/.exec(rule.style)[0];
|
|
31607
|
+
if (matchedStyles.indexOf(prop3) < 0)
|
|
31608
|
+
matchedStyles.push(prop3);
|
|
31537
31609
|
this.styles.push(rule);
|
|
31610
|
+
}
|
|
31538
31611
|
});
|
|
31539
31612
|
this.normalizeLists = !this.tags.some((r2) => {
|
|
31540
31613
|
if (!/^(ul|ol)\b/.test(r2.tag) || !r2.node)
|
|
@@ -31794,10 +31867,10 @@ class ParseContext {
|
|
|
31794
31867
|
this.addElement(dom);
|
|
31795
31868
|
}
|
|
31796
31869
|
withStyleRules(dom, f2) {
|
|
31797
|
-
let style2 = dom.
|
|
31798
|
-
if (!style2)
|
|
31870
|
+
let style2 = dom.style;
|
|
31871
|
+
if (!style2 || !style2.length)
|
|
31799
31872
|
return f2();
|
|
31800
|
-
let marks = this.readStyles(
|
|
31873
|
+
let marks = this.readStyles(dom.style);
|
|
31801
31874
|
if (!marks)
|
|
31802
31875
|
return;
|
|
31803
31876
|
let [addMarks, removeMarks] = marks, top2 = this.top;
|
|
@@ -31891,27 +31964,30 @@ class ParseContext {
|
|
|
31891
31964
|
// had a rule with `ignore` set.
|
|
31892
31965
|
readStyles(styles) {
|
|
31893
31966
|
let add2 = Mark$1.none, remove2 = Mark$1.none;
|
|
31894
|
-
|
|
31895
|
-
for (let
|
|
31896
|
-
let
|
|
31897
|
-
if (
|
|
31898
|
-
|
|
31899
|
-
|
|
31900
|
-
|
|
31901
|
-
|
|
31902
|
-
|
|
31903
|
-
|
|
31904
|
-
|
|
31905
|
-
|
|
31906
|
-
|
|
31907
|
-
|
|
31908
|
-
|
|
31909
|
-
|
|
31910
|
-
|
|
31911
|
-
|
|
31912
|
-
|
|
31967
|
+
if (styles.length)
|
|
31968
|
+
for (let i2 = 0; i2 < this.parser.matchedStyles.length; i2++) {
|
|
31969
|
+
let name = this.parser.matchedStyles[i2], value = styles.getPropertyValue(name);
|
|
31970
|
+
if (value)
|
|
31971
|
+
for (let after = void 0; ; ) {
|
|
31972
|
+
let rule = this.parser.matchStyle(name, value, this, after);
|
|
31973
|
+
if (!rule)
|
|
31974
|
+
break;
|
|
31975
|
+
if (rule.ignore)
|
|
31976
|
+
return null;
|
|
31977
|
+
if (rule.clearMark) {
|
|
31978
|
+
this.top.pendingMarks.concat(this.top.activeMarks).forEach((m2) => {
|
|
31979
|
+
if (rule.clearMark(m2))
|
|
31980
|
+
remove2 = m2.addToSet(remove2);
|
|
31981
|
+
});
|
|
31982
|
+
} else {
|
|
31983
|
+
add2 = this.parser.schema.marks[rule.mark].create(rule.attrs).addToSet(add2);
|
|
31984
|
+
}
|
|
31985
|
+
if (rule.consuming === false)
|
|
31986
|
+
after = rule;
|
|
31987
|
+
else
|
|
31988
|
+
break;
|
|
31989
|
+
}
|
|
31913
31990
|
}
|
|
31914
|
-
}
|
|
31915
31991
|
return [add2, remove2];
|
|
31916
31992
|
}
|
|
31917
31993
|
// Look up a handler for the given node. If none are found, return
|
|
@@ -32180,12 +32256,6 @@ function normalizeList(dom) {
|
|
|
32180
32256
|
function matches(dom, selector2) {
|
|
32181
32257
|
return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector2);
|
|
32182
32258
|
}
|
|
32183
|
-
function parseStyles(style2) {
|
|
32184
|
-
let re2 = /\s*([\w-]+)\s*:\s*([^;]+)/g, m2, result2 = [];
|
|
32185
|
-
while (m2 = re2.exec(style2))
|
|
32186
|
-
result2.push(m2[1], m2[2].trim());
|
|
32187
|
-
return result2;
|
|
32188
|
-
}
|
|
32189
32259
|
function copy$2(obj) {
|
|
32190
32260
|
let copy2 = {};
|
|
32191
32261
|
for (let prop3 in obj)
|
|
@@ -32276,7 +32346,7 @@ class DOMSerializer {
|
|
|
32276
32346
|
@internal
|
|
32277
32347
|
*/
|
|
32278
32348
|
serializeNodeInner(node, options) {
|
|
32279
|
-
let { dom, contentDOM } =
|
|
32349
|
+
let { dom, contentDOM } = renderSpec(doc$1(options), this.nodes[node.type.name](node), null, node.attrs);
|
|
32280
32350
|
if (contentDOM) {
|
|
32281
32351
|
if (node.isLeaf)
|
|
32282
32352
|
throw new RangeError("Content hole not allowed in a leaf node spec");
|
|
@@ -32307,7 +32377,7 @@ class DOMSerializer {
|
|
|
32307
32377
|
*/
|
|
32308
32378
|
serializeMark(mark, inline, options = {}) {
|
|
32309
32379
|
let toDOM = this.marks[mark.type.name];
|
|
32310
|
-
return toDOM &&
|
|
32380
|
+
return toDOM && renderSpec(doc$1(options), toDOM(mark, inline), null, mark.attrs);
|
|
32311
32381
|
}
|
|
32312
32382
|
/**
|
|
32313
32383
|
Render an [output spec](https://prosemirror.net/docs/ref/#model.DOMOutputSpec) to a DOM node. If
|
|
@@ -32315,48 +32385,7 @@ class DOMSerializer {
|
|
|
32315
32385
|
node with the hole.
|
|
32316
32386
|
*/
|
|
32317
32387
|
static renderSpec(doc2, structure, xmlNS = null) {
|
|
32318
|
-
|
|
32319
|
-
return { dom: doc2.createTextNode(structure) };
|
|
32320
|
-
if (structure.nodeType != null)
|
|
32321
|
-
return { dom: structure };
|
|
32322
|
-
if (structure.dom && structure.dom.nodeType != null)
|
|
32323
|
-
return structure;
|
|
32324
|
-
let tagName = structure[0], space = tagName.indexOf(" ");
|
|
32325
|
-
if (space > 0) {
|
|
32326
|
-
xmlNS = tagName.slice(0, space);
|
|
32327
|
-
tagName = tagName.slice(space + 1);
|
|
32328
|
-
}
|
|
32329
|
-
let contentDOM;
|
|
32330
|
-
let dom = xmlNS ? doc2.createElementNS(xmlNS, tagName) : doc2.createElement(tagName);
|
|
32331
|
-
let attrs = structure[1], start2 = 1;
|
|
32332
|
-
if (attrs && typeof attrs == "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
|
|
32333
|
-
start2 = 2;
|
|
32334
|
-
for (let name in attrs)
|
|
32335
|
-
if (attrs[name] != null) {
|
|
32336
|
-
let space2 = name.indexOf(" ");
|
|
32337
|
-
if (space2 > 0)
|
|
32338
|
-
dom.setAttributeNS(name.slice(0, space2), name.slice(space2 + 1), attrs[name]);
|
|
32339
|
-
else
|
|
32340
|
-
dom.setAttribute(name, attrs[name]);
|
|
32341
|
-
}
|
|
32342
|
-
}
|
|
32343
|
-
for (let i2 = start2; i2 < structure.length; i2++) {
|
|
32344
|
-
let child = structure[i2];
|
|
32345
|
-
if (child === 0) {
|
|
32346
|
-
if (i2 < structure.length - 1 || i2 > start2)
|
|
32347
|
-
throw new RangeError("Content hole must be the only child of its parent node");
|
|
32348
|
-
return { dom, contentDOM: dom };
|
|
32349
|
-
} else {
|
|
32350
|
-
let { dom: inner, contentDOM: innerContent } = DOMSerializer.renderSpec(doc2, child, xmlNS);
|
|
32351
|
-
dom.appendChild(inner);
|
|
32352
|
-
if (innerContent) {
|
|
32353
|
-
if (contentDOM)
|
|
32354
|
-
throw new RangeError("Multiple content holes");
|
|
32355
|
-
contentDOM = innerContent;
|
|
32356
|
-
}
|
|
32357
|
-
}
|
|
32358
|
-
}
|
|
32359
|
-
return { dom, contentDOM };
|
|
32388
|
+
return renderSpec(doc2, structure, xmlNS);
|
|
32360
32389
|
}
|
|
32361
32390
|
/**
|
|
32362
32391
|
Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)
|
|
@@ -32394,6 +32423,84 @@ function gatherToDOM(obj) {
|
|
|
32394
32423
|
function doc$1(options) {
|
|
32395
32424
|
return options.document || window.document;
|
|
32396
32425
|
}
|
|
32426
|
+
const suspiciousAttributeCache = /* @__PURE__ */ new WeakMap();
|
|
32427
|
+
function suspiciousAttributes(attrs) {
|
|
32428
|
+
let value = suspiciousAttributeCache.get(attrs);
|
|
32429
|
+
if (value === void 0)
|
|
32430
|
+
suspiciousAttributeCache.set(attrs, value = suspiciousAttributesInner(attrs));
|
|
32431
|
+
return value;
|
|
32432
|
+
}
|
|
32433
|
+
function suspiciousAttributesInner(attrs) {
|
|
32434
|
+
let result2 = null;
|
|
32435
|
+
function scan(value) {
|
|
32436
|
+
if (value && typeof value == "object") {
|
|
32437
|
+
if (Array.isArray(value)) {
|
|
32438
|
+
if (typeof value[0] == "string") {
|
|
32439
|
+
if (!result2)
|
|
32440
|
+
result2 = [];
|
|
32441
|
+
result2.push(value);
|
|
32442
|
+
} else {
|
|
32443
|
+
for (let i2 = 0; i2 < value.length; i2++)
|
|
32444
|
+
scan(value[i2]);
|
|
32445
|
+
}
|
|
32446
|
+
} else {
|
|
32447
|
+
for (let prop3 in value)
|
|
32448
|
+
scan(value[prop3]);
|
|
32449
|
+
}
|
|
32450
|
+
}
|
|
32451
|
+
}
|
|
32452
|
+
scan(attrs);
|
|
32453
|
+
return result2;
|
|
32454
|
+
}
|
|
32455
|
+
function renderSpec(doc2, structure, xmlNS, blockArraysIn) {
|
|
32456
|
+
if (typeof structure == "string")
|
|
32457
|
+
return { dom: doc2.createTextNode(structure) };
|
|
32458
|
+
if (structure.nodeType != null)
|
|
32459
|
+
return { dom: structure };
|
|
32460
|
+
if (structure.dom && structure.dom.nodeType != null)
|
|
32461
|
+
return structure;
|
|
32462
|
+
let tagName = structure[0], suspicious;
|
|
32463
|
+
if (typeof tagName != "string")
|
|
32464
|
+
throw new RangeError("Invalid array passed to renderSpec");
|
|
32465
|
+
if (blockArraysIn && (suspicious = suspiciousAttributes(blockArraysIn)) && suspicious.indexOf(structure) > -1)
|
|
32466
|
+
throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
|
|
32467
|
+
let space = tagName.indexOf(" ");
|
|
32468
|
+
if (space > 0) {
|
|
32469
|
+
xmlNS = tagName.slice(0, space);
|
|
32470
|
+
tagName = tagName.slice(space + 1);
|
|
32471
|
+
}
|
|
32472
|
+
let contentDOM;
|
|
32473
|
+
let dom = xmlNS ? doc2.createElementNS(xmlNS, tagName) : doc2.createElement(tagName);
|
|
32474
|
+
let attrs = structure[1], start2 = 1;
|
|
32475
|
+
if (attrs && typeof attrs == "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
|
|
32476
|
+
start2 = 2;
|
|
32477
|
+
for (let name in attrs)
|
|
32478
|
+
if (attrs[name] != null) {
|
|
32479
|
+
let space2 = name.indexOf(" ");
|
|
32480
|
+
if (space2 > 0)
|
|
32481
|
+
dom.setAttributeNS(name.slice(0, space2), name.slice(space2 + 1), attrs[name]);
|
|
32482
|
+
else
|
|
32483
|
+
dom.setAttribute(name, attrs[name]);
|
|
32484
|
+
}
|
|
32485
|
+
}
|
|
32486
|
+
for (let i2 = start2; i2 < structure.length; i2++) {
|
|
32487
|
+
let child = structure[i2];
|
|
32488
|
+
if (child === 0) {
|
|
32489
|
+
if (i2 < structure.length - 1 || i2 > start2)
|
|
32490
|
+
throw new RangeError("Content hole must be the only child of its parent node");
|
|
32491
|
+
return { dom, contentDOM: dom };
|
|
32492
|
+
} else {
|
|
32493
|
+
let { dom: inner, contentDOM: innerContent } = renderSpec(doc2, child, xmlNS, blockArraysIn);
|
|
32494
|
+
dom.appendChild(inner);
|
|
32495
|
+
if (innerContent) {
|
|
32496
|
+
if (contentDOM)
|
|
32497
|
+
throw new RangeError("Multiple content holes");
|
|
32498
|
+
contentDOM = innerContent;
|
|
32499
|
+
}
|
|
32500
|
+
}
|
|
32501
|
+
}
|
|
32502
|
+
return { dom, contentDOM };
|
|
32503
|
+
}
|
|
32397
32504
|
const lower16 = 65535;
|
|
32398
32505
|
const factor16 = Math.pow(2, 16);
|
|
32399
32506
|
function makeRecover(index2, offset2) {
|
|
@@ -33053,7 +33160,8 @@ class ReplaceAroundStep extends Step$1 {
|
|
|
33053
33160
|
}
|
|
33054
33161
|
map(mapping) {
|
|
33055
33162
|
let from2 = mapping.mapResult(this.from, 1), to2 = mapping.mapResult(this.to, -1);
|
|
33056
|
-
let gapFrom =
|
|
33163
|
+
let gapFrom = this.from == this.gapFrom ? from2.pos : mapping.map(this.gapFrom, -1);
|
|
33164
|
+
let gapTo = this.to == this.gapTo ? to2.pos : mapping.map(this.gapTo, 1);
|
|
33057
33165
|
if (from2.deletedAcross && to2.deletedAcross || gapFrom < from2.pos || gapTo > to2.pos)
|
|
33058
33166
|
return null;
|
|
33059
33167
|
return new ReplaceAroundStep(from2.pos, to2.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
|
|
@@ -33166,7 +33274,7 @@ function removeMark(tr2, from2, to2, mark) {
|
|
|
33166
33274
|
});
|
|
33167
33275
|
matched.forEach((m2) => tr2.step(new RemoveMarkStep(m2.from, m2.to, m2.style)));
|
|
33168
33276
|
}
|
|
33169
|
-
function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatch) {
|
|
33277
|
+
function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatch, clearNewlines = true) {
|
|
33170
33278
|
let node = tr2.doc.nodeAt(pos);
|
|
33171
33279
|
let replSteps = [], cur = pos + 1;
|
|
33172
33280
|
for (let i2 = 0; i2 < node.childCount; i2++) {
|
|
@@ -33179,7 +33287,7 @@ function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatc
|
|
|
33179
33287
|
for (let j2 = 0; j2 < child.marks.length; j2++)
|
|
33180
33288
|
if (!parentType.allowsMarkType(child.marks[j2].type))
|
|
33181
33289
|
tr2.step(new RemoveMarkStep(cur, end2, child.marks[j2]));
|
|
33182
|
-
if (child.isText &&
|
|
33290
|
+
if (clearNewlines && child.isText && parentType.whitespace != "pre") {
|
|
33183
33291
|
let m2, newline = /\r?\n|\r/g, slice4;
|
|
33184
33292
|
while (m2 = newline.exec(child.text)) {
|
|
33185
33293
|
if (!slice4)
|
|
@@ -33288,14 +33396,45 @@ function setBlockType$1(tr2, from2, to2, type3, attrs) {
|
|
|
33288
33396
|
let mapFrom = tr2.steps.length;
|
|
33289
33397
|
tr2.doc.nodesBetween(from2, to2, (node, pos) => {
|
|
33290
33398
|
if (node.isTextblock && !node.hasMarkup(type3, attrs) && canChangeType(tr2.doc, tr2.mapping.slice(mapFrom).map(pos), type3)) {
|
|
33291
|
-
|
|
33399
|
+
let convertNewlines = null;
|
|
33400
|
+
if (type3.schema.linebreakReplacement) {
|
|
33401
|
+
let pre = type3.whitespace == "pre", supportLinebreak = !!type3.contentMatch.matchType(type3.schema.linebreakReplacement);
|
|
33402
|
+
if (pre && !supportLinebreak)
|
|
33403
|
+
convertNewlines = false;
|
|
33404
|
+
else if (!pre && supportLinebreak)
|
|
33405
|
+
convertNewlines = true;
|
|
33406
|
+
}
|
|
33407
|
+
if (convertNewlines === false)
|
|
33408
|
+
replaceLinebreaks(tr2, node, pos, mapFrom);
|
|
33409
|
+
clearIncompatible(tr2, tr2.mapping.slice(mapFrom).map(pos, 1), type3, void 0, convertNewlines === null);
|
|
33292
33410
|
let mapping = tr2.mapping.slice(mapFrom);
|
|
33293
33411
|
let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);
|
|
33294
33412
|
tr2.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type3.create(attrs, null, node.marks)), 0, 0), 1, true));
|
|
33413
|
+
if (convertNewlines === true)
|
|
33414
|
+
replaceNewlines(tr2, node, pos, mapFrom);
|
|
33295
33415
|
return false;
|
|
33296
33416
|
}
|
|
33297
33417
|
});
|
|
33298
33418
|
}
|
|
33419
|
+
function replaceNewlines(tr2, node, pos, mapFrom) {
|
|
33420
|
+
node.forEach((child, offset2) => {
|
|
33421
|
+
if (child.isText) {
|
|
33422
|
+
let m2, newline = /\r?\n|\r/g;
|
|
33423
|
+
while (m2 = newline.exec(child.text)) {
|
|
33424
|
+
let start2 = tr2.mapping.slice(mapFrom).map(pos + 1 + offset2 + m2.index);
|
|
33425
|
+
tr2.replaceWith(start2, start2 + 1, node.type.schema.linebreakReplacement.create());
|
|
33426
|
+
}
|
|
33427
|
+
}
|
|
33428
|
+
});
|
|
33429
|
+
}
|
|
33430
|
+
function replaceLinebreaks(tr2, node, pos, mapFrom) {
|
|
33431
|
+
node.forEach((child, offset2) => {
|
|
33432
|
+
if (child.type == child.type.schema.linebreakReplacement) {
|
|
33433
|
+
let start2 = tr2.mapping.slice(mapFrom).map(pos + 1 + offset2);
|
|
33434
|
+
tr2.replaceWith(start2, start2 + 1, node.type.schema.text("\n"));
|
|
33435
|
+
}
|
|
33436
|
+
});
|
|
33437
|
+
}
|
|
33299
33438
|
function canChangeType(doc2, pos, type3) {
|
|
33300
33439
|
let $pos = doc2.resolve(pos), index2 = $pos.index();
|
|
33301
33440
|
return $pos.parent.canReplaceWith(index2, index2 + 1, type3);
|
|
@@ -35061,6 +35200,9 @@ const textRange = function(node, from2, to2) {
|
|
|
35061
35200
|
range2.setStart(node, from2 || 0);
|
|
35062
35201
|
return range2;
|
|
35063
35202
|
};
|
|
35203
|
+
const clearReusedRange = function() {
|
|
35204
|
+
reusedRange = null;
|
|
35205
|
+
};
|
|
35064
35206
|
const isEquivalentPosition = function(node, off2, targetNode, targetOff) {
|
|
35065
35207
|
return targetNode && (scanFor(node, off2, targetNode, targetOff, -1) || scanFor(node, off2, targetNode, targetOff, 1));
|
|
35066
35208
|
};
|
|
@@ -35088,6 +35230,40 @@ function scanFor(node, off2, targetNode, targetOff, dir) {
|
|
|
35088
35230
|
function nodeSize(node) {
|
|
35089
35231
|
return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
|
|
35090
35232
|
}
|
|
35233
|
+
function textNodeBefore$1(node, offset2) {
|
|
35234
|
+
for (; ; ) {
|
|
35235
|
+
if (node.nodeType == 3 && offset2)
|
|
35236
|
+
return node;
|
|
35237
|
+
if (node.nodeType == 1 && offset2 > 0) {
|
|
35238
|
+
if (node.contentEditable == "false")
|
|
35239
|
+
return null;
|
|
35240
|
+
node = node.childNodes[offset2 - 1];
|
|
35241
|
+
offset2 = nodeSize(node);
|
|
35242
|
+
} else if (node.parentNode && !hasBlockDesc(node)) {
|
|
35243
|
+
offset2 = domIndex(node);
|
|
35244
|
+
node = node.parentNode;
|
|
35245
|
+
} else {
|
|
35246
|
+
return null;
|
|
35247
|
+
}
|
|
35248
|
+
}
|
|
35249
|
+
}
|
|
35250
|
+
function textNodeAfter$1(node, offset2) {
|
|
35251
|
+
for (; ; ) {
|
|
35252
|
+
if (node.nodeType == 3 && offset2 < node.nodeValue.length)
|
|
35253
|
+
return node;
|
|
35254
|
+
if (node.nodeType == 1 && offset2 < node.childNodes.length) {
|
|
35255
|
+
if (node.contentEditable == "false")
|
|
35256
|
+
return null;
|
|
35257
|
+
node = node.childNodes[offset2];
|
|
35258
|
+
offset2 = 0;
|
|
35259
|
+
} else if (node.parentNode && !hasBlockDesc(node)) {
|
|
35260
|
+
offset2 = domIndex(node) + 1;
|
|
35261
|
+
node = node.parentNode;
|
|
35262
|
+
} else {
|
|
35263
|
+
return null;
|
|
35264
|
+
}
|
|
35265
|
+
}
|
|
35266
|
+
}
|
|
35091
35267
|
function isOnEdge(node, offset2, parent) {
|
|
35092
35268
|
for (let atStart = offset2 == 0, atEnd = offset2 == nodeSize(node); atStart || atEnd; ) {
|
|
35093
35269
|
if (node == parent)
|
|
@@ -35159,6 +35335,14 @@ const android = /Android \d/.test(agent);
|
|
|
35159
35335
|
const webkit = !!doc && "webkitFontSmoothing" in doc.documentElement.style;
|
|
35160
35336
|
const webkit_version = webkit ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
|
|
35161
35337
|
function windowRect(doc2) {
|
|
35338
|
+
let vp = doc2.defaultView && doc2.defaultView.visualViewport;
|
|
35339
|
+
if (vp)
|
|
35340
|
+
return {
|
|
35341
|
+
left: 0,
|
|
35342
|
+
right: vp.width,
|
|
35343
|
+
top: 0,
|
|
35344
|
+
bottom: vp.height
|
|
35345
|
+
};
|
|
35162
35346
|
return {
|
|
35163
35347
|
left: 0,
|
|
35164
35348
|
right: doc2.documentElement.clientWidth,
|
|
@@ -35360,14 +35544,14 @@ function posFromCaret(view, node, offset2, coords) {
|
|
|
35360
35544
|
let desc = view.docView.nearestDesc(cur, true);
|
|
35361
35545
|
if (!desc)
|
|
35362
35546
|
return null;
|
|
35363
|
-
if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent
|
|
35547
|
+
if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM)) {
|
|
35364
35548
|
let rect = desc.dom.getBoundingClientRect();
|
|
35365
|
-
if (desc.node.isBlock && desc.parent
|
|
35366
|
-
sawBlock
|
|
35367
|
-
if (rect.left > coords.left || rect.top > coords.top)
|
|
35549
|
+
if (desc.node.isBlock && desc.parent) {
|
|
35550
|
+
if (!sawBlock && rect.left > coords.left || rect.top > coords.top)
|
|
35368
35551
|
outsideBlock = desc.posBefore;
|
|
35369
|
-
else if (rect.right < coords.left || rect.bottom < coords.top)
|
|
35552
|
+
else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top)
|
|
35370
35553
|
outsideBlock = desc.posAfter;
|
|
35554
|
+
sawBlock = true;
|
|
35371
35555
|
}
|
|
35372
35556
|
if (!desc.contentDOM && outsideBlock < 0 && !desc.node.isText) {
|
|
35373
35557
|
let before = desc.node.isBlock ? coords.top < (rect.top + rect.bottom) / 2 : coords.left < (rect.left + rect.right) / 2;
|
|
@@ -35982,6 +36166,9 @@ class ViewDesc {
|
|
|
35982
36166
|
get ignoreForCoords() {
|
|
35983
36167
|
return false;
|
|
35984
36168
|
}
|
|
36169
|
+
isText(text) {
|
|
36170
|
+
return false;
|
|
36171
|
+
}
|
|
35985
36172
|
}
|
|
35986
36173
|
class WidgetViewDesc extends ViewDesc {
|
|
35987
36174
|
constructor(parent, widget, view, pos) {
|
|
@@ -36220,8 +36407,7 @@ class NodeViewDesc extends ViewDesc {
|
|
|
36220
36407
|
let { from: from2, to: to2 } = view.state.selection;
|
|
36221
36408
|
if (!(view.state.selection instanceof TextSelection) || from2 < pos || to2 > pos + this.node.content.size)
|
|
36222
36409
|
return null;
|
|
36223
|
-
let
|
|
36224
|
-
let textNode = nearbyTextNode(sel.focusNode, sel.focusOffset);
|
|
36410
|
+
let textNode = view.input.compositionNode;
|
|
36225
36411
|
if (!textNode || !this.dom.contains(textNode.parentNode))
|
|
36226
36412
|
return null;
|
|
36227
36413
|
if (this.node.inlineContent) {
|
|
@@ -36287,10 +36473,11 @@ class NodeViewDesc extends ViewDesc {
|
|
|
36287
36473
|
}
|
|
36288
36474
|
// Remove selected node marking from this node.
|
|
36289
36475
|
deselectNode() {
|
|
36290
|
-
if (this.nodeDOM.nodeType == 1)
|
|
36476
|
+
if (this.nodeDOM.nodeType == 1) {
|
|
36291
36477
|
this.nodeDOM.classList.remove("ProseMirror-selectednode");
|
|
36292
|
-
|
|
36293
|
-
|
|
36478
|
+
if (this.contentDOM || !this.node.type.spec.draggable)
|
|
36479
|
+
this.dom.removeAttribute("draggable");
|
|
36480
|
+
}
|
|
36294
36481
|
}
|
|
36295
36482
|
get domAtom() {
|
|
36296
36483
|
return this.node.isAtom;
|
|
@@ -36356,6 +36543,9 @@ class TextViewDesc extends NodeViewDesc {
|
|
|
36356
36543
|
get domAtom() {
|
|
36357
36544
|
return false;
|
|
36358
36545
|
}
|
|
36546
|
+
isText(text) {
|
|
36547
|
+
return this.node.text == text;
|
|
36548
|
+
}
|
|
36359
36549
|
}
|
|
36360
36550
|
class TrailingHackViewDesc extends ViewDesc {
|
|
36361
36551
|
parseRule() {
|
|
@@ -36871,23 +37061,6 @@ function iosHacks(dom) {
|
|
|
36871
37061
|
dom.style.cssText = oldCSS;
|
|
36872
37062
|
}
|
|
36873
37063
|
}
|
|
36874
|
-
function nearbyTextNode(node, offset2) {
|
|
36875
|
-
for (; ; ) {
|
|
36876
|
-
if (node.nodeType == 3)
|
|
36877
|
-
return node;
|
|
36878
|
-
if (node.nodeType == 1 && offset2 > 0) {
|
|
36879
|
-
if (node.childNodes.length > offset2 && node.childNodes[offset2].nodeType == 3)
|
|
36880
|
-
return node.childNodes[offset2];
|
|
36881
|
-
node = node.childNodes[offset2 - 1];
|
|
36882
|
-
offset2 = nodeSize(node);
|
|
36883
|
-
} else if (node.nodeType == 1 && offset2 < node.childNodes.length) {
|
|
36884
|
-
node = node.childNodes[offset2];
|
|
36885
|
-
offset2 = 0;
|
|
36886
|
-
} else {
|
|
36887
|
-
return null;
|
|
36888
|
-
}
|
|
36889
|
-
}
|
|
36890
|
-
}
|
|
36891
37064
|
function findTextInFragment(frag, text, from2, to2) {
|
|
36892
37065
|
for (let i2 = 0, pos = 0; i2 < frag.childCount && pos <= to2; ) {
|
|
36893
37066
|
let child = frag.child(i2++), childStart = pos;
|
|
@@ -37462,7 +37635,7 @@ function serializeForClipboard(view, slice4) {
|
|
|
37462
37635
|
if (firstChild && firstChild.nodeType == 1)
|
|
37463
37636
|
firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
|
|
37464
37637
|
let text = view.someProp("clipboardTextSerializer", (f2) => f2(slice4, view)) || slice4.content.textBetween(0, slice4.content.size, "\n\n");
|
|
37465
|
-
return { dom: wrap2, text };
|
|
37638
|
+
return { dom: wrap2, text, slice: slice4 };
|
|
37466
37639
|
}
|
|
37467
37640
|
function parseFromClipboard(view, text, html, plainText, $context) {
|
|
37468
37641
|
let inCode = $context.parent.type.spec.code;
|
|
@@ -37682,6 +37855,7 @@ class InputState {
|
|
|
37682
37855
|
this.lastTouch = 0;
|
|
37683
37856
|
this.lastAndroidDelete = 0;
|
|
37684
37857
|
this.composing = false;
|
|
37858
|
+
this.compositionNode = null;
|
|
37685
37859
|
this.composingTimeout = -1;
|
|
37686
37860
|
this.compositionNodes = [];
|
|
37687
37861
|
this.compositionEndedAt = -2e8;
|
|
@@ -37809,8 +37983,7 @@ function updateSelection(view, selection, origin2) {
|
|
|
37809
37983
|
if (!view.focused)
|
|
37810
37984
|
view.focus();
|
|
37811
37985
|
let tr2 = view.state.tr.setSelection(selection);
|
|
37812
|
-
|
|
37813
|
-
tr2.setMeta("pointer", true);
|
|
37986
|
+
tr2.setMeta("pointer", true);
|
|
37814
37987
|
view.dispatch(tr2);
|
|
37815
37988
|
}
|
|
37816
37989
|
function selectClickedLeaf(view, inside) {
|
|
@@ -37818,7 +37991,7 @@ function selectClickedLeaf(view, inside) {
|
|
|
37818
37991
|
return false;
|
|
37819
37992
|
let $pos = view.state.doc.resolve(inside), node = $pos.nodeAfter;
|
|
37820
37993
|
if (node && node.isAtom && NodeSelection.isSelectable(node)) {
|
|
37821
|
-
updateSelection(view, new NodeSelection($pos)
|
|
37994
|
+
updateSelection(view, new NodeSelection($pos));
|
|
37822
37995
|
return true;
|
|
37823
37996
|
}
|
|
37824
37997
|
return false;
|
|
@@ -37841,7 +38014,7 @@ function selectClickedNode(view, inside) {
|
|
|
37841
38014
|
}
|
|
37842
38015
|
}
|
|
37843
38016
|
if (selectAt != null) {
|
|
37844
|
-
updateSelection(view, NodeSelection.create(view.state.doc, selectAt)
|
|
38017
|
+
updateSelection(view, NodeSelection.create(view.state.doc, selectAt));
|
|
37845
38018
|
return true;
|
|
37846
38019
|
} else {
|
|
37847
38020
|
return false;
|
|
@@ -37862,7 +38035,7 @@ function defaultTripleClick(view, inside, event) {
|
|
|
37862
38035
|
let doc2 = view.state.doc;
|
|
37863
38036
|
if (inside == -1) {
|
|
37864
38037
|
if (doc2.inlineContent) {
|
|
37865
|
-
updateSelection(view, TextSelection.create(doc2, 0, doc2.content.size)
|
|
38038
|
+
updateSelection(view, TextSelection.create(doc2, 0, doc2.content.size));
|
|
37866
38039
|
return true;
|
|
37867
38040
|
}
|
|
37868
38041
|
return false;
|
|
@@ -37872,9 +38045,9 @@ function defaultTripleClick(view, inside, event) {
|
|
|
37872
38045
|
let node = i2 > $pos.depth ? $pos.nodeAfter : $pos.node(i2);
|
|
37873
38046
|
let nodePos = $pos.before(i2);
|
|
37874
38047
|
if (node.inlineContent)
|
|
37875
|
-
updateSelection(view, TextSelection.create(doc2, nodePos + 1, nodePos + 1 + node.content.size)
|
|
38048
|
+
updateSelection(view, TextSelection.create(doc2, nodePos + 1, nodePos + 1 + node.content.size));
|
|
37876
38049
|
else if (NodeSelection.isSelectable(node))
|
|
37877
|
-
updateSelection(view, NodeSelection.create(doc2, nodePos)
|
|
38050
|
+
updateSelection(view, NodeSelection.create(doc2, nodePos));
|
|
37878
38051
|
else
|
|
37879
38052
|
continue;
|
|
37880
38053
|
return true;
|
|
@@ -37931,7 +38104,7 @@ class MouseDown {
|
|
|
37931
38104
|
}
|
|
37932
38105
|
const target = flushed ? null : event.target;
|
|
37933
38106
|
const targetDesc = target ? view.docView.nearestDesc(target, true) : null;
|
|
37934
|
-
this.target = targetDesc ? targetDesc.dom : null;
|
|
38107
|
+
this.target = targetDesc && targetDesc.dom.nodeType == 1 ? targetDesc.dom : null;
|
|
37935
38108
|
let { selection } = view.state;
|
|
37936
38109
|
if (event.button == 0 && targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos)
|
|
37937
38110
|
this.mightDrag = {
|
|
@@ -37991,7 +38164,7 @@ class MouseDown {
|
|
|
37991
38164
|
// thus doesn't get a reaction from ProseMirror. This
|
|
37992
38165
|
// works around that.
|
|
37993
38166
|
chrome && !this.view.state.selection.visible && Math.min(Math.abs(pos.pos - this.view.state.selection.from), Math.abs(pos.pos - this.view.state.selection.to)) <= 2)) {
|
|
37994
|
-
updateSelection(this.view, Selection$1.near(this.view.state.doc.resolve(pos.pos))
|
|
38167
|
+
updateSelection(this.view, Selection$1.near(this.view.state.doc.resolve(pos.pos)));
|
|
37995
38168
|
event.preventDefault();
|
|
37996
38169
|
} else {
|
|
37997
38170
|
setSelectionOrigin(this.view, "pointer");
|
|
@@ -38063,6 +38236,7 @@ editHandlers.compositionend = (view, event) => {
|
|
|
38063
38236
|
view.input.composing = false;
|
|
38064
38237
|
view.input.compositionEndedAt = event.timeStamp;
|
|
38065
38238
|
view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0;
|
|
38239
|
+
view.input.compositionNode = null;
|
|
38066
38240
|
if (view.input.compositionPendingChanges)
|
|
38067
38241
|
Promise.resolve().then(() => view.domObserver.flush());
|
|
38068
38242
|
view.input.compositionID++;
|
|
@@ -38082,6 +38256,26 @@ function clearComposition(view) {
|
|
|
38082
38256
|
while (view.input.compositionNodes.length > 0)
|
|
38083
38257
|
view.input.compositionNodes.pop().markParentsDirty();
|
|
38084
38258
|
}
|
|
38259
|
+
function findCompositionNode(view) {
|
|
38260
|
+
let sel = view.domSelectionRange();
|
|
38261
|
+
if (!sel.focusNode)
|
|
38262
|
+
return null;
|
|
38263
|
+
let textBefore = textNodeBefore$1(sel.focusNode, sel.focusOffset);
|
|
38264
|
+
let textAfter = textNodeAfter$1(sel.focusNode, sel.focusOffset);
|
|
38265
|
+
if (textBefore && textAfter && textBefore != textAfter) {
|
|
38266
|
+
let descAfter = textAfter.pmViewDesc, lastChanged = view.domObserver.lastChangedTextNode;
|
|
38267
|
+
if (textBefore == lastChanged || textAfter == lastChanged)
|
|
38268
|
+
return lastChanged;
|
|
38269
|
+
if (!descAfter || !descAfter.isText(textAfter.nodeValue)) {
|
|
38270
|
+
return textAfter;
|
|
38271
|
+
} else if (view.input.compositionNode == textAfter) {
|
|
38272
|
+
let descBefore = textBefore.pmViewDesc;
|
|
38273
|
+
if (!(!descBefore || !descBefore.isText(textBefore.nodeValue)))
|
|
38274
|
+
return textAfter;
|
|
38275
|
+
}
|
|
38276
|
+
}
|
|
38277
|
+
return textBefore || textAfter;
|
|
38278
|
+
}
|
|
38085
38279
|
function timestampFromCustomEvent() {
|
|
38086
38280
|
let event = document.createEvent("Event");
|
|
38087
38281
|
event.initEvent("event", true, true);
|
|
@@ -38216,7 +38410,8 @@ handlers.dragstart = (view, _event) => {
|
|
|
38216
38410
|
if (desc && desc.node.type.spec.draggable && desc != view.docView)
|
|
38217
38411
|
node = NodeSelection.create(view.state.doc, desc.posBefore);
|
|
38218
38412
|
}
|
|
38219
|
-
let
|
|
38413
|
+
let draggedSlice = (node || view.state.selection).content();
|
|
38414
|
+
let { dom, text, slice: slice4 } = serializeForClipboard(view, draggedSlice);
|
|
38220
38415
|
event.dataTransfer.clearData();
|
|
38221
38416
|
event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML);
|
|
38222
38417
|
event.dataTransfer.effectAllowed = "copyMove";
|
|
@@ -38636,9 +38831,6 @@ class DecorationSet {
|
|
|
38636
38831
|
return this;
|
|
38637
38832
|
return local.length || children2.length ? new DecorationSet(local, children2) : empty$1;
|
|
38638
38833
|
}
|
|
38639
|
-
/**
|
|
38640
|
-
@internal
|
|
38641
|
-
*/
|
|
38642
38834
|
forChild(offset2, node) {
|
|
38643
38835
|
if (this == empty$1)
|
|
38644
38836
|
return this;
|
|
@@ -38992,6 +39184,7 @@ class DOMObserver {
|
|
|
38992
39184
|
this.currentSelection = new SelectionState();
|
|
38993
39185
|
this.onCharData = null;
|
|
38994
39186
|
this.suppressingSelectionUpdates = false;
|
|
39187
|
+
this.lastChangedTextNode = null;
|
|
38995
39188
|
this.observer = window.MutationObserver && new window.MutationObserver((mutations) => {
|
|
38996
39189
|
for (let i2 = 0; i2 < mutations.length; i2++)
|
|
38997
39190
|
this.queue.push(mutations[i2]);
|
|
@@ -39117,14 +39310,21 @@ class DOMObserver {
|
|
|
39117
39310
|
}
|
|
39118
39311
|
}
|
|
39119
39312
|
}
|
|
39120
|
-
if (gecko && added.length
|
|
39313
|
+
if (gecko && added.length) {
|
|
39121
39314
|
let brs = added.filter((n2) => n2.nodeName == "BR");
|
|
39122
39315
|
if (brs.length == 2) {
|
|
39123
|
-
let a2
|
|
39316
|
+
let [a2, b2] = brs;
|
|
39124
39317
|
if (a2.parentNode && a2.parentNode.parentNode == b2.parentNode)
|
|
39125
39318
|
b2.remove();
|
|
39126
39319
|
else
|
|
39127
39320
|
a2.remove();
|
|
39321
|
+
} else {
|
|
39322
|
+
let { focusNode } = this.currentSelection;
|
|
39323
|
+
for (let br2 of brs) {
|
|
39324
|
+
let parent = br2.parentNode;
|
|
39325
|
+
if (parent && parent.nodeName == "LI" && (!focusNode || blockParent(view, focusNode) != parent))
|
|
39326
|
+
br2.remove();
|
|
39327
|
+
}
|
|
39128
39328
|
}
|
|
39129
39329
|
}
|
|
39130
39330
|
let readSel = null;
|
|
@@ -39156,8 +39356,12 @@ class DOMObserver {
|
|
|
39156
39356
|
if (!desc || desc.ignoreMutation(mut))
|
|
39157
39357
|
return null;
|
|
39158
39358
|
if (mut.type == "childList") {
|
|
39159
|
-
for (let i2 = 0; i2 < mut.addedNodes.length; i2++)
|
|
39160
|
-
|
|
39359
|
+
for (let i2 = 0; i2 < mut.addedNodes.length; i2++) {
|
|
39360
|
+
let node = mut.addedNodes[i2];
|
|
39361
|
+
added.push(node);
|
|
39362
|
+
if (node.nodeType == 3)
|
|
39363
|
+
this.lastChangedTextNode = node;
|
|
39364
|
+
}
|
|
39161
39365
|
if (desc.contentDOM && desc.contentDOM != desc.dom && !desc.contentDOM.contains(mut.target))
|
|
39162
39366
|
return { from: desc.posBefore, to: desc.posAfter };
|
|
39163
39367
|
let prev = mut.previousSibling, next = mut.nextSibling;
|
|
@@ -39178,6 +39382,7 @@ class DOMObserver {
|
|
|
39178
39382
|
} else if (mut.type == "attributes") {
|
|
39179
39383
|
return { from: desc.posAtStart - desc.border, to: desc.posAtEnd + desc.border };
|
|
39180
39384
|
} else {
|
|
39385
|
+
this.lastChangedTextNode = mut.target;
|
|
39181
39386
|
return {
|
|
39182
39387
|
from: desc.posAtStart,
|
|
39183
39388
|
to: desc.posAtEnd,
|
|
@@ -39204,7 +39409,20 @@ function checkCSS(view) {
|
|
|
39204
39409
|
cssCheckWarned = true;
|
|
39205
39410
|
}
|
|
39206
39411
|
}
|
|
39207
|
-
function
|
|
39412
|
+
function rangeToSelectionRange(view, range2) {
|
|
39413
|
+
let anchorNode = range2.startContainer, anchorOffset = range2.startOffset;
|
|
39414
|
+
let focusNode = range2.endContainer, focusOffset = range2.endOffset;
|
|
39415
|
+
let currentAnchor = view.domAtPos(view.state.selection.anchor);
|
|
39416
|
+
if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset))
|
|
39417
|
+
[anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];
|
|
39418
|
+
return { anchorNode, anchorOffset, focusNode, focusOffset };
|
|
39419
|
+
}
|
|
39420
|
+
function safariShadowSelectionRange(view, selection) {
|
|
39421
|
+
if (selection.getComposedRanges) {
|
|
39422
|
+
let range2 = selection.getComposedRanges(view.root)[0];
|
|
39423
|
+
if (range2)
|
|
39424
|
+
return rangeToSelectionRange(view, range2);
|
|
39425
|
+
}
|
|
39208
39426
|
let found2;
|
|
39209
39427
|
function read2(event) {
|
|
39210
39428
|
event.preventDefault();
|
|
@@ -39214,12 +39432,15 @@ function safariShadowSelectionRange(view) {
|
|
|
39214
39432
|
view.dom.addEventListener("beforeinput", read2, true);
|
|
39215
39433
|
document.execCommand("indent");
|
|
39216
39434
|
view.dom.removeEventListener("beforeinput", read2, true);
|
|
39217
|
-
|
|
39218
|
-
|
|
39219
|
-
|
|
39220
|
-
|
|
39221
|
-
|
|
39222
|
-
|
|
39435
|
+
return found2 ? rangeToSelectionRange(view, found2) : null;
|
|
39436
|
+
}
|
|
39437
|
+
function blockParent(view, node) {
|
|
39438
|
+
for (let p2 = node.parentNode; p2 && p2 != view.dom; p2 = p2.parentNode) {
|
|
39439
|
+
let desc = view.docView.nearestDesc(p2, true);
|
|
39440
|
+
if (desc && desc.node.isBlock)
|
|
39441
|
+
return p2;
|
|
39442
|
+
}
|
|
39443
|
+
return null;
|
|
39223
39444
|
}
|
|
39224
39445
|
function parseBetween(view, from_, to_) {
|
|
39225
39446
|
let { node: parent, fromOffset, toOffset, from: from2, to: to2 } = view.docView.parseRange(from_, to_);
|
|
@@ -39339,10 +39560,6 @@ function readDOMChange(view, from2, to2, typeOver, addedNodes) {
|
|
|
39339
39560
|
return;
|
|
39340
39561
|
}
|
|
39341
39562
|
}
|
|
39342
|
-
if (chrome && view.cursorWrapper && parse2.sel && parse2.sel.anchor == view.cursorWrapper.deco.from && parse2.sel.head == parse2.sel.anchor) {
|
|
39343
|
-
let size2 = change.endB - change.start;
|
|
39344
|
-
parse2.sel = { anchor: parse2.sel.anchor + size2, head: parse2.sel.anchor + size2 };
|
|
39345
|
-
}
|
|
39346
39563
|
view.input.domChangeCount++;
|
|
39347
39564
|
if (view.state.selection.from < view.state.selection.to && change.start == change.endB && view.state.selection instanceof TextSelection) {
|
|
39348
39565
|
if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 && view.state.selection.from >= parse2.from) {
|
|
@@ -39366,7 +39583,7 @@ function readDOMChange(view, from2, to2, typeOver, addedNodes) {
|
|
|
39366
39583
|
view.input.lastIOSEnter = 0;
|
|
39367
39584
|
return;
|
|
39368
39585
|
}
|
|
39369
|
-
if (view.state.selection.anchor > change.start &&
|
|
39586
|
+
if (view.state.selection.anchor > change.start && looksLikeBackspace(doc2, change.start, change.endA, $from, $to) && view.someProp("handleKeyDown", (f2) => f2(view, keyEvent(8, "Backspace")))) {
|
|
39370
39587
|
if (android && chrome)
|
|
39371
39588
|
view.domObserver.suppressSelectionUpdates();
|
|
39372
39589
|
return;
|
|
@@ -39450,12 +39667,18 @@ function isMarkChange(cur, prev) {
|
|
|
39450
39667
|
if (Fragment.from(updated).eq(cur))
|
|
39451
39668
|
return { mark, type: type3 };
|
|
39452
39669
|
}
|
|
39453
|
-
function
|
|
39454
|
-
if (
|
|
39455
|
-
|
|
39456
|
-
|
|
39670
|
+
function looksLikeBackspace(old, start2, end2, $newStart, $newEnd) {
|
|
39671
|
+
if (
|
|
39672
|
+
// The content must have shrunk
|
|
39673
|
+
end2 - start2 <= $newEnd.pos - $newStart.pos || // newEnd must point directly at or after the end of the block that newStart points into
|
|
39674
|
+
skipClosingAndOpening($newStart, true, false) < $newEnd.pos
|
|
39675
|
+
)
|
|
39457
39676
|
return false;
|
|
39458
39677
|
let $start = old.resolve(start2);
|
|
39678
|
+
if (!$newStart.parent.isTextblock) {
|
|
39679
|
+
let after = $start.nodeAfter;
|
|
39680
|
+
return after != null && end2 == start2 + after.nodeSize;
|
|
39681
|
+
}
|
|
39459
39682
|
if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock)
|
|
39460
39683
|
return false;
|
|
39461
39684
|
let $next = old.resolve(skipClosingAndOpening($start, true, true));
|
|
@@ -39644,8 +39867,10 @@ class EditorView {
|
|
|
39644
39867
|
let forceSelUpdate = updateDoc && (ie$1 || chrome) && !this.composing && !prev.selection.empty && !state2.selection.empty && selectionContextChanged(prev.selection, state2.selection);
|
|
39645
39868
|
if (updateDoc) {
|
|
39646
39869
|
let chromeKludge = chrome ? this.trackWrites = this.domSelectionRange().focusNode : null;
|
|
39870
|
+
if (this.composing)
|
|
39871
|
+
this.input.compositionNode = findCompositionNode(this);
|
|
39647
39872
|
if (redraw || !this.docView.update(state2.doc, outerDeco, innerDeco, this)) {
|
|
39648
|
-
this.docView.updateOuterDeco(
|
|
39873
|
+
this.docView.updateOuterDeco(outerDeco);
|
|
39649
39874
|
this.docView.destroy();
|
|
39650
39875
|
this.docView = docViewDesc(state2.doc, outerDeco, innerDeco, this.dom, this);
|
|
39651
39876
|
}
|
|
@@ -39904,6 +40129,7 @@ class EditorView {
|
|
|
39904
40129
|
}
|
|
39905
40130
|
this.docView.destroy();
|
|
39906
40131
|
this.docView = null;
|
|
40132
|
+
clearReusedRange();
|
|
39907
40133
|
}
|
|
39908
40134
|
/**
|
|
39909
40135
|
This is true when the view has been
|
|
@@ -39939,7 +40165,8 @@ class EditorView {
|
|
|
39939
40165
|
@internal
|
|
39940
40166
|
*/
|
|
39941
40167
|
domSelectionRange() {
|
|
39942
|
-
|
|
40168
|
+
let sel = this.domSelection();
|
|
40169
|
+
return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom && safariShadowSelectionRange(this, sel) || sel;
|
|
39943
40170
|
}
|
|
39944
40171
|
/**
|
|
39945
40172
|
@internal
|
|
@@ -40930,7 +41157,8 @@ function getAttributesFromExtensions(extensions) {
|
|
|
40930
41157
|
const context = {
|
|
40931
41158
|
name: extension.name,
|
|
40932
41159
|
options: extension.options,
|
|
40933
|
-
storage: extension.storage
|
|
41160
|
+
storage: extension.storage,
|
|
41161
|
+
extensions: nodeAndMarkExtensions
|
|
40934
41162
|
};
|
|
40935
41163
|
const addGlobalAttributes = getExtensionField(extension, "addGlobalAttributes", context);
|
|
40936
41164
|
if (!addGlobalAttributes) {
|
|
@@ -41056,7 +41284,7 @@ function fromString(value) {
|
|
|
41056
41284
|
return value;
|
|
41057
41285
|
}
|
|
41058
41286
|
function injectExtensionAttributesToParseRule(parseRule, extensionAttributes) {
|
|
41059
|
-
if (parseRule
|
|
41287
|
+
if ("style" in parseRule) {
|
|
41060
41288
|
return parseRule;
|
|
41061
41289
|
}
|
|
41062
41290
|
return {
|
|
@@ -41121,6 +41349,7 @@ function getSchemaByResolvedExtensions(extensions, editor) {
|
|
|
41121
41349
|
selectable: callOrReturn(getExtensionField(extension, "selectable", context)),
|
|
41122
41350
|
draggable: callOrReturn(getExtensionField(extension, "draggable", context)),
|
|
41123
41351
|
code: callOrReturn(getExtensionField(extension, "code", context)),
|
|
41352
|
+
whitespace: callOrReturn(getExtensionField(extension, "whitespace", context)),
|
|
41124
41353
|
defining: callOrReturn(getExtensionField(extension, "defining", context)),
|
|
41125
41354
|
isolating: callOrReturn(getExtensionField(extension, "isolating", context)),
|
|
41126
41355
|
attrs: Object.fromEntries(extensionAttributes.map((extensionAttribute) => {
|
|
@@ -41676,7 +41905,7 @@ class ExtensionManager {
|
|
|
41676
41905
|
const plugins2 = [];
|
|
41677
41906
|
const addKeyboardShortcuts = getExtensionField(extension, "addKeyboardShortcuts", context);
|
|
41678
41907
|
let defaultBindings = {};
|
|
41679
|
-
if (extension.type === "mark" && extension
|
|
41908
|
+
if (extension.type === "mark" && getExtensionField(extension, "exitable", context)) {
|
|
41680
41909
|
defaultBindings.ArrowRight = () => Mark.handleExit({ editor, mark: extension });
|
|
41681
41910
|
}
|
|
41682
41911
|
if (addKeyboardShortcuts) {
|
|
@@ -41824,14 +42053,10 @@ function mergeDeep(target, source) {
|
|
|
41824
42053
|
const output = { ...target };
|
|
41825
42054
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
41826
42055
|
Object.keys(source).forEach((key) => {
|
|
41827
|
-
if (isPlainObject(source[key])) {
|
|
41828
|
-
|
|
41829
|
-
Object.assign(output, { [key]: source[key] });
|
|
41830
|
-
} else {
|
|
41831
|
-
output[key] = mergeDeep(target[key], source[key]);
|
|
41832
|
-
}
|
|
42056
|
+
if (isPlainObject(source[key]) && isPlainObject(target[key])) {
|
|
42057
|
+
output[key] = mergeDeep(target[key], source[key]);
|
|
41833
42058
|
} else {
|
|
41834
|
-
|
|
42059
|
+
output[key] = source[key];
|
|
41835
42060
|
}
|
|
41836
42061
|
});
|
|
41837
42062
|
}
|
|
@@ -41870,13 +42095,14 @@ class Extension {
|
|
|
41870
42095
|
return new Extension(config);
|
|
41871
42096
|
}
|
|
41872
42097
|
configure(options = {}) {
|
|
41873
|
-
const extension = this.extend(
|
|
42098
|
+
const extension = this.extend({
|
|
42099
|
+
...this.config,
|
|
42100
|
+
addOptions: () => {
|
|
42101
|
+
return mergeDeep(this.options, options);
|
|
42102
|
+
}
|
|
42103
|
+
});
|
|
42104
|
+
extension.name = this.name;
|
|
41874
42105
|
extension.parent = this.parent;
|
|
41875
|
-
extension.options = mergeDeep(this.options, options);
|
|
41876
|
-
extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
|
|
41877
|
-
name: extension.name,
|
|
41878
|
-
options: extension.options
|
|
41879
|
-
}));
|
|
41880
42106
|
return extension;
|
|
41881
42107
|
}
|
|
41882
42108
|
extend(extendedConfig = {}) {
|
|
@@ -41884,7 +42110,7 @@ class Extension {
|
|
|
41884
42110
|
extension.parent = this;
|
|
41885
42111
|
this.child = extension;
|
|
41886
42112
|
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
41887
|
-
if (extendedConfig.defaultOptions) {
|
|
42113
|
+
if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
|
|
41888
42114
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
41889
42115
|
}
|
|
41890
42116
|
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
@@ -42268,13 +42494,47 @@ function createNodeFromContent(content, schema, options) {
|
|
|
42268
42494
|
}
|
|
42269
42495
|
return schema.nodeFromJSON(content);
|
|
42270
42496
|
} catch (error) {
|
|
42497
|
+
if (options.errorOnInvalidContent) {
|
|
42498
|
+
throw new Error("[tiptap error]: Invalid JSON content", { cause: error });
|
|
42499
|
+
}
|
|
42271
42500
|
console.warn("[tiptap warn]: Invalid content.", "Passed value:", content, "Error:", error);
|
|
42272
42501
|
return createNodeFromContent("", schema, options);
|
|
42273
42502
|
}
|
|
42274
42503
|
}
|
|
42275
42504
|
if (isTextContent) {
|
|
42276
|
-
|
|
42277
|
-
|
|
42505
|
+
let schemaToUse = schema;
|
|
42506
|
+
let hasInvalidContent = false;
|
|
42507
|
+
let invalidContent = "";
|
|
42508
|
+
if (options.errorOnInvalidContent) {
|
|
42509
|
+
schemaToUse = new Schema({
|
|
42510
|
+
topNode: schema.spec.topNode,
|
|
42511
|
+
marks: schema.spec.marks,
|
|
42512
|
+
// Prosemirror's schemas are executed such that: the last to execute, matches last
|
|
42513
|
+
// This means that we can add a catch-all node at the end of the schema to catch any content that we don't know how to handle
|
|
42514
|
+
nodes: schema.spec.nodes.append({
|
|
42515
|
+
__tiptap__private__unknown__catch__all__node: {
|
|
42516
|
+
content: "inline*",
|
|
42517
|
+
group: "block",
|
|
42518
|
+
parseDOM: [
|
|
42519
|
+
{
|
|
42520
|
+
tag: "*",
|
|
42521
|
+
getAttrs: (e) => {
|
|
42522
|
+
hasInvalidContent = true;
|
|
42523
|
+
invalidContent = typeof e === "string" ? e : e.outerHTML;
|
|
42524
|
+
return null;
|
|
42525
|
+
}
|
|
42526
|
+
}
|
|
42527
|
+
]
|
|
42528
|
+
}
|
|
42529
|
+
})
|
|
42530
|
+
});
|
|
42531
|
+
}
|
|
42532
|
+
const parser = DOMParser.fromSchema(schemaToUse);
|
|
42533
|
+
const response = options.slice ? parser.parseSlice(elementFromString(content), options.parseOptions).content : parser.parse(elementFromString(content), options.parseOptions);
|
|
42534
|
+
if (options.errorOnInvalidContent && hasInvalidContent) {
|
|
42535
|
+
throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${invalidContent}`) });
|
|
42536
|
+
}
|
|
42537
|
+
return response;
|
|
42278
42538
|
}
|
|
42279
42539
|
return createNodeFromContent("", schema, options);
|
|
42280
42540
|
}
|
|
@@ -42297,9 +42557,10 @@ function selectionToInsertionEnd(tr2, startLen, bias) {
|
|
|
42297
42557
|
tr2.setSelection(Selection$1.near(tr2.doc.resolve(end2), bias));
|
|
42298
42558
|
}
|
|
42299
42559
|
const isFragment = (nodeOrFragment) => {
|
|
42300
|
-
return
|
|
42560
|
+
return !("type" in nodeOrFragment);
|
|
42301
42561
|
};
|
|
42302
42562
|
const insertContentAt = (position, value, options) => ({ tr: tr2, dispatch, editor }) => {
|
|
42563
|
+
var _a2;
|
|
42303
42564
|
if (dispatch) {
|
|
42304
42565
|
options = {
|
|
42305
42566
|
parseOptions: {},
|
|
@@ -42308,14 +42569,17 @@ const insertContentAt = (position, value, options) => ({ tr: tr2, dispatch, edit
|
|
|
42308
42569
|
applyPasteRules: false,
|
|
42309
42570
|
...options
|
|
42310
42571
|
};
|
|
42311
|
-
|
|
42312
|
-
|
|
42313
|
-
|
|
42314
|
-
|
|
42315
|
-
|
|
42316
|
-
|
|
42317
|
-
|
|
42318
|
-
|
|
42572
|
+
let content;
|
|
42573
|
+
try {
|
|
42574
|
+
content = createNodeFromContent(value, editor.schema, {
|
|
42575
|
+
parseOptions: {
|
|
42576
|
+
preserveWhitespace: "full",
|
|
42577
|
+
...options.parseOptions
|
|
42578
|
+
},
|
|
42579
|
+
errorOnInvalidContent: (_a2 = options.errorOnInvalidContent) !== null && _a2 !== void 0 ? _a2 : editor.options.enableContentCheck
|
|
42580
|
+
});
|
|
42581
|
+
} catch (e) {
|
|
42582
|
+
return false;
|
|
42319
42583
|
}
|
|
42320
42584
|
let { from: from2, to: to2 } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
|
|
42321
42585
|
let isOnlyTextContent = true;
|
|
@@ -42372,7 +42636,7 @@ const joinBackward = () => ({ state: state2, dispatch }) => {
|
|
|
42372
42636
|
const joinForward = () => ({ state: state2, dispatch }) => {
|
|
42373
42637
|
return joinForward$1(state2, dispatch);
|
|
42374
42638
|
};
|
|
42375
|
-
const joinItemBackward = () => ({
|
|
42639
|
+
const joinItemBackward = () => ({ state: state2, dispatch, tr: tr2 }) => {
|
|
42376
42640
|
try {
|
|
42377
42641
|
const point2 = joinPoint(state2.doc, state2.selection.$from.pos, -1);
|
|
42378
42642
|
if (point2 === null || point2 === void 0) {
|
|
@@ -42383,7 +42647,7 @@ const joinItemBackward = () => ({ tr: tr2, state: state2, dispatch }) => {
|
|
|
42383
42647
|
dispatch(tr2);
|
|
42384
42648
|
}
|
|
42385
42649
|
return true;
|
|
42386
|
-
} catch {
|
|
42650
|
+
} catch (e) {
|
|
42387
42651
|
return false;
|
|
42388
42652
|
}
|
|
42389
42653
|
};
|
|
@@ -42601,16 +42865,32 @@ const selectTextblockEnd = () => ({ state: state2, dispatch }) => {
|
|
|
42601
42865
|
const selectTextblockStart = () => ({ state: state2, dispatch }) => {
|
|
42602
42866
|
return selectTextblockStart$1(state2, dispatch);
|
|
42603
42867
|
};
|
|
42604
|
-
function createDocument(content, schema, parseOptions = {}) {
|
|
42605
|
-
return createNodeFromContent(content, schema, {
|
|
42868
|
+
function createDocument(content, schema, parseOptions = {}, options = {}) {
|
|
42869
|
+
return createNodeFromContent(content, schema, {
|
|
42870
|
+
slice: false,
|
|
42871
|
+
parseOptions,
|
|
42872
|
+
errorOnInvalidContent: options.errorOnInvalidContent
|
|
42873
|
+
});
|
|
42606
42874
|
}
|
|
42607
|
-
const setContent$1 = (content, emitUpdate = false, parseOptions = {}) => ({ tr: tr2,
|
|
42875
|
+
const setContent$1 = (content, emitUpdate = false, parseOptions = {}, options = {}) => ({ editor, tr: tr2, dispatch, commands: commands2 }) => {
|
|
42876
|
+
var _a2, _b;
|
|
42608
42877
|
const { doc: doc2 } = tr2;
|
|
42609
|
-
|
|
42878
|
+
if (parseOptions.preserveWhitespace !== "full") {
|
|
42879
|
+
const document2 = createDocument(content, editor.schema, parseOptions, {
|
|
42880
|
+
errorOnInvalidContent: (_a2 = options.errorOnInvalidContent) !== null && _a2 !== void 0 ? _a2 : editor.options.enableContentCheck
|
|
42881
|
+
});
|
|
42882
|
+
if (dispatch) {
|
|
42883
|
+
tr2.replaceWith(0, doc2.content.size, document2).setMeta("preventUpdate", !emitUpdate);
|
|
42884
|
+
}
|
|
42885
|
+
return true;
|
|
42886
|
+
}
|
|
42610
42887
|
if (dispatch) {
|
|
42611
|
-
tr2.
|
|
42888
|
+
tr2.setMeta("preventUpdate", !emitUpdate);
|
|
42612
42889
|
}
|
|
42613
|
-
return
|
|
42890
|
+
return commands2.insertContentAt({ from: 0, to: doc2.content.size }, content, {
|
|
42891
|
+
parseOptions,
|
|
42892
|
+
errorOnInvalidContent: (_b = options.errorOnInvalidContent) !== null && _b !== void 0 ? _b : editor.options.enableContentCheck
|
|
42893
|
+
});
|
|
42614
42894
|
};
|
|
42615
42895
|
function getMarkAttributes(state2, typeOrName) {
|
|
42616
42896
|
const type3 = getMarkType(typeOrName, state2.schema);
|
|
@@ -42813,10 +43093,11 @@ function isList(name, extensions) {
|
|
|
42813
43093
|
return group.split(" ").includes("list");
|
|
42814
43094
|
}
|
|
42815
43095
|
function isNodeEmpty(node) {
|
|
42816
|
-
|
|
42817
|
-
|
|
42818
|
-
|
|
42819
|
-
|
|
43096
|
+
const defaultContent = node.type.createAndFill();
|
|
43097
|
+
if (!defaultContent) {
|
|
43098
|
+
return false;
|
|
43099
|
+
}
|
|
43100
|
+
return node.eq(defaultContent);
|
|
42820
43101
|
}
|
|
42821
43102
|
function isNodeSelection(value) {
|
|
42822
43103
|
return value instanceof NodeSelection;
|
|
@@ -43331,14 +43612,14 @@ var commands = /* @__PURE__ */ Object.freeze({
|
|
|
43331
43612
|
forEach,
|
|
43332
43613
|
insertContent,
|
|
43333
43614
|
insertContentAt,
|
|
43334
|
-
joinUp,
|
|
43335
|
-
joinDown,
|
|
43336
43615
|
joinBackward,
|
|
43616
|
+
joinDown,
|
|
43337
43617
|
joinForward,
|
|
43338
43618
|
joinItemBackward,
|
|
43339
43619
|
joinItemForward,
|
|
43340
43620
|
joinTextblockBackward,
|
|
43341
43621
|
joinTextblockForward,
|
|
43622
|
+
joinUp,
|
|
43342
43623
|
keyboardShortcut,
|
|
43343
43624
|
lift,
|
|
43344
43625
|
liftEmptyBlock,
|
|
@@ -43535,13 +43816,16 @@ const Tabindex = Extension.create({
|
|
|
43535
43816
|
new Plugin({
|
|
43536
43817
|
key: new PluginKey("tabindex"),
|
|
43537
43818
|
props: {
|
|
43538
|
-
attributes: this.editor.isEditable ? { tabindex: "0" } : {}
|
|
43819
|
+
attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
|
|
43539
43820
|
}
|
|
43540
43821
|
})
|
|
43541
43822
|
];
|
|
43542
43823
|
}
|
|
43543
43824
|
});
|
|
43544
43825
|
class NodePos {
|
|
43826
|
+
get name() {
|
|
43827
|
+
return this.node.type.name;
|
|
43828
|
+
}
|
|
43545
43829
|
constructor(pos, editor, isBlock = false, node = null) {
|
|
43546
43830
|
this.currentNode = null;
|
|
43547
43831
|
this.actualDepth = null;
|
|
@@ -43550,9 +43834,6 @@ class NodePos {
|
|
|
43550
43834
|
this.editor = editor;
|
|
43551
43835
|
this.currentNode = node;
|
|
43552
43836
|
}
|
|
43553
|
-
get name() {
|
|
43554
|
-
return this.node.type.name;
|
|
43555
|
-
}
|
|
43556
43837
|
get node() {
|
|
43557
43838
|
return this.currentNode || this.resolvedPos.node();
|
|
43558
43839
|
}
|
|
@@ -43784,7 +44065,7 @@ img.ProseMirror-separator {
|
|
|
43784
44065
|
opacity: 0
|
|
43785
44066
|
}`;
|
|
43786
44067
|
function createStyleTag(style2, nonce, suffix) {
|
|
43787
|
-
const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${
|
|
44068
|
+
const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${""}]`);
|
|
43788
44069
|
if (tiptapStyleTag !== null) {
|
|
43789
44070
|
return tiptapStyleTag;
|
|
43790
44071
|
}
|
|
@@ -43792,7 +44073,7 @@ function createStyleTag(style2, nonce, suffix) {
|
|
|
43792
44073
|
if (nonce) {
|
|
43793
44074
|
styleNode.setAttribute("nonce", nonce);
|
|
43794
44075
|
}
|
|
43795
|
-
styleNode.setAttribute(`data-tiptap-style${
|
|
44076
|
+
styleNode.setAttribute(`data-tiptap-style${""}`, "");
|
|
43796
44077
|
styleNode.innerHTML = style2;
|
|
43797
44078
|
document.getElementsByTagName("head")[0].appendChild(styleNode);
|
|
43798
44079
|
return styleNode;
|
|
@@ -43816,6 +44097,7 @@ let Editor$1 = class Editor2 extends EventEmitter {
|
|
|
43816
44097
|
enableInputRules: true,
|
|
43817
44098
|
enablePasteRules: true,
|
|
43818
44099
|
enableCoreExtensions: true,
|
|
44100
|
+
enableContentCheck: false,
|
|
43819
44101
|
onBeforeCreate: () => null,
|
|
43820
44102
|
onCreate: () => null,
|
|
43821
44103
|
onUpdate: () => null,
|
|
@@ -43823,7 +44105,10 @@ let Editor$1 = class Editor2 extends EventEmitter {
|
|
|
43823
44105
|
onTransaction: () => null,
|
|
43824
44106
|
onFocus: () => null,
|
|
43825
44107
|
onBlur: () => null,
|
|
43826
|
-
onDestroy: () => null
|
|
44108
|
+
onDestroy: () => null,
|
|
44109
|
+
onContentError: ({ error }) => {
|
|
44110
|
+
throw error;
|
|
44111
|
+
}
|
|
43827
44112
|
};
|
|
43828
44113
|
this.isCapturingTransaction = false;
|
|
43829
44114
|
this.capturedTransaction = null;
|
|
@@ -43833,6 +44118,7 @@ let Editor$1 = class Editor2 extends EventEmitter {
|
|
|
43833
44118
|
this.createSchema();
|
|
43834
44119
|
this.on("beforeCreate", this.options.onBeforeCreate);
|
|
43835
44120
|
this.emit("beforeCreate", { editor: this });
|
|
44121
|
+
this.on("contentError", this.options.onContentError);
|
|
43836
44122
|
this.createView();
|
|
43837
44123
|
this.injectCSS();
|
|
43838
44124
|
this.on("create", this.options.onCreate);
|
|
@@ -43986,7 +44272,23 @@ let Editor$1 = class Editor2 extends EventEmitter {
|
|
|
43986
44272
|
* Creates a ProseMirror view.
|
|
43987
44273
|
*/
|
|
43988
44274
|
createView() {
|
|
43989
|
-
|
|
44275
|
+
let doc2;
|
|
44276
|
+
try {
|
|
44277
|
+
doc2 = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
|
|
44278
|
+
} catch (e) {
|
|
44279
|
+
if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message)) {
|
|
44280
|
+
throw e;
|
|
44281
|
+
}
|
|
44282
|
+
this.emit("contentError", {
|
|
44283
|
+
editor: this,
|
|
44284
|
+
error: e,
|
|
44285
|
+
disableCollaboration: () => {
|
|
44286
|
+
this.options.extensions = this.options.extensions.filter((extension) => extension.name !== "collaboration");
|
|
44287
|
+
this.createExtensionManager();
|
|
44288
|
+
}
|
|
44289
|
+
});
|
|
44290
|
+
doc2 = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: false });
|
|
44291
|
+
}
|
|
43990
44292
|
const selection = resolveFocusPosition(doc2, this.options.autofocus);
|
|
43991
44293
|
this.view = new EditorView(this.options.element, {
|
|
43992
44294
|
...this.options.editorProps,
|
|
@@ -44224,7 +44526,8 @@ function nodeInputRule(config) {
|
|
|
44224
44526
|
tr2.insertText(lastChar, start2 + match2[0].length - 1);
|
|
44225
44527
|
tr2.replaceWith(matchStart, end2, newNode);
|
|
44226
44528
|
} else if (match2[0]) {
|
|
44227
|
-
|
|
44529
|
+
const insertionStart = config.type.isInline ? start2 : start2 - 1;
|
|
44530
|
+
tr2.insert(insertionStart, config.type.create(attributes)).delete(tr2.mapping.map(start2), tr2.mapping.map(end2));
|
|
44228
44531
|
}
|
|
44229
44532
|
tr2.scrollIntoView();
|
|
44230
44533
|
}
|
|
@@ -44309,20 +44612,22 @@ class Mark {
|
|
|
44309
44612
|
return new Mark(config);
|
|
44310
44613
|
}
|
|
44311
44614
|
configure(options = {}) {
|
|
44312
|
-
const extension = this.extend(
|
|
44313
|
-
|
|
44314
|
-
|
|
44315
|
-
|
|
44316
|
-
|
|
44317
|
-
})
|
|
44615
|
+
const extension = this.extend({
|
|
44616
|
+
...this.config,
|
|
44617
|
+
addOptions: () => {
|
|
44618
|
+
return mergeDeep(this.options, options);
|
|
44619
|
+
}
|
|
44620
|
+
});
|
|
44621
|
+
extension.name = this.name;
|
|
44622
|
+
extension.parent = this.parent;
|
|
44318
44623
|
return extension;
|
|
44319
44624
|
}
|
|
44320
44625
|
extend(extendedConfig = {}) {
|
|
44321
|
-
const extension = new Mark(
|
|
44626
|
+
const extension = new Mark(extendedConfig);
|
|
44322
44627
|
extension.parent = this;
|
|
44323
44628
|
this.child = extension;
|
|
44324
44629
|
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
44325
|
-
if (extendedConfig.defaultOptions) {
|
|
44630
|
+
if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
|
|
44326
44631
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
44327
44632
|
}
|
|
44328
44633
|
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
@@ -44388,20 +44693,22 @@ let Node$2 = class Node3 {
|
|
|
44388
44693
|
return new Node3(config);
|
|
44389
44694
|
}
|
|
44390
44695
|
configure(options = {}) {
|
|
44391
|
-
const extension = this.extend(
|
|
44392
|
-
|
|
44393
|
-
|
|
44394
|
-
|
|
44395
|
-
|
|
44396
|
-
})
|
|
44696
|
+
const extension = this.extend({
|
|
44697
|
+
...this.config,
|
|
44698
|
+
addOptions: () => {
|
|
44699
|
+
return mergeDeep(this.options, options);
|
|
44700
|
+
}
|
|
44701
|
+
});
|
|
44702
|
+
extension.name = this.name;
|
|
44703
|
+
extension.parent = this.parent;
|
|
44397
44704
|
return extension;
|
|
44398
44705
|
}
|
|
44399
44706
|
extend(extendedConfig = {}) {
|
|
44400
|
-
const extension = new Node3(
|
|
44707
|
+
const extension = new Node3(extendedConfig);
|
|
44401
44708
|
extension.parent = this;
|
|
44402
44709
|
this.child = extension;
|
|
44403
44710
|
extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
|
|
44404
|
-
if (extendedConfig.defaultOptions) {
|
|
44711
|
+
if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
|
|
44405
44712
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
44406
44713
|
}
|
|
44407
44714
|
extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
|
|
@@ -44936,14 +45243,12 @@ const CodeBlock = Node$2.create({
|
|
|
44936
45243
|
if (!text || !language) {
|
|
44937
45244
|
return false;
|
|
44938
45245
|
}
|
|
44939
|
-
const { tr: tr2 } = view.state;
|
|
44940
|
-
|
|
44941
|
-
|
|
44942
|
-
|
|
44943
|
-
tr2.
|
|
45246
|
+
const { tr: tr2, schema } = view.state;
|
|
45247
|
+
const textNode = schema.text(text.replace(/\r\n?/g, "\n"));
|
|
45248
|
+
tr2.replaceSelectionWith(this.type.create({ language }, textNode));
|
|
45249
|
+
if (tr2.selection.$from.parent.type !== this.type) {
|
|
45250
|
+
tr2.setSelection(TextSelection.near(tr2.doc.resolve(Math.max(0, tr2.selection.from - 2))));
|
|
44944
45251
|
}
|
|
44945
|
-
tr2.setSelection(TextSelection.near(tr2.doc.resolve(Math.max(0, tr2.selection.from - 2))));
|
|
44946
|
-
tr2.insertText(text.replace(/\r\n?/g, "\n"));
|
|
44947
45252
|
tr2.setMeta("paste", true);
|
|
44948
45253
|
view.dispatch(tr2);
|
|
44949
45254
|
return true;
|
|
@@ -45859,13 +46164,13 @@ function applyTransaction(history2, state2, tr2, options) {
|
|
|
45859
46164
|
return history2;
|
|
45860
46165
|
} else if (appended && appended.getMeta(historyKey)) {
|
|
45861
46166
|
if (appended.getMeta(historyKey).redo)
|
|
45862
|
-
return new HistoryState(history2.done.addTransform(tr2, void 0, options, mustPreserveItems(state2)), history2.undone, rangesFor(tr2.mapping.maps
|
|
46167
|
+
return new HistoryState(history2.done.addTransform(tr2, void 0, options, mustPreserveItems(state2)), history2.undone, rangesFor(tr2.mapping.maps), history2.prevTime, history2.prevComposition);
|
|
45863
46168
|
else
|
|
45864
46169
|
return new HistoryState(history2.done, history2.undone.addTransform(tr2, void 0, options, mustPreserveItems(state2)), null, history2.prevTime, history2.prevComposition);
|
|
45865
46170
|
} else if (tr2.getMeta("addToHistory") !== false && !(appended && appended.getMeta("addToHistory") === false)) {
|
|
45866
46171
|
let composition = tr2.getMeta("composition");
|
|
45867
46172
|
let newGroup = history2.prevTime == 0 || !appended && history2.prevComposition != composition && (history2.prevTime < (tr2.time || 0) - options.newGroupDelay || !isAdjacentTo(tr2, history2.prevRanges));
|
|
45868
|
-
let prevRanges = appended ? mapRanges(history2.prevRanges, tr2.mapping) : rangesFor(tr2.mapping.maps
|
|
46173
|
+
let prevRanges = appended ? mapRanges(history2.prevRanges, tr2.mapping) : rangesFor(tr2.mapping.maps);
|
|
45869
46174
|
return new HistoryState(history2.done.addTransform(tr2, newGroup ? state2.selection.getBookmark() : void 0, options, mustPreserveItems(state2)), Branch.empty, prevRanges, tr2.time, composition == null ? history2.prevComposition : composition);
|
|
45870
46175
|
} else if (rebased = tr2.getMeta("rebased")) {
|
|
45871
46176
|
return new HistoryState(history2.done.rebased(tr2, rebased), history2.undone.rebased(tr2, rebased), mapRanges(history2.prevRanges, tr2.mapping), history2.prevTime, history2.prevComposition);
|
|
@@ -45886,9 +46191,10 @@ function isAdjacentTo(transform, prevRanges) {
|
|
|
45886
46191
|
});
|
|
45887
46192
|
return adjacent;
|
|
45888
46193
|
}
|
|
45889
|
-
function rangesFor(
|
|
46194
|
+
function rangesFor(maps) {
|
|
45890
46195
|
let result2 = [];
|
|
45891
|
-
|
|
46196
|
+
for (let i2 = maps.length - 1; i2 >= 0 && result2.length == 0; i2--)
|
|
46197
|
+
maps[i2].forEach((_from, _to, from2, to2) => result2.push(from2, to2));
|
|
45892
46198
|
return result2;
|
|
45893
46199
|
}
|
|
45894
46200
|
function mapRanges(ranges, mapping) {
|
|
@@ -45902,16 +46208,16 @@ function mapRanges(ranges, mapping) {
|
|
|
45902
46208
|
}
|
|
45903
46209
|
return result2;
|
|
45904
46210
|
}
|
|
45905
|
-
function histTransaction(history2, state2,
|
|
46211
|
+
function histTransaction(history2, state2, redo2) {
|
|
45906
46212
|
let preserveItems = mustPreserveItems(state2);
|
|
45907
46213
|
let histOptions = historyKey.get(state2).spec.config;
|
|
45908
46214
|
let pop = (redo2 ? history2.undone : history2.done).popEvent(state2, preserveItems);
|
|
45909
46215
|
if (!pop)
|
|
45910
|
-
return;
|
|
46216
|
+
return null;
|
|
45911
46217
|
let selection = pop.selection.resolve(pop.transform.doc);
|
|
45912
46218
|
let added = (redo2 ? history2.done : history2.undone).addTransform(pop.transform, state2.selection.getBookmark(), histOptions, preserveItems);
|
|
45913
46219
|
let newHist = new HistoryState(redo2 ? added : pop.remaining, redo2 ? pop.remaining : added, null, 0, -1);
|
|
45914
|
-
|
|
46220
|
+
return pop.transform.setSelection(selection).setMeta(historyKey, { redo: redo2, historyState: newHist });
|
|
45915
46221
|
}
|
|
45916
46222
|
let cachedPreserveItems = false, cachedPreserveItemsPlugins = null;
|
|
45917
46223
|
function mustPreserveItems(state2) {
|
|
@@ -45959,22 +46265,21 @@ function history(config = {}) {
|
|
|
45959
46265
|
}
|
|
45960
46266
|
});
|
|
45961
46267
|
}
|
|
45962
|
-
|
|
45963
|
-
|
|
45964
|
-
|
|
45965
|
-
|
|
45966
|
-
|
|
45967
|
-
|
|
45968
|
-
|
|
45969
|
-
|
|
45970
|
-
|
|
45971
|
-
|
|
45972
|
-
|
|
45973
|
-
|
|
45974
|
-
|
|
45975
|
-
|
|
45976
|
-
|
|
45977
|
-
};
|
|
46268
|
+
function buildCommand(redo2, scroll) {
|
|
46269
|
+
return (state2, dispatch) => {
|
|
46270
|
+
let hist = historyKey.getState(state2);
|
|
46271
|
+
if (!hist || (redo2 ? hist.undone : hist.done).eventCount == 0)
|
|
46272
|
+
return false;
|
|
46273
|
+
if (dispatch) {
|
|
46274
|
+
let tr2 = histTransaction(hist, state2, redo2);
|
|
46275
|
+
if (tr2)
|
|
46276
|
+
dispatch(scroll ? tr2.scrollIntoView() : tr2);
|
|
46277
|
+
}
|
|
46278
|
+
return true;
|
|
46279
|
+
};
|
|
46280
|
+
}
|
|
46281
|
+
const undo = buildCommand(false, true);
|
|
46282
|
+
const redo = buildCommand(true, true);
|
|
45978
46283
|
const History = Extension.create({
|
|
45979
46284
|
name: "history",
|
|
45980
46285
|
addOptions() {
|
|
@@ -46026,10 +46331,20 @@ const HorizontalRule = Node$2.create({
|
|
|
46026
46331
|
addCommands() {
|
|
46027
46332
|
return {
|
|
46028
46333
|
setHorizontalRule: () => ({ chain, state: state2 }) => {
|
|
46029
|
-
const {
|
|
46334
|
+
const { selection } = state2;
|
|
46335
|
+
const { $from: $originFrom, $to: $originTo } = selection;
|
|
46030
46336
|
const currentChain = chain();
|
|
46031
|
-
if ($
|
|
46032
|
-
currentChain.insertContentAt(
|
|
46337
|
+
if ($originFrom.parentOffset === 0) {
|
|
46338
|
+
currentChain.insertContentAt({
|
|
46339
|
+
from: Math.max($originFrom.pos - 1, 0),
|
|
46340
|
+
to: $originTo.pos
|
|
46341
|
+
}, {
|
|
46342
|
+
type: this.name
|
|
46343
|
+
});
|
|
46344
|
+
} else if (isNodeSelection(selection)) {
|
|
46345
|
+
currentChain.insertContentAt($originTo.pos, {
|
|
46346
|
+
type: this.name
|
|
46347
|
+
});
|
|
46033
46348
|
} else {
|
|
46034
46349
|
currentChain.insertContent({ type: this.name });
|
|
46035
46350
|
}
|
|
@@ -46415,11 +46730,11 @@ const StarterKit = Extension.create({
|
|
|
46415
46730
|
addExtensions() {
|
|
46416
46731
|
var _a2, _b, _c, _d, _e2, _f, _g, _h, _j, _k, _l2, _m, _o, _p, _q, _r2, _s, _t2;
|
|
46417
46732
|
const extensions = [];
|
|
46418
|
-
if (this.options.blockquote !== false) {
|
|
46419
|
-
extensions.push(Blockquote.configure((_a2 = this.options) === null || _a2 === void 0 ? void 0 : _a2.blockquote));
|
|
46420
|
-
}
|
|
46421
46733
|
if (this.options.bold !== false) {
|
|
46422
|
-
extensions.push(Bold.configure((
|
|
46734
|
+
extensions.push(Bold.configure((_a2 = this.options) === null || _a2 === void 0 ? void 0 : _a2.bold));
|
|
46735
|
+
}
|
|
46736
|
+
if (this.options.blockquote !== false) {
|
|
46737
|
+
extensions.push(Blockquote.configure((_b = this.options) === null || _b === void 0 ? void 0 : _b.blockquote));
|
|
46423
46738
|
}
|
|
46424
46739
|
if (this.options.bulletList !== false) {
|
|
46425
46740
|
extensions.push(BulletList.configure((_c = this.options) === null || _c === void 0 ? void 0 : _c.bulletList));
|
|
@@ -49226,7 +49541,7 @@ class BubbleMenuView {
|
|
|
49226
49541
|
}
|
|
49227
49542
|
update(view, oldState) {
|
|
49228
49543
|
const { state: state2 } = view;
|
|
49229
|
-
const hasValidSelection = state2.selection
|
|
49544
|
+
const hasValidSelection = state2.selection.from !== state2.selection.to;
|
|
49230
49545
|
if (this.updateDelay > 0 && hasValidSelection) {
|
|
49231
49546
|
this.handleDebouncedUpdate(view, oldState);
|
|
49232
49547
|
return;
|
|
@@ -52271,9 +52586,6 @@ function createColGroup(node, cellMinWidth, overrideCol, overrideValue) {
|
|
|
52271
52586
|
return { colgroup, tableWidth, tableMinWidth };
|
|
52272
52587
|
}
|
|
52273
52588
|
function createCell(cellType, cellContent) {
|
|
52274
|
-
if (cellContent) {
|
|
52275
|
-
return cellType.createChecked(null, cellContent);
|
|
52276
|
-
}
|
|
52277
52589
|
return cellType.createAndFill();
|
|
52278
52590
|
}
|
|
52279
52591
|
function getTableNodeTypes(schema) {
|
|
@@ -52295,12 +52607,12 @@ function createTable$1(schema, rowsCount, colsCount, withHeaderRow, cellContent)
|
|
|
52295
52607
|
const headerCells = [];
|
|
52296
52608
|
const cells = [];
|
|
52297
52609
|
for (let index2 = 0; index2 < colsCount; index2 += 1) {
|
|
52298
|
-
const cell = createCell(types.cell
|
|
52610
|
+
const cell = createCell(types.cell);
|
|
52299
52611
|
if (cell) {
|
|
52300
52612
|
cells.push(cell);
|
|
52301
52613
|
}
|
|
52302
52614
|
if (withHeaderRow) {
|
|
52303
|
-
const headerCell = createCell(types.header_cell
|
|
52615
|
+
const headerCell = createCell(types.header_cell);
|
|
52304
52616
|
if (headerCell) {
|
|
52305
52617
|
headerCells.push(headerCell);
|
|
52306
52618
|
}
|
|
@@ -52378,7 +52690,7 @@ const Table = Node$2.create({
|
|
|
52378
52690
|
insertTable: ({ rows = 3, cols = 3, withHeaderRow = true } = {}) => ({ tr: tr2, dispatch, editor }) => {
|
|
52379
52691
|
const node = createTable$1(editor.schema, rows, cols, withHeaderRow);
|
|
52380
52692
|
if (dispatch) {
|
|
52381
|
-
const offset2 = tr2.selection.
|
|
52693
|
+
const offset2 = tr2.selection.from + 1;
|
|
52382
52694
|
tr2.replaceSelectionWith(node).scrollIntoView().setSelection(TextSelection.near(tr2.doc.resolve(offset2)));
|
|
52383
52695
|
}
|
|
52384
52696
|
return true;
|
|
@@ -52855,18 +53167,7 @@ function _typeof$1(obj) {
|
|
|
52855
53167
|
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
52856
53168
|
}, _typeof$1(obj);
|
|
52857
53169
|
}
|
|
52858
|
-
function _defineProperties$2(target, props2) {
|
|
52859
|
-
for (var i2 = 0; i2 < props2.length; i2++) {
|
|
52860
|
-
var descriptor = props2[i2];
|
|
52861
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
52862
|
-
descriptor.configurable = true;
|
|
52863
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
52864
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
52865
|
-
}
|
|
52866
|
-
}
|
|
52867
53170
|
function _createClass$2(Constructor, protoProps, staticProps) {
|
|
52868
|
-
if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
|
|
52869
|
-
if (staticProps) _defineProperties$2(Constructor, staticProps);
|
|
52870
53171
|
Object.defineProperty(Constructor, "prototype", { writable: false });
|
|
52871
53172
|
return Constructor;
|
|
52872
53173
|
}
|
|
@@ -53043,7 +53344,6 @@ function _defineProperties$1(target, props2) {
|
|
|
53043
53344
|
}
|
|
53044
53345
|
function _createClass$1(Constructor, protoProps, staticProps) {
|
|
53045
53346
|
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
|
53046
|
-
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
|
53047
53347
|
Object.defineProperty(Constructor, "prototype", { writable: false });
|
|
53048
53348
|
return Constructor;
|
|
53049
53349
|
}
|
|
@@ -53685,10 +53985,10 @@ var DIGITS = {
|
|
|
53685
53985
|
function parseDigit(character) {
|
|
53686
53986
|
return DIGITS[character];
|
|
53687
53987
|
}
|
|
53688
|
-
function _createForOfIteratorHelperLoose$
|
|
53988
|
+
function _createForOfIteratorHelperLoose$3(o2, allowArrayLike) {
|
|
53689
53989
|
var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
|
|
53690
53990
|
if (it2) return (it2 = it2.call(o2)).next.bind(it2);
|
|
53691
|
-
if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$
|
|
53991
|
+
if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$4(o2)) || allowArrayLike) {
|
|
53692
53992
|
if (it2) o2 = it2;
|
|
53693
53993
|
var i2 = 0;
|
|
53694
53994
|
return function() {
|
|
@@ -53698,15 +53998,15 @@ function _createForOfIteratorHelperLoose$4(o2, allowArrayLike) {
|
|
|
53698
53998
|
}
|
|
53699
53999
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
53700
54000
|
}
|
|
53701
|
-
function _unsupportedIterableToArray$
|
|
54001
|
+
function _unsupportedIterableToArray$4(o2, minLen) {
|
|
53702
54002
|
if (!o2) return;
|
|
53703
|
-
if (typeof o2 === "string") return _arrayLikeToArray$
|
|
54003
|
+
if (typeof o2 === "string") return _arrayLikeToArray$4(o2, minLen);
|
|
53704
54004
|
var n2 = Object.prototype.toString.call(o2).slice(8, -1);
|
|
53705
54005
|
if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name;
|
|
53706
54006
|
if (n2 === "Map" || n2 === "Set") return Array.from(o2);
|
|
53707
|
-
if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$
|
|
54007
|
+
if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$4(o2, minLen);
|
|
53708
54008
|
}
|
|
53709
|
-
function _arrayLikeToArray$
|
|
54009
|
+
function _arrayLikeToArray$4(arr, len) {
|
|
53710
54010
|
if (len == null || len > arr.length) len = arr.length;
|
|
53711
54011
|
for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++) {
|
|
53712
54012
|
arr2[i2] = arr[i2];
|
|
@@ -53715,7 +54015,7 @@ function _arrayLikeToArray$5(arr, len) {
|
|
|
53715
54015
|
}
|
|
53716
54016
|
function parseIncompletePhoneNumber(string2) {
|
|
53717
54017
|
var result2 = "";
|
|
53718
|
-
for (var _iterator = _createForOfIteratorHelperLoose$
|
|
54018
|
+
for (var _iterator = _createForOfIteratorHelperLoose$3(string2.split("")), _step; !(_step = _iterator()).done; ) {
|
|
53719
54019
|
var character = _step.value;
|
|
53720
54020
|
result2 += parsePhoneNumberCharacter(character, result2) || "";
|
|
53721
54021
|
}
|
|
@@ -53724,55 +54024,12 @@ function parseIncompletePhoneNumber(string2) {
|
|
|
53724
54024
|
function parsePhoneNumberCharacter(character, prevParsedCharacters, emitEvent) {
|
|
53725
54025
|
if (character === "+") {
|
|
53726
54026
|
if (prevParsedCharacters) {
|
|
53727
|
-
if (typeof emitEvent === "function") {
|
|
53728
|
-
emitEvent("end");
|
|
53729
|
-
}
|
|
53730
54027
|
return;
|
|
53731
54028
|
}
|
|
53732
54029
|
return "+";
|
|
53733
54030
|
}
|
|
53734
54031
|
return parseDigit(character);
|
|
53735
54032
|
}
|
|
53736
|
-
function _createForOfIteratorHelperLoose$3(o2, allowArrayLike) {
|
|
53737
|
-
var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
|
|
53738
|
-
if (it2) return (it2 = it2.call(o2)).next.bind(it2);
|
|
53739
|
-
if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$4(o2)) || allowArrayLike && o2 && typeof o2.length === "number") {
|
|
53740
|
-
if (it2) o2 = it2;
|
|
53741
|
-
var i2 = 0;
|
|
53742
|
-
return function() {
|
|
53743
|
-
if (i2 >= o2.length) return { done: true };
|
|
53744
|
-
return { done: false, value: o2[i2++] };
|
|
53745
|
-
};
|
|
53746
|
-
}
|
|
53747
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
53748
|
-
}
|
|
53749
|
-
function _unsupportedIterableToArray$4(o2, minLen) {
|
|
53750
|
-
if (!o2) return;
|
|
53751
|
-
if (typeof o2 === "string") return _arrayLikeToArray$4(o2, minLen);
|
|
53752
|
-
var n2 = Object.prototype.toString.call(o2).slice(8, -1);
|
|
53753
|
-
if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name;
|
|
53754
|
-
if (n2 === "Map" || n2 === "Set") return Array.from(o2);
|
|
53755
|
-
if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$4(o2, minLen);
|
|
53756
|
-
}
|
|
53757
|
-
function _arrayLikeToArray$4(arr, len) {
|
|
53758
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
53759
|
-
for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++) {
|
|
53760
|
-
arr2[i2] = arr[i2];
|
|
53761
|
-
}
|
|
53762
|
-
return arr2;
|
|
53763
|
-
}
|
|
53764
|
-
function mergeArrays(a2, b2) {
|
|
53765
|
-
var merged = a2.slice();
|
|
53766
|
-
for (var _iterator = _createForOfIteratorHelperLoose$3(b2), _step; !(_step = _iterator()).done; ) {
|
|
53767
|
-
var element = _step.value;
|
|
53768
|
-
if (a2.indexOf(element) < 0) {
|
|
53769
|
-
merged.push(element);
|
|
53770
|
-
}
|
|
53771
|
-
}
|
|
53772
|
-
return merged.sort(function(a3, b3) {
|
|
53773
|
-
return a3 - b3;
|
|
53774
|
-
});
|
|
53775
|
-
}
|
|
53776
54033
|
function checkNumberLength(nationalNumber, metadata2) {
|
|
53777
54034
|
return checkNumberLengthForType(nationalNumber, void 0, metadata2);
|
|
53778
54035
|
}
|
|
@@ -53782,17 +54039,6 @@ function checkNumberLengthForType(nationalNumber, type3, metadata2) {
|
|
|
53782
54039
|
if (!possible_lengths) {
|
|
53783
54040
|
return "IS_POSSIBLE";
|
|
53784
54041
|
}
|
|
53785
|
-
if (type3 === "FIXED_LINE_OR_MOBILE") {
|
|
53786
|
-
if (!metadata2.type("FIXED_LINE")) {
|
|
53787
|
-
return checkNumberLengthForType(nationalNumber, "MOBILE", metadata2);
|
|
53788
|
-
}
|
|
53789
|
-
var mobile_type = metadata2.type("MOBILE");
|
|
53790
|
-
if (mobile_type) {
|
|
53791
|
-
possible_lengths = mergeArrays(possible_lengths, mobile_type.possibleLengths());
|
|
53792
|
-
}
|
|
53793
|
-
} else if (type3 && !type_info) {
|
|
53794
|
-
return "INVALID_LENGTH";
|
|
53795
|
-
}
|
|
53796
54042
|
var actual_length = nationalNumber.length;
|
|
53797
54043
|
var minimum_length = possible_lengths[0];
|
|
53798
54044
|
if (minimum_length === actual_length) {
|
|
@@ -53857,7 +54103,7 @@ function matchesEntirely(text, regular_expression) {
|
|
|
53857
54103
|
function _createForOfIteratorHelperLoose$2(o2, allowArrayLike) {
|
|
53858
54104
|
var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
|
|
53859
54105
|
if (it2) return (it2 = it2.call(o2)).next.bind(it2);
|
|
53860
|
-
if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$3(o2)) || allowArrayLike
|
|
54106
|
+
if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$3(o2)) || allowArrayLike) {
|
|
53861
54107
|
if (it2) o2 = it2;
|
|
53862
54108
|
var i2 = 0;
|
|
53863
54109
|
return function() {
|
|
@@ -53957,8 +54203,6 @@ function applyInternationalSeparatorStyle(formattedNumber) {
|
|
|
53957
54203
|
var FIRST_GROUP_PATTERN = /(\$\d)/;
|
|
53958
54204
|
function formatNationalNumberUsingFormat(number2, format2, _ref) {
|
|
53959
54205
|
var useInternationalFormat = _ref.useInternationalFormat, withNationalPrefix = _ref.withNationalPrefix;
|
|
53960
|
-
_ref.carrierCode;
|
|
53961
|
-
_ref.metadata;
|
|
53962
54206
|
var formattedNumber = number2.replace(new RegExp(format2.pattern()), useInternationalFormat ? format2.internationalFormat() : (
|
|
53963
54207
|
// This library doesn't use `domestic_carrier_code_formatting_rule`,
|
|
53964
54208
|
// because that one is only used when formatting phone numbers
|
|
@@ -54004,7 +54248,7 @@ function formatRFC3966(_ref) {
|
|
|
54004
54248
|
function _createForOfIteratorHelperLoose$1(o2, allowArrayLike) {
|
|
54005
54249
|
var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
|
|
54006
54250
|
if (it2) return (it2 = it2.call(o2)).next.bind(it2);
|
|
54007
|
-
if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$2(o2)) || allowArrayLike
|
|
54251
|
+
if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$2(o2)) || allowArrayLike) {
|
|
54008
54252
|
if (it2) o2 = it2;
|
|
54009
54253
|
var i2 = 0;
|
|
54010
54254
|
return function() {
|
|
@@ -54200,7 +54444,6 @@ function _defineProperties(target, props2) {
|
|
|
54200
54444
|
}
|
|
54201
54445
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
54202
54446
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
54203
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
54204
54447
|
Object.defineProperty(Constructor, "prototype", { writable: false });
|
|
54205
54448
|
return Constructor;
|
|
54206
54449
|
}
|
|
@@ -54497,7 +54740,7 @@ function extractCountryCallingCode(number2, country, callingCode, metadata2) {
|
|
|
54497
54740
|
function _createForOfIteratorHelperLoose(o2, allowArrayLike) {
|
|
54498
54741
|
var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
|
|
54499
54742
|
if (it2) return (it2 = it2.call(o2)).next.bind(it2);
|
|
54500
|
-
if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$1(o2)) || allowArrayLike
|
|
54743
|
+
if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$1(o2)) || allowArrayLike) {
|
|
54501
54744
|
if (it2) o2 = it2;
|
|
54502
54745
|
var i2 = 0;
|
|
54503
54746
|
return function() {
|
|
@@ -54551,14 +54794,8 @@ function getCountryByNationalNumber(nationalPhoneNumber, _ref) {
|
|
|
54551
54794
|
return matchingCountries[0];
|
|
54552
54795
|
}
|
|
54553
54796
|
}
|
|
54554
|
-
var USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;
|
|
54555
54797
|
function getCountryByCallingCode(callingCode, _ref) {
|
|
54556
54798
|
var nationalPhoneNumber = _ref.nationalNumber, defaultCountry = _ref.defaultCountry, metadata2 = _ref.metadata;
|
|
54557
|
-
if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {
|
|
54558
|
-
if (metadata2.isNonGeographicCallingCode(callingCode)) {
|
|
54559
|
-
return "001";
|
|
54560
|
-
}
|
|
54561
|
-
}
|
|
54562
54799
|
var possibleCountries = metadata2.getCountryCodesForCallingCode(callingCode);
|
|
54563
54800
|
if (!possibleCountries) {
|
|
54564
54801
|
return;
|
|
@@ -57392,7 +57629,7 @@ const bisectCenter = bisector(number$2).center;
|
|
|
57392
57629
|
function extent(values3, valueof) {
|
|
57393
57630
|
let min2;
|
|
57394
57631
|
let max2;
|
|
57395
|
-
|
|
57632
|
+
{
|
|
57396
57633
|
for (const value of values3) {
|
|
57397
57634
|
if (value != null) {
|
|
57398
57635
|
if (min2 === void 0) {
|
|
@@ -57403,18 +57640,6 @@ function extent(values3, valueof) {
|
|
|
57403
57640
|
}
|
|
57404
57641
|
}
|
|
57405
57642
|
}
|
|
57406
|
-
} else {
|
|
57407
|
-
let index2 = -1;
|
|
57408
|
-
for (let value of values3) {
|
|
57409
|
-
if ((value = valueof(value, ++index2, values3)) != null) {
|
|
57410
|
-
if (min2 === void 0) {
|
|
57411
|
-
if (value >= value) min2 = max2 = value;
|
|
57412
|
-
} else {
|
|
57413
|
-
if (min2 > value) min2 = value;
|
|
57414
|
-
if (max2 < value) max2 = value;
|
|
57415
|
-
}
|
|
57416
|
-
}
|
|
57417
|
-
}
|
|
57418
57643
|
}
|
|
57419
57644
|
return [min2, max2];
|
|
57420
57645
|
}
|