@wangeditor-next/editor 5.3.12-alpha.1 → 5.3.12-alpha.2

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/index.js CHANGED
@@ -38565,15 +38565,1866 @@
38565
38565
  }));
38566
38566
  });
38567
38567
 
38568
+ /**
38569
+ * Lodash (Custom Build) <https://lodash.com/>
38570
+ * Build: `lodash modularize exports="npm" -o ./`
38571
+ * Copyright JS Foundation and other contributors <https://js.foundation/>
38572
+ * Released under MIT license <https://lodash.com/license>
38573
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
38574
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
38575
+ */
38576
+
38577
+ var lodash_isequal = createCommonjsModule$1(function (module, exports) {
38578
+ /** Used as the size to enable large array optimizations. */
38579
+ var LARGE_ARRAY_SIZE = 200;
38580
+
38581
+ /** Used to stand-in for `undefined` hash values. */
38582
+ var HASH_UNDEFINED = '__lodash_hash_undefined__';
38583
+
38584
+ /** Used to compose bitmasks for value comparisons. */
38585
+ var COMPARE_PARTIAL_FLAG = 1,
38586
+ COMPARE_UNORDERED_FLAG = 2;
38587
+
38588
+ /** Used as references for various `Number` constants. */
38589
+ var MAX_SAFE_INTEGER = 9007199254740991;
38590
+
38591
+ /** `Object#toString` result references. */
38592
+ var argsTag = '[object Arguments]',
38593
+ arrayTag = '[object Array]',
38594
+ asyncTag = '[object AsyncFunction]',
38595
+ boolTag = '[object Boolean]',
38596
+ dateTag = '[object Date]',
38597
+ errorTag = '[object Error]',
38598
+ funcTag = '[object Function]',
38599
+ genTag = '[object GeneratorFunction]',
38600
+ mapTag = '[object Map]',
38601
+ numberTag = '[object Number]',
38602
+ nullTag = '[object Null]',
38603
+ objectTag = '[object Object]',
38604
+ promiseTag = '[object Promise]',
38605
+ proxyTag = '[object Proxy]',
38606
+ regexpTag = '[object RegExp]',
38607
+ setTag = '[object Set]',
38608
+ stringTag = '[object String]',
38609
+ symbolTag = '[object Symbol]',
38610
+ undefinedTag = '[object Undefined]',
38611
+ weakMapTag = '[object WeakMap]';
38612
+
38613
+ var arrayBufferTag = '[object ArrayBuffer]',
38614
+ dataViewTag = '[object DataView]',
38615
+ float32Tag = '[object Float32Array]',
38616
+ float64Tag = '[object Float64Array]',
38617
+ int8Tag = '[object Int8Array]',
38618
+ int16Tag = '[object Int16Array]',
38619
+ int32Tag = '[object Int32Array]',
38620
+ uint8Tag = '[object Uint8Array]',
38621
+ uint8ClampedTag = '[object Uint8ClampedArray]',
38622
+ uint16Tag = '[object Uint16Array]',
38623
+ uint32Tag = '[object Uint32Array]';
38624
+
38625
+ /**
38626
+ * Used to match `RegExp`
38627
+ * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
38628
+ */
38629
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
38630
+
38631
+ /** Used to detect host constructors (Safari). */
38632
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
38633
+
38634
+ /** Used to detect unsigned integer values. */
38635
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
38636
+
38637
+ /** Used to identify `toStringTag` values of typed arrays. */
38638
+ var typedArrayTags = {};
38639
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
38640
+ typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
38641
+ typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
38642
+ typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
38643
+ typedArrayTags[uint32Tag] = true;
38644
+ typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
38645
+ typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
38646
+ typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
38647
+ typedArrayTags[errorTag] = typedArrayTags[funcTag] =
38648
+ typedArrayTags[mapTag] = typedArrayTags[numberTag] =
38649
+ typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
38650
+ typedArrayTags[setTag] = typedArrayTags[stringTag] =
38651
+ typedArrayTags[weakMapTag] = false;
38652
+
38653
+ /** Detect free variable `global` from Node.js. */
38654
+ var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
38655
+
38656
+ /** Detect free variable `self`. */
38657
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
38658
+
38659
+ /** Used as a reference to the global object. */
38660
+ var root = freeGlobal || freeSelf || Function('return this')();
38661
+
38662
+ /** Detect free variable `exports`. */
38663
+ var freeExports = exports && !exports.nodeType && exports;
38664
+
38665
+ /** Detect free variable `module`. */
38666
+ var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
38667
+
38668
+ /** Detect the popular CommonJS extension `module.exports`. */
38669
+ var moduleExports = freeModule && freeModule.exports === freeExports;
38670
+
38671
+ /** Detect free variable `process` from Node.js. */
38672
+ var freeProcess = moduleExports && freeGlobal.process;
38673
+
38674
+ /** Used to access faster Node.js helpers. */
38675
+ var nodeUtil = (function() {
38676
+ try {
38677
+ return freeProcess && freeProcess.binding && freeProcess.binding('util');
38678
+ } catch (e) {}
38679
+ }());
38680
+
38681
+ /* Node.js helper references. */
38682
+ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
38683
+
38684
+ /**
38685
+ * A specialized version of `_.filter` for arrays without support for
38686
+ * iteratee shorthands.
38687
+ *
38688
+ * @private
38689
+ * @param {Array} [array] The array to iterate over.
38690
+ * @param {Function} predicate The function invoked per iteration.
38691
+ * @returns {Array} Returns the new filtered array.
38692
+ */
38693
+ function arrayFilter(array, predicate) {
38694
+ var index = -1,
38695
+ length = array == null ? 0 : array.length,
38696
+ resIndex = 0,
38697
+ result = [];
38698
+
38699
+ while (++index < length) {
38700
+ var value = array[index];
38701
+ if (predicate(value, index, array)) {
38702
+ result[resIndex++] = value;
38703
+ }
38704
+ }
38705
+ return result;
38706
+ }
38707
+
38708
+ /**
38709
+ * Appends the elements of `values` to `array`.
38710
+ *
38711
+ * @private
38712
+ * @param {Array} array The array to modify.
38713
+ * @param {Array} values The values to append.
38714
+ * @returns {Array} Returns `array`.
38715
+ */
38716
+ function arrayPush(array, values) {
38717
+ var index = -1,
38718
+ length = values.length,
38719
+ offset = array.length;
38720
+
38721
+ while (++index < length) {
38722
+ array[offset + index] = values[index];
38723
+ }
38724
+ return array;
38725
+ }
38726
+
38727
+ /**
38728
+ * A specialized version of `_.some` for arrays without support for iteratee
38729
+ * shorthands.
38730
+ *
38731
+ * @private
38732
+ * @param {Array} [array] The array to iterate over.
38733
+ * @param {Function} predicate The function invoked per iteration.
38734
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
38735
+ * else `false`.
38736
+ */
38737
+ function arraySome(array, predicate) {
38738
+ var index = -1,
38739
+ length = array == null ? 0 : array.length;
38740
+
38741
+ while (++index < length) {
38742
+ if (predicate(array[index], index, array)) {
38743
+ return true;
38744
+ }
38745
+ }
38746
+ return false;
38747
+ }
38748
+
38749
+ /**
38750
+ * The base implementation of `_.times` without support for iteratee shorthands
38751
+ * or max array length checks.
38752
+ *
38753
+ * @private
38754
+ * @param {number} n The number of times to invoke `iteratee`.
38755
+ * @param {Function} iteratee The function invoked per iteration.
38756
+ * @returns {Array} Returns the array of results.
38757
+ */
38758
+ function baseTimes(n, iteratee) {
38759
+ var index = -1,
38760
+ result = Array(n);
38761
+
38762
+ while (++index < n) {
38763
+ result[index] = iteratee(index);
38764
+ }
38765
+ return result;
38766
+ }
38767
+
38768
+ /**
38769
+ * The base implementation of `_.unary` without support for storing metadata.
38770
+ *
38771
+ * @private
38772
+ * @param {Function} func The function to cap arguments for.
38773
+ * @returns {Function} Returns the new capped function.
38774
+ */
38775
+ function baseUnary(func) {
38776
+ return function(value) {
38777
+ return func(value);
38778
+ };
38779
+ }
38780
+
38781
+ /**
38782
+ * Checks if a `cache` value for `key` exists.
38783
+ *
38784
+ * @private
38785
+ * @param {Object} cache The cache to query.
38786
+ * @param {string} key The key of the entry to check.
38787
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
38788
+ */
38789
+ function cacheHas(cache, key) {
38790
+ return cache.has(key);
38791
+ }
38792
+
38793
+ /**
38794
+ * Gets the value at `key` of `object`.
38795
+ *
38796
+ * @private
38797
+ * @param {Object} [object] The object to query.
38798
+ * @param {string} key The key of the property to get.
38799
+ * @returns {*} Returns the property value.
38800
+ */
38801
+ function getValue(object, key) {
38802
+ return object == null ? undefined : object[key];
38803
+ }
38804
+
38805
+ /**
38806
+ * Converts `map` to its key-value pairs.
38807
+ *
38808
+ * @private
38809
+ * @param {Object} map The map to convert.
38810
+ * @returns {Array} Returns the key-value pairs.
38811
+ */
38812
+ function mapToArray(map) {
38813
+ var index = -1,
38814
+ result = Array(map.size);
38815
+
38816
+ map.forEach(function(value, key) {
38817
+ result[++index] = [key, value];
38818
+ });
38819
+ return result;
38820
+ }
38821
+
38822
+ /**
38823
+ * Creates a unary function that invokes `func` with its argument transformed.
38824
+ *
38825
+ * @private
38826
+ * @param {Function} func The function to wrap.
38827
+ * @param {Function} transform The argument transform.
38828
+ * @returns {Function} Returns the new function.
38829
+ */
38830
+ function overArg(func, transform) {
38831
+ return function(arg) {
38832
+ return func(transform(arg));
38833
+ };
38834
+ }
38835
+
38836
+ /**
38837
+ * Converts `set` to an array of its values.
38838
+ *
38839
+ * @private
38840
+ * @param {Object} set The set to convert.
38841
+ * @returns {Array} Returns the values.
38842
+ */
38843
+ function setToArray(set) {
38844
+ var index = -1,
38845
+ result = Array(set.size);
38846
+
38847
+ set.forEach(function(value) {
38848
+ result[++index] = value;
38849
+ });
38850
+ return result;
38851
+ }
38852
+
38853
+ /** Used for built-in method references. */
38854
+ var arrayProto = Array.prototype,
38855
+ funcProto = Function.prototype,
38856
+ objectProto = Object.prototype;
38857
+
38858
+ /** Used to detect overreaching core-js shims. */
38859
+ var coreJsData = root['__core-js_shared__'];
38860
+
38861
+ /** Used to resolve the decompiled source of functions. */
38862
+ var funcToString = funcProto.toString;
38863
+
38864
+ /** Used to check objects for own properties. */
38865
+ var hasOwnProperty = objectProto.hasOwnProperty;
38866
+
38867
+ /** Used to detect methods masquerading as native. */
38868
+ var maskSrcKey = (function() {
38869
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
38870
+ return uid ? ('Symbol(src)_1.' + uid) : '';
38871
+ }());
38872
+
38873
+ /**
38874
+ * Used to resolve the
38875
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
38876
+ * of values.
38877
+ */
38878
+ var nativeObjectToString = objectProto.toString;
38879
+
38880
+ /** Used to detect if a method is native. */
38881
+ var reIsNative = RegExp('^' +
38882
+ funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
38883
+ .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
38884
+ );
38885
+
38886
+ /** Built-in value references. */
38887
+ var Buffer = moduleExports ? root.Buffer : undefined,
38888
+ Symbol = root.Symbol,
38889
+ Uint8Array = root.Uint8Array,
38890
+ propertyIsEnumerable = objectProto.propertyIsEnumerable,
38891
+ splice = arrayProto.splice,
38892
+ symToStringTag = Symbol ? Symbol.toStringTag : undefined;
38893
+
38894
+ /* Built-in method references for those with the same name as other `lodash` methods. */
38895
+ var nativeGetSymbols = Object.getOwnPropertySymbols,
38896
+ nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
38897
+ nativeKeys = overArg(Object.keys, Object);
38898
+
38899
+ /* Built-in method references that are verified to be native. */
38900
+ var DataView = getNative(root, 'DataView'),
38901
+ Map = getNative(root, 'Map'),
38902
+ Promise = getNative(root, 'Promise'),
38903
+ Set = getNative(root, 'Set'),
38904
+ WeakMap = getNative(root, 'WeakMap'),
38905
+ nativeCreate = getNative(Object, 'create');
38906
+
38907
+ /** Used to detect maps, sets, and weakmaps. */
38908
+ var dataViewCtorString = toSource(DataView),
38909
+ mapCtorString = toSource(Map),
38910
+ promiseCtorString = toSource(Promise),
38911
+ setCtorString = toSource(Set),
38912
+ weakMapCtorString = toSource(WeakMap);
38913
+
38914
+ /** Used to convert symbols to primitives and strings. */
38915
+ var symbolProto = Symbol ? Symbol.prototype : undefined,
38916
+ symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
38917
+
38918
+ /**
38919
+ * Creates a hash object.
38920
+ *
38921
+ * @private
38922
+ * @constructor
38923
+ * @param {Array} [entries] The key-value pairs to cache.
38924
+ */
38925
+ function Hash(entries) {
38926
+ var index = -1,
38927
+ length = entries == null ? 0 : entries.length;
38928
+
38929
+ this.clear();
38930
+ while (++index < length) {
38931
+ var entry = entries[index];
38932
+ this.set(entry[0], entry[1]);
38933
+ }
38934
+ }
38935
+
38936
+ /**
38937
+ * Removes all key-value entries from the hash.
38938
+ *
38939
+ * @private
38940
+ * @name clear
38941
+ * @memberOf Hash
38942
+ */
38943
+ function hashClear() {
38944
+ this.__data__ = nativeCreate ? nativeCreate(null) : {};
38945
+ this.size = 0;
38946
+ }
38947
+
38948
+ /**
38949
+ * Removes `key` and its value from the hash.
38950
+ *
38951
+ * @private
38952
+ * @name delete
38953
+ * @memberOf Hash
38954
+ * @param {Object} hash The hash to modify.
38955
+ * @param {string} key The key of the value to remove.
38956
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
38957
+ */
38958
+ function hashDelete(key) {
38959
+ var result = this.has(key) && delete this.__data__[key];
38960
+ this.size -= result ? 1 : 0;
38961
+ return result;
38962
+ }
38963
+
38964
+ /**
38965
+ * Gets the hash value for `key`.
38966
+ *
38967
+ * @private
38968
+ * @name get
38969
+ * @memberOf Hash
38970
+ * @param {string} key The key of the value to get.
38971
+ * @returns {*} Returns the entry value.
38972
+ */
38973
+ function hashGet(key) {
38974
+ var data = this.__data__;
38975
+ if (nativeCreate) {
38976
+ var result = data[key];
38977
+ return result === HASH_UNDEFINED ? undefined : result;
38978
+ }
38979
+ return hasOwnProperty.call(data, key) ? data[key] : undefined;
38980
+ }
38981
+
38982
+ /**
38983
+ * Checks if a hash value for `key` exists.
38984
+ *
38985
+ * @private
38986
+ * @name has
38987
+ * @memberOf Hash
38988
+ * @param {string} key The key of the entry to check.
38989
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
38990
+ */
38991
+ function hashHas(key) {
38992
+ var data = this.__data__;
38993
+ return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
38994
+ }
38995
+
38996
+ /**
38997
+ * Sets the hash `key` to `value`.
38998
+ *
38999
+ * @private
39000
+ * @name set
39001
+ * @memberOf Hash
39002
+ * @param {string} key The key of the value to set.
39003
+ * @param {*} value The value to set.
39004
+ * @returns {Object} Returns the hash instance.
39005
+ */
39006
+ function hashSet(key, value) {
39007
+ var data = this.__data__;
39008
+ this.size += this.has(key) ? 0 : 1;
39009
+ data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
39010
+ return this;
39011
+ }
39012
+
39013
+ // Add methods to `Hash`.
39014
+ Hash.prototype.clear = hashClear;
39015
+ Hash.prototype['delete'] = hashDelete;
39016
+ Hash.prototype.get = hashGet;
39017
+ Hash.prototype.has = hashHas;
39018
+ Hash.prototype.set = hashSet;
39019
+
39020
+ /**
39021
+ * Creates an list cache object.
39022
+ *
39023
+ * @private
39024
+ * @constructor
39025
+ * @param {Array} [entries] The key-value pairs to cache.
39026
+ */
39027
+ function ListCache(entries) {
39028
+ var index = -1,
39029
+ length = entries == null ? 0 : entries.length;
39030
+
39031
+ this.clear();
39032
+ while (++index < length) {
39033
+ var entry = entries[index];
39034
+ this.set(entry[0], entry[1]);
39035
+ }
39036
+ }
39037
+
39038
+ /**
39039
+ * Removes all key-value entries from the list cache.
39040
+ *
39041
+ * @private
39042
+ * @name clear
39043
+ * @memberOf ListCache
39044
+ */
39045
+ function listCacheClear() {
39046
+ this.__data__ = [];
39047
+ this.size = 0;
39048
+ }
39049
+
39050
+ /**
39051
+ * Removes `key` and its value from the list cache.
39052
+ *
39053
+ * @private
39054
+ * @name delete
39055
+ * @memberOf ListCache
39056
+ * @param {string} key The key of the value to remove.
39057
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
39058
+ */
39059
+ function listCacheDelete(key) {
39060
+ var data = this.__data__,
39061
+ index = assocIndexOf(data, key);
39062
+
39063
+ if (index < 0) {
39064
+ return false;
39065
+ }
39066
+ var lastIndex = data.length - 1;
39067
+ if (index == lastIndex) {
39068
+ data.pop();
39069
+ } else {
39070
+ splice.call(data, index, 1);
39071
+ }
39072
+ --this.size;
39073
+ return true;
39074
+ }
39075
+
39076
+ /**
39077
+ * Gets the list cache value for `key`.
39078
+ *
39079
+ * @private
39080
+ * @name get
39081
+ * @memberOf ListCache
39082
+ * @param {string} key The key of the value to get.
39083
+ * @returns {*} Returns the entry value.
39084
+ */
39085
+ function listCacheGet(key) {
39086
+ var data = this.__data__,
39087
+ index = assocIndexOf(data, key);
39088
+
39089
+ return index < 0 ? undefined : data[index][1];
39090
+ }
39091
+
39092
+ /**
39093
+ * Checks if a list cache value for `key` exists.
39094
+ *
39095
+ * @private
39096
+ * @name has
39097
+ * @memberOf ListCache
39098
+ * @param {string} key The key of the entry to check.
39099
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
39100
+ */
39101
+ function listCacheHas(key) {
39102
+ return assocIndexOf(this.__data__, key) > -1;
39103
+ }
39104
+
39105
+ /**
39106
+ * Sets the list cache `key` to `value`.
39107
+ *
39108
+ * @private
39109
+ * @name set
39110
+ * @memberOf ListCache
39111
+ * @param {string} key The key of the value to set.
39112
+ * @param {*} value The value to set.
39113
+ * @returns {Object} Returns the list cache instance.
39114
+ */
39115
+ function listCacheSet(key, value) {
39116
+ var data = this.__data__,
39117
+ index = assocIndexOf(data, key);
39118
+
39119
+ if (index < 0) {
39120
+ ++this.size;
39121
+ data.push([key, value]);
39122
+ } else {
39123
+ data[index][1] = value;
39124
+ }
39125
+ return this;
39126
+ }
39127
+
39128
+ // Add methods to `ListCache`.
39129
+ ListCache.prototype.clear = listCacheClear;
39130
+ ListCache.prototype['delete'] = listCacheDelete;
39131
+ ListCache.prototype.get = listCacheGet;
39132
+ ListCache.prototype.has = listCacheHas;
39133
+ ListCache.prototype.set = listCacheSet;
39134
+
39135
+ /**
39136
+ * Creates a map cache object to store key-value pairs.
39137
+ *
39138
+ * @private
39139
+ * @constructor
39140
+ * @param {Array} [entries] The key-value pairs to cache.
39141
+ */
39142
+ function MapCache(entries) {
39143
+ var index = -1,
39144
+ length = entries == null ? 0 : entries.length;
39145
+
39146
+ this.clear();
39147
+ while (++index < length) {
39148
+ var entry = entries[index];
39149
+ this.set(entry[0], entry[1]);
39150
+ }
39151
+ }
39152
+
39153
+ /**
39154
+ * Removes all key-value entries from the map.
39155
+ *
39156
+ * @private
39157
+ * @name clear
39158
+ * @memberOf MapCache
39159
+ */
39160
+ function mapCacheClear() {
39161
+ this.size = 0;
39162
+ this.__data__ = {
39163
+ 'hash': new Hash,
39164
+ 'map': new (Map || ListCache),
39165
+ 'string': new Hash
39166
+ };
39167
+ }
39168
+
39169
+ /**
39170
+ * Removes `key` and its value from the map.
39171
+ *
39172
+ * @private
39173
+ * @name delete
39174
+ * @memberOf MapCache
39175
+ * @param {string} key The key of the value to remove.
39176
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
39177
+ */
39178
+ function mapCacheDelete(key) {
39179
+ var result = getMapData(this, key)['delete'](key);
39180
+ this.size -= result ? 1 : 0;
39181
+ return result;
39182
+ }
39183
+
39184
+ /**
39185
+ * Gets the map value for `key`.
39186
+ *
39187
+ * @private
39188
+ * @name get
39189
+ * @memberOf MapCache
39190
+ * @param {string} key The key of the value to get.
39191
+ * @returns {*} Returns the entry value.
39192
+ */
39193
+ function mapCacheGet(key) {
39194
+ return getMapData(this, key).get(key);
39195
+ }
39196
+
39197
+ /**
39198
+ * Checks if a map value for `key` exists.
39199
+ *
39200
+ * @private
39201
+ * @name has
39202
+ * @memberOf MapCache
39203
+ * @param {string} key The key of the entry to check.
39204
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
39205
+ */
39206
+ function mapCacheHas(key) {
39207
+ return getMapData(this, key).has(key);
39208
+ }
39209
+
39210
+ /**
39211
+ * Sets the map `key` to `value`.
39212
+ *
39213
+ * @private
39214
+ * @name set
39215
+ * @memberOf MapCache
39216
+ * @param {string} key The key of the value to set.
39217
+ * @param {*} value The value to set.
39218
+ * @returns {Object} Returns the map cache instance.
39219
+ */
39220
+ function mapCacheSet(key, value) {
39221
+ var data = getMapData(this, key),
39222
+ size = data.size;
39223
+
39224
+ data.set(key, value);
39225
+ this.size += data.size == size ? 0 : 1;
39226
+ return this;
39227
+ }
39228
+
39229
+ // Add methods to `MapCache`.
39230
+ MapCache.prototype.clear = mapCacheClear;
39231
+ MapCache.prototype['delete'] = mapCacheDelete;
39232
+ MapCache.prototype.get = mapCacheGet;
39233
+ MapCache.prototype.has = mapCacheHas;
39234
+ MapCache.prototype.set = mapCacheSet;
39235
+
39236
+ /**
39237
+ *
39238
+ * Creates an array cache object to store unique values.
39239
+ *
39240
+ * @private
39241
+ * @constructor
39242
+ * @param {Array} [values] The values to cache.
39243
+ */
39244
+ function SetCache(values) {
39245
+ var index = -1,
39246
+ length = values == null ? 0 : values.length;
39247
+
39248
+ this.__data__ = new MapCache;
39249
+ while (++index < length) {
39250
+ this.add(values[index]);
39251
+ }
39252
+ }
39253
+
39254
+ /**
39255
+ * Adds `value` to the array cache.
39256
+ *
39257
+ * @private
39258
+ * @name add
39259
+ * @memberOf SetCache
39260
+ * @alias push
39261
+ * @param {*} value The value to cache.
39262
+ * @returns {Object} Returns the cache instance.
39263
+ */
39264
+ function setCacheAdd(value) {
39265
+ this.__data__.set(value, HASH_UNDEFINED);
39266
+ return this;
39267
+ }
39268
+
39269
+ /**
39270
+ * Checks if `value` is in the array cache.
39271
+ *
39272
+ * @private
39273
+ * @name has
39274
+ * @memberOf SetCache
39275
+ * @param {*} value The value to search for.
39276
+ * @returns {number} Returns `true` if `value` is found, else `false`.
39277
+ */
39278
+ function setCacheHas(value) {
39279
+ return this.__data__.has(value);
39280
+ }
39281
+
39282
+ // Add methods to `SetCache`.
39283
+ SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
39284
+ SetCache.prototype.has = setCacheHas;
39285
+
39286
+ /**
39287
+ * Creates a stack cache object to store key-value pairs.
39288
+ *
39289
+ * @private
39290
+ * @constructor
39291
+ * @param {Array} [entries] The key-value pairs to cache.
39292
+ */
39293
+ function Stack(entries) {
39294
+ var data = this.__data__ = new ListCache(entries);
39295
+ this.size = data.size;
39296
+ }
39297
+
39298
+ /**
39299
+ * Removes all key-value entries from the stack.
39300
+ *
39301
+ * @private
39302
+ * @name clear
39303
+ * @memberOf Stack
39304
+ */
39305
+ function stackClear() {
39306
+ this.__data__ = new ListCache;
39307
+ this.size = 0;
39308
+ }
39309
+
39310
+ /**
39311
+ * Removes `key` and its value from the stack.
39312
+ *
39313
+ * @private
39314
+ * @name delete
39315
+ * @memberOf Stack
39316
+ * @param {string} key The key of the value to remove.
39317
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
39318
+ */
39319
+ function stackDelete(key) {
39320
+ var data = this.__data__,
39321
+ result = data['delete'](key);
39322
+
39323
+ this.size = data.size;
39324
+ return result;
39325
+ }
39326
+
39327
+ /**
39328
+ * Gets the stack value for `key`.
39329
+ *
39330
+ * @private
39331
+ * @name get
39332
+ * @memberOf Stack
39333
+ * @param {string} key The key of the value to get.
39334
+ * @returns {*} Returns the entry value.
39335
+ */
39336
+ function stackGet(key) {
39337
+ return this.__data__.get(key);
39338
+ }
39339
+
39340
+ /**
39341
+ * Checks if a stack value for `key` exists.
39342
+ *
39343
+ * @private
39344
+ * @name has
39345
+ * @memberOf Stack
39346
+ * @param {string} key The key of the entry to check.
39347
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
39348
+ */
39349
+ function stackHas(key) {
39350
+ return this.__data__.has(key);
39351
+ }
39352
+
39353
+ /**
39354
+ * Sets the stack `key` to `value`.
39355
+ *
39356
+ * @private
39357
+ * @name set
39358
+ * @memberOf Stack
39359
+ * @param {string} key The key of the value to set.
39360
+ * @param {*} value The value to set.
39361
+ * @returns {Object} Returns the stack cache instance.
39362
+ */
39363
+ function stackSet(key, value) {
39364
+ var data = this.__data__;
39365
+ if (data instanceof ListCache) {
39366
+ var pairs = data.__data__;
39367
+ if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
39368
+ pairs.push([key, value]);
39369
+ this.size = ++data.size;
39370
+ return this;
39371
+ }
39372
+ data = this.__data__ = new MapCache(pairs);
39373
+ }
39374
+ data.set(key, value);
39375
+ this.size = data.size;
39376
+ return this;
39377
+ }
39378
+
39379
+ // Add methods to `Stack`.
39380
+ Stack.prototype.clear = stackClear;
39381
+ Stack.prototype['delete'] = stackDelete;
39382
+ Stack.prototype.get = stackGet;
39383
+ Stack.prototype.has = stackHas;
39384
+ Stack.prototype.set = stackSet;
39385
+
39386
+ /**
39387
+ * Creates an array of the enumerable property names of the array-like `value`.
39388
+ *
39389
+ * @private
39390
+ * @param {*} value The value to query.
39391
+ * @param {boolean} inherited Specify returning inherited property names.
39392
+ * @returns {Array} Returns the array of property names.
39393
+ */
39394
+ function arrayLikeKeys(value, inherited) {
39395
+ var isArr = isArray(value),
39396
+ isArg = !isArr && isArguments(value),
39397
+ isBuff = !isArr && !isArg && isBuffer(value),
39398
+ isType = !isArr && !isArg && !isBuff && isTypedArray(value),
39399
+ skipIndexes = isArr || isArg || isBuff || isType,
39400
+ result = skipIndexes ? baseTimes(value.length, String) : [],
39401
+ length = result.length;
39402
+
39403
+ for (var key in value) {
39404
+ if ((inherited || hasOwnProperty.call(value, key)) &&
39405
+ !(skipIndexes && (
39406
+ // Safari 9 has enumerable `arguments.length` in strict mode.
39407
+ key == 'length' ||
39408
+ // Node.js 0.10 has enumerable non-index properties on buffers.
39409
+ (isBuff && (key == 'offset' || key == 'parent')) ||
39410
+ // PhantomJS 2 has enumerable non-index properties on typed arrays.
39411
+ (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
39412
+ // Skip index properties.
39413
+ isIndex(key, length)
39414
+ ))) {
39415
+ result.push(key);
39416
+ }
39417
+ }
39418
+ return result;
39419
+ }
39420
+
39421
+ /**
39422
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
39423
+ *
39424
+ * @private
39425
+ * @param {Array} array The array to inspect.
39426
+ * @param {*} key The key to search for.
39427
+ * @returns {number} Returns the index of the matched value, else `-1`.
39428
+ */
39429
+ function assocIndexOf(array, key) {
39430
+ var length = array.length;
39431
+ while (length--) {
39432
+ if (eq(array[length][0], key)) {
39433
+ return length;
39434
+ }
39435
+ }
39436
+ return -1;
39437
+ }
39438
+
39439
+ /**
39440
+ * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
39441
+ * `keysFunc` and `symbolsFunc` to get the enumerable property names and
39442
+ * symbols of `object`.
39443
+ *
39444
+ * @private
39445
+ * @param {Object} object The object to query.
39446
+ * @param {Function} keysFunc The function to get the keys of `object`.
39447
+ * @param {Function} symbolsFunc The function to get the symbols of `object`.
39448
+ * @returns {Array} Returns the array of property names and symbols.
39449
+ */
39450
+ function baseGetAllKeys(object, keysFunc, symbolsFunc) {
39451
+ var result = keysFunc(object);
39452
+ return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
39453
+ }
39454
+
39455
+ /**
39456
+ * The base implementation of `getTag` without fallbacks for buggy environments.
39457
+ *
39458
+ * @private
39459
+ * @param {*} value The value to query.
39460
+ * @returns {string} Returns the `toStringTag`.
39461
+ */
39462
+ function baseGetTag(value) {
39463
+ if (value == null) {
39464
+ return value === undefined ? undefinedTag : nullTag;
39465
+ }
39466
+ return (symToStringTag && symToStringTag in Object(value))
39467
+ ? getRawTag(value)
39468
+ : objectToString(value);
39469
+ }
39470
+
39471
+ /**
39472
+ * The base implementation of `_.isArguments`.
39473
+ *
39474
+ * @private
39475
+ * @param {*} value The value to check.
39476
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
39477
+ */
39478
+ function baseIsArguments(value) {
39479
+ return isObjectLike(value) && baseGetTag(value) == argsTag;
39480
+ }
39481
+
39482
+ /**
39483
+ * The base implementation of `_.isEqual` which supports partial comparisons
39484
+ * and tracks traversed objects.
39485
+ *
39486
+ * @private
39487
+ * @param {*} value The value to compare.
39488
+ * @param {*} other The other value to compare.
39489
+ * @param {boolean} bitmask The bitmask flags.
39490
+ * 1 - Unordered comparison
39491
+ * 2 - Partial comparison
39492
+ * @param {Function} [customizer] The function to customize comparisons.
39493
+ * @param {Object} [stack] Tracks traversed `value` and `other` objects.
39494
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
39495
+ */
39496
+ function baseIsEqual(value, other, bitmask, customizer, stack) {
39497
+ if (value === other) {
39498
+ return true;
39499
+ }
39500
+ if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
39501
+ return value !== value && other !== other;
39502
+ }
39503
+ return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
39504
+ }
39505
+
39506
+ /**
39507
+ * A specialized version of `baseIsEqual` for arrays and objects which performs
39508
+ * deep comparisons and tracks traversed objects enabling objects with circular
39509
+ * references to be compared.
39510
+ *
39511
+ * @private
39512
+ * @param {Object} object The object to compare.
39513
+ * @param {Object} other The other object to compare.
39514
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
39515
+ * @param {Function} customizer The function to customize comparisons.
39516
+ * @param {Function} equalFunc The function to determine equivalents of values.
39517
+ * @param {Object} [stack] Tracks traversed `object` and `other` objects.
39518
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
39519
+ */
39520
+ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
39521
+ var objIsArr = isArray(object),
39522
+ othIsArr = isArray(other),
39523
+ objTag = objIsArr ? arrayTag : getTag(object),
39524
+ othTag = othIsArr ? arrayTag : getTag(other);
39525
+
39526
+ objTag = objTag == argsTag ? objectTag : objTag;
39527
+ othTag = othTag == argsTag ? objectTag : othTag;
39528
+
39529
+ var objIsObj = objTag == objectTag,
39530
+ othIsObj = othTag == objectTag,
39531
+ isSameTag = objTag == othTag;
39532
+
39533
+ if (isSameTag && isBuffer(object)) {
39534
+ if (!isBuffer(other)) {
39535
+ return false;
39536
+ }
39537
+ objIsArr = true;
39538
+ objIsObj = false;
39539
+ }
39540
+ if (isSameTag && !objIsObj) {
39541
+ stack || (stack = new Stack);
39542
+ return (objIsArr || isTypedArray(object))
39543
+ ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
39544
+ : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
39545
+ }
39546
+ if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
39547
+ var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
39548
+ othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
39549
+
39550
+ if (objIsWrapped || othIsWrapped) {
39551
+ var objUnwrapped = objIsWrapped ? object.value() : object,
39552
+ othUnwrapped = othIsWrapped ? other.value() : other;
39553
+
39554
+ stack || (stack = new Stack);
39555
+ return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
39556
+ }
39557
+ }
39558
+ if (!isSameTag) {
39559
+ return false;
39560
+ }
39561
+ stack || (stack = new Stack);
39562
+ return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
39563
+ }
39564
+
39565
+ /**
39566
+ * The base implementation of `_.isNative` without bad shim checks.
39567
+ *
39568
+ * @private
39569
+ * @param {*} value The value to check.
39570
+ * @returns {boolean} Returns `true` if `value` is a native function,
39571
+ * else `false`.
39572
+ */
39573
+ function baseIsNative(value) {
39574
+ if (!isObject(value) || isMasked(value)) {
39575
+ return false;
39576
+ }
39577
+ var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
39578
+ return pattern.test(toSource(value));
39579
+ }
39580
+
39581
+ /**
39582
+ * The base implementation of `_.isTypedArray` without Node.js optimizations.
39583
+ *
39584
+ * @private
39585
+ * @param {*} value The value to check.
39586
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
39587
+ */
39588
+ function baseIsTypedArray(value) {
39589
+ return isObjectLike(value) &&
39590
+ isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
39591
+ }
39592
+
39593
+ /**
39594
+ * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
39595
+ *
39596
+ * @private
39597
+ * @param {Object} object The object to query.
39598
+ * @returns {Array} Returns the array of property names.
39599
+ */
39600
+ function baseKeys(object) {
39601
+ if (!isPrototype(object)) {
39602
+ return nativeKeys(object);
39603
+ }
39604
+ var result = [];
39605
+ for (var key in Object(object)) {
39606
+ if (hasOwnProperty.call(object, key) && key != 'constructor') {
39607
+ result.push(key);
39608
+ }
39609
+ }
39610
+ return result;
39611
+ }
39612
+
39613
+ /**
39614
+ * A specialized version of `baseIsEqualDeep` for arrays with support for
39615
+ * partial deep comparisons.
39616
+ *
39617
+ * @private
39618
+ * @param {Array} array The array to compare.
39619
+ * @param {Array} other The other array to compare.
39620
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
39621
+ * @param {Function} customizer The function to customize comparisons.
39622
+ * @param {Function} equalFunc The function to determine equivalents of values.
39623
+ * @param {Object} stack Tracks traversed `array` and `other` objects.
39624
+ * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
39625
+ */
39626
+ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
39627
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
39628
+ arrLength = array.length,
39629
+ othLength = other.length;
39630
+
39631
+ if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
39632
+ return false;
39633
+ }
39634
+ // Assume cyclic values are equal.
39635
+ var stacked = stack.get(array);
39636
+ if (stacked && stack.get(other)) {
39637
+ return stacked == other;
39638
+ }
39639
+ var index = -1,
39640
+ result = true,
39641
+ seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
39642
+
39643
+ stack.set(array, other);
39644
+ stack.set(other, array);
39645
+
39646
+ // Ignore non-index properties.
39647
+ while (++index < arrLength) {
39648
+ var arrValue = array[index],
39649
+ othValue = other[index];
39650
+
39651
+ if (customizer) {
39652
+ var compared = isPartial
39653
+ ? customizer(othValue, arrValue, index, other, array, stack)
39654
+ : customizer(arrValue, othValue, index, array, other, stack);
39655
+ }
39656
+ if (compared !== undefined) {
39657
+ if (compared) {
39658
+ continue;
39659
+ }
39660
+ result = false;
39661
+ break;
39662
+ }
39663
+ // Recursively compare arrays (susceptible to call stack limits).
39664
+ if (seen) {
39665
+ if (!arraySome(other, function(othValue, othIndex) {
39666
+ if (!cacheHas(seen, othIndex) &&
39667
+ (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
39668
+ return seen.push(othIndex);
39669
+ }
39670
+ })) {
39671
+ result = false;
39672
+ break;
39673
+ }
39674
+ } else if (!(
39675
+ arrValue === othValue ||
39676
+ equalFunc(arrValue, othValue, bitmask, customizer, stack)
39677
+ )) {
39678
+ result = false;
39679
+ break;
39680
+ }
39681
+ }
39682
+ stack['delete'](array);
39683
+ stack['delete'](other);
39684
+ return result;
39685
+ }
39686
+
39687
+ /**
39688
+ * A specialized version of `baseIsEqualDeep` for comparing objects of
39689
+ * the same `toStringTag`.
39690
+ *
39691
+ * **Note:** This function only supports comparing values with tags of
39692
+ * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
39693
+ *
39694
+ * @private
39695
+ * @param {Object} object The object to compare.
39696
+ * @param {Object} other The other object to compare.
39697
+ * @param {string} tag The `toStringTag` of the objects to compare.
39698
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
39699
+ * @param {Function} customizer The function to customize comparisons.
39700
+ * @param {Function} equalFunc The function to determine equivalents of values.
39701
+ * @param {Object} stack Tracks traversed `object` and `other` objects.
39702
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
39703
+ */
39704
+ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
39705
+ switch (tag) {
39706
+ case dataViewTag:
39707
+ if ((object.byteLength != other.byteLength) ||
39708
+ (object.byteOffset != other.byteOffset)) {
39709
+ return false;
39710
+ }
39711
+ object = object.buffer;
39712
+ other = other.buffer;
39713
+
39714
+ case arrayBufferTag:
39715
+ if ((object.byteLength != other.byteLength) ||
39716
+ !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
39717
+ return false;
39718
+ }
39719
+ return true;
39720
+
39721
+ case boolTag:
39722
+ case dateTag:
39723
+ case numberTag:
39724
+ // Coerce booleans to `1` or `0` and dates to milliseconds.
39725
+ // Invalid dates are coerced to `NaN`.
39726
+ return eq(+object, +other);
39727
+
39728
+ case errorTag:
39729
+ return object.name == other.name && object.message == other.message;
39730
+
39731
+ case regexpTag:
39732
+ case stringTag:
39733
+ // Coerce regexes to strings and treat strings, primitives and objects,
39734
+ // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
39735
+ // for more details.
39736
+ return object == (other + '');
39737
+
39738
+ case mapTag:
39739
+ var convert = mapToArray;
39740
+
39741
+ case setTag:
39742
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
39743
+ convert || (convert = setToArray);
39744
+
39745
+ if (object.size != other.size && !isPartial) {
39746
+ return false;
39747
+ }
39748
+ // Assume cyclic values are equal.
39749
+ var stacked = stack.get(object);
39750
+ if (stacked) {
39751
+ return stacked == other;
39752
+ }
39753
+ bitmask |= COMPARE_UNORDERED_FLAG;
39754
+
39755
+ // Recursively compare objects (susceptible to call stack limits).
39756
+ stack.set(object, other);
39757
+ var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
39758
+ stack['delete'](object);
39759
+ return result;
39760
+
39761
+ case symbolTag:
39762
+ if (symbolValueOf) {
39763
+ return symbolValueOf.call(object) == symbolValueOf.call(other);
39764
+ }
39765
+ }
39766
+ return false;
39767
+ }
39768
+
39769
+ /**
39770
+ * A specialized version of `baseIsEqualDeep` for objects with support for
39771
+ * partial deep comparisons.
39772
+ *
39773
+ * @private
39774
+ * @param {Object} object The object to compare.
39775
+ * @param {Object} other The other object to compare.
39776
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
39777
+ * @param {Function} customizer The function to customize comparisons.
39778
+ * @param {Function} equalFunc The function to determine equivalents of values.
39779
+ * @param {Object} stack Tracks traversed `object` and `other` objects.
39780
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
39781
+ */
39782
+ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
39783
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
39784
+ objProps = getAllKeys(object),
39785
+ objLength = objProps.length,
39786
+ othProps = getAllKeys(other),
39787
+ othLength = othProps.length;
39788
+
39789
+ if (objLength != othLength && !isPartial) {
39790
+ return false;
39791
+ }
39792
+ var index = objLength;
39793
+ while (index--) {
39794
+ var key = objProps[index];
39795
+ if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
39796
+ return false;
39797
+ }
39798
+ }
39799
+ // Assume cyclic values are equal.
39800
+ var stacked = stack.get(object);
39801
+ if (stacked && stack.get(other)) {
39802
+ return stacked == other;
39803
+ }
39804
+ var result = true;
39805
+ stack.set(object, other);
39806
+ stack.set(other, object);
39807
+
39808
+ var skipCtor = isPartial;
39809
+ while (++index < objLength) {
39810
+ key = objProps[index];
39811
+ var objValue = object[key],
39812
+ othValue = other[key];
39813
+
39814
+ if (customizer) {
39815
+ var compared = isPartial
39816
+ ? customizer(othValue, objValue, key, other, object, stack)
39817
+ : customizer(objValue, othValue, key, object, other, stack);
39818
+ }
39819
+ // Recursively compare objects (susceptible to call stack limits).
39820
+ if (!(compared === undefined
39821
+ ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
39822
+ : compared
39823
+ )) {
39824
+ result = false;
39825
+ break;
39826
+ }
39827
+ skipCtor || (skipCtor = key == 'constructor');
39828
+ }
39829
+ if (result && !skipCtor) {
39830
+ var objCtor = object.constructor,
39831
+ othCtor = other.constructor;
39832
+
39833
+ // Non `Object` object instances with different constructors are not equal.
39834
+ if (objCtor != othCtor &&
39835
+ ('constructor' in object && 'constructor' in other) &&
39836
+ !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
39837
+ typeof othCtor == 'function' && othCtor instanceof othCtor)) {
39838
+ result = false;
39839
+ }
39840
+ }
39841
+ stack['delete'](object);
39842
+ stack['delete'](other);
39843
+ return result;
39844
+ }
39845
+
39846
+ /**
39847
+ * Creates an array of own enumerable property names and symbols of `object`.
39848
+ *
39849
+ * @private
39850
+ * @param {Object} object The object to query.
39851
+ * @returns {Array} Returns the array of property names and symbols.
39852
+ */
39853
+ function getAllKeys(object) {
39854
+ return baseGetAllKeys(object, keys, getSymbols);
39855
+ }
39856
+
39857
+ /**
39858
+ * Gets the data for `map`.
39859
+ *
39860
+ * @private
39861
+ * @param {Object} map The map to query.
39862
+ * @param {string} key The reference key.
39863
+ * @returns {*} Returns the map data.
39864
+ */
39865
+ function getMapData(map, key) {
39866
+ var data = map.__data__;
39867
+ return isKeyable(key)
39868
+ ? data[typeof key == 'string' ? 'string' : 'hash']
39869
+ : data.map;
39870
+ }
39871
+
39872
+ /**
39873
+ * Gets the native function at `key` of `object`.
39874
+ *
39875
+ * @private
39876
+ * @param {Object} object The object to query.
39877
+ * @param {string} key The key of the method to get.
39878
+ * @returns {*} Returns the function if it's native, else `undefined`.
39879
+ */
39880
+ function getNative(object, key) {
39881
+ var value = getValue(object, key);
39882
+ return baseIsNative(value) ? value : undefined;
39883
+ }
39884
+
39885
+ /**
39886
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
39887
+ *
39888
+ * @private
39889
+ * @param {*} value The value to query.
39890
+ * @returns {string} Returns the raw `toStringTag`.
39891
+ */
39892
+ function getRawTag(value) {
39893
+ var isOwn = hasOwnProperty.call(value, symToStringTag),
39894
+ tag = value[symToStringTag];
39895
+
39896
+ try {
39897
+ value[symToStringTag] = undefined;
39898
+ var unmasked = true;
39899
+ } catch (e) {}
39900
+
39901
+ var result = nativeObjectToString.call(value);
39902
+ if (unmasked) {
39903
+ if (isOwn) {
39904
+ value[symToStringTag] = tag;
39905
+ } else {
39906
+ delete value[symToStringTag];
39907
+ }
39908
+ }
39909
+ return result;
39910
+ }
39911
+
39912
+ /**
39913
+ * Creates an array of the own enumerable symbols of `object`.
39914
+ *
39915
+ * @private
39916
+ * @param {Object} object The object to query.
39917
+ * @returns {Array} Returns the array of symbols.
39918
+ */
39919
+ var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
39920
+ if (object == null) {
39921
+ return [];
39922
+ }
39923
+ object = Object(object);
39924
+ return arrayFilter(nativeGetSymbols(object), function(symbol) {
39925
+ return propertyIsEnumerable.call(object, symbol);
39926
+ });
39927
+ };
39928
+
39929
+ /**
39930
+ * Gets the `toStringTag` of `value`.
39931
+ *
39932
+ * @private
39933
+ * @param {*} value The value to query.
39934
+ * @returns {string} Returns the `toStringTag`.
39935
+ */
39936
+ var getTag = baseGetTag;
39937
+
39938
+ // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
39939
+ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
39940
+ (Map && getTag(new Map) != mapTag) ||
39941
+ (Promise && getTag(Promise.resolve()) != promiseTag) ||
39942
+ (Set && getTag(new Set) != setTag) ||
39943
+ (WeakMap && getTag(new WeakMap) != weakMapTag)) {
39944
+ getTag = function(value) {
39945
+ var result = baseGetTag(value),
39946
+ Ctor = result == objectTag ? value.constructor : undefined,
39947
+ ctorString = Ctor ? toSource(Ctor) : '';
39948
+
39949
+ if (ctorString) {
39950
+ switch (ctorString) {
39951
+ case dataViewCtorString: return dataViewTag;
39952
+ case mapCtorString: return mapTag;
39953
+ case promiseCtorString: return promiseTag;
39954
+ case setCtorString: return setTag;
39955
+ case weakMapCtorString: return weakMapTag;
39956
+ }
39957
+ }
39958
+ return result;
39959
+ };
39960
+ }
39961
+
39962
+ /**
39963
+ * Checks if `value` is a valid array-like index.
39964
+ *
39965
+ * @private
39966
+ * @param {*} value The value to check.
39967
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
39968
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
39969
+ */
39970
+ function isIndex(value, length) {
39971
+ length = length == null ? MAX_SAFE_INTEGER : length;
39972
+ return !!length &&
39973
+ (typeof value == 'number' || reIsUint.test(value)) &&
39974
+ (value > -1 && value % 1 == 0 && value < length);
39975
+ }
39976
+
39977
+ /**
39978
+ * Checks if `value` is suitable for use as unique object key.
39979
+ *
39980
+ * @private
39981
+ * @param {*} value The value to check.
39982
+ * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
39983
+ */
39984
+ function isKeyable(value) {
39985
+ var type = typeof value;
39986
+ return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
39987
+ ? (value !== '__proto__')
39988
+ : (value === null);
39989
+ }
39990
+
39991
+ /**
39992
+ * Checks if `func` has its source masked.
39993
+ *
39994
+ * @private
39995
+ * @param {Function} func The function to check.
39996
+ * @returns {boolean} Returns `true` if `func` is masked, else `false`.
39997
+ */
39998
+ function isMasked(func) {
39999
+ return !!maskSrcKey && (maskSrcKey in func);
40000
+ }
40001
+
40002
+ /**
40003
+ * Checks if `value` is likely a prototype object.
40004
+ *
40005
+ * @private
40006
+ * @param {*} value The value to check.
40007
+ * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
40008
+ */
40009
+ function isPrototype(value) {
40010
+ var Ctor = value && value.constructor,
40011
+ proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
40012
+
40013
+ return value === proto;
40014
+ }
40015
+
40016
+ /**
40017
+ * Converts `value` to a string using `Object.prototype.toString`.
40018
+ *
40019
+ * @private
40020
+ * @param {*} value The value to convert.
40021
+ * @returns {string} Returns the converted string.
40022
+ */
40023
+ function objectToString(value) {
40024
+ return nativeObjectToString.call(value);
40025
+ }
40026
+
40027
+ /**
40028
+ * Converts `func` to its source code.
40029
+ *
40030
+ * @private
40031
+ * @param {Function} func The function to convert.
40032
+ * @returns {string} Returns the source code.
40033
+ */
40034
+ function toSource(func) {
40035
+ if (func != null) {
40036
+ try {
40037
+ return funcToString.call(func);
40038
+ } catch (e) {}
40039
+ try {
40040
+ return (func + '');
40041
+ } catch (e) {}
40042
+ }
40043
+ return '';
40044
+ }
40045
+
40046
+ /**
40047
+ * Performs a
40048
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
40049
+ * comparison between two values to determine if they are equivalent.
40050
+ *
40051
+ * @static
40052
+ * @memberOf _
40053
+ * @since 4.0.0
40054
+ * @category Lang
40055
+ * @param {*} value The value to compare.
40056
+ * @param {*} other The other value to compare.
40057
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
40058
+ * @example
40059
+ *
40060
+ * var object = { 'a': 1 };
40061
+ * var other = { 'a': 1 };
40062
+ *
40063
+ * _.eq(object, object);
40064
+ * // => true
40065
+ *
40066
+ * _.eq(object, other);
40067
+ * // => false
40068
+ *
40069
+ * _.eq('a', 'a');
40070
+ * // => true
40071
+ *
40072
+ * _.eq('a', Object('a'));
40073
+ * // => false
40074
+ *
40075
+ * _.eq(NaN, NaN);
40076
+ * // => true
40077
+ */
40078
+ function eq(value, other) {
40079
+ return value === other || (value !== value && other !== other);
40080
+ }
40081
+
40082
+ /**
40083
+ * Checks if `value` is likely an `arguments` object.
40084
+ *
40085
+ * @static
40086
+ * @memberOf _
40087
+ * @since 0.1.0
40088
+ * @category Lang
40089
+ * @param {*} value The value to check.
40090
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
40091
+ * else `false`.
40092
+ * @example
40093
+ *
40094
+ * _.isArguments(function() { return arguments; }());
40095
+ * // => true
40096
+ *
40097
+ * _.isArguments([1, 2, 3]);
40098
+ * // => false
40099
+ */
40100
+ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
40101
+ return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
40102
+ !propertyIsEnumerable.call(value, 'callee');
40103
+ };
40104
+
40105
+ /**
40106
+ * Checks if `value` is classified as an `Array` object.
40107
+ *
40108
+ * @static
40109
+ * @memberOf _
40110
+ * @since 0.1.0
40111
+ * @category Lang
40112
+ * @param {*} value The value to check.
40113
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
40114
+ * @example
40115
+ *
40116
+ * _.isArray([1, 2, 3]);
40117
+ * // => true
40118
+ *
40119
+ * _.isArray(document.body.children);
40120
+ * // => false
40121
+ *
40122
+ * _.isArray('abc');
40123
+ * // => false
40124
+ *
40125
+ * _.isArray(_.noop);
40126
+ * // => false
40127
+ */
40128
+ var isArray = Array.isArray;
40129
+
40130
+ /**
40131
+ * Checks if `value` is array-like. A value is considered array-like if it's
40132
+ * not a function and has a `value.length` that's an integer greater than or
40133
+ * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
40134
+ *
40135
+ * @static
40136
+ * @memberOf _
40137
+ * @since 4.0.0
40138
+ * @category Lang
40139
+ * @param {*} value The value to check.
40140
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
40141
+ * @example
40142
+ *
40143
+ * _.isArrayLike([1, 2, 3]);
40144
+ * // => true
40145
+ *
40146
+ * _.isArrayLike(document.body.children);
40147
+ * // => true
40148
+ *
40149
+ * _.isArrayLike('abc');
40150
+ * // => true
40151
+ *
40152
+ * _.isArrayLike(_.noop);
40153
+ * // => false
40154
+ */
40155
+ function isArrayLike(value) {
40156
+ return value != null && isLength(value.length) && !isFunction(value);
40157
+ }
40158
+
40159
+ /**
40160
+ * Checks if `value` is a buffer.
40161
+ *
40162
+ * @static
40163
+ * @memberOf _
40164
+ * @since 4.3.0
40165
+ * @category Lang
40166
+ * @param {*} value The value to check.
40167
+ * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
40168
+ * @example
40169
+ *
40170
+ * _.isBuffer(new Buffer(2));
40171
+ * // => true
40172
+ *
40173
+ * _.isBuffer(new Uint8Array(2));
40174
+ * // => false
40175
+ */
40176
+ var isBuffer = nativeIsBuffer || stubFalse;
40177
+
40178
+ /**
40179
+ * Performs a deep comparison between two values to determine if they are
40180
+ * equivalent.
40181
+ *
40182
+ * **Note:** This method supports comparing arrays, array buffers, booleans,
40183
+ * date objects, error objects, maps, numbers, `Object` objects, regexes,
40184
+ * sets, strings, symbols, and typed arrays. `Object` objects are compared
40185
+ * by their own, not inherited, enumerable properties. Functions and DOM
40186
+ * nodes are compared by strict equality, i.e. `===`.
40187
+ *
40188
+ * @static
40189
+ * @memberOf _
40190
+ * @since 0.1.0
40191
+ * @category Lang
40192
+ * @param {*} value The value to compare.
40193
+ * @param {*} other The other value to compare.
40194
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
40195
+ * @example
40196
+ *
40197
+ * var object = { 'a': 1 };
40198
+ * var other = { 'a': 1 };
40199
+ *
40200
+ * _.isEqual(object, other);
40201
+ * // => true
40202
+ *
40203
+ * object === other;
40204
+ * // => false
40205
+ */
40206
+ function isEqual(value, other) {
40207
+ return baseIsEqual(value, other);
40208
+ }
40209
+
40210
+ /**
40211
+ * Checks if `value` is classified as a `Function` object.
40212
+ *
40213
+ * @static
40214
+ * @memberOf _
40215
+ * @since 0.1.0
40216
+ * @category Lang
40217
+ * @param {*} value The value to check.
40218
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
40219
+ * @example
40220
+ *
40221
+ * _.isFunction(_);
40222
+ * // => true
40223
+ *
40224
+ * _.isFunction(/abc/);
40225
+ * // => false
40226
+ */
40227
+ function isFunction(value) {
40228
+ if (!isObject(value)) {
40229
+ return false;
40230
+ }
40231
+ // The use of `Object#toString` avoids issues with the `typeof` operator
40232
+ // in Safari 9 which returns 'object' for typed arrays and other constructors.
40233
+ var tag = baseGetTag(value);
40234
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
40235
+ }
40236
+
40237
+ /**
40238
+ * Checks if `value` is a valid array-like length.
40239
+ *
40240
+ * **Note:** This method is loosely based on
40241
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
40242
+ *
40243
+ * @static
40244
+ * @memberOf _
40245
+ * @since 4.0.0
40246
+ * @category Lang
40247
+ * @param {*} value The value to check.
40248
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
40249
+ * @example
40250
+ *
40251
+ * _.isLength(3);
40252
+ * // => true
40253
+ *
40254
+ * _.isLength(Number.MIN_VALUE);
40255
+ * // => false
40256
+ *
40257
+ * _.isLength(Infinity);
40258
+ * // => false
40259
+ *
40260
+ * _.isLength('3');
40261
+ * // => false
40262
+ */
40263
+ function isLength(value) {
40264
+ return typeof value == 'number' &&
40265
+ value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
40266
+ }
40267
+
40268
+ /**
40269
+ * Checks if `value` is the
40270
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
40271
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
40272
+ *
40273
+ * @static
40274
+ * @memberOf _
40275
+ * @since 0.1.0
40276
+ * @category Lang
40277
+ * @param {*} value The value to check.
40278
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
40279
+ * @example
40280
+ *
40281
+ * _.isObject({});
40282
+ * // => true
40283
+ *
40284
+ * _.isObject([1, 2, 3]);
40285
+ * // => true
40286
+ *
40287
+ * _.isObject(_.noop);
40288
+ * // => true
40289
+ *
40290
+ * _.isObject(null);
40291
+ * // => false
40292
+ */
40293
+ function isObject(value) {
40294
+ var type = typeof value;
40295
+ return value != null && (type == 'object' || type == 'function');
40296
+ }
40297
+
40298
+ /**
40299
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
40300
+ * and has a `typeof` result of "object".
40301
+ *
40302
+ * @static
40303
+ * @memberOf _
40304
+ * @since 4.0.0
40305
+ * @category Lang
40306
+ * @param {*} value The value to check.
40307
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
40308
+ * @example
40309
+ *
40310
+ * _.isObjectLike({});
40311
+ * // => true
40312
+ *
40313
+ * _.isObjectLike([1, 2, 3]);
40314
+ * // => true
40315
+ *
40316
+ * _.isObjectLike(_.noop);
40317
+ * // => false
40318
+ *
40319
+ * _.isObjectLike(null);
40320
+ * // => false
40321
+ */
40322
+ function isObjectLike(value) {
40323
+ return value != null && typeof value == 'object';
40324
+ }
40325
+
40326
+ /**
40327
+ * Checks if `value` is classified as a typed array.
40328
+ *
40329
+ * @static
40330
+ * @memberOf _
40331
+ * @since 3.0.0
40332
+ * @category Lang
40333
+ * @param {*} value The value to check.
40334
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
40335
+ * @example
40336
+ *
40337
+ * _.isTypedArray(new Uint8Array);
40338
+ * // => true
40339
+ *
40340
+ * _.isTypedArray([]);
40341
+ * // => false
40342
+ */
40343
+ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
40344
+
40345
+ /**
40346
+ * Creates an array of the own enumerable property names of `object`.
40347
+ *
40348
+ * **Note:** Non-object values are coerced to objects. See the
40349
+ * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
40350
+ * for more details.
40351
+ *
40352
+ * @static
40353
+ * @since 0.1.0
40354
+ * @memberOf _
40355
+ * @category Object
40356
+ * @param {Object} object The object to query.
40357
+ * @returns {Array} Returns the array of property names.
40358
+ * @example
40359
+ *
40360
+ * function Foo() {
40361
+ * this.a = 1;
40362
+ * this.b = 2;
40363
+ * }
40364
+ *
40365
+ * Foo.prototype.c = 3;
40366
+ *
40367
+ * _.keys(new Foo);
40368
+ * // => ['a', 'b'] (iteration order is not guaranteed)
40369
+ *
40370
+ * _.keys('hi');
40371
+ * // => ['0', '1']
40372
+ */
40373
+ function keys(object) {
40374
+ return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
40375
+ }
40376
+
40377
+ /**
40378
+ * This method returns a new empty array.
40379
+ *
40380
+ * @static
40381
+ * @memberOf _
40382
+ * @since 4.13.0
40383
+ * @category Util
40384
+ * @returns {Array} Returns the new empty array.
40385
+ * @example
40386
+ *
40387
+ * var arrays = _.times(2, _.stubArray);
40388
+ *
40389
+ * console.log(arrays);
40390
+ * // => [[], []]
40391
+ *
40392
+ * console.log(arrays[0] === arrays[1]);
40393
+ * // => false
40394
+ */
40395
+ function stubArray() {
40396
+ return [];
40397
+ }
40398
+
40399
+ /**
40400
+ * This method returns `false`.
40401
+ *
40402
+ * @static
40403
+ * @memberOf _
40404
+ * @since 4.13.0
40405
+ * @category Util
40406
+ * @returns {boolean} Returns `false`.
40407
+ * @example
40408
+ *
40409
+ * _.times(2, _.stubFalse);
40410
+ * // => [false, false]
40411
+ */
40412
+ function stubFalse() {
40413
+ return false;
40414
+ }
40415
+
40416
+ module.exports = isEqual;
40417
+ });
40418
+
38568
40419
  var dist$3 = createCommonjsModule$1(function (module, exports) {
38569
40420
  (function (global, factory) {
38570
- module.exports = factory(dist$6, require$$2$1, lodash_debounce, require$$2, lodash_throttle, require$$1, require$$4) ;
38571
- })(commonjsGlobal, (function (core, slate, debounce, snabbdom, throttle, $) {
40421
+ module.exports = factory(dist$6, require$$2$1, require$$2, lodash_throttle, require$$1, require$$4, lodash_isequal) ;
40422
+ })(commonjsGlobal, (function (core, slate, snabbdom, throttle, $, nanoid, isEqual) {
38572
40423
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
38573
40424
 
38574
- var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
38575
40425
  var throttle__default = /*#__PURE__*/_interopDefaultLegacy(throttle);
38576
40426
  var $__default = /*#__PURE__*/_interopDefaultLegacy($);
40427
+ var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
38577
40428
 
38578
40429
  /**
38579
40430
  * @description i18n en
@@ -38589,8 +40440,6 @@
38589
40440
  insertRow: 'Insert row',
38590
40441
  insertTable: 'Insert table',
38591
40442
  header: 'Header',
38592
- mergeCell: 'merge cell',
38593
- splitCell: 'split cell',
38594
40443
  },
38595
40444
  };
38596
40445
 
@@ -38608,472 +40457,64 @@
38608
40457
  insertRow: '插入行',
38609
40458
  insertTable: '插入表格',
38610
40459
  header: '表头',
38611
- mergeCell: '合并单元格',
38612
- splitCell: '拆分单元格',
38613
- },
38614
- };
38615
-
38616
- /**
38617
- * @description i18n entry
38618
- * @author wangfupeng
38619
- */
38620
- core.i18nAddResources('en', enResources);
38621
- core.i18nAddResources('zh-CN', zhResources);
38622
-
38623
- /******************************************************************************
38624
- Copyright (c) Microsoft Corporation.
38625
-
38626
- Permission to use, copy, modify, and/or distribute this software for any
38627
- purpose with or without fee is hereby granted.
38628
-
38629
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
38630
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
38631
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
38632
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
38633
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
38634
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
38635
- PERFORMANCE OF THIS SOFTWARE.
38636
- ***************************************************************************** */
38637
-
38638
- var __assign = function() {
38639
- __assign = Object.assign || function __assign(t) {
38640
- for (var s, i = 1, n = arguments.length; i < n; i++) {
38641
- s = arguments[i];
38642
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
38643
- }
38644
- return t;
38645
- };
38646
- return __assign.apply(this, arguments);
38647
- };
38648
-
38649
- function __generator(thisArg, body) {
38650
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
38651
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
38652
- function verb(n) { return function (v) { return step([n, v]); }; }
38653
- function step(op) {
38654
- if (f) throw new TypeError("Generator is already executing.");
38655
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
38656
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
38657
- if (y = 0, t) op = [op[0] & 2, t.value];
38658
- switch (op[0]) {
38659
- case 0: case 1: t = op; break;
38660
- case 4: _.label++; return { value: op[1], done: false };
38661
- case 5: _.label++; y = op[1]; op = [0]; continue;
38662
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
38663
- default:
38664
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38665
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38666
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
38667
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
38668
- if (t[2]) _.ops.pop();
38669
- _.trys.pop(); continue;
38670
- }
38671
- op = body.call(thisArg, _);
38672
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
38673
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
38674
- }
38675
- }
38676
-
38677
- function __values(o) {
38678
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
38679
- if (m) return m.call(o);
38680
- if (o && typeof o.length === "number") return {
38681
- next: function () {
38682
- if (o && i >= o.length) o = void 0;
38683
- return { value: o && o[i++], done: !o };
38684
- }
38685
- };
38686
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
38687
- }
38688
-
38689
- function __read(o, n) {
38690
- var m = typeof Symbol === "function" && o[Symbol.iterator];
38691
- if (!m) return o;
38692
- var i = m.call(o), r, ar = [], e;
38693
- try {
38694
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
38695
- }
38696
- catch (error) { e = { error: error }; }
38697
- finally {
38698
- try {
38699
- if (r && !r.done && (m = i["return"])) m.call(i);
38700
- }
38701
- finally { if (e) throw e.error; }
38702
- }
38703
- return ar;
38704
- }
38705
-
38706
- function __spreadArray(to, from, pack) {
38707
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
38708
- if (ar || !(i in from)) {
38709
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
38710
- ar[i] = from[i];
38711
- }
38712
- }
38713
- return to.concat(ar || Array.prototype.slice.call(from));
38714
- }
38715
-
38716
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
38717
- var e = new Error(message);
38718
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
38719
- };
38720
-
38721
- /** Weak reference between the `Editor` and the selected elements */
38722
- var EDITOR_TO_SELECTION = new WeakMap();
38723
- /** Weak reference between the `Editor` and a set of the selected elements */
38724
- var EDITOR_TO_SELECTION_SET = new WeakMap();
38725
-
38726
- var DEFAULT_WITH_TABLE_OPTIONS = {
38727
- blocks: {
38728
- td: 'table-cell',
38729
- th: 'table-cell',
38730
- content: 'paragraph',
38731
- tr: 'table-row',
38732
- table: 'table',
38733
- tbody: 'table-body',
38734
- // tfoot: "table-footer",
38735
- // thead: "table-head",
38736
40460
  },
38737
40461
  };
38738
40462
 
38739
- function isElement(node) {
38740
- return !slate.Editor.isEditor(node) && slate.Element.isElement(node) && 'type' in node;
38741
- }
38742
- /** @returns a `NodeMatch` function which is used to match the elements of a specific `type`. */
38743
- function isOfType(editor) {
38744
- var types = [];
38745
- for (var _i = 1; _i < arguments.length; _i++) {
38746
- types[_i - 1] = arguments[_i];
38747
- }
38748
- var options = DEFAULT_WITH_TABLE_OPTIONS, elementTypes = types.map(function (type) { var _a; return (_a = options === null || options === void 0 ? void 0 : options.blocks) === null || _a === void 0 ? void 0 : _a[type]; });
38749
- return function (node) { return isElement(node) && elementTypes.includes(node.type); };
38750
- }
38751
-
38752
40463
  /**
38753
- * Determines whether two paths belong to the same types by checking
38754
- * if they share a common ancestor node of type table
38755
- */
38756
- function hasCommon(editor, _a) {
38757
- var _b = __read(_a, 2), path = _b[0], another = _b[1];
38758
- var types = [];
38759
- for (var _i = 2; _i < arguments.length; _i++) {
38760
- types[_i - 2] = arguments[_i];
38761
- }
38762
- var _c = __read(slate.Node.common(editor, path, another), 2), node = _c[0], commonPath = _c[1];
38763
- if (isOfType.apply(void 0, __spreadArray([editor], __read(types)))(node, commonPath)) {
38764
- return true;
38765
- }
38766
- // Warning: returns the common ancestor but will return `undefined` if the
38767
- // `commonPath` is equal to the specified types path
38768
- return !!slate.Editor.above(editor, {
38769
- match: isOfType.apply(void 0, __spreadArray([editor], __read(types))),
38770
- at: commonPath,
38771
- });
38772
- }
38773
-
38774
- /** Generates a matrix for each table section (`thead`, `tbody`, `tfoot`) */
38775
- function matrices(editor, options) {
38776
- var _a, table, _b, tablePath, _c, _d, _e, path, matrix, _f, _g, _h, trPath, e_1_1;
38777
- var e_1, _j, e_2, _k;
38778
- if (options === void 0) { options = {}; }
38779
- return __generator(this, function (_l) {
38780
- switch (_l.label) {
38781
- case 0:
38782
- _a = __read(slate.Editor.nodes(editor, {
38783
- match: isOfType(editor, 'table'),
38784
- at: options.at,
38785
- }), 1), table = _a[0];
38786
- if (!table) {
38787
- return [2 /*return*/, []];
38788
- }
38789
- _b = __read(table, 2), tablePath = _b[1];
38790
- _l.label = 1;
38791
- case 1:
38792
- _l.trys.push([1, 6, 7, 8]);
38793
- _c = __values(slate.Editor.nodes(editor, {
38794
- // match: isOfType(editor, "thead", "tbody", "tfoot"),
38795
- match: isOfType(editor, 'table'),
38796
- at: tablePath,
38797
- })), _d = _c.next();
38798
- _l.label = 2;
38799
- case 2:
38800
- if (!!_d.done) return [3 /*break*/, 5];
38801
- _e = __read(_d.value, 2), path = _e[1];
38802
- matrix = [];
38803
- try {
38804
- for (_f = (e_2 = void 0, __values(slate.Editor.nodes(editor, {
38805
- match: isOfType(editor, 'tr'),
38806
- at: path,
38807
- }))), _g = _f.next(); !_g.done; _g = _f.next()) {
38808
- _h = __read(_g.value, 2), trPath = _h[1];
38809
- matrix.push(__spreadArray([], __read(slate.Editor.nodes(editor, {
38810
- match: isOfType(editor, 'th', 'td'),
38811
- at: trPath,
38812
- }))));
38813
- }
38814
- }
38815
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
38816
- finally {
38817
- try {
38818
- if (_g && !_g.done && (_k = _f.return)) _k.call(_f);
38819
- }
38820
- finally { if (e_2) throw e_2.error; }
38821
- }
38822
- return [4 /*yield*/, matrix];
38823
- case 3:
38824
- _l.sent();
38825
- _l.label = 4;
38826
- case 4:
38827
- _d = _c.next();
38828
- return [3 /*break*/, 2];
38829
- case 5: return [3 /*break*/, 8];
38830
- case 6:
38831
- e_1_1 = _l.sent();
38832
- e_1 = { error: e_1_1 };
38833
- return [3 /*break*/, 8];
38834
- case 7:
38835
- try {
38836
- if (_d && !_d.done && (_j = _c.return)) _j.call(_c);
38837
- }
38838
- finally { if (e_1) throw e_1.error; }
38839
- return [7 /*endfinally*/];
38840
- case 8: return [2 /*return*/];
38841
- }
38842
- });
38843
- }
38844
- function filledMatrix(editor, options) {
38845
- var e_3, _a;
38846
- if (options === void 0) { options = {}; }
38847
- var filled = [];
38848
- try {
38849
- // Expand each section separately to avoid sections collapsing into each other.
38850
- for (var _b = __values(matrices(editor, { at: options.at })), _c = _b.next(); !_c.done; _c = _b.next()) {
38851
- var matrix = _c.value;
38852
- var filledSection = [];
38853
- for (var x = 0; x < matrix.length; x++) {
38854
- if (!filledSection[x]) {
38855
- filledSection[x] = [];
38856
- }
38857
- for (var y = 0; y < matrix[x].length; y++) {
38858
- var _d = __read(matrix[x][y], 1), _e = _d[0], _f = _e.rowSpan, rowSpan = _f === void 0 ? 1 : _f, _g = _e.colSpan, colSpan = _g === void 0 ? 1 : _g;
38859
- for (var c = 0, occupied = 0; c < colSpan + occupied; c++) {
38860
- for (var r = 0; r < rowSpan; r++) {
38861
- if (!filledSection[x + r]) {
38862
- filledSection[x + r] = [];
38863
- }
38864
- if (filledSection[x + r][y + c]) {
38865
- continue;
38866
- }
38867
- filledSection[x + r][y + c] = [
38868
- matrix[x + r][y + c],
38869
- {
38870
- rtl: c - occupied + 1,
38871
- ltr: colSpan - c + occupied,
38872
- ttb: r + 1,
38873
- btt: rowSpan - r,
38874
- },
38875
- ];
38876
- }
38877
- }
38878
- }
38879
- }
38880
- filled.push.apply(filled, __spreadArray([], __read(filledSection)));
38881
- }
38882
- }
38883
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
38884
- finally {
38885
- try {
38886
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
38887
- }
38888
- finally { if (e_3) throw e_3.error; }
38889
- }
38890
- return filled;
38891
- }
38892
-
38893
- var Point = /** @class */ (function () {
38894
- function Point(x, y) {
38895
- this.x = x;
38896
- this.y = y;
38897
- }
38898
- Point.valueOf = function (x, y) {
38899
- return new this(x, y);
38900
- };
38901
- Point.equals = function (point, another) {
38902
- return point.x === another.x && point.y === another.y;
38903
- };
38904
- return Point;
38905
- }());
38906
-
38907
- var TableCursor = {
38908
- /** @returns {boolean} `true` if the selection is inside a table, otherwise `false`. */
38909
- isInTable: function (editor, options) {
38910
- if (options === void 0) { options = {}; }
38911
- var _a = __read(slate.Editor.nodes(editor, {
38912
- match: isOfType(editor, 'table'),
38913
- at: options.at,
38914
- }), 1), table = _a[0];
38915
- return !!table;
38916
- },
38917
- /**
38918
- * Retrieves a matrix representing the selected cells within a table.
38919
- * @returns {NodeEntry<T>[][]} A matrix containing the selected cells.
38920
- */
38921
- selection: function (editor) {
38922
- var matrix, x, cells, y, _a, entry, _b, colSpan, ttb;
38923
- return __generator(this, function (_c) {
38924
- switch (_c.label) {
38925
- case 0:
38926
- matrix = EDITOR_TO_SELECTION.get(editor);
38927
- x = 0;
38928
- _c.label = 1;
38929
- case 1:
38930
- if (!(matrix && x < matrix.length)) return [3 /*break*/, 4];
38931
- cells = [];
38932
- for (y = 0; y < matrix[x].length; y++) {
38933
- _a = __read(matrix[x][y], 2), entry = _a[0], _b = _a[1], colSpan = _b.ltr, ttb = _b.ttb;
38934
- ttb === 1 && cells.push(entry);
38935
- y += colSpan - 1;
38936
- }
38937
- return [4 /*yield*/, cells];
38938
- case 2:
38939
- _c.sent();
38940
- _c.label = 3;
38941
- case 3:
38942
- x++;
38943
- return [3 /*break*/, 1];
38944
- case 4: return [2 /*return*/];
38945
- }
38946
- });
38947
- },
38948
- /** Clears the selection from the table */
38949
- unselect: function (editor) {
38950
- // const matrix = EDITOR_TO_SELECTION.get(editor);
38951
- var _a;
38952
- // if (!matrix?.length) {
38953
- // return;
38954
- // }
38955
- // for (let x = 0; x < matrix.length; x++) {
38956
- // for (let y = 0; y < matrix[x].length; y++) {
38957
- // const [[, path], { ltr: colSpan, ttb }] = matrix[x][y];
38958
- // y += colSpan - 1;
38959
- // if (ttb > 1) {
38960
- // continue;
38961
- // }
38962
- // // no-op since the paths are the same
38963
- // const noop: Operation = {
38964
- // type: "move_node",
38965
- // newPath: path,
38966
- // path: path,
38967
- // };
38968
- // Transforms.transform(editor, noop);
38969
- // }
38970
- // }
38971
- EDITOR_TO_SELECTION_SET.delete(editor);
38972
- EDITOR_TO_SELECTION.delete(editor);
38973
- // 清除选区
38974
- (_a = document.getSelection()) === null || _a === void 0 ? void 0 : _a.removeAllRanges();
38975
- },
38976
- /**
38977
- * Checks whether a given cell is part of the current table selection.
38978
- * @returns {boolean} - Returns true if the cell is selected, otherwise false.
38979
- */
38980
- isSelected: function (editor, element) {
38981
- var selectedElements = EDITOR_TO_SELECTION_SET.get(editor);
38982
- if (!selectedElements) {
38983
- return false;
38984
- }
38985
- return selectedElements.has(element);
38986
- },
38987
- };
38988
-
38989
- function withSelection(editor) {
38990
- var apply = editor.apply;
38991
- editor.apply = function (op) {
38992
- if (!slate.Operation.isSelectionOperation(op) || !op.newProperties) {
38993
- // TableCursor.unselect(editor);
38994
- // 仿飞书效果,拖动单元格宽度时,选区不消失
38995
- return apply(op);
38996
- }
38997
- var selection = __assign(__assign({}, editor.selection), op.newProperties);
38998
- if (!slate.Range.isRange(selection)) {
38999
- TableCursor.unselect(editor);
39000
- return apply(op);
39001
- }
39002
- var _a = __read(slate.Editor.nodes(editor, {
39003
- match: isOfType(editor, 'th', 'td'),
39004
- at: slate.Range.start(selection),
39005
- }), 1), fromEntry = _a[0];
39006
- var _b = __read(slate.Editor.nodes(editor, {
39007
- match: isOfType(editor, 'th', 'td'),
39008
- at: slate.Range.end(selection),
39009
- }), 1), toEntry = _b[0];
39010
- if (!fromEntry || !toEntry) {
39011
- TableCursor.unselect(editor);
39012
- return apply(op);
39013
- }
39014
- var _c = __read(fromEntry, 2), fromPath = _c[1];
39015
- var _d = __read(toEntry, 2), toPath = _d[1];
39016
- if (slate.Path.equals(fromPath, toPath) || !hasCommon(editor, [fromPath, toPath], 'table')) {
39017
- TableCursor.unselect(editor);
39018
- return apply(op);
39019
- }
39020
- // TODO: perf: could be improved by passing a Span [fromPath, toPath]
39021
- var filled = filledMatrix(editor, { at: fromPath });
39022
- // find initial bounds
39023
- var from = Point.valueOf(0, 0);
39024
- var to = Point.valueOf(0, 0);
39025
- outer: for (var x = 0; x < filled.length; x++) {
39026
- for (var y = 0; y < filled[x].length; y++) {
39027
- var _e = __read(filled[x][y], 1), _f = __read(_e[0], 2), path = _f[1];
39028
- if (slate.Path.equals(fromPath, path)) {
39029
- from.x = x;
39030
- from.y = y;
39031
- }
39032
- if (slate.Path.equals(toPath, path)) {
39033
- to.x = x;
39034
- to.y = y;
39035
- break outer;
39036
- }
39037
- }
39038
- }
39039
- var start = Point.valueOf(Math.min(from.x, to.x), Math.min(from.y, to.y));
39040
- var end = Point.valueOf(Math.max(from.x, to.x), Math.max(from.y, to.y));
39041
- // expand the selection based on rowspan and colspan
39042
- for (;;) {
39043
- var nextStart = Point.valueOf(start.x, start.y);
39044
- var nextEnd = Point.valueOf(end.x, end.y);
39045
- for (var x = nextStart.x; x <= nextEnd.x; x++) {
39046
- for (var y = nextStart.y; y <= nextEnd.y; y++) {
39047
- var _g = __read(filled[x][y], 2), _h = _g[1], rtl = _h.rtl, ltr = _h.ltr, btt = _h.btt, ttb = _h.ttb;
39048
- nextStart.x = Math.min(nextStart.x, x - (ttb - 1));
39049
- nextStart.y = Math.min(nextStart.y, y - (rtl - 1));
39050
- nextEnd.x = Math.max(nextEnd.x, x + (btt - 1));
39051
- nextEnd.y = Math.max(nextEnd.y, y + (ltr - 1));
39052
- }
39053
- }
39054
- if (Point.equals(start, nextStart) && Point.equals(end, nextEnd)) {
39055
- break;
39056
- }
39057
- start = nextStart;
39058
- end = nextEnd;
39059
- }
39060
- var selected = [];
39061
- var selectedSet = new WeakSet();
39062
- for (var x = start.x; x <= end.x; x++) {
39063
- var cells = [];
39064
- for (var y = start.y; y <= end.y; y++) {
39065
- var _j = __read(filled[x][y], 1), _k = __read(_j[0], 1), element = _k[0];
39066
- selectedSet.add(element);
39067
- cells.push(filled[x][y]);
39068
- }
39069
- selected.push(cells);
40464
+ * @description i18n entry
40465
+ * @author wangfupeng
40466
+ */
40467
+ core.i18nAddResources('en', enResources);
40468
+ core.i18nAddResources('zh-CN', zhResources);
40469
+
40470
+ /******************************************************************************
40471
+ Copyright (c) Microsoft Corporation.
40472
+
40473
+ Permission to use, copy, modify, and/or distribute this software for any
40474
+ purpose with or without fee is hereby granted.
40475
+
40476
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
40477
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
40478
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
40479
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
40480
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
40481
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
40482
+ PERFORMANCE OF THIS SOFTWARE.
40483
+ ***************************************************************************** */
40484
+
40485
+ function __values(o) {
40486
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
40487
+ if (m) return m.call(o);
40488
+ if (o && typeof o.length === "number") return {
40489
+ next: function () {
40490
+ if (o && i >= o.length) o = void 0;
40491
+ return { value: o && o[i++], done: !o };
39070
40492
  }
39071
- EDITOR_TO_SELECTION.set(editor, selected);
39072
- EDITOR_TO_SELECTION_SET.set(editor, selectedSet);
39073
- apply(op);
39074
40493
  };
39075
- return editor;
39076
- }
40494
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
40495
+ }
40496
+
40497
+ function __read(o, n) {
40498
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
40499
+ if (!m) return o;
40500
+ var i = m.call(o), r, ar = [], e;
40501
+ try {
40502
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
40503
+ }
40504
+ catch (error) { e = { error: error }; }
40505
+ finally {
40506
+ try {
40507
+ if (r && !r.done && (m = i["return"])) m.call(i);
40508
+ }
40509
+ finally { if (e) throw e.error; }
40510
+ }
40511
+ return ar;
40512
+ }
40513
+
40514
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
40515
+ var e = new Error(message);
40516
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
40517
+ };
39077
40518
 
39078
40519
  /**
39079
40520
  * @description editor 插件,重写 editor API
@@ -39151,9 +40592,9 @@
39151
40592
  var before = slate.Editor.before(newEditor, selection); // 前一个 location
39152
40593
  if (before) {
39153
40594
  var isTableOnBeforeLocation = isTableLocation(newEditor, before); // before 是否是 table
39154
- // 如果前面是 table, 当前是空 p,则不执行删除。否则会删除 table 最后一个 cell
39155
- if (isTableOnBeforeLocation && core.DomEditor.isSelectedEmptyParagraph(newEditor)) {
39156
- return;
40595
+ var isTableOnCurSelection = isTableLocation(newEditor, selection); // 当前是否是 table
40596
+ if (isTableOnBeforeLocation && !isTableOnCurSelection) {
40597
+ return; // 如果当前不是 table ,前面是 table ,则不执行删除。否则会删除 table 最后一个 cell
39157
40598
  }
39158
40599
  }
39159
40600
  }
@@ -39264,299 +40705,49 @@
39264
40705
  };
39265
40706
  newEditor.select(newSelection); // 选中 table-cell 内部的全部文字
39266
40707
  };
39267
- /**
39268
- * 光标选区行为新增
39269
- */
39270
- withSelection(newEditor);
39271
40708
  // 可继续修改其他 newEditor API ...
39272
40709
  // 返回 editor ,重要!
39273
40710
  return newEditor;
39274
40711
  }
39275
40712
 
39276
40713
  /**
39277
- * @description DOM 操作
40714
+ * @description table menu helpers
39278
40715
  * @author wangfupeng
39279
40716
  */
39280
- if ($.append)
39281
- $__default["default"].fn.append = $.append;
39282
- if ($.on)
39283
- $__default["default"].fn.on = $.on;
39284
- if ($.focus)
39285
- $__default["default"].fn.focus = $.focus;
39286
- if ($.attr)
39287
- $__default["default"].fn.attr = $.attr;
39288
- if ($.val)
39289
- $__default["default"].fn.val = $.val;
39290
- if ($.html)
39291
- $__default["default"].fn.html = $.html;
39292
- if ($.dataset)
39293
- $__default["default"].fn.dataset = $.dataset;
39294
- if ($.addClass)
39295
- $__default["default"].fn.addClass = $.addClass;
39296
- if ($.removeClass)
39297
- $__default["default"].fn.removeClass = $.removeClass;
39298
- if ($.children)
39299
- $__default["default"].fn.children = $.children;
39300
- if ($.each)
39301
- $__default["default"].fn.each = $.each;
39302
- if ($.find)
39303
- $__default["default"].fn.find = $.find;
39304
- /**
39305
- * 获取 tagName lower-case
39306
- * @param $elem $elem
39307
- */
39308
- function getTagName($elem) {
39309
- if ($elem.length)
39310
- return $elem[0].tagName.toLowerCase();
39311
- return '';
39312
- }
39313
40717
  /**
39314
- * 获取 $elem 某一个 style 值
39315
- * @param $elem $elem
39316
- * @param styleKey style key
39317
- */
39318
- function getStyleValue($elem, styleKey) {
39319
- var res = '';
39320
- var styleStr = $elem.attr('style') || ''; // 如 'line-height: 2.5; color: red;'
39321
- var styleArr = styleStr.split(';'); // 如 ['line-height: 2.5', ' color: red', '']
39322
- var length = styleArr.length;
39323
- for (var i = 0; i < length; i++) {
39324
- var styleItemStr = styleArr[i]; // 如 'line-height: 2.5'
39325
- if (styleItemStr) {
39326
- var arr = styleItemStr.split(':'); // ['line-height', ' 2.5']
39327
- if (arr[0].trim() === styleKey) {
39328
- res = arr[1].trim();
39329
- }
39330
- }
39331
- }
39332
- return res;
39333
- }
39334
-
39335
- /***
39336
- * 计算 cell border 距离 table 左侧距离
39337
- */
39338
- function getCumulativeWidths(columnWidths) {
39339
- var e_1, _a;
39340
- var cumulativeWidths = [];
39341
- var totalWidth = 0;
39342
- try {
39343
- for (var columnWidths_1 = __values(columnWidths), columnWidths_1_1 = columnWidths_1.next(); !columnWidths_1_1.done; columnWidths_1_1 = columnWidths_1.next()) {
39344
- var width = columnWidths_1_1.value;
39345
- totalWidth += width;
39346
- cumulativeWidths.push(totalWidth);
39347
- }
39348
- }
39349
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
39350
- finally {
39351
- try {
39352
- if (columnWidths_1_1 && !columnWidths_1_1.done && (_a = columnWidths_1.return)) _a.call(columnWidths_1);
39353
- }
39354
- finally { if (e_1) throw e_1.error; }
39355
- }
39356
- return cumulativeWidths;
39357
- }
39358
- /***
39359
- * 用于计算拖动 cell 时,cell 宽度变化的比例
40718
+ * 获取第一行所有 cells
40719
+ * @param tableNode table node
39360
40720
  */
39361
- function getColumnWidthRatios(columnWidths) {
39362
- var e_2, _a;
39363
- var columnWidthsRatio = [];
39364
- var totalWidth = columnWidths.reduce(function (a, b) { return a + b; }, 0);
39365
- try {
39366
- for (var columnWidths_2 = __values(columnWidths), columnWidths_2_1 = columnWidths_2.next(); !columnWidths_2_1.done; columnWidths_2_1 = columnWidths_2.next()) {
39367
- var width = columnWidths_2_1.value;
39368
- columnWidthsRatio.push(width / totalWidth);
39369
- }
39370
- }
39371
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
39372
- finally {
39373
- try {
39374
- if (columnWidths_2_1 && !columnWidths_2_1.done && (_a = columnWidths_2.return)) _a.call(columnWidths_2);
39375
- }
39376
- finally { if (e_2) throw e_2.error; }
39377
- }
39378
- return columnWidthsRatio;
39379
- }
39380
- /**
39381
- * 监听 table 内部变化,如新增行、列,删除行列等操作,引起的高度变化。
39382
- * ResizeObserver 需要即时释放,以免引起内存泄露
39383
- */
39384
- var resizeObserver = null;
39385
- function observerTableResize(editor, elm) {
39386
- if (elm instanceof HTMLElement) {
39387
- var table = elm.querySelector('table');
39388
- if (table) {
39389
- resizeObserver = new ResizeObserver(function (_a) {
39390
- var _b = __read(_a, 1), contentRect = _b[0].contentRect;
39391
- // 当非拖动引起的宽度变化,需要调整 columnWidths
39392
- slate.Transforms.setNodes(editor, {
39393
- scrollWidth: contentRect.width,
39394
- height: contentRect.height,
39395
- }, { mode: 'highest' });
39396
- });
39397
- resizeObserver.observe(table);
39398
- }
39399
- }
39400
- }
39401
- function unObserveTableResize() {
39402
- if (resizeObserver) {
39403
- resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
39404
- resizeObserver = null;
39405
- }
39406
- }
39407
- // 是否为光标选区行为
39408
- var isSelectionOperation = false;
39409
- // 拖拽列宽相关信息
39410
- var isMouseDownForResize = false;
39411
- var clientXWhenMouseDown = 0;
39412
- var cellWidthWhenMouseDown = 0;
39413
- var editorWhenMouseDown = null;
39414
- var $window = $__default["default"](window);
39415
- $window.on('mousedown', onMouseDown);
39416
- function onMouseDown(event) {
39417
- var elem = event.target;
39418
- // 判断是否为光标选区行为,对列宽变更行为进行过滤
39419
- // console.log('onMouseDown', elem)
39420
- if (elem.closest('[data-block-type="table-cell"]')) {
39421
- isSelectionOperation = true;
39422
- }
39423
- else if (elem.tagName == 'DIV' && elem.closest('.column-resizer-item')) {
39424
- if (editorWhenMouseDown == null)
39425
- return;
39426
- var _a = __read(slate.Editor.nodes(editorWhenMouseDown, {
39427
- match: isOfType(editorWhenMouseDown, 'table'),
39428
- }), 1), _b = __read(_a[0], 1), elemNode = _b[0];
39429
- var _c = elemNode, _d = _c.width, tableWidth = _d === void 0 ? 'auto' : _d, _e = _c.columnWidths, columnWidths = _e === void 0 ? [] : _e, _f = _c.resizingIndex, resizingIndex = _f === void 0 ? -1 : _f;
39430
- /**
39431
- * table width 为 100% 模式时,因无法增加Table宽度,不触发 列宽变更行为
39432
- * 如需变更,到底哪个列增宽度,哪个列减去宽度??
39433
- */
39434
- if (tableWidth == '100%')
39435
- return;
39436
- // 记录必要信息
39437
- isMouseDownForResize = true;
39438
- var clientX = event.clientX;
39439
- clientXWhenMouseDown = clientX;
39440
- cellWidthWhenMouseDown = columnWidths[resizingIndex];
39441
- document.body.style.cursor = 'col-resize';
39442
- event.preventDefault();
39443
- }
39444
- $window.on('mousemove', onMouseMove);
39445
- $window.on('mouseup', onMouseUp);
39446
- }
39447
- var onMouseMove = throttle__default["default"](function (event) {
39448
- if (!isMouseDownForResize)
39449
- return;
39450
- if (editorWhenMouseDown == null)
39451
- return;
39452
- event.preventDefault();
39453
- var clientX = event.clientX;
39454
- var newWith = cellWidthWhenMouseDown + (clientX - clientXWhenMouseDown); // 计算新宽度
39455
- newWith = Math.floor(newWith * 100) / 100; // 保留小数点后两位
39456
- if (newWith < 30)
39457
- newWith = 30; // 最小宽度
39458
- var _a = __read(slate.Editor.nodes(editorWhenMouseDown, {
39459
- match: isOfType(editorWhenMouseDown, 'table'),
39460
- }), 1), _b = __read(_a[0], 1), elemNode = _b[0];
39461
- var _c = elemNode, _d = _c.columnWidths, columnWidths = _d === void 0 ? [] : _d, _e = _c.resizingIndex, resizingIndex = _e === void 0 ? -1 : _e, _f = _c.scrollWidth, scrollWidth = _f === void 0 ? 0 : _f;
39462
- /**
39463
- * 判断拖动引起的宽度是否最大化了
39464
- * 如果最大化了,则需要调整列的宽度
39465
- *
39466
- * 0.5 很微妙
39467
- */
39468
- var cumulativeTotalWidth = columnWidths.reduce(function (a, b) { return a + b; }, 0);
39469
- var remainWidth = cumulativeTotalWidth - columnWidths[resizingIndex];
39470
- if (cumulativeTotalWidth > scrollWidth && remainWidth + newWith > scrollWidth) {
39471
- newWith = scrollWidth - remainWidth + 0.5;
39472
- }
39473
- var adjustColumnWidths = __spreadArray([], __read(columnWidths)).map(function (width) { return Math.floor(width); });
39474
- adjustColumnWidths[resizingIndex] = newWith;
39475
- // 这是宽度
39476
- slate.Transforms.setNodes(editorWhenMouseDown, { columnWidths: adjustColumnWidths }, {
39477
- mode: 'highest',
39478
- });
39479
- }, 100);
39480
- function onMouseUp(event) {
39481
- isSelectionOperation = false;
39482
- isMouseDownForResize = false;
39483
- editorWhenMouseDown = null;
39484
- document.body.style.cursor = '';
39485
- // 解绑事件
39486
- $window.off('mousemove', onMouseMove);
39487
- $window.off('mouseup', onMouseUp);
40721
+ function getFirstRowCells(tableNode) {
40722
+ var rows = tableNode.children || []; // 所有行
40723
+ if (rows.length === 0)
40724
+ return [];
40725
+ var firstRow = rows[0] || {}; // 第一行
40726
+ var cells = firstRow.children || []; // 第一行所有 cell
40727
+ return cells;
39488
40728
  }
39489
40729
  /**
39490
- * 鼠标移动时,判断在哪个 Cell border 上
39491
- * Class visible 后 highlight @跟随飞书
39492
- * 避免光标选区功能收到干扰
40730
+ * 表格是否带有表头?
40731
+ * @param tableNode table node
39493
40732
  */
39494
- function handleCellBorderVisible(editor, elemNode, e) {
39495
- if (editor.isDisabled())
39496
- return;
39497
- if (isSelectionOperation || isMouseDownForResize)
39498
- return;
39499
- var _a = elemNode, _b = _a.width, tableWidth = _b === void 0 ? 'auto' : _b, _c = _a.columnWidths, columnWidths = _c === void 0 ? [] : _c, isHoverCellBorder = _a.isHoverCellBorder, resizingIndex = _a.resizingIndex;
39500
- /**
39501
- * table width 为 100% 模式时,因无法增加Table宽度,不触发 列宽变更行为
39502
- * 如需变更,到底哪个列增宽度,哪个列减去宽度??
39503
- */
39504
- if (tableWidth == '100%')
39505
- return;
39506
- // Cell Border 宽度为 10px
39507
- var clientX = e.clientX, target = e.target;
39508
- // 当单元格合并的时候,鼠标在 cell 中间,则不显示 cell border
39509
- if (target instanceof HTMLElement) {
39510
- var rect = target.getBoundingClientRect();
39511
- if (clientX > rect.x + 5 && clientX < rect.x + rect.width - 5) {
39512
- if (isHoverCellBorder) {
39513
- slate.Transforms.setNodes(editor, { isHoverCellBorder: false, resizingIndex: -1 }, { mode: 'highest' });
39514
- }
39515
- return;
39516
- }
39517
- }
39518
- if (target instanceof HTMLElement) {
39519
- var parent_1 = target.closest('.table');
39520
- if (parent_1) {
39521
- var clientX_1 = e.clientX;
39522
- var rect = parent_1.getBoundingClientRect();
39523
- var cumulativeWidths = getCumulativeWidths(columnWidths);
39524
- // 鼠标移动时,计算当前鼠标位置,判断在哪个 Cell border 上
39525
- for (var i = 0; i < cumulativeWidths.length; i++) {
39526
- if (clientX_1 - rect.x >= cumulativeWidths[i] - 5 &&
39527
- clientX_1 - rect.x < cumulativeWidths[i] + 5) {
39528
- // 节流,防止多次引起Transforms.setNodes重绘
39529
- if (resizingIndex == i)
39530
- return;
39531
- slate.Transforms.setNodes(editor, { isHoverCellBorder: true, resizingIndex: i }, { mode: 'highest' });
39532
- return;
39533
- }
39534
- }
39535
- }
39536
- }
39537
- // 鼠标移出时,重置
39538
- if (isHoverCellBorder == true) {
39539
- slate.Transforms.setNodes(editor, { isHoverCellBorder: false, resizingIndex: -1 }, {
39540
- mode: 'highest',
39541
- });
39542
- }
40733
+ function isTableWithHeader(tableNode) {
40734
+ var firstRowCells = getFirstRowCells(tableNode);
40735
+ return firstRowCells.every(function (cell) { return !!cell.isHeader; });
39543
40736
  }
39544
40737
  /**
39545
- * 设置 class highlight
39546
- * render-cell.tsx 拖动功能迁移至 div.column-resize
40738
+ * 单元格是否在第一行
40739
+ * @param editor editor
40740
+ * @param cellNode cell node
39547
40741
  */
39548
- function handleCellBorderHighlight(editor, e) {
39549
- if (e.type === 'mouseenter') {
39550
- slate.Transforms.setNodes(editor, { isResizing: true }, { mode: 'highest' });
39551
- }
39552
- else {
39553
- slate.Transforms.setNodes(editor, { isResizing: false }, { mode: 'highest' });
39554
- }
39555
- }
39556
- function handleCellBorderMouseDown(editor, elemNode) {
39557
- if (isMouseDownForResize)
39558
- return; // 此时正在修改列宽
39559
- editorWhenMouseDown = editor;
40742
+ function isCellInFirstRow(editor, cellNode) {
40743
+ var rowNode = core.DomEditor.getParentNode(editor, cellNode);
40744
+ if (rowNode == null)
40745
+ return false;
40746
+ var tableNode = core.DomEditor.getParentNode(editor, rowNode);
40747
+ if (tableNode == null)
40748
+ return false;
40749
+ var firstRowCells = getFirstRowCells(tableNode);
40750
+ return firstRowCells.some(function (c) { return c === cellNode; });
39560
40751
  }
39561
40752
 
39562
40753
  /**
@@ -39594,13 +40785,11 @@
39594
40785
  // 是否可编辑
39595
40786
  var editable = getContentEditable(editor, elemNode);
39596
40787
  // 宽度
39597
- var _a = elemNode, _b = _a.width, tableWidth = _b === void 0 ? 'auto' : _b, height = _a.height, _c = _a.columnWidths, columnWidths = _c === void 0 ? [] : _c, _d = _a.scrollWidth, scrollWidth = _d === void 0 ? 0 : _d, isHoverCellBorder = _a.isHoverCellBorder, resizingIndex = _a.resizingIndex, isResizing = _a.isResizing;
39598
- // 光标是否选中
40788
+ var _a = elemNode.width, width = _a === void 0 ? 'auto' : _a;
40789
+ // 是否选中
39599
40790
  var selected = core.DomEditor.isNodeSelected(editor, elemNode);
39600
- // 光标是否有选区
39601
- var _e = __read(TableCursor.selection(editor), 1), isSelecting = _e[0];
39602
- // 列宽之间比值
39603
- var columnWidthRatios = getColumnWidthRatios(columnWidths);
40791
+ // 第一行的 cells ,以计算列宽
40792
+ var firstRowCells = getFirstRowCells(elemNode);
39604
40793
  var vnode = (snabbdom.jsx("div", { className: "table-container", "data-selected": selected, on: {
39605
40794
  mousedown: function (e) {
39606
40795
  // @ts-ignore 阻止光标定位到 table 后面
@@ -39608,10 +40797,6 @@
39608
40797
  e.preventDefault();
39609
40798
  if (editor.isDisabled())
39610
40799
  return;
39611
- // @ts-ignore 如果用户行为是获取焦点输入文本时,需释放选区
39612
- if (e.target.closest('[data-block-type="table-cell"]')) {
39613
- TableCursor.unselect(editor);
39614
- }
39615
40800
  // 是否需要定位到 table 内部
39616
40801
  var tablePath = core.DomEditor.findPath(editor, elemNode);
39617
40802
  var tableStart = slate.Editor.start(editor, tablePath);
@@ -39626,64 +40811,13 @@
39626
40811
  editor.select(tableStart); // 选中 table 内部
39627
40812
  },
39628
40813
  } },
39629
- snabbdom.jsx("table", { width: tableWidth, contentEditable: editable,
39630
- /**
39631
- * 1. 当表格处于选区状态,屏蔽 Chrome 自带的样式
39632
- * 2. table 宽度为 auto 时,宽度为 列宽之和
39633
- * 3. 鼠标移动到 单元格 边缘,设置 visible className
39634
- */
39635
- className: 'table ' + (isSelecting ? 'table-selection-none' : ''), style: {
39636
- width: tableWidth == '100%' ? '' : columnWidths.reduce(function (a, b) { return a + b; }, 0) + 'px',
39637
- }, on: {
39638
- mousemove: debounce__default["default"](function (e) { return handleCellBorderVisible(editor, elemNode, e); }, 25),
39639
- } },
39640
- snabbdom.jsx("colgroup", { contentEditable: false },
39641
- /**
39642
- * 剔除 firstRowCells,因单元格合并 表头 th,会计算错误。
39643
- * 使用 columnWidth 数组长度代表列数
39644
- * 拖动行为及变量设置均参考 飞书
39645
- */
39646
- columnWidths.map(function (width) {
40814
+ snabbdom.jsx("table", { width: width, contentEditable: editable },
40815
+ snabbdom.jsx("colgroup", { contentEditable: false }, firstRowCells.map(function (cell) {
40816
+ var _a = cell.width, width = _a === void 0 ? 'auto' : _a;
39647
40817
  return snabbdom.jsx("col", { width: width });
39648
40818
  })),
39649
- snabbdom.jsx("tbody", null, children)),
39650
- snabbdom.jsx("div", { className: "column-resizer", contenteditable: "false" }, columnWidths.map(function (width, index) {
39651
- var minWidth = width;
39652
- /**
39653
- * table width 为 100% 模式时
39654
- * columnWidths 表示的是比例
39655
- * 1. 需要计算出真实的宽度
39656
- */
39657
- if (tableWidth == '100%') {
39658
- minWidth = columnWidthRatios[index] * scrollWidth;
39659
- }
39660
- return (snabbdom.jsx("div", { className: "column-resizer-item", style: { minWidth: minWidth + "px" } },
39661
- snabbdom.jsx("div", { className: 'resizer-line-hotzone ' +
39662
- (isHoverCellBorder && index == resizingIndex ? 'visible ' : '') +
39663
- (isResizing && index == resizingIndex ? 'highlight' : ''), style: { height: height + 'px' }, on: {
39664
- mouseenter: function (e) { return handleCellBorderHighlight(editor, e); },
39665
- mouseleave: function (e) { return handleCellBorderHighlight(editor, e); },
39666
- mousedown: function (e) { return handleCellBorderMouseDown(editor); },
39667
- } },
39668
- snabbdom.jsx("div", { className: "resizer-line" }))));
39669
- }))));
39670
- /**
39671
- * 移出直接返回 vnode
39672
- * 添加 ObserverResize 监听行为
39673
- * 监听 table 内部变化,更新 table resize-bar 高度
39674
- */
39675
- var containerVnode = snabbdom.h('div', {
39676
- hook: {
39677
- insert: function (_a) {
39678
- var elm = _a.elm;
39679
- return observerTableResize(editor, elm);
39680
- },
39681
- destroy: function () {
39682
- unObserveTableResize();
39683
- },
39684
- },
39685
- }, vnode);
39686
- return containerVnode;
40819
+ snabbdom.jsx("tbody", null, children))));
40820
+ return vnode;
39687
40821
  }
39688
40822
 
39689
40823
  /**
@@ -39694,62 +40828,156 @@
39694
40828
  var vnode = snabbdom.jsx("tr", null, children);
39695
40829
  return vnode;
39696
40830
  }
39697
-
39698
- /**
39699
- * @description table menu helpers
39700
- * @author wangfupeng
39701
- */
39702
- /**
39703
- * 获取第一行所有 cells
39704
- * @param tableNode table node
39705
- */
39706
- function getFirstRowCells(tableNode) {
39707
- var rows = tableNode.children || []; // 所有行
39708
- if (rows.length === 0)
39709
- return [];
39710
- var firstRow = rows[0] || {}; // 第一行
39711
- var cells = firstRow.children || []; // 第一行所有 cell
39712
- return cells;
39713
- }
40831
+
39714
40832
  /**
39715
- * 表格是否带有表头?
39716
- * @param tableNode table node
40833
+ * @description DOM 操作
40834
+ * @author wangfupeng
39717
40835
  */
39718
- function isTableWithHeader(tableNode) {
39719
- var firstRowCells = getFirstRowCells(tableNode);
39720
- return firstRowCells.every(function (cell) { return !!cell.isHeader; });
40836
+ if ($.append)
40837
+ $__default["default"].fn.append = $.append;
40838
+ if ($.on)
40839
+ $__default["default"].fn.on = $.on;
40840
+ if ($.focus)
40841
+ $__default["default"].fn.focus = $.focus;
40842
+ if ($.attr)
40843
+ $__default["default"].fn.attr = $.attr;
40844
+ if ($.val)
40845
+ $__default["default"].fn.val = $.val;
40846
+ if ($.html)
40847
+ $__default["default"].fn.html = $.html;
40848
+ if ($.dataset)
40849
+ $__default["default"].fn.dataset = $.dataset;
40850
+ if ($.addClass)
40851
+ $__default["default"].fn.addClass = $.addClass;
40852
+ if ($.removeClass)
40853
+ $__default["default"].fn.removeClass = $.removeClass;
40854
+ if ($.children)
40855
+ $__default["default"].fn.children = $.children;
40856
+ if ($.each)
40857
+ $__default["default"].fn.each = $.each;
40858
+ if ($.find)
40859
+ $__default["default"].fn.find = $.find;
40860
+ /**
40861
+ * 获取 tagName lower-case
40862
+ * @param $elem $elem
40863
+ */
40864
+ function getTagName($elem) {
40865
+ if ($elem.length)
40866
+ return $elem[0].tagName.toLowerCase();
40867
+ return '';
39721
40868
  }
39722
40869
  /**
39723
- * 单元格是否在第一行
39724
- * @param editor editor
39725
- * @param cellNode cell node
40870
+ * 获取 $elem 某一个 style 值
40871
+ * @param $elem $elem
40872
+ * @param styleKey style key
39726
40873
  */
39727
- function isCellInFirstRow(editor, cellNode) {
39728
- var rowNode = core.DomEditor.getParentNode(editor, cellNode);
39729
- if (rowNode == null)
39730
- return false;
39731
- var tableNode = core.DomEditor.getParentNode(editor, rowNode);
39732
- if (tableNode == null)
39733
- return false;
39734
- var firstRowCells = getFirstRowCells(tableNode);
39735
- return firstRowCells.some(function (c) { return c === cellNode; });
40874
+ function getStyleValue($elem, styleKey) {
40875
+ var res = '';
40876
+ var styleStr = $elem.attr('style') || ''; // 如 'line-height: 2.5; color: red;'
40877
+ var styleArr = styleStr.split(';'); // 如 ['line-height: 2.5', ' color: red', '']
40878
+ var length = styleArr.length;
40879
+ for (var i = 0; i < length; i++) {
40880
+ var styleItemStr = styleArr[i]; // 如 'line-height: 2.5'
40881
+ if (styleItemStr) {
40882
+ var arr = styleItemStr.split(':'); // ['line-height', ' 2.5']
40883
+ if (arr[0].trim() === styleKey) {
40884
+ res = arr[1].trim();
40885
+ }
40886
+ }
40887
+ }
40888
+ return res;
39736
40889
  }
39737
40890
 
39738
40891
  /**
39739
40892
  * @description render cell
39740
40893
  * @author wangfupeng
39741
40894
  */
40895
+ // 拖拽列宽相关信息
40896
+ var isMouseDownForResize = false;
40897
+ var clientXWhenMouseDown = 0;
40898
+ var cellWidthWhenMouseDown = 0;
40899
+ var cellPathWhenMouseDown = null;
40900
+ var editorWhenMouseDown = null;
40901
+ var $body = $__default["default"]('body');
40902
+ function onMouseDown(event) {
40903
+ var elem = event.target;
40904
+ if (elem.tagName !== 'TH' && elem.tagName !== 'TD')
40905
+ return;
40906
+ if (elem.style.cursor !== 'col-resize')
40907
+ return;
40908
+ elem.style.cursor = 'auto';
40909
+ event.preventDefault();
40910
+ // 记录必要信息
40911
+ isMouseDownForResize = true;
40912
+ var clientX = event.clientX;
40913
+ clientXWhenMouseDown = clientX;
40914
+ var width = elem.getBoundingClientRect().width;
40915
+ cellWidthWhenMouseDown = width;
40916
+ // 绑定事件
40917
+ $body.on('mousemove', onMouseMove);
40918
+ $body.on('mouseup', onMouseUp);
40919
+ }
40920
+ $body.on('mousedown', onMouseDown); // 绑定事件
40921
+ function onMouseUp(event) {
40922
+ isMouseDownForResize = false;
40923
+ editorWhenMouseDown = null;
40924
+ cellPathWhenMouseDown = null;
40925
+ // 解绑事件
40926
+ $body.off('mousemove', onMouseMove);
40927
+ $body.off('mouseup', onMouseUp);
40928
+ }
40929
+ var onMouseMove = throttle__default["default"](function (event) {
40930
+ if (!isMouseDownForResize)
40931
+ return;
40932
+ if (editorWhenMouseDown == null || cellPathWhenMouseDown == null)
40933
+ return;
40934
+ event.preventDefault();
40935
+ var clientX = event.clientX;
40936
+ var newWith = cellWidthWhenMouseDown + (clientX - clientXWhenMouseDown); // 计算新宽度
40937
+ newWith = Math.floor(newWith * 100) / 100; // 保留小数点后两位
40938
+ if (newWith < 30)
40939
+ newWith = 30; // 最小宽度
40940
+ // 这是宽度
40941
+ slate.Transforms.setNodes(editorWhenMouseDown, { width: newWith.toString() }, {
40942
+ at: cellPathWhenMouseDown,
40943
+ });
40944
+ }, 100);
39742
40945
  function renderTableCell(cellNode, children, editor) {
39743
40946
  var isFirstRow = isCellInFirstRow(editor, cellNode);
39744
- var _a = cellNode, _b = _a.colSpan, colSpan = _b === void 0 ? 1 : _b, _c = _a.rowSpan, rowSpan = _c === void 0 ? 1 : _c, _d = _a.isHeader, isHeader = _d === void 0 ? false : _d, _e = _a.hidden, hidden = _e === void 0 ? false : _e;
39745
- var selected = TableCursor.isSelected(editor, cellNode);
40947
+ var _a = cellNode, _b = _a.colSpan, colSpan = _b === void 0 ? 1 : _b, _c = _a.rowSpan, rowSpan = _c === void 0 ? 1 : _c, _d = _a.isHeader, isHeader = _d === void 0 ? false : _d;
39746
40948
  // ------------------ 不是第一行,直接渲染 <td> ------------------
39747
40949
  if (!isFirstRow) {
39748
- return (snabbdom.jsx("td", { colSpan: colSpan, rowSpan: rowSpan, "data-block-type": "table-cell", className: selected ? 'w-e-selected' : '', style: { display: hidden ? 'none' : '' } }, children));
40950
+ return (snabbdom.jsx("td", { colSpan: colSpan, rowSpan: rowSpan }, children));
39749
40951
  }
39750
40952
  // ------------------ 是第一行:1. 判断 th ;2. 拖拽列宽 ------------------
39751
40953
  var Tag = isHeader ? 'th' : 'td';
39752
- var vnode = (snabbdom.jsx(Tag, { colSpan: colSpan, rowSpan: rowSpan, "data-block-type": "table-cell", className: selected ? 'w-e-selected' : '', style: { display: hidden ? 'none' : '' } }, children));
40954
+ var vnode = (snabbdom.jsx(Tag, { colSpan: colSpan, rowSpan: rowSpan, style: { borderRightWidth: '3px' }, on: {
40955
+ mousemove: throttle__default["default"](function (event) {
40956
+ var elem = this.elm;
40957
+ if (elem == null)
40958
+ return;
40959
+ var _a = elem.getBoundingClientRect(), left = _a.left, width = _a.width, top = _a.top, height = _a.height;
40960
+ var clientX = event.clientX, clientY = event.clientY;
40961
+ if (isMouseDownForResize)
40962
+ return; // 此时正在修改列宽
40963
+ // 非 mousedown 状态,计算 cursor 样式
40964
+ var matchX = clientX > left + width - 5 && clientX < left + width; // X 轴,是否接近 cell 右侧?
40965
+ var matchY = clientY > top && clientY < top + height; // Y 轴,是否在 cell 之内
40966
+ // X Y 轴都接近,则修改鼠标样式
40967
+ if (matchX && matchY) {
40968
+ elem.style.cursor = 'col-resize';
40969
+ editorWhenMouseDown = editor;
40970
+ cellPathWhenMouseDown = core.DomEditor.findPath(editor, cellNode);
40971
+ }
40972
+ else {
40973
+ if (!isMouseDownForResize) {
40974
+ elem.style.cursor = 'auto';
40975
+ editorWhenMouseDown = null;
40976
+ cellPathWhenMouseDown = null;
40977
+ }
40978
+ }
40979
+ }, 100),
40980
+ } }, children));
39753
40981
  return vnode;
39754
40982
  }
39755
40983
 
@@ -39776,16 +41004,15 @@
39776
41004
  */
39777
41005
  function tableToHtml(elemNode, childrenHtml) {
39778
41006
  var _a = elemNode.width, width = _a === void 0 ? 'auto' : _a;
39779
- return "<table style=\"width: " + width + ";table-layout: fixed;\"><tbody>" + childrenHtml + "</tbody></table>";
41007
+ return "<table style=\"width: " + width + ";\"><tbody>" + childrenHtml + "</tbody></table>";
39780
41008
  }
39781
41009
  function tableRowToHtml(elem, childrenHtml) {
39782
41010
  return "<tr>" + childrenHtml + "</tr>";
39783
41011
  }
39784
41012
  function tableCellToHtml(cellNode, childrenHtml) {
39785
- var _a = cellNode, _b = _a.colSpan, colSpan = _b === void 0 ? 1 : _b, _c = _a.rowSpan, rowSpan = _c === void 0 ? 1 : _c, _d = _a.isHeader, isHeader = _d === void 0 ? false : _d, _e = _a.width, width = _e === void 0 ? 'auto' : _e, _f = _a.hidden, hidden = _f === void 0 ? false : _f;
41013
+ var _a = cellNode, _b = _a.colSpan, colSpan = _b === void 0 ? 1 : _b, _c = _a.rowSpan, rowSpan = _c === void 0 ? 1 : _c, _d = _a.isHeader, isHeader = _d === void 0 ? false : _d, _e = _a.width, width = _e === void 0 ? 'auto' : _e;
39786
41014
  var tag = isHeader ? 'th' : 'td';
39787
- var style = hidden ? 'display:none' : '';
39788
- return "<" + tag + " colSpan=\"" + colSpan + "\" rowSpan=\"" + rowSpan + "\" width=\"" + width + "\" style=\"" + style + "\">" + childrenHtml + "</" + tag + ">";
41015
+ return "<" + tag + " colSpan=\"" + colSpan + "\" rowSpan=\"" + rowSpan + "\" width=\"" + width + "\">" + childrenHtml + "</" + tag + ">";
39789
41016
  }
39790
41017
  var tableToHtmlConf = {
39791
41018
  type: 'table',
@@ -39874,7 +41101,6 @@
39874
41101
  parseElemHtml: parseRowHtml,
39875
41102
  };
39876
41103
  function parseTableHtml(elem, children, editor) {
39877
- var _a;
39878
41104
  var $elem = $__default["default"](elem);
39879
41105
  // 计算宽度
39880
41106
  var width = 'auto';
@@ -39882,17 +41108,12 @@
39882
41108
  width = '100%';
39883
41109
  if ($elem.attr('width') === '100%')
39884
41110
  width = '100%'; // 兼容 v4 格式
39885
- var tableELement = {
41111
+ return {
39886
41112
  type: 'table',
39887
41113
  width: width,
39888
41114
  // @ts-ignore
39889
41115
  children: children.filter(function (child) { return core.DomEditor.getNodeType(child) === 'table-row'; }),
39890
41116
  };
39891
- var cellLength = (_a = $elem.find('tr')[0]) === null || _a === void 0 ? void 0 : _a.children.length;
39892
- if (cellLength > 0) {
39893
- tableELement.columnWidths = Array(cellLength).fill(180);
39894
- }
39895
- return tableELement;
39896
41117
  }
39897
41118
  var parseTableHtmlConf = {
39898
41119
  selector: 'table:not([data-w-e-type])',
@@ -39923,11 +41144,7 @@
39923
41144
  // 表头
39924
41145
  var TABLE_HEADER_SVG = '<svg viewBox="0 0 1024 1024"><path d="M704 128l-64 0L384 128 320 128 0 128l0 256 0 64 0 192 0 64 0 256 320 0 64 0 256 0 64 0 320 0 0-256 0-64L1024 448 1024 384 1024 128 704 128zM640 640 384 640 384 448l256 0L640 640zM64 448l256 0 0 192L64 640 64 448zM320 896 64 896l0-192 256 0L320 896zM640 896 384 896l0-192 256 0L640 896zM960 896l-256 0 0-192 256 0L960 896zM960 640l-256 0L704 448l256 0L960 640z"></path></svg>';
39925
41146
  // 宽度
39926
- var FULL_WIDTH_SVG = '<svg viewBox="0 0 1228 1024"><path d="M862.514337 563.200461H404.581995v121.753478a13.311987 13.311987 0 0 1-6.655993 11.468789 10.23999 10.23999 0 0 1-12.083188-1.433599l-204.799795-179.199821a13.721586 13.721586 0 0 1 0-20.479979l204.799795-179.302221a10.23999 10.23999 0 0 1 12.185588-1.535998 13.209587 13.209587 0 0 1 6.553593 11.673588v115.097485h457.932342V319.693504a11.571188 11.571188 0 0 1 18.841582-10.239989l204.799795 179.19982a13.721586 13.721586 0 0 1 0 20.47998l-204.799795 179.199821a10.23999 10.23999 0 0 1-12.185588 1.535998 13.311987 13.311987 0 0 1-6.655994-11.571188V563.200461zM136.499064 14.951409v993.893406a15.257585 15.257585 0 0 1-15.155185 15.052785H15.155185A15.155185 15.155185 0 0 1 0 1008.844815V14.951409a15.257585 15.257585 0 0 1 15.155185-15.052785h106.086294a15.155185 15.155185 0 0 1 15.257585 15.155185zM1228.798771 14.951409v993.893406a15.257585 15.257585 0 0 1-15.155185 15.052785h-106.188693a15.155185 15.155185 0 0 1-15.155185-15.052785V14.951409a15.257585 15.257585 0 0 1 15.155185-15.052785h106.086293A15.155185 15.155185 0 0 1 1228.798771 15.053809z"></path></svg>';
39927
- // 合并单元格
39928
- var MERGE_CELL_SVG = '<svg viewBox="0 0 1024 1024"><path d="M482.2 508.4 331.3 389c-3-2.4-7.3-.2-7.3 3.6V478H184V184h204v128c0 2.2 1.8 4 4 4h60c2.2 0 4-1.8 4-4V144c0-15.5-12.5-28-28-28H144c-15.5 0-28 12.5-28 28v736c0 15.5 12.5 28 28 28h284c15.5 0 28-12.5 28-28V712c0-2.2-1.8-4-4-4h-60c-2.2 0-4 1.8-4 4v128H184V546h140v85.4c0 3.8 4.4 6 7.3 3.6l150.9-119.4c2.4-1.8 2.4-5.4 0-7.2zM880 116H596c-15.5 0-28 12.5-28 28v168c0 2.2 1.8 4 4 4h60c2.2 0 4-1.8 4-4V184h204v294H700v-85.4c0-3.8-4.3-6-7.3-3.6l-151 119.4c-2.3 1.8-2.3 5.3 0 7.1l151 119.5c2.9 2.3 7.3.2 7.3-3.6V546h140v294H636V712c0-2.2-1.8-4-4-4h-60c-2.2 0-4 1.8-4 4v168c0 15.5 12.5 28 28 28h284c15.5 0 28-12.5 28-28V144c0-15.5-12.5-28-28-28z"/></svg>';
39929
- // 拆分单元格
39930
- var SPLIT_CELL_SVG = '<svg viewBox="0 0 1024 1024"><path d="M362.667 494.933v53.334l25.6-25.6zm0-241.066L460.8 352V78.933H57.6v98.134h305.067zm0 535.466v57.6H57.6v98.134h403.2V691.2zM661.333 494.933v53.334l-25.6-25.6zm0-241.066L563.2 352V78.933h403.2v98.134H661.333zm0 535.466v57.6H966.4v98.134H563.2V691.2z"/><path d="M753.067 341.333 693.333 281.6 512 460.8 330.667 281.6l-59.734 59.733 181.334 181.334L270.933 704l59.734 59.733L512 582.4l181.333 181.333L753.067 704 571.733 522.667z"/></svg>';
41147
+ var FULL_WIDTH_SVG = '<svg viewBox="0 0 1228 1024"><path d="M862.514337 563.200461H404.581995v121.753478a13.311987 13.311987 0 0 1-6.655993 11.468789 10.23999 10.23999 0 0 1-12.083188-1.433599l-204.799795-179.199821a13.721586 13.721586 0 0 1 0-20.479979l204.799795-179.302221a10.23999 10.23999 0 0 1 12.185588-1.535998 13.209587 13.209587 0 0 1 6.553593 11.673588v115.097485h457.932342V319.693504a11.571188 11.571188 0 0 1 18.841582-10.239989l204.799795 179.19982a13.721586 13.721586 0 0 1 0 20.47998l-204.799795 179.199821a10.23999 10.23999 0 0 1-12.185588 1.535998 13.311987 13.311987 0 0 1-6.655994-11.571188V563.200461zM136.499064 14.951409v993.893406a15.257585 15.257585 0 0 1-15.155185 15.052785H15.155185A15.155185 15.155185 0 0 1 0 1008.844815V14.951409a15.257585 15.257585 0 0 1 15.155185-15.052785h106.086294a15.155185 15.155185 0 0 1 15.257585 15.155185zM1228.798771 14.951409v993.893406a15.257585 15.257585 0 0 1-15.155185 15.052785h-106.188693a15.155185 15.155185 0 0 1-15.155185-15.052785V14.951409a15.257585 15.257585 0 0 1 15.155185-15.052785h106.086293A15.155185 15.155185 0 0 1 1228.798771 15.053809z"></path></svg>';
39931
41148
 
39932
41149
  /**
39933
41150
  * @description insert table menu
@@ -39936,7 +41153,6 @@
39936
41153
  function genTableNode(rowNum, colNum) {
39937
41154
  // 拼接 rows
39938
41155
  var rows = [];
39939
- var columnWidths = Array(colNum).fill(60);
39940
41156
  for (var i = 0; i < rowNum; i++) {
39941
41157
  // 拼接 cells
39942
41158
  var cells = [];
@@ -39960,7 +41176,6 @@
39960
41176
  type: 'table',
39961
41177
  width: 'auto',
39962
41178
  children: rows,
39963
- columnWidths: columnWidths,
39964
41179
  };
39965
41180
  }
39966
41181
  var InsertTable = /** @class */ (function () {
@@ -40082,12 +41297,6 @@
40082
41297
  if (core.DomEditor.isSelectedEmptyParagraph(editor)) {
40083
41298
  slate.Transforms.removeNodes(editor, { mode: 'highest' });
40084
41299
  }
40085
- if (editor.children.length === 0) {
40086
- // table 作为第一个 children 时会导致无法正常删除
40087
- // 在当前位置插入空行,当前元素下移
40088
- var newElem = { type: 'paragraph', children: [{ text: '' }] };
40089
- slate.Transforms.insertNodes(editor, newElem, { mode: 'highest' });
40090
- }
40091
41300
  // 插入表格
40092
41301
  var tableNode = genTableNode(rowNum, colNum);
40093
41302
  slate.Transforms.insertNodes(editor, tableNode, { mode: 'highest' });
@@ -40176,56 +41385,19 @@
40176
41385
  var cellsLength = (rowNode === null || rowNode === void 0 ? void 0 : rowNode.children.length) || 0;
40177
41386
  if (cellsLength === 0)
40178
41387
  return;
40179
- var matrix = filledMatrix(editor);
40180
- // 向下插入行为,先找到
40181
- // 当前选区所在的 tr 索引
40182
- var trIndex = 0;
40183
- outer: for (var x = 0; x < matrix.length; x++) {
40184
- for (var y = 0; y < matrix[x].length; y++) {
40185
- var _c = __read(matrix[x][y], 1), _d = __read(_c[0], 2), path = _d[1];
40186
- if (!slate.Path.equals(cellPath, path)) {
40187
- continue;
40188
- }
40189
- trIndex = x;
40190
- break outer;
40191
- }
41388
+ // 拼接新的 row
41389
+ var newRow = { type: 'table-row', children: [] };
41390
+ for (var i = 0; i < cellsLength; i++) {
41391
+ var cell = {
41392
+ type: 'table-cell',
41393
+ children: [{ text: '' }],
41394
+ };
41395
+ newRow.children.push(cell);
40192
41396
  }
40193
- slate.Editor.withoutNormalizing(editor, function () {
40194
- // 向下添加 tr 索引
40195
- var destIndex = trIndex + 1;
40196
- var isWithinBounds = destIndex >= 0 && destIndex < matrix.length;
40197
- var exitMerge = [];
40198
- for (var y = 0; isWithinBounds && y < matrix[trIndex].length; y++) {
40199
- var _a = __read(matrix[trIndex][y], 2), _b = _a[1], ttb = _b.ttb, btt = _b.btt;
40200
- // 向上找到 1 元素为止
40201
- if (ttb > 1 || btt > 1) {
40202
- if (btt == 1)
40203
- continue;
40204
- var _c = __read(matrix[trIndex - (ttb - 1)][y], 1), _d = __read(_c[0], 2), element = _d[0], path = _d[1];
40205
- var rowSpan = element.rowSpan || 1;
40206
- exitMerge.push(y);
40207
- if (!element.hidden) {
40208
- slate.Transforms.setNodes(editor, {
40209
- rowSpan: rowSpan + 1,
40210
- }, { at: path });
40211
- }
40212
- }
40213
- }
40214
- // 拼接新的 row
40215
- var newRow = { type: 'table-row', children: [] };
40216
- for (var i = 0; i < cellsLength; i++) {
40217
- var cell = {
40218
- type: 'table-cell',
40219
- hidden: exitMerge.includes(i),
40220
- children: [{ text: '' }],
40221
- };
40222
- newRow.children.push(cell);
40223
- }
40224
- // 插入 row
40225
- var rowPath = slate.Path.parent(cellPath); // 获取 tr 的 path
40226
- var newRowPath = slate.Path.next(rowPath);
40227
- slate.Transforms.insertNodes(editor, newRow, { at: newRowPath });
40228
- });
41397
+ // 插入 row
41398
+ var rowPath = slate.Path.parent(cellPath); // 获取 tr 的 path
41399
+ var newRowPath = slate.Path.next(rowPath);
41400
+ slate.Transforms.insertNodes(editor, newRow, { at: newRowPath });
40229
41401
  };
40230
41402
  return InsertRow;
40231
41403
  }());
@@ -40277,67 +41449,7 @@
40277
41449
  return;
40278
41450
  }
40279
41451
  // row > 1 行,则删掉这一行
40280
- var _c = __read(slate.Editor.nodes(editor, {
40281
- match: function (n) { return core.DomEditor.checkNodeType(n, 'table-cell'); },
40282
- universal: true,
40283
- }), 1), cellEntry = _c[0];
40284
- var _d = __read(cellEntry, 2), cellPath = _d[1];
40285
- var matrix = filledMatrix(editor);
40286
- var trIndex = 0;
40287
- outer: for (var x = 0; x < matrix.length; x++) {
40288
- for (var y = 0; y < matrix[x].length; y++) {
40289
- var _e = __read(matrix[x][y], 1), _f = __read(_e[0], 2), path = _f[1];
40290
- if (!slate.Path.equals(cellPath, path)) {
40291
- continue;
40292
- }
40293
- trIndex = x;
40294
- break outer;
40295
- }
40296
- }
40297
- slate.Editor.withoutNormalizing(editor, function () {
40298
- var e_1, _a;
40299
- for (var y = 0; y < matrix[trIndex].length; y++) {
40300
- var _b = __read(matrix[trIndex][y], 2), _c = __read(_b[0], 1), hidden = _c[0].hidden, _d = _b[1], ttb = _d.ttb, btt = _d.btt;
40301
- // 寻找跨行行为
40302
- if (ttb > 1 || btt > 1) {
40303
- // 找到显示中 rowSpan 节点
40304
- var _e = __read(matrix[trIndex - (ttb - 1)][y], 1), _f = __read(_e[0], 2), _g = _f[0], _h = _g.rowSpan, rowSpan = _h === void 0 ? 1 : _h, _j = _g.colSpan, colSpan = _j === void 0 ? 1 : _j, path = _f[1];
40305
- // 如果当前选中节点为隐藏节点,则向上寻找处理 rowSpan 逻辑
40306
- if (hidden) {
40307
- slate.Transforms.setNodes(editor, {
40308
- rowSpan: Math.max(rowSpan - 1, 1),
40309
- colSpan: colSpan,
40310
- }, { at: path });
40311
- }
40312
- else {
40313
- var _k = __read(matrix[trIndex + 1][y], 1), _l = __read(_k[0], 2), belowPath = _l[1];
40314
- slate.Transforms.setNodes(editor, {
40315
- rowSpan: rowSpan - 1,
40316
- colSpan: colSpan,
40317
- hidden: false,
40318
- }, { at: belowPath });
40319
- try {
40320
- // 移动单元格 文本、图片等元素
40321
- for (var _m = (e_1 = void 0, __values(slate.Node.children(editor, path, { reverse: true }))), _o = _m.next(); !_o.done; _o = _m.next()) {
40322
- var _p = __read(_o.value, 2), childPath = _p[1];
40323
- slate.Transforms.moveNodes(editor, {
40324
- to: __spreadArray(__spreadArray([], __read(belowPath)), [0]),
40325
- at: childPath,
40326
- });
40327
- }
40328
- }
40329
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
40330
- finally {
40331
- try {
40332
- if (_o && !_o.done && (_a = _m.return)) _a.call(_m);
40333
- }
40334
- finally { if (e_1) throw e_1.error; }
40335
- }
40336
- }
40337
- }
40338
- }
40339
- slate.Transforms.removeNodes(editor, { at: rowPath });
40340
- });
41452
+ slate.Transforms.removeNodes(editor, { at: rowPath });
40341
41453
  };
40342
41454
  return DeleteRow;
40343
41455
  }());
@@ -40387,62 +41499,27 @@
40387
41499
  var tableNode = core.DomEditor.getParentNode(editor, rowNode);
40388
41500
  if (tableNode == null)
40389
41501
  return;
40390
- var matrix = filledMatrix(editor);
40391
- var tdIndex = 0;
40392
- out: for (var x = 0; x < matrix.length; x++) {
40393
- for (var y = 0; y < matrix[x].length; y++) {
40394
- var _c = __read(matrix[x][y], 1), _d = __read(_c[0], 2), path = _d[1];
40395
- if (slate.Path.equals(selectedCellPath, path)) {
40396
- tdIndex = y;
40397
- break out;
40398
- }
40399
- }
40400
- }
40401
- slate.Editor.withoutNormalizing(editor, function () {
40402
- var exitMerge = [];
40403
- for (var x = 0; x < matrix.length; x++) {
40404
- var _a = __read(matrix[x][tdIndex], 2), _b = _a[1], ltr = _b.ltr, rtl = _b.rtl;
40405
- // 向左找到 1 元素为止
40406
- if (ltr > 1 || rtl > 1) {
40407
- if (rtl == 1)
40408
- continue;
40409
- var _c = __read(matrix[x][tdIndex - (rtl - 1)], 1), _d = __read(_c[0], 2), element = _d[0], path = _d[1];
40410
- var colSpan = element.colSpan || 1;
40411
- exitMerge.push(x);
40412
- if (!element.hidden) {
40413
- slate.Transforms.setNodes(editor, {
40414
- colSpan: colSpan + 1,
40415
- }, { at: path });
41502
+ // 遍历所有 rows ,挨个添加 cell
41503
+ var rows = tableNode.children || [];
41504
+ rows.forEach(function (row, rowIndex) {
41505
+ if (!slate.Element.isElement(row))
41506
+ return;
41507
+ var cells = row.children || [];
41508
+ // 遍历一个 row 的所有 cells
41509
+ cells.forEach(function (cell) {
41510
+ var path = core.DomEditor.findPath(editor, cell);
41511
+ if (path.length === selectedCellPath.length &&
41512
+ isEqual__default["default"](path.slice(-1), selectedCellPath.slice(-1)) // 俩数组,最后一位相同
41513
+ ) {
41514
+ // 如果当前 td 的 path 和选中 td 的 path ,最后一位相同,说明是同一列
41515
+ // 则在其后插入一个 cell
41516
+ var newCell = { type: 'table-cell', children: [{ text: '' }] };
41517
+ if (rowIndex === 0 && isTableWithHeader(tableNode)) {
41518
+ newCell.isHeader = true;
40416
41519
  }
41520
+ slate.Transforms.insertNodes(editor, newCell, { at: path });
40417
41521
  }
40418
- }
40419
- // 遍历所有 rows ,挨个添加 cell
40420
- for (var x = 0; x < matrix.length; x++) {
40421
- var newCell = {
40422
- type: 'table-cell',
40423
- hidden: exitMerge.includes(x),
40424
- children: [{ text: '' }],
40425
- };
40426
- if (x === 0 && isTableWithHeader(tableNode)) {
40427
- newCell.isHeader = true;
40428
- }
40429
- var _e = __read(matrix[x][tdIndex], 1), _f = __read(_e[0], 2), insertPath = _f[1];
40430
- slate.Transforms.insertNodes(editor, newCell, { at: insertPath });
40431
- }
40432
- // 需要调整 columnWidths
40433
- var _g = __read(slate.Editor.nodes(editor, {
40434
- match: function (n) { return core.DomEditor.checkNodeType(n, 'table'); },
40435
- universal: true,
40436
- }), 1), tableEntry = _g[0];
40437
- if (tableEntry) {
40438
- var _h = __read(tableEntry, 2), elemNode = _h[0], tablePath = _h[1];
40439
- var _j = elemNode.columnWidths, columnWidths = _j === void 0 ? [] : _j;
40440
- var adjustColumnWidths = __spreadArray([], __read(columnWidths));
40441
- adjustColumnWidths.splice(tdIndex, 0, 60);
40442
- slate.Transforms.setNodes(editor, { columnWidths: adjustColumnWidths }, {
40443
- at: tablePath,
40444
- });
40445
- }
41522
+ });
40446
41523
  });
40447
41524
  };
40448
41525
  return InsertCol;
@@ -40498,76 +41575,23 @@
40498
41575
  var tableNode = core.DomEditor.getParentNode(editor, rowNode);
40499
41576
  if (tableNode == null)
40500
41577
  return;
40501
- var matrix = filledMatrix(editor);
40502
- var tdIndex = 0;
40503
- out: for (var x = 0; x < matrix.length; x++) {
40504
- for (var y = 0; y < matrix[x].length; y++) {
40505
- var _c = __read(matrix[x][y], 1), _d = __read(_c[0], 2), path = _d[1];
40506
- if (slate.Path.equals(selectedCellPath, path)) {
40507
- tdIndex = y;
40508
- break out;
40509
- }
40510
- }
40511
- }
40512
- slate.Editor.withoutNormalizing(editor, function () {
40513
- var e_1, _a;
40514
- for (var x = 0; x < matrix.length; x++) {
40515
- var _b = __read(matrix[x][tdIndex], 2), _c = __read(_b[0], 1), hidden = _c[0].hidden, _d = _b[1], rtl = _d.rtl, ltr = _d.ltr;
40516
- if (rtl > 1 || ltr > 1) {
40517
- // 找到显示中 colSpan 节点
40518
- var _e = __read(matrix[x][tdIndex - (rtl - 1)], 1), _f = __read(_e[0], 2), _g = _f[0], _h = _g.rowSpan, rowSpan = _h === void 0 ? 1 : _h, _j = _g.colSpan, colSpan = _j === void 0 ? 1 : _j, path = _f[1];
40519
- if (hidden) {
40520
- slate.Transforms.setNodes(editor, {
40521
- rowSpan: rowSpan,
40522
- colSpan: Math.max(colSpan - 1, 1),
40523
- }, { at: path });
40524
- }
40525
- else {
40526
- var _k = __read(matrix[x][tdIndex + 1], 1), _l = __read(_k[0], 2), rightPath = _l[1];
40527
- slate.Transforms.setNodes(editor, {
40528
- rowSpan: rowSpan,
40529
- colSpan: colSpan - 1,
40530
- hidden: false,
40531
- }, { at: rightPath });
40532
- try {
40533
- // 移动单元格 文本、图片等元素
40534
- for (var _m = (e_1 = void 0, __values(slate.Node.children(editor, path, { reverse: true }))), _o = _m.next(); !_o.done; _o = _m.next()) {
40535
- var _p = __read(_o.value, 2), childPath = _p[1];
40536
- slate.Transforms.moveNodes(editor, {
40537
- to: __spreadArray(__spreadArray([], __read(rightPath)), [0]),
40538
- at: childPath,
40539
- });
40540
- }
40541
- }
40542
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
40543
- finally {
40544
- try {
40545
- if (_o && !_o.done && (_a = _m.return)) _a.call(_m);
40546
- }
40547
- finally { if (e_1) throw e_1.error; }
40548
- }
40549
- }
41578
+ // 遍历所有 rows ,挨个删除 cell
41579
+ var rows = tableNode.children || [];
41580
+ rows.forEach(function (row) {
41581
+ if (!slate.Element.isElement(row))
41582
+ return;
41583
+ var cells = row.children || [];
41584
+ // 遍历一个 row 的所有 cells
41585
+ cells.forEach(function (cell) {
41586
+ var path = core.DomEditor.findPath(editor, cell);
41587
+ if (path.length === selectedCellPath.length &&
41588
+ isEqual__default["default"](path.slice(-1), selectedCellPath.slice(-1)) // 俩数组,最后一位相同
41589
+ ) {
41590
+ // 如果当前 td 的 path 和选中 td 的 path ,最后一位相同,说明是同一列
41591
+ // 删除当前的 cell
41592
+ slate.Transforms.removeNodes(editor, { at: path });
40550
41593
  }
40551
- }
40552
- // 挨个删除 cell
40553
- for (var x = 0; x < matrix.length; x++) {
40554
- var _q = __read(matrix[x][tdIndex], 1), _r = __read(_q[0], 2), path = _r[1];
40555
- slate.Transforms.removeNodes(editor, { at: path });
40556
- }
40557
- // 需要调整 columnWidths
40558
- var _s = __read(slate.Editor.nodes(editor, {
40559
- match: function (n) { return core.DomEditor.checkNodeType(n, 'table'); },
40560
- universal: true,
40561
- }), 1), tableEntry = _s[0];
40562
- if (tableEntry) {
40563
- var _t = __read(tableEntry, 2), elemNode = _t[0], tablePath = _t[1];
40564
- var _u = elemNode.columnWidths, columnWidths = _u === void 0 ? [] : _u;
40565
- var adjustColumnWidths = __spreadArray([], __read(columnWidths));
40566
- adjustColumnWidths.splice(tdIndex, 1);
40567
- slate.Transforms.setNodes(editor, { columnWidths: adjustColumnWidths }, {
40568
- at: tablePath,
40569
- });
40570
- }
41594
+ });
40571
41595
  });
40572
41596
  };
40573
41597
  return DeleteCol;
@@ -40670,234 +41694,6 @@
40670
41694
  return TableFullWidth;
40671
41695
  }());
40672
41696
 
40673
- var MergeCell = /** @class */ (function () {
40674
- function MergeCell() {
40675
- this.title = core.t('tableModule.mergeCell');
40676
- this.iconSvg = MERGE_CELL_SVG;
40677
- this.tag = 'button';
40678
- }
40679
- MergeCell.prototype.getValue = function (editor) {
40680
- // 无需获取 val
40681
- return '';
40682
- };
40683
- MergeCell.prototype.isActive = function (editor) {
40684
- // 无需 active
40685
- return false;
40686
- };
40687
- MergeCell.prototype.isDisabled = function (editor) {
40688
- return !this.canMerge(editor);
40689
- };
40690
- MergeCell.prototype.exec = function (editor, value) {
40691
- if (this.isDisabled(editor))
40692
- return;
40693
- this.merge(editor);
40694
- // 释放选区
40695
- TableCursor.unselect(editor);
40696
- };
40697
- /**
40698
- * Checks if the current selection can be merged. Merging is not possible when any of the following conditions are met:
40699
- * - The selection is empty.
40700
- * - The selection is not within the same "thead", "tbody," or "tfoot" section.
40701
- * @returns {boolean} `true` if the selection can be merged, otherwise `false`.
40702
- */
40703
- MergeCell.prototype.canMerge = function (editor) {
40704
- var matrix = EDITOR_TO_SELECTION.get(editor);
40705
- // cannot merge when selection is empty
40706
- if (!matrix || !matrix.length) {
40707
- return false;
40708
- }
40709
- // prettier-ignore
40710
- var _a = __read(matrix[matrix.length - 1][matrix[matrix.length - 1].length - 1], 1), _b = __read(_a[0], 2), lastPath = _b[1];
40711
- var _c = __read(matrix[0][0], 1), _d = __read(_c[0], 2), firstPath = _d[1];
40712
- // cannot merge when selection is not in common section
40713
- if (!hasCommon(editor, [firstPath, lastPath], 'table')) {
40714
- return false;
40715
- }
40716
- return true;
40717
- };
40718
- /**
40719
- * Merges the selected cells in the table.
40720
- * @returns void
40721
- */
40722
- MergeCell.prototype.merge = function (editor) {
40723
- if (!this.canMerge(editor)) {
40724
- return;
40725
- }
40726
- var selection = EDITOR_TO_SELECTION.get(editor);
40727
- if (!selection || !selection.length) {
40728
- return;
40729
- }
40730
- var _a = __read(selection[0][0], 1), _b = __read(_a[0], 2), basePath = _b[1];
40731
- var _c = __read(slate.Node.children(editor, basePath, { reverse: true }), 1), _d = __read(_c[0], 2), lastPath = _d[1];
40732
- filledMatrix(editor, { at: basePath });
40733
- slate.Editor.withoutNormalizing(editor, function () {
40734
- var e_1, _a;
40735
- var rowSpan = 0;
40736
- var colSpan = 0;
40737
- for (var x = selection.length - 1; x >= 0; x--, rowSpan++) {
40738
- colSpan = 0;
40739
- for (var y = selection[x].length - 1; y >= 0; y--, colSpan++) {
40740
- var _b = __read(selection[x][y], 2), _c = __read(_b[0], 2), path = _c[1], ttb = _b[1].ttb;
40741
- // skip first cell and "fake" cells which belong to a cell with a `rowspan`
40742
- if (slate.Path.equals(basePath, path) || ttb > 1) {
40743
- continue;
40744
- }
40745
- try {
40746
- // prettier-ignore
40747
- for (var _d = (e_1 = void 0, __values(slate.Node.children(editor, path, { reverse: true }))), _e = _d.next(); !_e.done; _e = _d.next()) {
40748
- var _f = __read(_e.value, 2), childPath = _f[1];
40749
- slate.Transforms.moveNodes(editor, {
40750
- to: slate.Path.next(lastPath),
40751
- at: childPath,
40752
- });
40753
- }
40754
- }
40755
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
40756
- finally {
40757
- try {
40758
- if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
40759
- }
40760
- finally { if (e_1) throw e_1.error; }
40761
- }
40762
- var _g = __read(slate.Editor.nodes(editor, {
40763
- match: isOfType(editor, 'tr'),
40764
- at: path,
40765
- }), 1), _h = __read(_g[0], 2), trPath = _h[1];
40766
- var _j = __read(slate.Node.children(editor, trPath), 2), sibling = _j[1];
40767
- if (sibling) {
40768
- /**
40769
- * 删除节点调整成隐藏节点
40770
- * 隐藏节点不会影响 table 布局
40771
- */
40772
- slate.Transforms.setNodes(editor, { hidden: true }, { at: path });
40773
- continue;
40774
- }
40775
- }
40776
- }
40777
- slate.Transforms.setNodes(editor, { rowSpan: rowSpan, colSpan: colSpan }, { at: basePath });
40778
- });
40779
- };
40780
- return MergeCell;
40781
- }());
40782
-
40783
- // import { DEFAULT_WITH_TABLE_OPTIONS } from "../../utils/options";
40784
- var SplitCell = /** @class */ (function () {
40785
- function SplitCell() {
40786
- this.title = core.t('tableModule.splitCell');
40787
- this.iconSvg = SPLIT_CELL_SVG;
40788
- this.tag = 'button';
40789
- }
40790
- SplitCell.prototype.getValue = function (editor) {
40791
- // 无需获取 val
40792
- return '';
40793
- };
40794
- SplitCell.prototype.isActive = function (editor) {
40795
- // 无需 active
40796
- return false;
40797
- };
40798
- SplitCell.prototype.isDisabled = function (editor) {
40799
- var _a = __read(slate.Editor.nodes(editor, {
40800
- match: isOfType(editor, 'td'),
40801
- }), 1), td = _a[0];
40802
- var _b = __read(td, 1), _c = _b[0], _d = _c.rowSpan, rowSpan = _d === void 0 ? 1 : _d, _e = _c.colSpan, colSpan = _e === void 0 ? 1 : _e;
40803
- if (rowSpan > 1 || colSpan > 1) {
40804
- return false;
40805
- }
40806
- return true;
40807
- };
40808
- SplitCell.prototype.exec = function (editor, value) {
40809
- if (this.isDisabled(editor))
40810
- return;
40811
- this.split(editor);
40812
- };
40813
- /**
40814
- * Splits either the cell at the current selection or a specified location. If a range
40815
- * selection is present, all cells within the range will be split.
40816
- * @param {Location} [options.at] - Splits the cell at the specified location. If no
40817
- * location is specified it will split the cell at the current selection
40818
- * @param {boolean} [options.all] - If true, splits all cells in the table
40819
- * @returns void
40820
- */
40821
- SplitCell.prototype.split = function (editor, options) {
40822
- if (options === void 0) { options = {}; }
40823
- var _a = __read(slate.Editor.nodes(editor, {
40824
- match: isOfType(editor, 'table', 'th', 'td'),
40825
- // @ts-ignore
40826
- at: options.at,
40827
- }), 2), table = _a[0], td = _a[1];
40828
- if (!table || !td) {
40829
- return;
40830
- }
40831
- var selection = EDITOR_TO_SELECTION.get(editor) || [];
40832
- // @ts-ignore
40833
- var matrix = filledMatrix(editor, { at: options.at });
40834
- // const { blocks } = DEFAULT_WITH_TABLE_OPTIONS;
40835
- slate.Editor.withoutNormalizing(editor, function () {
40836
- for (var x = matrix.length - 1; x >= 0; x--) {
40837
- for (var y = matrix[x].length - 1; y >= 0; y--) {
40838
- var _a = __read(matrix[x][y], 2), _b = __read(_a[0], 2), path = _b[1], context = _a[1];
40839
- var colSpan = context.ltr, rtl = context.rtl, rowSpan = context.btt, ttb = context.ttb;
40840
- if (rtl > 1) {
40841
- // get to the start of the colspan
40842
- y -= rtl - 2;
40843
- continue;
40844
- }
40845
- if (ttb > 1) {
40846
- continue;
40847
- }
40848
- if (rowSpan === 1 && colSpan === 1) {
40849
- continue;
40850
- }
40851
- var found = !!options.all;
40852
- if (selection.length) {
40853
- outer: for (var i = 0; !options.all && i < selection.length; i++) {
40854
- for (var j = 0; j < selection[i].length; j++) {
40855
- var _c = __read(selection[i][j], 1), _d = __read(_c[0], 2), tdPath = _d[1];
40856
- if (slate.Path.equals(tdPath, path)) {
40857
- found = true;
40858
- break outer;
40859
- }
40860
- }
40861
- }
40862
- }
40863
- else {
40864
- var _e = __read(td, 2), tdPath = _e[1];
40865
- if (slate.Path.equals(tdPath, path)) {
40866
- found = true;
40867
- }
40868
- }
40869
- if (!found) {
40870
- continue;
40871
- }
40872
- var _f = __read(slate.Editor.nodes(editor, {
40873
- match: isOfType(editor, 'table'),
40874
- at: path,
40875
- }), 1), _g = __read(_f[0], 1); _g[0];
40876
- out: for (var r = 1; r < rowSpan; r++) {
40877
- for (var i = y; i >= 0; i--) {
40878
- var _h = __read(matrix[x + r][i], 2), _j = __read(_h[0], 2); _j[1]; var ttb_1 = _h[1].ttb;
40879
- if (ttb_1 == 1) {
40880
- continue;
40881
- }
40882
- for (var c = 0; c < colSpan; c++) {
40883
- var _k = __read(matrix[x + r][i + c], 1), _l = __read(_k[0], 2), nextPath = _l[1];
40884
- slate.Transforms.unsetNodes(editor, ['hidden', 'colSpan', 'rowSpan'], { at: nextPath });
40885
- }
40886
- continue out;
40887
- }
40888
- }
40889
- for (var c = 1; c < colSpan; c++) {
40890
- var _m = __read(matrix[x][y + c], 1), _o = __read(_m[0], 2), nextPath = _o[1];
40891
- slate.Transforms.unsetNodes(editor, ['hidden', 'colSpan', 'rowSpan'], { at: nextPath });
40892
- }
40893
- slate.Transforms.setNodes(editor, { rowSpan: 1, colSpan: 1 }, { at: path });
40894
- }
40895
- }
40896
- });
40897
- };
40898
- return SplitCell;
40899
- }());
40900
-
40901
41697
  /**
40902
41698
  * @description table menu
40903
41699
  * @author wangfupeng
@@ -40949,19 +41745,6 @@
40949
41745
  factory: function () {
40950
41746
  return new TableFullWidth();
40951
41747
  },
40952
- };
40953
- /** Meger / Split conf */
40954
- var mergeTableCellConf = {
40955
- key: 'mergeTableCell',
40956
- factory: function () {
40957
- return new MergeCell();
40958
- },
40959
- };
40960
- var splitTableCellConf = {
40961
- key: 'splitTableCell',
40962
- factory: function () {
40963
- return new SplitCell();
40964
- },
40965
41748
  };
40966
41749
 
40967
41750
  /**
@@ -40982,8 +41765,6 @@
40982
41765
  deleteTableColConf,
40983
41766
  tableHeaderMenuConf,
40984
41767
  tableFullWidthMenuConf,
40985
- mergeTableCellConf,
40986
- splitTableCellConf,
40987
41768
  ],
40988
41769
  editorPlugin: withTable,
40989
41770
  };
@@ -47951,9 +48732,6 @@
47951
48732
  'insertTableCol',
47952
48733
  'deleteTableCol',
47953
48734
  'deleteTable',
47954
- /** 注册单元格合并 拆分 */
47955
- 'mergeTableCell',
47956
- 'splitTableCell',
47957
48735
  ],
47958
48736
  },
47959
48737
  divider: {