@fewangsit/wangsvue 1.5.219-alpha.0 → 1.5.219-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/animation/index.es.js +54 -37
- package/assets/lottiejs/loading-page.es.js +14 -9
- package/assets/lottiejs/loading-plane.es.js +2 -2
- package/assets/lottiejs/loading-table.es.js +14 -9
- package/assets/lottiejs/no-data.es.js +14 -9
- package/backgroundimagecropper/index.es.js +61 -37
- package/badge/index.es.js +77 -67
- package/badgegroup/index.es.js +62 -50
- package/basecalendar/index.es.js +1258 -735
- package/basetree/index.es.js +213 -113
- package/breadcrumb/index.es.js +46 -38
- package/button/index.es.js +60 -54
- package/buttonbulkaction/index.es.js +168 -117
- package/buttoncopy/index.es.js +25 -22
- package/buttondownload/index.es.js +125 -76
- package/buttonfilter/index.es.js +21 -15
- package/buttonradio/index.es.js +91 -67
- package/buttonsearch/index.es.js +62 -46
- package/buttonselecttree/index.es.js +233 -172
- package/buttontoggle/index.es.js +8 -6
- package/calendar/index.es.js +113 -58
- package/card/index.es.js +44 -42
- package/checkbox/index.es.js +105 -74
- package/codesnippet/index.es.js +91 -71
- package/codesnippetadapter/index.es.js +25 -21
- package/columnlist/index.es.js +249 -171
- package/components.d.ts +0 -21
- package/config/defaultProps.es.js +9 -9
- package/config/index.es.js +11 -10
- package/config/locale.es.js +2 -2
- package/customcolumn/index.es.js +95 -78
- package/datatable/index.es.js +1071 -732
- package/dialog/index.es.js +54 -54
- package/dialogconfirm/index.es.js +90 -75
- package/dialogform/index.es.js +170 -133
- package/dialogselecttree/index.es.js +242 -194
- package/directives/focus.es.js +13 -8
- package/dropdown/index.es.js +250 -196
- package/editor/index.es.js +694 -498
- package/editorbutton/index.es.js +21 -19
- package/event-bus/index.es.js +3 -3
- package/event-bus/mitt.es.js +37 -20
- package/fieldwrapper/index.es.js +30 -25
- package/fileupload/index.es.js +230 -140
- package/filtercontainer/index.es.js +299 -222
- package/form/index.es.js +176 -126
- package/gallerypreview/index.es.js +138 -101
- package/icon/index.es.js +38 -36
- package/image/index.es.js +161 -108
- package/imagecompressor/index.es.js +616 -449
- package/imageinputinfo/index.es.js +26 -22
- package/inlinemessage/index.es.js +77 -65
- package/inputbadge/index.es.js +230 -156
- package/inputcurrency/index.es.js +146 -109
- package/inputemail/index.es.js +18 -16
- package/inputgroup/index.es.js +19 -16
- package/inputnumber/index.es.js +252 -182
- package/inputpassword/index.es.js +120 -94
- package/inputphonenumber/index.es.js +1017 -550
- package/inputrangenumber/index.es.js +129 -98
- package/inputtext/index.es.js +264 -189
- package/inputurl/index.es.js +31 -29
- package/invisiblefield/index.es.js +24 -16
- package/litedropdown/index.es.js +87 -81
- package/loading/index.es.js +21 -19
- package/loading-page-BXZ4fLOS.js +8 -0
- package/loading-page-BuLpsb_1.js +8 -0
- package/loading-page-CNqVBg__.js +4 -0
- package/loading-page-DbhhZih2.js +4 -0
- package/loading-page-DjfWXoOy.js +8 -0
- package/loading-page-S-KRY5zm.js +4 -0
- package/loading-plane-C1mi7Whv.js +4 -0
- package/loading-plane-CWq1hz_l.js +8 -0
- package/loading-table-B7LAXzAp.js +4 -0
- package/loading-table-BLmgKUsR.js +4 -0
- package/loading-table-CG7-cuhv.js +8 -0
- package/loading-table-CUPS49ta.js +4 -0
- package/loading-table-CuWWrTbv.js +8 -0
- package/loading-table-DbBzVwaZ.js +8 -0
- package/mentionlist/index.es.js +77 -44
- package/mentionsection/index.es.js +53 -43
- package/menu/index.es.js +65 -51
- package/menuitem/index.es.js +39 -37
- package/multirow/index.es.js +29 -28
- package/multiselect/index.es.js +184 -152
- package/no-data-B781skt3.js +4 -0
- package/no-data-CAksOnDl.js +4 -0
- package/no-data-DCsjBXQR.js +4 -0
- package/no-data-Dz0QOe7Q.js +8 -0
- package/no-data-_Huxiv9q.js +8 -0
- package/no-data-ybRQontJ.js +8 -0
- package/overlaypanel/index.es.js +49 -36
- package/package.json +1 -1
- package/paginator/index.es.js +36 -33
- package/plugins/WangsVue.es.js +63 -45
- package/plugins/formValidation.es.js +15 -11
- package/progressbar/index.es.js +39 -32
- package/quickfilter/index.es.js +94 -81
- package/stats.html +1 -1
- package/style.css +2 -2
- package/tabmenu/index.es.js +18 -16
- package/textarea/index.es.js +94 -72
- package/timeline/index.es.js +124 -102
- package/timelinecontentbytype/index.es.js +114 -92
- package/toast/index.es.js +67 -54
- package/toggleswitch/index.es.js +83 -66
- package/tree/index.es.js +306 -198
- package/treenode/index.es.js +464 -339
- package/treesearchinput/index.es.js +32 -26
- package/usergroup/index.es.js +83 -67
- package/username/index.es.js +99 -85
- package/utils/addAttachment.util.es.js +47 -21
- package/utils/baseToast.util.es.js +41 -33
- package/utils/convertJsonImage.util.es.js +24 -24
- package/utils/date.util.es.js +131 -106
- package/utils/exportToExcel.util.es.js +81 -47
- package/utils/filterOptions.util.es.js +8 -2
- package/utils/genPlaceholder.util.es.js +30 -16
- package/utils/getProjectPermission.util.es.js +15 -12
- package/utils/getSalesRole.util.es.js +4 -4
- package/utils/getUser.util.es.js +2 -2
- package/utils/getUserType.util.es.js +13 -8
- package/utils/isIntersect.es.js +4 -2
- package/utils/mergePropsWithDefaults.util.es.js +7 -6
- package/utils/object.util.es.js +88 -54
- package/utils/queryParamsStringfy.util.es.js +19 -11
- package/utils/role.util.es.js +5 -4
- package/utils/statusSeverity.util.es.js +20 -5
- package/utils/textFormatter.util.es.js +28 -50
- package/utils/toast.util.es.js +8 -5
- package/utils/xlsx.util.es.js +12 -6
- package/validatormessage/index.es.js +9 -9
- package/vendor/@popperjs/core/lib/createPopper.es.js +110 -83
- package/vendor/@popperjs/core/lib/dom-utils/contains.es.js +14 -13
- package/vendor/@popperjs/core/lib/dom-utils/getBoundingClientRect.es.js +33 -18
- package/vendor/@popperjs/core/lib/dom-utils/getClippingRect.es.js +55 -31
- package/vendor/@popperjs/core/lib/dom-utils/getCompositeRect.es.js +43 -22
- package/vendor/@popperjs/core/lib/dom-utils/getComputedStyle.es.js +4 -4
- package/vendor/@popperjs/core/lib/dom-utils/getDocumentElement.es.js +5 -5
- package/vendor/@popperjs/core/lib/dom-utils/getDocumentRect.es.js +23 -13
- package/vendor/@popperjs/core/lib/dom-utils/getHTMLElementScroll.es.js +4 -4
- package/vendor/@popperjs/core/lib/dom-utils/getLayoutRect.es.js +17 -9
- package/vendor/@popperjs/core/lib/dom-utils/getNodeName.es.js +3 -3
- package/vendor/@popperjs/core/lib/dom-utils/getNodeScroll.es.js +11 -7
- package/vendor/@popperjs/core/lib/dom-utils/getOffsetParent.es.js +42 -26
- package/vendor/@popperjs/core/lib/dom-utils/getParentNode.es.js +13 -10
- package/vendor/@popperjs/core/lib/dom-utils/getScrollParent.es.js +13 -7
- package/vendor/@popperjs/core/lib/dom-utils/getViewportRect.es.js +25 -15
- package/vendor/@popperjs/core/lib/dom-utils/getWindow.es.js +8 -7
- package/vendor/@popperjs/core/lib/dom-utils/getWindowScroll.es.js +8 -6
- package/vendor/@popperjs/core/lib/dom-utils/getWindowScrollBarX.es.js +6 -6
- package/vendor/@popperjs/core/lib/dom-utils/instanceOf.es.js +16 -15
- package/vendor/@popperjs/core/lib/dom-utils/isLayoutViewport.es.js +4 -4
- package/vendor/@popperjs/core/lib/dom-utils/isScrollParent.es.js +5 -5
- package/vendor/@popperjs/core/lib/dom-utils/isTableElement.es.js +4 -4
- package/vendor/@popperjs/core/lib/dom-utils/listScrollParents.es.js +17 -11
- package/vendor/@popperjs/core/lib/enums.es.js +43 -20
- package/vendor/@popperjs/core/lib/modifiers/applyStyles.es.js +49 -25
- package/vendor/@popperjs/core/lib/modifiers/arrow.es.js +61 -26
- package/vendor/@popperjs/core/lib/modifiers/computeStyles.es.js +101 -69
- package/vendor/@popperjs/core/lib/modifiers/eventListeners.es.js +30 -16
- package/vendor/@popperjs/core/lib/modifiers/flip.es.js +99 -60
- package/vendor/@popperjs/core/lib/modifiers/hide.es.js +44 -31
- package/vendor/@popperjs/core/lib/modifiers/offset.es.js +32 -20
- package/vendor/@popperjs/core/lib/modifiers/popperOffsets.es.js +11 -11
- package/vendor/@popperjs/core/lib/modifiers/preventOverflow.es.js +91 -40
- package/vendor/@popperjs/core/lib/popper.es.js +14 -13
- package/vendor/@popperjs/core/lib/utils/computeAutoPlacement.es.js +29 -21
- package/vendor/@popperjs/core/lib/utils/computeOffsets.es.js +41 -36
- package/vendor/@popperjs/core/lib/utils/debounce.es.js +11 -7
- package/vendor/@popperjs/core/lib/utils/detectOverflow.es.js +42 -28
- package/vendor/@popperjs/core/lib/utils/expandToHashMap.es.js +5 -4
- package/vendor/@popperjs/core/lib/utils/getAltAxis.es.js +3 -3
- package/vendor/@popperjs/core/lib/utils/getBasePlacement.es.js +3 -3
- package/vendor/@popperjs/core/lib/utils/getFreshSideObject.es.js +2 -2
- package/vendor/@popperjs/core/lib/utils/getMainAxisFromPlacement.es.js +3 -3
- package/vendor/@popperjs/core/lib/utils/getOppositePlacement.es.js +5 -5
- package/vendor/@popperjs/core/lib/utils/getOppositeVariationPlacement.es.js +5 -5
- package/vendor/@popperjs/core/lib/utils/getVariation.es.js +3 -3
- package/vendor/@popperjs/core/lib/utils/math.es.js +6 -4
- package/vendor/@popperjs/core/lib/utils/mergeByName.es.js +11 -10
- package/vendor/@popperjs/core/lib/utils/mergePaddingObject.es.js +4 -4
- package/vendor/@popperjs/core/lib/utils/orderModifiers.es.js +30 -22
- package/vendor/@popperjs/core/lib/utils/rectToClientRect.es.js +7 -7
- package/vendor/@popperjs/core/lib/utils/userAgent.es.js +9 -6
- package/vendor/@popperjs/core/lib/utils/within.es.js +8 -8
- package/vendor/@tiptap/core/dist/index.es.js +3494 -2000
- package/vendor/@tiptap/extension-bold/dist/index.es.js +29 -19
- package/vendor/@tiptap/extension-bubble-menu/dist/index.es.js +145 -71
- package/vendor/@tiptap/extension-bullet-list/dist/index.es.js +32 -19
- package/vendor/@tiptap/extension-code/dist/index.es.js +22 -14
- package/vendor/@tiptap/extension-document/dist/index.es.js +4 -4
- package/vendor/@tiptap/extension-floating-menu/dist/index.es.js +106 -51
- package/vendor/@tiptap/extension-heading/dist/index.es.js +38 -22
- package/vendor/@tiptap/extension-history/dist/index.es.js +11 -7
- package/vendor/@tiptap/extension-image/dist/index.es.js +20 -17
- package/vendor/@tiptap/extension-italic/dist/index.es.js +28 -18
- package/vendor/@tiptap/extension-link/dist/index.es.js +236 -147
- package/vendor/@tiptap/extension-list-item/dist/index.es.js +6 -6
- package/vendor/@tiptap/extension-mention/dist/index.es.js +98 -63
- package/vendor/@tiptap/extension-ordered-list/dist/index.es.js +38 -25
- package/vendor/@tiptap/extension-paragraph/dist/index.es.js +8 -6
- package/vendor/@tiptap/extension-placeholder/dist/index.es.js +34 -27
- package/vendor/@tiptap/extension-text/dist/index.es.js +3 -3
- package/vendor/@tiptap/extension-underline/dist/index.es.js +16 -10
- package/vendor/@tiptap/suggestion/dist/index.es.js +174 -90
- package/vendor/@tiptap/vue-3/dist/index.es.js +287 -188
- package/vendor/@wangs-ui/core/components/p-BU8h34na.es.js +17 -14
- package/vendor/@wangs-ui/core/components/p-C5lMEBcj.es.js +69 -55
- package/vendor/@wangs-ui/core/components/p-CKYwZoTo.es.js +26 -22
- package/vendor/@wangs-ui/core/components/p-CsoK-EWG.es.js +147 -102
- package/vendor/@wangs-ui/core/components/p-DPHEi31J.es.js +102 -77
- package/vendor/@wangs-ui/core/components/p-DTTCzifR.es.js +1298 -551
- package/vendor/@wangs-ui/core/components/p-Duri5p90.es.js +60 -49
- package/vendor/@wangs-ui/core/components/wangs-button.es.js +19 -15
- package/vendor/@wangs-ui/core/components/wangs-icon.es.js +3 -3
- package/vendor/@wangs-ui/core/components/wangs-input-otp.es.js +3 -3
- package/vendor/@wangs-ui/core/components/wangs-tab-menu.es.js +3 -3
- package/vendor/@wangs-ui/core/dist/esm/index-DCkh3cGv.es.js +116 -102
- package/vendor/@wangs-ui/vue/dist/index.es.js +77 -77
- package/vendor/base64toblob/base64toblob.es.js +31 -15
- package/vendor/highlight.js/es/core.es.js +5 -5
- package/vendor/highlight.js/es/languages/javascript.es.js +237 -193
- package/vendor/highlight.js/es/languages/json.es.js +18 -15
- package/vendor/highlight.js/es/languages/typescript.es.js +288 -228
- package/vendor/highlight.js/es/languages/vbscript-html.es.js +2 -2
- package/vendor/highlight.js/lib/core.es.js +1144 -666
- package/vendor/linkifyjs/dist/linkify.es.es.js +858 -405
- package/vendor/lodash/_Symbol.es.js +11 -8
- package/vendor/lodash/_baseGetTag.es.js +19 -12
- package/vendor/lodash/_baseTrim.es.js +13 -10
- package/vendor/lodash/_freeGlobal.es.js +10 -8
- package/vendor/lodash/_getRawTag.es.js +28 -15
- package/vendor/lodash/_objectToString.es.js +12 -9
- package/vendor/lodash/_root.es.js +12 -8
- package/vendor/lodash/_trimmedEndIndex.es.js +14 -11
- package/vendor/lodash/debounce.es.js +92 -54
- package/vendor/lodash/isObject.es.js +11 -9
- package/vendor/lodash/isObjectLike.es.js +10 -8
- package/vendor/lodash/isSymbol.es.js +14 -11
- package/vendor/lodash/now.es.js +12 -9
- package/vendor/lodash/throttle.es.js +25 -17
- package/vendor/lodash/toNumber.es.js +33 -23
- package/vendor/lodash-es/_DataView.es.js +4 -4
- package/vendor/lodash-es/_Hash.es.js +17 -16
- package/vendor/lodash-es/_ListCache.es.js +17 -16
- package/vendor/lodash-es/_Map.es.js +4 -4
- package/vendor/lodash-es/_MapCache.es.js +17 -16
- package/vendor/lodash-es/_Promise.es.js +4 -4
- package/vendor/lodash-es/_Set.es.js +4 -4
- package/vendor/lodash-es/_SetCache.es.js +12 -10
- package/vendor/lodash-es/_Stack.es.js +15 -15
- package/vendor/lodash-es/_Symbol.es.js +3 -3
- package/vendor/lodash-es/_Uint8Array.es.js +3 -3
- package/vendor/lodash-es/_WeakMap.es.js +4 -4
- package/vendor/lodash-es/_arrayEach.es.js +9 -5
- package/vendor/lodash-es/_arrayFilter.es.js +9 -6
- package/vendor/lodash-es/_arrayLikeKeys.es.js +21 -17
- package/vendor/lodash-es/_arrayPush.es.js +7 -5
- package/vendor/lodash-es/_arraySome.es.js +9 -6
- package/vendor/lodash-es/_assignValue.es.js +10 -7
- package/vendor/lodash-es/_assocIndexOf.es.js +9 -6
- package/vendor/lodash-es/_baseAssignValue.es.js +13 -9
- package/vendor/lodash-es/_baseClone.es.js +67 -49
- package/vendor/lodash-es/_baseCreate.es.js +15 -11
- package/vendor/lodash-es/_baseGetAllKeys.es.js +6 -6
- package/vendor/lodash-es/_baseGetTag.es.js +11 -7
- package/vendor/lodash-es/_baseIsArguments.es.js +6 -6
- package/vendor/lodash-es/_baseIsEqual.es.js +11 -5
- package/vendor/lodash-es/_baseIsEqualDeep.es.js +39 -26
- package/vendor/lodash-es/_baseIsMap.es.js +6 -6
- package/vendor/lodash-es/_baseIsNative.es.js +18 -12
- package/vendor/lodash-es/_baseIsSet.es.js +6 -6
- package/vendor/lodash-es/_baseIsTypedArray.es.js +11 -9
- package/vendor/lodash-es/_baseKeys.es.js +16 -11
- package/vendor/lodash-es/_baseTimes.es.js +7 -5
- package/vendor/lodash-es/_baseTrim.es.js +5 -5
- package/vendor/lodash-es/_baseUnary.es.js +4 -4
- package/vendor/lodash-es/_cacheHas.es.js +3 -3
- package/vendor/lodash-es/_cloneArrayBuffer.es.js +6 -5
- package/vendor/lodash-es/_cloneBuffer.es.js +11 -6
- package/vendor/lodash-es/_cloneDataView.es.js +5 -5
- package/vendor/lodash-es/_cloneRegExp.es.js +6 -5
- package/vendor/lodash-es/_cloneSymbol.es.js +5 -5
- package/vendor/lodash-es/_cloneTypedArray.es.js +5 -5
- package/vendor/lodash-es/_coreJsData.es.js +3 -3
- package/vendor/lodash-es/_defineProperty.es.js +7 -6
- package/vendor/lodash-es/_equalArrays.es.js +38 -28
- package/vendor/lodash-es/_equalByTag.es.js +55 -41
- package/vendor/lodash-es/_equalObjects.es.js +42 -28
- package/vendor/lodash-es/_freeGlobal.es.js +2 -2
- package/vendor/lodash-es/_getAllKeys.es.js +6 -6
- package/vendor/lodash-es/_getMapData.es.js +5 -5
- package/vendor/lodash-es/_getNative.es.js +6 -6
- package/vendor/lodash-es/_getPrototype.es.js +3 -3
- package/vendor/lodash-es/_getRawTag.es.js +20 -10
- package/vendor/lodash-es/_getSymbols.es.js +15 -8
- package/vendor/lodash-es/_getTag.es.js +31 -25
- package/vendor/lodash-es/_getValue.es.js +3 -3
- package/vendor/lodash-es/_hashClear.es.js +5 -4
- package/vendor/lodash-es/_hashDelete.es.js +5 -4
- package/vendor/lodash-es/_hashGet.es.js +11 -9
- package/vendor/lodash-es/_hashHas.es.js +7 -6
- package/vendor/lodash-es/_hashSet.es.js +8 -6
- package/vendor/lodash-es/_initCloneArray.es.js +10 -5
- package/vendor/lodash-es/_initCloneByTag.es.js +39 -38
- package/vendor/lodash-es/_initCloneObject.es.js +6 -6
- package/vendor/lodash-es/_isIndex.es.js +7 -5
- package/vendor/lodash-es/_isKeyable.es.js +4 -4
- package/vendor/lodash-es/_isMasked.es.js +7 -7
- package/vendor/lodash-es/_isPrototype.es.js +5 -5
- package/vendor/lodash-es/_listCacheClear.es.js +4 -3
- package/vendor/lodash-es/_listCacheDelete.es.js +17 -9
- package/vendor/lodash-es/_listCacheGet.es.js +5 -5
- package/vendor/lodash-es/_listCacheHas.es.js +4 -4
- package/vendor/lodash-es/_listCacheSet.es.js +11 -5
- package/vendor/lodash-es/_mapCacheClear.es.js +10 -9
- package/vendor/lodash-es/_mapCacheDelete.es.js +6 -5
- package/vendor/lodash-es/_mapCacheGet.es.js +4 -4
- package/vendor/lodash-es/_mapCacheHas.es.js +4 -4
- package/vendor/lodash-es/_mapCacheSet.es.js +7 -5
- package/vendor/lodash-es/_mapToArray.es.js +7 -6
- package/vendor/lodash-es/_nativeCreate.es.js +3 -3
- package/vendor/lodash-es/_nativeKeys.es.js +3 -3
- package/vendor/lodash-es/_nodeUtil.es.js +13 -6
- package/vendor/lodash-es/_objectToString.es.js +5 -4
- package/vendor/lodash-es/_overArg.es.js +4 -4
- package/vendor/lodash-es/_root.es.js +4 -3
- package/vendor/lodash-es/_setCacheAdd.es.js +5 -4
- package/vendor/lodash-es/_setCacheHas.es.js +3 -3
- package/vendor/lodash-es/_setToArray.es.js +7 -6
- package/vendor/lodash-es/_stackClear.es.js +5 -4
- package/vendor/lodash-es/_stackDelete.es.js +5 -4
- package/vendor/lodash-es/_stackGet.es.js +3 -3
- package/vendor/lodash-es/_stackHas.es.js +3 -3
- package/vendor/lodash-es/_stackSet.es.js +18 -13
- package/vendor/lodash-es/_toSource.es.js +9 -8
- package/vendor/lodash-es/_trimmedEndIndex.es.js +7 -6
- package/vendor/lodash-es/cloneDeep.es.js +5 -5
- package/vendor/lodash-es/debounce.es.js +84 -49
- package/vendor/lodash-es/eq.es.js +3 -3
- package/vendor/lodash-es/isArguments.es.js +9 -6
- package/vendor/lodash-es/isArray.es.js +2 -2
- package/vendor/lodash-es/isArrayLike.es.js +5 -5
- package/vendor/lodash-es/isBuffer.es.js +9 -4
- package/vendor/lodash-es/isEqual.es.js +4 -4
- package/vendor/lodash-es/isFunction.es.js +10 -9
- package/vendor/lodash-es/isLength.es.js +4 -4
- package/vendor/lodash-es/isMap.es.js +6 -5
- package/vendor/lodash-es/isObject.es.js +4 -4
- package/vendor/lodash-es/isObjectLike.es.js +3 -3
- package/vendor/lodash-es/isSet.es.js +6 -5
- package/vendor/lodash-es/isSymbol.es.js +6 -6
- package/vendor/lodash-es/isTypedArray.es.js +6 -5
- package/vendor/lodash-es/keys.es.js +6 -6
- package/vendor/lodash-es/now.es.js +4 -4
- package/vendor/lodash-es/stubArray.es.js +2 -2
- package/vendor/lodash-es/stubFalse.es.js +3 -3
- package/vendor/lodash-es/toNumber.es.js +25 -18
- package/vendor/lodash-es/toString.es.js +2 -2
- package/vendor/lodash-es/uniqueId.es.js +6 -6
- package/vendor/orderedmap/dist/index.es.js +65 -49
- package/vendor/primevue/api/api.esm.es.js +214 -121
- package/vendor/primevue/avatar/avatar.esm.es.js +44 -41
- package/vendor/primevue/avatar/style/avatarstyle.esm.es.js +12 -11
- package/vendor/primevue/avatargroup/avatargroup.esm.es.js +17 -16
- package/vendor/primevue/avatargroup/style/avatargroupstyle.esm.es.js +6 -5
- package/vendor/primevue/badge/badge.esm.es.js +21 -20
- package/vendor/primevue/badge/style/badgestyle.esm.es.js +19 -18
- package/vendor/primevue/base/style/basestyle.esm.es.js +88 -99
- package/vendor/primevue/basecomponent/basecomponent.esm.es.js +327 -261
- package/vendor/primevue/basedirective/basedirective.esm.es.js +257 -186
- package/vendor/primevue/baseicon/baseicon.esm.es.js +55 -49
- package/vendor/primevue/baseicon/style/baseiconstyle.esm.es.js +5 -35
- package/vendor/primevue/button/button.esm.es.js +76 -72
- package/vendor/primevue/button/style/buttonstyle.esm.es.js +46 -39
- package/vendor/primevue/card/card.esm.es.js +30 -29
- package/vendor/primevue/card/style/cardstyle.esm.es.js +6 -5
- package/vendor/primevue/checkbox/checkbox.esm.es.js +109 -101
- package/vendor/primevue/checkbox/style/checkboxstyle.esm.es.js +12 -11
- package/vendor/primevue/config/config.esm.es.js +76 -58
- package/vendor/primevue/dialog/dialog.esm.es.js +421 -281
- package/vendor/primevue/dialog/style/dialogstyle.esm.es.js +26 -22
- package/vendor/primevue/dropdown/dropdown.esm.es.js +956 -742
- package/vendor/primevue/dropdown/style/dropdownstyle.esm.es.js +33 -31
- package/vendor/primevue/fileupload/fileupload.esm.es.js +559 -450
- package/vendor/primevue/fileupload/style/fileuploadstyle.esm.es.js +14 -13
- package/vendor/primevue/focustrap/focustrap.esm.es.js +128 -90
- package/vendor/primevue/focustrap/style/focustrapstyle.esm.es.js +2 -2
- package/vendor/primevue/icons/angledoubleleft/index.esm.es.js +13 -11
- package/vendor/primevue/icons/angledoubleright/index.esm.es.js +13 -11
- package/vendor/primevue/icons/angledown/index.esm.es.js +13 -11
- package/vendor/primevue/icons/angleleft/index.esm.es.js +13 -11
- package/vendor/primevue/icons/angleright/index.esm.es.js +13 -11
- package/vendor/primevue/icons/angleup/index.esm.es.js +13 -11
- package/vendor/primevue/icons/blank/index.esm.es.js +13 -11
- package/vendor/primevue/icons/check/index.esm.es.js +13 -11
- package/vendor/primevue/icons/chevrondown/index.esm.es.js +13 -11
- package/vendor/primevue/icons/exclamationtriangle/index.esm.es.js +17 -13
- package/vendor/primevue/icons/eye/index.esm.es.js +13 -11
- package/vendor/primevue/icons/eyeslash/index.esm.es.js +13 -11
- package/vendor/primevue/icons/infocircle/index.esm.es.js +13 -11
- package/vendor/primevue/icons/plus/index.esm.es.js +13 -11
- package/vendor/primevue/icons/refresh/index.esm.es.js +13 -11
- package/vendor/primevue/icons/search/index.esm.es.js +13 -11
- package/vendor/primevue/icons/searchminus/index.esm.es.js +13 -11
- package/vendor/primevue/icons/searchplus/index.esm.es.js +13 -11
- package/vendor/primevue/icons/spinner/index.esm.es.js +13 -11
- package/vendor/primevue/icons/times/index.esm.es.js +13 -11
- package/vendor/primevue/icons/timescircle/index.esm.es.js +13 -11
- package/vendor/primevue/icons/undo/index.esm.es.js +13 -11
- package/vendor/primevue/icons/upload/index.esm.es.js +13 -11
- package/vendor/primevue/icons/windowmaximize/index.esm.es.js +13 -11
- package/vendor/primevue/icons/windowminimize/index.esm.es.js +13 -11
- package/vendor/primevue/image/image.esm.es.js +280 -235
- package/vendor/primevue/image/style/imagestyle.esm.es.js +18 -17
- package/vendor/primevue/inputgroup/inputgroup.esm.es.js +17 -16
- package/vendor/primevue/inputgroup/style/inputgroupstyle.esm.es.js +6 -5
- package/vendor/primevue/inputgroupaddon/inputgroupaddon.esm.es.js +17 -16
- package/vendor/primevue/inputgroupaddon/style/inputgroupaddonstyle.esm.es.js +6 -5
- package/vendor/primevue/inputnumber/inputnumber.esm.es.js +834 -566
- package/vendor/primevue/inputnumber/style/inputnumberstyle.esm.es.js +23 -22
- package/vendor/primevue/inputtext/inputtext.esm.es.js +32 -30
- package/vendor/primevue/inputtext/style/inputtextstyle.esm.es.js +13 -12
- package/vendor/primevue/menu/menu.esm.es.js +402 -304
- package/vendor/primevue/menu/style/menustyle.esm.es.js +14 -13
- package/vendor/primevue/message/message.esm.es.js +126 -112
- package/vendor/primevue/message/style/messagestyle.esm.es.js +9 -8
- package/vendor/primevue/multiselect/multiselect.esm.es.js +1083 -835
- package/vendor/primevue/multiselect/style/multiselectstyle.esm.es.js +38 -36
- package/vendor/primevue/overlayeventbus/overlayeventbus.esm.es.js +3 -3
- package/vendor/primevue/overlaypanel/overlaypanel.esm.es.js +275 -169
- package/vendor/primevue/overlaypanel/style/overlaypanelstyle.esm.es.js +9 -8
- package/vendor/primevue/paginator/paginator.esm.es.js +513 -469
- package/vendor/primevue/paginator/style/paginatorstyle.esm.es.js +50 -43
- package/vendor/primevue/password/password.esm.es.js +306 -233
- package/vendor/primevue/password/style/passwordstyle.esm.es.js +26 -24
- package/vendor/primevue/portal/portal.esm.es.js +17 -17
- package/vendor/primevue/progressbar/progressbar.esm.es.js +37 -35
- package/vendor/primevue/progressbar/style/progressbarstyle.esm.es.js +10 -9
- package/vendor/primevue/ripple/ripple.esm.es.js +90 -62
- package/vendor/primevue/ripple/style/ripplestyle.esm.es.js +6 -5
- package/vendor/primevue/selectbutton/selectbutton.esm.es.js +213 -167
- package/vendor/primevue/selectbutton/style/selectbuttonstyle.esm.es.js +14 -13
- package/vendor/primevue/skeleton/skeleton.esm.es.js +28 -26
- package/vendor/primevue/skeleton/style/skeletonstyle.esm.es.js +13 -11
- package/vendor/primevue/textarea/style/textareastyle.esm.es.js +12 -11
- package/vendor/primevue/textarea/textarea.esm.es.js +49 -33
- package/vendor/primevue/timeline/style/timelinestyle.esm.es.js +9 -8
- package/vendor/primevue/timeline/timeline.esm.es.js +53 -52
- package/vendor/primevue/toast/style/toaststyle.esm.es.js +54 -46
- package/vendor/primevue/toast/toast.esm.es.js +309 -260
- package/vendor/primevue/toasteventbus/toasteventbus.esm.es.js +3 -3
- package/vendor/primevue/toastservice/toastservice.esm.es.js +16 -15
- package/vendor/primevue/tooltip/style/tooltipstyle.esm.es.js +6 -5
- package/vendor/primevue/tooltip/tooltip.esm.es.js +383 -186
- package/vendor/primevue/usestyle/usestyle.esm.es.js +94 -64
- package/vendor/primevue/usetoast/usetoast.esm.es.js +9 -8
- package/vendor/primevue/utils/utils.esm.es.js +1078 -772
- package/vendor/primevue/virtualscroller/style/virtualscrollerstyle.esm.es.js +5 -67
- package/vendor/primevue/virtualscroller/virtualscroller.esm.es.js +655 -428
- package/vendor/prosemirror-commands/dist/index.es.js +454 -316
- package/vendor/prosemirror-history/dist/index.es.js +286 -178
- package/vendor/prosemirror-keymap/dist/index.es.js +68 -48
- package/vendor/prosemirror-model/dist/index.es.js +1905 -1436
- package/vendor/prosemirror-schema-list/dist/index.es.js +115 -73
- package/vendor/prosemirror-state/dist/index.es.js +467 -353
- package/vendor/prosemirror-transform/dist/index.es.js +1146 -829
- package/vendor/prosemirror-view/dist/index.es.js +4127 -2719
- package/vendor/rope-sequence/dist/index.es.js +165 -82
- package/vendor/simplebar-core/dist/index.es.js +670 -242
- package/vendor/simplebar-vue/dist/simplebar-vue.esm.es.js +73 -60
- package/vendor/single-spa/lib/es2015/esm/single-spa.min.es.js +511 -510
- package/vendor/tippy.js/dist/tippy.esm.es.js +971 -525
- package/vendor/vee-validate/dist/vee-validate.esm.es.js +1830 -1097
- package/vendor/vue-advanced-cropper/dist/index.esm-bundler.es.js +740 -738
- package/vendor/w3c-keyname/index.es.js +25 -13
- package/wangsvue.es.js +167 -208
- package/wangsvue.esm.browser.js +49417 -48026
- package/wangsvue.system.js +67600 -234
- package/api/index.es.js +0 -149
- package/apiitem/index.es.js +0 -611
- package/assignmember/index.es.js +0 -434
- package/attachment/index.es.js +0 -118
- package/attachmentchangelog/index.es.js +0 -79
- package/attachmentitem/index.es.js +0 -231
- package/attachmentthumbnail/index.es.js +0 -83
- package/changelog/index.d.ts +0 -164
- package/changelog/index.es.js +0 -85
- package/changelogfilter/index.es.js +0 -113
- package/changelogpage/index.d.ts +0 -184
- package/changelogpage/index.es.js +0 -176
- package/checklist/index.es.js +0 -571
- package/checklistchangelog/index.es.js +0 -85
- package/comment/index.d.ts +0 -187
- package/comment/index.es.js +0 -267
- package/commentblock/index.es.js +0 -337
- package/confirmdeploy/index.es.js +0 -64
- package/dependencycol/index.es.js +0 -32
- package/description/index.es.js +0 -135
- package/descriptiontab/index.es.js +0 -30
- package/detailmember/index.d.ts +0 -77
- package/detailmember/index.es.js +0 -32
- package/detailmemberadmin/index.es.js +0 -210
- package/detailmemberleader/index.es.js +0 -164
- package/detailmemberlog/index.es.js +0 -117
- package/detailsprint/index.d.ts +0 -86
- package/detailsprint/index.es.js +0 -414
- package/dialogaddattachment/index.es.js +0 -273
- package/dialogaddchecklist/index.es.js +0 -120
- package/dialogaddeditapi/index.es.js +0 -87
- package/dialogaddpbi/index.es.js +0 -197
- package/dialogadjustmenttask/index.es.js +0 -484
- package/dialogadjustmenttaskheader/index.es.js +0 -193
- package/dialogapichangelog/index.es.js +0 -83
- package/dialogassignmember/index.es.js +0 -171
- package/dialogconfirmapproval/index.es.js +0 -54
- package/dialogconfirmchecklist/index.es.js +0 -189
- package/dialogconfirmdeletetask/index.es.js +0 -70
- package/dialogconfirmdeletetaskpermanently/index.es.js +0 -50
- package/dialogconfirmedit/index.es.js +0 -50
- package/dialogconfirmfinishtask/index.es.js +0 -50
- package/dialogconfirmrestoretask/index.es.js +0 -46
- package/dialogconfirmsprint/index.es.js +0 -42
- package/dialogcopyapi/index.es.js +0 -130
- package/dialogcustomdependency/index.es.js +0 -55
- package/dialogdetailchecklisttemplate/index.es.js +0 -214
- package/dialogdetailcomponent/index.es.js +0 -121
- package/dialogdetailpbi/index.es.js +0 -192
- package/dialogfinishreview/index.es.js +0 -126
- package/dialogimprovementtask/index.es.js +0 -191
- package/dialogmemberadmin/index.es.js +0 -93
- package/dialogpreparepbi/index.es.js +0 -93
- package/dialogpriorityvalue/index.es.js +0 -85
- package/dialogreportbug/index.es.js +0 -207
- package/dialogreviewleader/index.es.js +0 -280
- package/dialogsavechecklisttemplate/index.es.js +0 -127
- package/dialogselectproject/index.es.js +0 -69
- package/dialogsetduration/index.es.js +0 -109
- package/dialogsettasklink/index.es.js +0 -153
- package/dialogtestapi/index.es.js +0 -389
- package/eventlogtab/index.es.js +0 -50
- package/infotasktab/index.es.js +0 -186
- package/inputadditional/index.es.js +0 -62
- package/inputinitialname/index.d.ts +0 -118
- package/inputinitialname/index.es.js +0 -95
- package/inputrepositoryname/index.d.ts +0 -86
- package/inputrepositoryname/index.es.js +0 -41
- package/isrequiredtext/index.es.js +0 -16
- package/legend/index.es.js +0 -727
- package/legendlist/index.es.js +0 -33
- package/loading-page-BrQattYE.js +0 -1
- package/loading-page-CgfbWppy.js +0 -1
- package/loading-page-CoC9UhfC.js +0 -4
- package/loading-page-CoXtqoc9.js +0 -4
- package/loading-page-DbLuqCHa.js +0 -1
- package/loading-page-f8D03l3G.js +0 -4
- package/loading-plane-CgfbWppy.js +0 -1
- package/loading-plane-CoXtqoc9.js +0 -4
- package/loading-table-Bdr9ZhtP.js +0 -1
- package/loading-table-ByUoWqUo.js +0 -4
- package/loading-table-BygEMzFM.js +0 -4
- package/loading-table-BzrSQlA0.js +0 -1
- package/loading-table-D9bw9OcI.js +0 -4
- package/loading-table-chOgXi94.js +0 -1
- package/no-data-CTKux8RI.js +0 -4
- package/no-data-Cgze_Rvp.js +0 -1
- package/no-data-DLHO1L_u.js +0 -4
- package/no-data-Dep79CBh.js +0 -1
- package/no-data-g0dJCy2p.js +0 -4
- package/no-data-y1X5WtcQ.js +0 -1
- package/notificationitem/index.d.ts +0 -107
- package/notificationitem/index.es.js +0 -333
- package/reviewitem/index.es.js +0 -65
- package/reviewtab/index.es.js +0 -44
- package/services/calendar.service.es.js +0 -32
- package/sonarqubesummary/index.es.js +0 -234
- package/sprintsummary/index.es.js +0 -73
- package/summaryaccordion/index.d.ts +0 -121
- package/summaryaccordion/index.es.js +0 -365
- package/taskdependency/index.es.js +0 -686
- package/taskdetail/index.d.ts +0 -82
- package/taskdetail/index.es.js +0 -491
- package/taskdetailpbi/index.d.ts +0 -35
- package/taskdetailpbi/index.es.js +0 -172
- package/taskdetailunassignedpbi/index.es.js +0 -261
- package/tasklink/index.es.js +0 -257
- package/tasklinkchangelog/index.es.js +0 -93
- package/tasklist/index.es.js +0 -92
- package/taskmore/index.es.js +0 -52
- package/taskstatusbadge/index.es.js +0 -18
- package/tasktable/index.d.ts +0 -87
- package/tasktable/index.es.js +0 -832
- package/ticket/index.es.js +0 -151
- package/tooltipspan/index.es.js +0 -30
- package/utils/updateSprintStatus.util.es.js +0 -17
- package/valueformdatainput/index.es.js +0 -70
- package/workcalendar/index.es.js +0 -351
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import { b as
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { b as Slice, F as Fragment, M as Mark, d as MarkType, R as ReplaceError } from "../../prosemirror-model/dist/index.es.js";
|
|
2
|
+
const lower16 = 65535;
|
|
3
|
+
const factor16 = Math.pow(2, 16);
|
|
4
|
+
function makeRecover(index, offset) {
|
|
5
|
+
return index + offset * factor16;
|
|
5
6
|
}
|
|
6
|
-
function
|
|
7
|
-
return
|
|
7
|
+
function recoverIndex(value) {
|
|
8
|
+
return value & lower16;
|
|
8
9
|
}
|
|
9
|
-
function
|
|
10
|
-
return (
|
|
10
|
+
function recoverOffset(value) {
|
|
11
|
+
return (value - (value & lower16)) / factor16;
|
|
11
12
|
}
|
|
12
|
-
const
|
|
13
|
-
class
|
|
13
|
+
const DEL_BEFORE = 1, DEL_AFTER = 2, DEL_ACROSS = 4, DEL_SIDE = 8;
|
|
14
|
+
class MapResult {
|
|
14
15
|
/**
|
|
15
16
|
@internal
|
|
16
17
|
*/
|
|
17
|
-
constructor(
|
|
18
|
-
this.pos =
|
|
18
|
+
constructor(pos, delInfo, recover) {
|
|
19
|
+
this.pos = pos;
|
|
20
|
+
this.delInfo = delInfo;
|
|
21
|
+
this.recover = recover;
|
|
19
22
|
}
|
|
20
23
|
/**
|
|
21
24
|
Tells you whether the position was deleted, that is, whether the
|
|
@@ -23,19 +26,19 @@ class L {
|
|
|
23
26
|
argument from the document.
|
|
24
27
|
*/
|
|
25
28
|
get deleted() {
|
|
26
|
-
return (this.delInfo &
|
|
29
|
+
return (this.delInfo & DEL_SIDE) > 0;
|
|
27
30
|
}
|
|
28
31
|
/**
|
|
29
32
|
Tells you whether the token before the mapped position was deleted.
|
|
30
33
|
*/
|
|
31
34
|
get deletedBefore() {
|
|
32
|
-
return (this.delInfo & (
|
|
35
|
+
return (this.delInfo & (DEL_BEFORE | DEL_ACROSS)) > 0;
|
|
33
36
|
}
|
|
34
37
|
/**
|
|
35
38
|
True when the token after the mapped position was deleted.
|
|
36
39
|
*/
|
|
37
40
|
get deletedAfter() {
|
|
38
|
-
return (this.delInfo & (
|
|
41
|
+
return (this.delInfo & (DEL_AFTER | DEL_ACROSS)) > 0;
|
|
39
42
|
}
|
|
40
43
|
/**
|
|
41
44
|
Tells whether any of the steps mapped through deletes across the
|
|
@@ -43,81 +46,90 @@ class L {
|
|
|
43
46
|
position).
|
|
44
47
|
*/
|
|
45
48
|
get deletedAcross() {
|
|
46
|
-
return (this.delInfo &
|
|
49
|
+
return (this.delInfo & DEL_ACROSS) > 0;
|
|
47
50
|
}
|
|
48
51
|
}
|
|
49
|
-
class
|
|
52
|
+
class StepMap {
|
|
50
53
|
/**
|
|
51
54
|
Create a position map. The modifications to the document are
|
|
52
55
|
represented as an array of numbers, in which each group of three
|
|
53
56
|
represents a modified chunk as `[start, oldSize, newSize]`.
|
|
54
57
|
*/
|
|
55
|
-
constructor(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
constructor(ranges, inverted = false) {
|
|
59
|
+
this.ranges = ranges;
|
|
60
|
+
this.inverted = inverted;
|
|
61
|
+
if (!ranges.length && StepMap.empty)
|
|
62
|
+
return StepMap.empty;
|
|
58
63
|
}
|
|
59
64
|
/**
|
|
60
65
|
@internal
|
|
61
66
|
*/
|
|
62
|
-
recover(
|
|
63
|
-
let
|
|
67
|
+
recover(value) {
|
|
68
|
+
let diff = 0, index = recoverIndex(value);
|
|
64
69
|
if (!this.inverted)
|
|
65
|
-
for (let
|
|
66
|
-
|
|
67
|
-
return this.ranges[
|
|
70
|
+
for (let i = 0; i < index; i++)
|
|
71
|
+
diff += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];
|
|
72
|
+
return this.ranges[index * 3] + diff + recoverOffset(value);
|
|
68
73
|
}
|
|
69
|
-
mapResult(
|
|
70
|
-
return this._map(
|
|
74
|
+
mapResult(pos, assoc = 1) {
|
|
75
|
+
return this._map(pos, assoc, false);
|
|
71
76
|
}
|
|
72
|
-
map(
|
|
73
|
-
return this._map(
|
|
77
|
+
map(pos, assoc = 1) {
|
|
78
|
+
return this._map(pos, assoc, true);
|
|
74
79
|
}
|
|
75
80
|
/**
|
|
76
81
|
@internal
|
|
77
82
|
*/
|
|
78
|
-
_map(
|
|
79
|
-
let
|
|
80
|
-
for (let
|
|
81
|
-
let
|
|
82
|
-
if (
|
|
83
|
+
_map(pos, assoc, simple) {
|
|
84
|
+
let diff = 0, oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
|
|
85
|
+
for (let i = 0; i < this.ranges.length; i += 3) {
|
|
86
|
+
let start = this.ranges[i] - (this.inverted ? diff : 0);
|
|
87
|
+
if (start > pos)
|
|
83
88
|
break;
|
|
84
|
-
let
|
|
85
|
-
if (
|
|
86
|
-
let
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
let oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex], end = start + oldSize;
|
|
90
|
+
if (pos <= end) {
|
|
91
|
+
let side = !oldSize ? assoc : pos == start ? -1 : pos == end ? 1 : assoc;
|
|
92
|
+
let result = start + diff + (side < 0 ? 0 : newSize);
|
|
93
|
+
if (simple)
|
|
94
|
+
return result;
|
|
95
|
+
let recover = pos == (assoc < 0 ? start : end) ? null : makeRecover(i / 3, pos - start);
|
|
96
|
+
let del = pos == start ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS;
|
|
97
|
+
if (assoc < 0 ? pos != start : pos != end)
|
|
98
|
+
del |= DEL_SIDE;
|
|
99
|
+
return new MapResult(result, del, recover);
|
|
91
100
|
}
|
|
92
|
-
|
|
101
|
+
diff += newSize - oldSize;
|
|
93
102
|
}
|
|
94
|
-
return
|
|
103
|
+
return simple ? pos + diff : new MapResult(pos + diff, 0, null);
|
|
95
104
|
}
|
|
96
105
|
/**
|
|
97
106
|
@internal
|
|
98
107
|
*/
|
|
99
|
-
touches(
|
|
100
|
-
let
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
108
|
+
touches(pos, recover) {
|
|
109
|
+
let diff = 0, index = recoverIndex(recover);
|
|
110
|
+
let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
|
|
111
|
+
for (let i = 0; i < this.ranges.length; i += 3) {
|
|
112
|
+
let start = this.ranges[i] - (this.inverted ? diff : 0);
|
|
113
|
+
if (start > pos)
|
|
104
114
|
break;
|
|
105
|
-
let
|
|
106
|
-
if (
|
|
107
|
-
return
|
|
108
|
-
|
|
115
|
+
let oldSize = this.ranges[i + oldIndex], end = start + oldSize;
|
|
116
|
+
if (pos <= end && i == index * 3)
|
|
117
|
+
return true;
|
|
118
|
+
diff += this.ranges[i + newIndex] - oldSize;
|
|
109
119
|
}
|
|
110
|
-
return
|
|
120
|
+
return false;
|
|
111
121
|
}
|
|
112
122
|
/**
|
|
113
123
|
Calls the given function on each of the changed ranges included in
|
|
114
124
|
this map.
|
|
115
125
|
*/
|
|
116
|
-
forEach(
|
|
117
|
-
let
|
|
118
|
-
for (let
|
|
119
|
-
let
|
|
120
|
-
|
|
126
|
+
forEach(f) {
|
|
127
|
+
let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
|
|
128
|
+
for (let i = 0, diff = 0; i < this.ranges.length; i += 3) {
|
|
129
|
+
let start = this.ranges[i], oldStart = start - (this.inverted ? diff : 0), newStart = start + (this.inverted ? 0 : diff);
|
|
130
|
+
let oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex];
|
|
131
|
+
f(oldStart, oldStart + oldSize, newStart, newStart + newSize);
|
|
132
|
+
diff += newSize - oldSize;
|
|
121
133
|
}
|
|
122
134
|
}
|
|
123
135
|
/**
|
|
@@ -125,7 +137,7 @@ class S {
|
|
|
125
137
|
map positions in the post-step document to the pre-step document.
|
|
126
138
|
*/
|
|
127
139
|
invert() {
|
|
128
|
-
return new
|
|
140
|
+
return new StepMap(this.ranges, !this.inverted);
|
|
129
141
|
}
|
|
130
142
|
/**
|
|
131
143
|
@internal
|
|
@@ -138,17 +150,21 @@ class S {
|
|
|
138
150
|
negative). This can be useful when applying steps meant for a
|
|
139
151
|
sub-document to a larger document, or vice-versa.
|
|
140
152
|
*/
|
|
141
|
-
static offset(
|
|
142
|
-
return
|
|
153
|
+
static offset(n) {
|
|
154
|
+
return n == 0 ? StepMap.empty : new StepMap(n < 0 ? [0, -n, 0] : [0, 0, n]);
|
|
143
155
|
}
|
|
144
156
|
}
|
|
145
|
-
|
|
146
|
-
class
|
|
157
|
+
StepMap.empty = new StepMap([]);
|
|
158
|
+
class Mapping {
|
|
147
159
|
/**
|
|
148
160
|
Create a new mapping with the given position maps.
|
|
149
161
|
*/
|
|
150
|
-
constructor(
|
|
151
|
-
this.mirror =
|
|
162
|
+
constructor(maps, mirror, from = 0, to = maps ? maps.length : 0) {
|
|
163
|
+
this.mirror = mirror;
|
|
164
|
+
this.from = from;
|
|
165
|
+
this.to = to;
|
|
166
|
+
this._maps = maps || [];
|
|
167
|
+
this.ownData = !(maps || mirror);
|
|
152
168
|
}
|
|
153
169
|
/**
|
|
154
170
|
The step maps in this mapping.
|
|
@@ -159,25 +175,32 @@ class A {
|
|
|
159
175
|
/**
|
|
160
176
|
Create a mapping that maps only through a part of this one.
|
|
161
177
|
*/
|
|
162
|
-
slice(
|
|
163
|
-
return new
|
|
178
|
+
slice(from = 0, to = this.maps.length) {
|
|
179
|
+
return new Mapping(this._maps, this.mirror, from, to);
|
|
164
180
|
}
|
|
165
181
|
/**
|
|
166
182
|
Add a step map to the end of this mapping. If `mirrors` is
|
|
167
183
|
given, it should be the index of the step map that is the mirror
|
|
168
184
|
image of this one.
|
|
169
185
|
*/
|
|
170
|
-
appendMap(
|
|
171
|
-
|
|
186
|
+
appendMap(map, mirrors) {
|
|
187
|
+
if (!this.ownData) {
|
|
188
|
+
this._maps = this._maps.slice();
|
|
189
|
+
this.mirror = this.mirror && this.mirror.slice();
|
|
190
|
+
this.ownData = true;
|
|
191
|
+
}
|
|
192
|
+
this.to = this._maps.push(map);
|
|
193
|
+
if (mirrors != null)
|
|
194
|
+
this.setMirror(this._maps.length - 1, mirrors);
|
|
172
195
|
}
|
|
173
196
|
/**
|
|
174
197
|
Add all the step maps in a given mapping to this one (preserving
|
|
175
198
|
mirroring information).
|
|
176
199
|
*/
|
|
177
|
-
appendMapping(
|
|
178
|
-
for (let
|
|
179
|
-
let
|
|
180
|
-
this.appendMap(
|
|
200
|
+
appendMapping(mapping) {
|
|
201
|
+
for (let i = 0, startSize = this._maps.length; i < mapping._maps.length; i++) {
|
|
202
|
+
let mirr = mapping.getMirror(i);
|
|
203
|
+
this.appendMap(mapping._maps[i], mirr != null && mirr < i ? startSize + mirr : void 0);
|
|
181
204
|
}
|
|
182
205
|
}
|
|
183
206
|
/**
|
|
@@ -185,100 +208,105 @@ class A {
|
|
|
185
208
|
given offset, in this mapping (as per the second argument to
|
|
186
209
|
`appendMap`).
|
|
187
210
|
*/
|
|
188
|
-
getMirror(
|
|
211
|
+
getMirror(n) {
|
|
189
212
|
if (this.mirror) {
|
|
190
|
-
for (let
|
|
191
|
-
if (this.mirror[
|
|
192
|
-
return this.mirror[
|
|
213
|
+
for (let i = 0; i < this.mirror.length; i++)
|
|
214
|
+
if (this.mirror[i] == n)
|
|
215
|
+
return this.mirror[i + (i % 2 ? -1 : 1)];
|
|
193
216
|
}
|
|
194
217
|
}
|
|
195
218
|
/**
|
|
196
219
|
@internal
|
|
197
220
|
*/
|
|
198
|
-
setMirror(
|
|
199
|
-
|
|
221
|
+
setMirror(n, m) {
|
|
222
|
+
if (!this.mirror)
|
|
223
|
+
this.mirror = [];
|
|
224
|
+
this.mirror.push(n, m);
|
|
200
225
|
}
|
|
201
226
|
/**
|
|
202
227
|
Append the inverse of the given mapping to this one.
|
|
203
228
|
*/
|
|
204
|
-
appendMappingInverted(
|
|
205
|
-
for (let
|
|
206
|
-
let
|
|
207
|
-
this.appendMap(
|
|
229
|
+
appendMappingInverted(mapping) {
|
|
230
|
+
for (let i = mapping.maps.length - 1, totalSize = this._maps.length + mapping._maps.length; i >= 0; i--) {
|
|
231
|
+
let mirr = mapping.getMirror(i);
|
|
232
|
+
this.appendMap(mapping._maps[i].invert(), mirr != null && mirr > i ? totalSize - mirr - 1 : void 0);
|
|
208
233
|
}
|
|
209
234
|
}
|
|
210
235
|
/**
|
|
211
236
|
Create an inverted version of this mapping.
|
|
212
237
|
*/
|
|
213
238
|
invert() {
|
|
214
|
-
let
|
|
215
|
-
|
|
239
|
+
let inverse = new Mapping();
|
|
240
|
+
inverse.appendMappingInverted(this);
|
|
241
|
+
return inverse;
|
|
216
242
|
}
|
|
217
243
|
/**
|
|
218
244
|
Map a position through this mapping.
|
|
219
245
|
*/
|
|
220
|
-
map(
|
|
246
|
+
map(pos, assoc = 1) {
|
|
221
247
|
if (this.mirror)
|
|
222
|
-
return this._map(
|
|
223
|
-
for (let
|
|
224
|
-
|
|
225
|
-
return
|
|
248
|
+
return this._map(pos, assoc, true);
|
|
249
|
+
for (let i = this.from; i < this.to; i++)
|
|
250
|
+
pos = this._maps[i].map(pos, assoc);
|
|
251
|
+
return pos;
|
|
226
252
|
}
|
|
227
253
|
/**
|
|
228
254
|
Map a position through this mapping, returning a mapping
|
|
229
255
|
result.
|
|
230
256
|
*/
|
|
231
|
-
mapResult(
|
|
232
|
-
return this._map(
|
|
257
|
+
mapResult(pos, assoc = 1) {
|
|
258
|
+
return this._map(pos, assoc, false);
|
|
233
259
|
}
|
|
234
260
|
/**
|
|
235
261
|
@internal
|
|
236
262
|
*/
|
|
237
|
-
_map(
|
|
238
|
-
let
|
|
263
|
+
_map(pos, assoc, simple) {
|
|
264
|
+
let delInfo = 0;
|
|
239
265
|
for (let i = this.from; i < this.to; i++) {
|
|
240
|
-
let
|
|
241
|
-
if (
|
|
242
|
-
let
|
|
243
|
-
if (
|
|
244
|
-
i =
|
|
266
|
+
let map = this._maps[i], result = map.mapResult(pos, assoc);
|
|
267
|
+
if (result.recover != null) {
|
|
268
|
+
let corr = this.getMirror(i);
|
|
269
|
+
if (corr != null && corr > i && corr < this.to) {
|
|
270
|
+
i = corr;
|
|
271
|
+
pos = this._maps[corr].recover(result.recover);
|
|
245
272
|
continue;
|
|
246
273
|
}
|
|
247
274
|
}
|
|
248
|
-
|
|
275
|
+
delInfo |= result.delInfo;
|
|
276
|
+
pos = result.pos;
|
|
249
277
|
}
|
|
250
|
-
return
|
|
278
|
+
return simple ? pos : new MapResult(pos, delInfo, null);
|
|
251
279
|
}
|
|
252
280
|
}
|
|
253
|
-
const
|
|
254
|
-
class
|
|
281
|
+
const stepsByID = /* @__PURE__ */ Object.create(null);
|
|
282
|
+
class Step {
|
|
255
283
|
/**
|
|
256
284
|
Get the step map that represents the changes made by this step,
|
|
257
285
|
and which can be used to transform between positions in the old
|
|
258
286
|
and the new document.
|
|
259
287
|
*/
|
|
260
288
|
getMap() {
|
|
261
|
-
return
|
|
289
|
+
return StepMap.empty;
|
|
262
290
|
}
|
|
263
291
|
/**
|
|
264
292
|
Try to merge this step with another one, to be applied directly
|
|
265
293
|
after it. Returns the merged step when possible, null if the
|
|
266
294
|
steps can't be merged.
|
|
267
295
|
*/
|
|
268
|
-
merge(
|
|
296
|
+
merge(other) {
|
|
269
297
|
return null;
|
|
270
298
|
}
|
|
271
299
|
/**
|
|
272
300
|
Deserialize a step from its JSON representation. Will call
|
|
273
301
|
through to the step class' own implementation of this method.
|
|
274
302
|
*/
|
|
275
|
-
static fromJSON(
|
|
276
|
-
if (!
|
|
303
|
+
static fromJSON(schema, json) {
|
|
304
|
+
if (!json || !json.stepType)
|
|
277
305
|
throw new RangeError("Invalid input for Step.fromJSON");
|
|
278
|
-
let
|
|
279
|
-
if (!
|
|
280
|
-
throw new RangeError(`No step type ${
|
|
281
|
-
return
|
|
306
|
+
let type = stepsByID[json.stepType];
|
|
307
|
+
if (!type)
|
|
308
|
+
throw new RangeError(`No step type ${json.stepType} defined`);
|
|
309
|
+
return type.fromJSON(schema, json);
|
|
282
310
|
}
|
|
283
311
|
/**
|
|
284
312
|
To be able to serialize steps to JSON, each step needs a string
|
|
@@ -286,74 +314,94 @@ class k {
|
|
|
286
314
|
register an ID for your step classes. Try to pick something
|
|
287
315
|
that's unlikely to clash with steps from other modules.
|
|
288
316
|
*/
|
|
289
|
-
static jsonID(
|
|
290
|
-
if (
|
|
291
|
-
throw new RangeError("Duplicate use of step JSON ID " +
|
|
292
|
-
|
|
317
|
+
static jsonID(id, stepClass) {
|
|
318
|
+
if (id in stepsByID)
|
|
319
|
+
throw new RangeError("Duplicate use of step JSON ID " + id);
|
|
320
|
+
stepsByID[id] = stepClass;
|
|
321
|
+
stepClass.prototype.jsonID = id;
|
|
322
|
+
return stepClass;
|
|
293
323
|
}
|
|
294
324
|
}
|
|
295
|
-
class
|
|
325
|
+
class StepResult {
|
|
296
326
|
/**
|
|
297
327
|
@internal
|
|
298
328
|
*/
|
|
299
|
-
constructor(
|
|
300
|
-
this.doc =
|
|
329
|
+
constructor(doc, failed) {
|
|
330
|
+
this.doc = doc;
|
|
331
|
+
this.failed = failed;
|
|
301
332
|
}
|
|
302
333
|
/**
|
|
303
334
|
Create a successful step result.
|
|
304
335
|
*/
|
|
305
|
-
static ok(
|
|
306
|
-
return new
|
|
336
|
+
static ok(doc) {
|
|
337
|
+
return new StepResult(doc, null);
|
|
307
338
|
}
|
|
308
339
|
/**
|
|
309
340
|
Create a failed step result.
|
|
310
341
|
*/
|
|
311
|
-
static fail(
|
|
312
|
-
return new
|
|
342
|
+
static fail(message) {
|
|
343
|
+
return new StepResult(null, message);
|
|
313
344
|
}
|
|
314
345
|
/**
|
|
315
346
|
Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given
|
|
316
347
|
arguments. Create a successful result if it succeeds, and a
|
|
317
348
|
failed one if it throws a `ReplaceError`.
|
|
318
349
|
*/
|
|
319
|
-
static fromReplace(
|
|
350
|
+
static fromReplace(doc, from, to, slice) {
|
|
320
351
|
try {
|
|
321
|
-
return
|
|
322
|
-
} catch (
|
|
323
|
-
if (
|
|
324
|
-
return
|
|
325
|
-
throw
|
|
352
|
+
return StepResult.ok(doc.replace(from, to, slice));
|
|
353
|
+
} catch (e) {
|
|
354
|
+
if (e instanceof ReplaceError)
|
|
355
|
+
return StepResult.fail(e.message);
|
|
356
|
+
throw e;
|
|
326
357
|
}
|
|
327
358
|
}
|
|
328
359
|
}
|
|
329
|
-
function
|
|
330
|
-
let
|
|
331
|
-
for (let
|
|
332
|
-
let
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
360
|
+
function mapFragment(fragment, f, parent) {
|
|
361
|
+
let mapped = [];
|
|
362
|
+
for (let i = 0; i < fragment.childCount; i++) {
|
|
363
|
+
let child = fragment.child(i);
|
|
364
|
+
if (child.content.size)
|
|
365
|
+
child = child.copy(mapFragment(child.content, f, child));
|
|
366
|
+
if (child.isInline)
|
|
367
|
+
child = f(child, parent, i);
|
|
368
|
+
mapped.push(child);
|
|
369
|
+
}
|
|
370
|
+
return Fragment.fromArray(mapped);
|
|
336
371
|
}
|
|
337
|
-
class
|
|
372
|
+
class AddMarkStep extends Step {
|
|
338
373
|
/**
|
|
339
374
|
Create a mark step.
|
|
340
375
|
*/
|
|
341
|
-
constructor(
|
|
342
|
-
super()
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
376
|
+
constructor(from, to, mark) {
|
|
377
|
+
super();
|
|
378
|
+
this.from = from;
|
|
379
|
+
this.to = to;
|
|
380
|
+
this.mark = mark;
|
|
381
|
+
}
|
|
382
|
+
apply(doc) {
|
|
383
|
+
let oldSlice = doc.slice(this.from, this.to), $from = doc.resolve(this.from);
|
|
384
|
+
let parent = $from.node($from.sharedDepth(this.to));
|
|
385
|
+
let slice = new Slice(mapFragment(oldSlice.content, (node, parent2) => {
|
|
386
|
+
if (!node.isAtom || !parent2.type.allowsMarkType(this.mark.type))
|
|
387
|
+
return node;
|
|
388
|
+
return node.mark(this.mark.addToSet(node.marks));
|
|
389
|
+
}, parent), oldSlice.openStart, oldSlice.openEnd);
|
|
390
|
+
return StepResult.fromReplace(doc, this.from, this.to, slice);
|
|
347
391
|
}
|
|
348
392
|
invert() {
|
|
349
|
-
return new
|
|
393
|
+
return new RemoveMarkStep(this.from, this.to, this.mark);
|
|
350
394
|
}
|
|
351
|
-
map(
|
|
352
|
-
let
|
|
353
|
-
|
|
395
|
+
map(mapping) {
|
|
396
|
+
let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
|
|
397
|
+
if (from.deleted && to.deleted || from.pos >= to.pos)
|
|
398
|
+
return null;
|
|
399
|
+
return new AddMarkStep(from.pos, to.pos, this.mark);
|
|
354
400
|
}
|
|
355
|
-
merge(
|
|
356
|
-
|
|
401
|
+
merge(other) {
|
|
402
|
+
if (other instanceof AddMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from)
|
|
403
|
+
return new AddMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);
|
|
404
|
+
return null;
|
|
357
405
|
}
|
|
358
406
|
toJSON() {
|
|
359
407
|
return {
|
|
@@ -366,33 +414,43 @@ class C extends k {
|
|
|
366
414
|
/**
|
|
367
415
|
@internal
|
|
368
416
|
*/
|
|
369
|
-
static fromJSON(
|
|
370
|
-
if (typeof
|
|
417
|
+
static fromJSON(schema, json) {
|
|
418
|
+
if (typeof json.from != "number" || typeof json.to != "number")
|
|
371
419
|
throw new RangeError("Invalid input for AddMarkStep.fromJSON");
|
|
372
|
-
return new
|
|
420
|
+
return new AddMarkStep(json.from, json.to, schema.markFromJSON(json.mark));
|
|
373
421
|
}
|
|
374
422
|
}
|
|
375
|
-
|
|
376
|
-
class
|
|
423
|
+
Step.jsonID("addMark", AddMarkStep);
|
|
424
|
+
class RemoveMarkStep extends Step {
|
|
377
425
|
/**
|
|
378
426
|
Create a mark-removing step.
|
|
379
427
|
*/
|
|
380
|
-
constructor(
|
|
381
|
-
super()
|
|
428
|
+
constructor(from, to, mark) {
|
|
429
|
+
super();
|
|
430
|
+
this.from = from;
|
|
431
|
+
this.to = to;
|
|
432
|
+
this.mark = mark;
|
|
382
433
|
}
|
|
383
|
-
apply(
|
|
384
|
-
let
|
|
385
|
-
|
|
434
|
+
apply(doc) {
|
|
435
|
+
let oldSlice = doc.slice(this.from, this.to);
|
|
436
|
+
let slice = new Slice(mapFragment(oldSlice.content, (node) => {
|
|
437
|
+
return node.mark(this.mark.removeFromSet(node.marks));
|
|
438
|
+
}, doc), oldSlice.openStart, oldSlice.openEnd);
|
|
439
|
+
return StepResult.fromReplace(doc, this.from, this.to, slice);
|
|
386
440
|
}
|
|
387
441
|
invert() {
|
|
388
|
-
return new
|
|
442
|
+
return new AddMarkStep(this.from, this.to, this.mark);
|
|
389
443
|
}
|
|
390
|
-
map(
|
|
391
|
-
let
|
|
392
|
-
|
|
444
|
+
map(mapping) {
|
|
445
|
+
let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
|
|
446
|
+
if (from.deleted && to.deleted || from.pos >= to.pos)
|
|
447
|
+
return null;
|
|
448
|
+
return new RemoveMarkStep(from.pos, to.pos, this.mark);
|
|
393
449
|
}
|
|
394
|
-
merge(
|
|
395
|
-
|
|
450
|
+
merge(other) {
|
|
451
|
+
if (other instanceof RemoveMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from)
|
|
452
|
+
return new RemoveMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);
|
|
453
|
+
return null;
|
|
396
454
|
}
|
|
397
455
|
toJSON() {
|
|
398
456
|
return {
|
|
@@ -405,43 +463,45 @@ class b extends k {
|
|
|
405
463
|
/**
|
|
406
464
|
@internal
|
|
407
465
|
*/
|
|
408
|
-
static fromJSON(
|
|
409
|
-
if (typeof
|
|
466
|
+
static fromJSON(schema, json) {
|
|
467
|
+
if (typeof json.from != "number" || typeof json.to != "number")
|
|
410
468
|
throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");
|
|
411
|
-
return new
|
|
469
|
+
return new RemoveMarkStep(json.from, json.to, schema.markFromJSON(json.mark));
|
|
412
470
|
}
|
|
413
471
|
}
|
|
414
|
-
|
|
415
|
-
class
|
|
472
|
+
Step.jsonID("removeMark", RemoveMarkStep);
|
|
473
|
+
class AddNodeMarkStep extends Step {
|
|
416
474
|
/**
|
|
417
475
|
Create a node mark step.
|
|
418
476
|
*/
|
|
419
|
-
constructor(
|
|
420
|
-
super()
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
477
|
+
constructor(pos, mark) {
|
|
478
|
+
super();
|
|
479
|
+
this.pos = pos;
|
|
480
|
+
this.mark = mark;
|
|
481
|
+
}
|
|
482
|
+
apply(doc) {
|
|
483
|
+
let node = doc.nodeAt(this.pos);
|
|
484
|
+
if (!node)
|
|
485
|
+
return StepResult.fail("No node at mark step's position");
|
|
486
|
+
let updated = node.type.create(node.attrs, null, this.mark.addToSet(node.marks));
|
|
487
|
+
return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));
|
|
488
|
+
}
|
|
489
|
+
invert(doc) {
|
|
490
|
+
let node = doc.nodeAt(this.pos);
|
|
491
|
+
if (node) {
|
|
492
|
+
let newSet = this.mark.addToSet(node.marks);
|
|
493
|
+
if (newSet.length == node.marks.length) {
|
|
494
|
+
for (let i = 0; i < node.marks.length; i++)
|
|
495
|
+
if (!node.marks[i].isInSet(newSet))
|
|
496
|
+
return new AddNodeMarkStep(this.pos, node.marks[i]);
|
|
497
|
+
return new AddNodeMarkStep(this.pos, this.mark);
|
|
438
498
|
}
|
|
439
499
|
}
|
|
440
|
-
return new
|
|
500
|
+
return new RemoveNodeMarkStep(this.pos, this.mark);
|
|
441
501
|
}
|
|
442
|
-
map(
|
|
443
|
-
let
|
|
444
|
-
return
|
|
502
|
+
map(mapping) {
|
|
503
|
+
let pos = mapping.mapResult(this.pos, 1);
|
|
504
|
+
return pos.deletedAfter ? null : new AddNodeMarkStep(pos.pos, this.mark);
|
|
445
505
|
}
|
|
446
506
|
toJSON() {
|
|
447
507
|
return { stepType: "addNodeMark", pos: this.pos, mark: this.mark.toJSON() };
|
|
@@ -449,34 +509,38 @@ class N extends k {
|
|
|
449
509
|
/**
|
|
450
510
|
@internal
|
|
451
511
|
*/
|
|
452
|
-
static fromJSON(
|
|
453
|
-
if (typeof
|
|
512
|
+
static fromJSON(schema, json) {
|
|
513
|
+
if (typeof json.pos != "number")
|
|
454
514
|
throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
|
|
455
|
-
return new
|
|
515
|
+
return new AddNodeMarkStep(json.pos, schema.markFromJSON(json.mark));
|
|
456
516
|
}
|
|
457
517
|
}
|
|
458
|
-
|
|
459
|
-
class
|
|
518
|
+
Step.jsonID("addNodeMark", AddNodeMarkStep);
|
|
519
|
+
class RemoveNodeMarkStep extends Step {
|
|
460
520
|
/**
|
|
461
521
|
Create a mark-removing step.
|
|
462
522
|
*/
|
|
463
|
-
constructor(
|
|
464
|
-
super()
|
|
523
|
+
constructor(pos, mark) {
|
|
524
|
+
super();
|
|
525
|
+
this.pos = pos;
|
|
526
|
+
this.mark = mark;
|
|
465
527
|
}
|
|
466
|
-
apply(
|
|
467
|
-
let
|
|
468
|
-
if (!
|
|
469
|
-
return
|
|
470
|
-
let
|
|
471
|
-
return
|
|
528
|
+
apply(doc) {
|
|
529
|
+
let node = doc.nodeAt(this.pos);
|
|
530
|
+
if (!node)
|
|
531
|
+
return StepResult.fail("No node at mark step's position");
|
|
532
|
+
let updated = node.type.create(node.attrs, null, this.mark.removeFromSet(node.marks));
|
|
533
|
+
return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));
|
|
472
534
|
}
|
|
473
|
-
invert(
|
|
474
|
-
let
|
|
475
|
-
|
|
535
|
+
invert(doc) {
|
|
536
|
+
let node = doc.nodeAt(this.pos);
|
|
537
|
+
if (!node || !this.mark.isInSet(node.marks))
|
|
538
|
+
return this;
|
|
539
|
+
return new AddNodeMarkStep(this.pos, this.mark);
|
|
476
540
|
}
|
|
477
|
-
map(
|
|
478
|
-
let
|
|
479
|
-
return
|
|
541
|
+
map(mapping) {
|
|
542
|
+
let pos = mapping.mapResult(this.pos, 1);
|
|
543
|
+
return pos.deletedAfter ? null : new RemoveNodeMarkStep(pos.pos, this.mark);
|
|
480
544
|
}
|
|
481
545
|
toJSON() {
|
|
482
546
|
return { stepType: "removeNodeMark", pos: this.pos, mark: this.mark.toJSON() };
|
|
@@ -484,14 +548,14 @@ class R extends k {
|
|
|
484
548
|
/**
|
|
485
549
|
@internal
|
|
486
550
|
*/
|
|
487
|
-
static fromJSON(
|
|
488
|
-
if (typeof
|
|
551
|
+
static fromJSON(schema, json) {
|
|
552
|
+
if (typeof json.pos != "number")
|
|
489
553
|
throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");
|
|
490
|
-
return new
|
|
554
|
+
return new RemoveNodeMarkStep(json.pos, schema.markFromJSON(json.mark));
|
|
491
555
|
}
|
|
492
556
|
}
|
|
493
|
-
|
|
494
|
-
class
|
|
557
|
+
Step.jsonID("removeNodeMark", RemoveNodeMarkStep);
|
|
558
|
+
class ReplaceStep extends Step {
|
|
495
559
|
/**
|
|
496
560
|
The given `slice` should fit the 'gap' between `from` and
|
|
497
561
|
`to`—the depths must line up, and the surrounding nodes must be
|
|
@@ -501,69 +565,91 @@ class v extends k {
|
|
|
501
565
|
tokens (this is to guard against rebased replace steps
|
|
502
566
|
overwriting something they weren't supposed to).
|
|
503
567
|
*/
|
|
504
|
-
constructor(
|
|
505
|
-
super()
|
|
568
|
+
constructor(from, to, slice, structure = false) {
|
|
569
|
+
super();
|
|
570
|
+
this.from = from;
|
|
571
|
+
this.to = to;
|
|
572
|
+
this.slice = slice;
|
|
573
|
+
this.structure = structure;
|
|
506
574
|
}
|
|
507
|
-
apply(
|
|
508
|
-
|
|
575
|
+
apply(doc) {
|
|
576
|
+
if (this.structure && contentBetween(doc, this.from, this.to))
|
|
577
|
+
return StepResult.fail("Structure replace would overwrite content");
|
|
578
|
+
return StepResult.fromReplace(doc, this.from, this.to, this.slice);
|
|
509
579
|
}
|
|
510
580
|
getMap() {
|
|
511
|
-
return new
|
|
581
|
+
return new StepMap([this.from, this.to - this.from, this.slice.size]);
|
|
512
582
|
}
|
|
513
|
-
invert(
|
|
514
|
-
return new
|
|
583
|
+
invert(doc) {
|
|
584
|
+
return new ReplaceStep(this.from, this.from + this.slice.size, doc.slice(this.from, this.to));
|
|
515
585
|
}
|
|
516
|
-
map(
|
|
517
|
-
let
|
|
518
|
-
|
|
586
|
+
map(mapping) {
|
|
587
|
+
let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
|
|
588
|
+
if (from.deletedAcross && to.deletedAcross)
|
|
589
|
+
return null;
|
|
590
|
+
return new ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice, this.structure);
|
|
519
591
|
}
|
|
520
|
-
merge(
|
|
521
|
-
if (!(
|
|
592
|
+
merge(other) {
|
|
593
|
+
if (!(other instanceof ReplaceStep) || other.structure || this.structure)
|
|
522
594
|
return null;
|
|
523
|
-
if (this.from + this.slice.size ==
|
|
524
|
-
let
|
|
525
|
-
return new
|
|
526
|
-
} else if (
|
|
527
|
-
let
|
|
528
|
-
return new
|
|
529
|
-
} else
|
|
595
|
+
if (this.from + this.slice.size == other.from && !this.slice.openEnd && !other.slice.openStart) {
|
|
596
|
+
let slice = this.slice.size + other.slice.size == 0 ? Slice.empty : new Slice(this.slice.content.append(other.slice.content), this.slice.openStart, other.slice.openEnd);
|
|
597
|
+
return new ReplaceStep(this.from, this.to + (other.to - other.from), slice, this.structure);
|
|
598
|
+
} else if (other.to == this.from && !this.slice.openStart && !other.slice.openEnd) {
|
|
599
|
+
let slice = this.slice.size + other.slice.size == 0 ? Slice.empty : new Slice(other.slice.content.append(this.slice.content), other.slice.openStart, this.slice.openEnd);
|
|
600
|
+
return new ReplaceStep(other.from, this.to, slice, this.structure);
|
|
601
|
+
} else {
|
|
530
602
|
return null;
|
|
603
|
+
}
|
|
531
604
|
}
|
|
532
605
|
toJSON() {
|
|
533
|
-
let
|
|
534
|
-
|
|
606
|
+
let json = { stepType: "replace", from: this.from, to: this.to };
|
|
607
|
+
if (this.slice.size)
|
|
608
|
+
json.slice = this.slice.toJSON();
|
|
609
|
+
if (this.structure)
|
|
610
|
+
json.structure = true;
|
|
611
|
+
return json;
|
|
535
612
|
}
|
|
536
613
|
/**
|
|
537
614
|
@internal
|
|
538
615
|
*/
|
|
539
|
-
static fromJSON(
|
|
540
|
-
if (typeof
|
|
616
|
+
static fromJSON(schema, json) {
|
|
617
|
+
if (typeof json.from != "number" || typeof json.to != "number")
|
|
541
618
|
throw new RangeError("Invalid input for ReplaceStep.fromJSON");
|
|
542
|
-
return new
|
|
619
|
+
return new ReplaceStep(json.from, json.to, Slice.fromJSON(schema, json.slice), !!json.structure);
|
|
543
620
|
}
|
|
544
621
|
}
|
|
545
|
-
|
|
546
|
-
class
|
|
622
|
+
Step.jsonID("replace", ReplaceStep);
|
|
623
|
+
class ReplaceAroundStep extends Step {
|
|
547
624
|
/**
|
|
548
625
|
Create a replace-around step with the given range and gap.
|
|
549
626
|
`insert` should be the point in the slice into which the content
|
|
550
627
|
of the gap should be moved. `structure` has the same meaning as
|
|
551
628
|
it has in the [`ReplaceStep`](https://prosemirror.net/docs/ref/#transform.ReplaceStep) class.
|
|
552
629
|
*/
|
|
553
|
-
constructor(
|
|
554
|
-
super()
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
630
|
+
constructor(from, to, gapFrom, gapTo, slice, insert, structure = false) {
|
|
631
|
+
super();
|
|
632
|
+
this.from = from;
|
|
633
|
+
this.to = to;
|
|
634
|
+
this.gapFrom = gapFrom;
|
|
635
|
+
this.gapTo = gapTo;
|
|
636
|
+
this.slice = slice;
|
|
637
|
+
this.insert = insert;
|
|
638
|
+
this.structure = structure;
|
|
639
|
+
}
|
|
640
|
+
apply(doc) {
|
|
641
|
+
if (this.structure && (contentBetween(doc, this.from, this.gapFrom) || contentBetween(doc, this.gapTo, this.to)))
|
|
642
|
+
return StepResult.fail("Structure gap-replace would overwrite content");
|
|
643
|
+
let gap = doc.slice(this.gapFrom, this.gapTo);
|
|
644
|
+
if (gap.openStart || gap.openEnd)
|
|
645
|
+
return StepResult.fail("Gap is not a flat range");
|
|
646
|
+
let inserted = this.slice.insertAt(this.insert, gap.content);
|
|
647
|
+
if (!inserted)
|
|
648
|
+
return StepResult.fail("Content does not fit in gap");
|
|
649
|
+
return StepResult.fromReplace(doc, this.from, this.to, inserted);
|
|
564
650
|
}
|
|
565
651
|
getMap() {
|
|
566
|
-
return new
|
|
652
|
+
return new StepMap([
|
|
567
653
|
this.from,
|
|
568
654
|
this.gapFrom - this.from,
|
|
569
655
|
this.insert,
|
|
@@ -572,16 +658,20 @@ class M extends k {
|
|
|
572
658
|
this.slice.size - this.insert
|
|
573
659
|
]);
|
|
574
660
|
}
|
|
575
|
-
invert(
|
|
576
|
-
let
|
|
577
|
-
return new
|
|
661
|
+
invert(doc) {
|
|
662
|
+
let gap = this.gapTo - this.gapFrom;
|
|
663
|
+
return new ReplaceAroundStep(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap, doc.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
|
|
578
664
|
}
|
|
579
|
-
map(
|
|
580
|
-
let
|
|
581
|
-
|
|
665
|
+
map(mapping) {
|
|
666
|
+
let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
|
|
667
|
+
let gapFrom = this.from == this.gapFrom ? from.pos : mapping.map(this.gapFrom, -1);
|
|
668
|
+
let gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1);
|
|
669
|
+
if (from.deletedAcross && to.deletedAcross || gapFrom < from.pos || gapTo > to.pos)
|
|
670
|
+
return null;
|
|
671
|
+
return new ReplaceAroundStep(from.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
|
|
582
672
|
}
|
|
583
673
|
toJSON() {
|
|
584
|
-
let
|
|
674
|
+
let json = {
|
|
585
675
|
stepType: "replaceAround",
|
|
586
676
|
from: this.from,
|
|
587
677
|
to: this.to,
|
|
@@ -589,690 +679,892 @@ class M extends k {
|
|
|
589
679
|
gapTo: this.gapTo,
|
|
590
680
|
insert: this.insert
|
|
591
681
|
};
|
|
592
|
-
|
|
682
|
+
if (this.slice.size)
|
|
683
|
+
json.slice = this.slice.toJSON();
|
|
684
|
+
if (this.structure)
|
|
685
|
+
json.structure = true;
|
|
686
|
+
return json;
|
|
593
687
|
}
|
|
594
688
|
/**
|
|
595
689
|
@internal
|
|
596
690
|
*/
|
|
597
|
-
static fromJSON(
|
|
598
|
-
if (typeof
|
|
691
|
+
static fromJSON(schema, json) {
|
|
692
|
+
if (typeof json.from != "number" || typeof json.to != "number" || typeof json.gapFrom != "number" || typeof json.gapTo != "number" || typeof json.insert != "number")
|
|
599
693
|
throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
|
|
600
|
-
return new
|
|
694
|
+
return new ReplaceAroundStep(json.from, json.to, json.gapFrom, json.gapTo, Slice.fromJSON(schema, json.slice), json.insert, !!json.structure);
|
|
601
695
|
}
|
|
602
696
|
}
|
|
603
|
-
|
|
604
|
-
function
|
|
605
|
-
let
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
697
|
+
Step.jsonID("replaceAround", ReplaceAroundStep);
|
|
698
|
+
function contentBetween(doc, from, to) {
|
|
699
|
+
let $from = doc.resolve(from), dist = to - from, depth = $from.depth;
|
|
700
|
+
while (dist > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) {
|
|
701
|
+
depth--;
|
|
702
|
+
dist--;
|
|
703
|
+
}
|
|
704
|
+
if (dist > 0) {
|
|
705
|
+
let next = $from.node(depth).maybeChild($from.indexAfter(depth));
|
|
706
|
+
while (dist > 0) {
|
|
707
|
+
if (!next || next.isLeaf)
|
|
708
|
+
return true;
|
|
709
|
+
next = next.firstChild;
|
|
710
|
+
dist--;
|
|
614
711
|
}
|
|
615
712
|
}
|
|
616
|
-
return
|
|
713
|
+
return false;
|
|
617
714
|
}
|
|
618
|
-
function
|
|
619
|
-
let
|
|
620
|
-
|
|
621
|
-
|
|
715
|
+
function addMark(tr, from, to, mark) {
|
|
716
|
+
let removed = [], added = [];
|
|
717
|
+
let removing, adding;
|
|
718
|
+
tr.doc.nodesBetween(from, to, (node, pos, parent) => {
|
|
719
|
+
if (!node.isInline)
|
|
622
720
|
return;
|
|
623
|
-
let
|
|
624
|
-
if (!
|
|
625
|
-
let
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
721
|
+
let marks = node.marks;
|
|
722
|
+
if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) {
|
|
723
|
+
let start = Math.max(pos, from), end = Math.min(pos + node.nodeSize, to);
|
|
724
|
+
let newSet = mark.addToSet(marks);
|
|
725
|
+
for (let i = 0; i < marks.length; i++) {
|
|
726
|
+
if (!marks[i].isInSet(newSet)) {
|
|
727
|
+
if (removing && removing.to == start && removing.mark.eq(marks[i]))
|
|
728
|
+
removing.to = end;
|
|
729
|
+
else
|
|
730
|
+
removed.push(removing = new RemoveMarkStep(start, end, marks[i]));
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
if (adding && adding.to == start)
|
|
734
|
+
adding.to = end;
|
|
735
|
+
else
|
|
736
|
+
added.push(adding = new AddMarkStep(start, end, mark));
|
|
629
737
|
}
|
|
630
|
-
})
|
|
738
|
+
});
|
|
739
|
+
removed.forEach((s) => tr.step(s));
|
|
740
|
+
added.forEach((s) => tr.step(s));
|
|
631
741
|
}
|
|
632
|
-
function
|
|
633
|
-
let
|
|
634
|
-
|
|
635
|
-
if (!
|
|
742
|
+
function removeMark(tr, from, to, mark) {
|
|
743
|
+
let matched = [], step = 0;
|
|
744
|
+
tr.doc.nodesBetween(from, to, (node, pos) => {
|
|
745
|
+
if (!node.isInline)
|
|
636
746
|
return;
|
|
637
|
-
|
|
638
|
-
let
|
|
639
|
-
if (
|
|
640
|
-
let
|
|
641
|
-
|
|
642
|
-
(
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
747
|
+
step++;
|
|
748
|
+
let toRemove = null;
|
|
749
|
+
if (mark instanceof MarkType) {
|
|
750
|
+
let set = node.marks, found;
|
|
751
|
+
while (found = mark.isInSet(set)) {
|
|
752
|
+
(toRemove || (toRemove = [])).push(found);
|
|
753
|
+
set = found.removeFromSet(set);
|
|
754
|
+
}
|
|
755
|
+
} else if (mark) {
|
|
756
|
+
if (mark.isInSet(node.marks))
|
|
757
|
+
toRemove = [mark];
|
|
758
|
+
} else {
|
|
759
|
+
toRemove = node.marks;
|
|
760
|
+
}
|
|
761
|
+
if (toRemove && toRemove.length) {
|
|
762
|
+
let end = Math.min(pos + node.nodeSize, to);
|
|
763
|
+
for (let i = 0; i < toRemove.length; i++) {
|
|
764
|
+
let style = toRemove[i], found;
|
|
765
|
+
for (let j = 0; j < matched.length; j++) {
|
|
766
|
+
let m = matched[j];
|
|
767
|
+
if (m.step == step - 1 && style.eq(matched[j].style))
|
|
768
|
+
found = m;
|
|
769
|
+
}
|
|
770
|
+
if (found) {
|
|
771
|
+
found.to = end;
|
|
772
|
+
found.step = step;
|
|
773
|
+
} else {
|
|
774
|
+
matched.push({ style, from: Math.max(pos, from), to: end, step });
|
|
651
775
|
}
|
|
652
|
-
f ? (f.to = h, f.step = i) : n.push({ style: c, from: Math.max(l, e), to: h, step: i });
|
|
653
776
|
}
|
|
654
777
|
}
|
|
655
|
-
})
|
|
778
|
+
});
|
|
779
|
+
matched.forEach((m) => tr.step(new RemoveMarkStep(m.from, m.to, m.style)));
|
|
656
780
|
}
|
|
657
|
-
function
|
|
658
|
-
let
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
781
|
+
function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch, clearNewlines = true) {
|
|
782
|
+
let node = tr.doc.nodeAt(pos);
|
|
783
|
+
let replSteps = [], cur = pos + 1;
|
|
784
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
785
|
+
let child = node.child(i), end = cur + child.nodeSize;
|
|
786
|
+
let allowed = match.matchType(child.type);
|
|
787
|
+
if (!allowed) {
|
|
788
|
+
replSteps.push(new ReplaceStep(cur, end, Slice.empty));
|
|
789
|
+
} else {
|
|
790
|
+
match = allowed;
|
|
791
|
+
for (let j = 0; j < child.marks.length; j++)
|
|
792
|
+
if (!parentType.allowsMarkType(child.marks[j].type))
|
|
793
|
+
tr.step(new RemoveMarkStep(cur, end, child.marks[j]));
|
|
794
|
+
if (clearNewlines && child.isText && parentType.whitespace != "pre") {
|
|
795
|
+
let m, newline = /\r?\n|\r/g, slice;
|
|
796
|
+
while (m = newline.exec(child.text)) {
|
|
797
|
+
if (!slice)
|
|
798
|
+
slice = new Slice(Fragment.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0);
|
|
799
|
+
replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length, slice));
|
|
800
|
+
}
|
|
671
801
|
}
|
|
672
802
|
}
|
|
673
|
-
|
|
803
|
+
cur = end;
|
|
674
804
|
}
|
|
675
|
-
if (!
|
|
676
|
-
let
|
|
677
|
-
|
|
805
|
+
if (!match.validEnd) {
|
|
806
|
+
let fill = match.fillBefore(Fragment.empty, true);
|
|
807
|
+
tr.replace(cur, cur, new Slice(fill, 0, 0));
|
|
678
808
|
}
|
|
679
|
-
for (let
|
|
680
|
-
|
|
809
|
+
for (let i = replSteps.length - 1; i >= 0; i--)
|
|
810
|
+
tr.step(replSteps[i]);
|
|
681
811
|
}
|
|
682
|
-
function
|
|
683
|
-
return (
|
|
812
|
+
function canCut(node, start, end) {
|
|
813
|
+
return (start == 0 || node.canReplace(start, node.childCount)) && (end == node.childCount || node.canReplace(0, end));
|
|
684
814
|
}
|
|
685
|
-
function
|
|
686
|
-
let
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
if (
|
|
815
|
+
function liftTarget(range) {
|
|
816
|
+
let parent = range.parent;
|
|
817
|
+
let content = parent.content.cutByIndex(range.startIndex, range.endIndex);
|
|
818
|
+
for (let depth = range.depth; ; --depth) {
|
|
819
|
+
let node = range.$from.node(depth);
|
|
820
|
+
let index = range.$from.index(depth), endIndex = range.$to.indexAfter(depth);
|
|
821
|
+
if (depth < range.depth && node.canReplace(index, endIndex, content))
|
|
822
|
+
return depth;
|
|
823
|
+
if (depth == 0 || node.type.spec.isolating || !canCut(node, index, endIndex))
|
|
692
824
|
break;
|
|
693
825
|
}
|
|
694
826
|
return null;
|
|
695
827
|
}
|
|
696
|
-
function
|
|
697
|
-
let { $from
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
let
|
|
701
|
-
for (let
|
|
702
|
-
|
|
703
|
-
|
|
828
|
+
function lift(tr, range, target) {
|
|
829
|
+
let { $from, $to, depth } = range;
|
|
830
|
+
let gapStart = $from.before(depth + 1), gapEnd = $to.after(depth + 1);
|
|
831
|
+
let start = gapStart, end = gapEnd;
|
|
832
|
+
let before = Fragment.empty, openStart = 0;
|
|
833
|
+
for (let d = depth, splitting = false; d > target; d--)
|
|
834
|
+
if (splitting || $from.index(d) > 0) {
|
|
835
|
+
splitting = true;
|
|
836
|
+
before = Fragment.from($from.node(d).copy(before));
|
|
837
|
+
openStart++;
|
|
838
|
+
} else {
|
|
839
|
+
start--;
|
|
840
|
+
}
|
|
841
|
+
let after = Fragment.empty, openEnd = 0;
|
|
842
|
+
for (let d = depth, splitting = false; d > target; d--)
|
|
843
|
+
if (splitting || $to.after(d + 1) < $to.end(d)) {
|
|
844
|
+
splitting = true;
|
|
845
|
+
after = Fragment.from($to.node(d).copy(after));
|
|
846
|
+
openEnd++;
|
|
847
|
+
} else {
|
|
848
|
+
end++;
|
|
849
|
+
}
|
|
850
|
+
tr.step(new ReplaceAroundStep(start, end, gapStart, gapEnd, new Slice(before.append(after), openStart, openEnd), before.size - openStart, true));
|
|
704
851
|
}
|
|
705
|
-
function
|
|
706
|
-
let
|
|
707
|
-
|
|
852
|
+
function findWrapping(range, nodeType, attrs = null, innerRange = range) {
|
|
853
|
+
let around = findWrappingOutside(range, nodeType);
|
|
854
|
+
let inner = around && findWrappingInside(innerRange, nodeType);
|
|
855
|
+
if (!inner)
|
|
856
|
+
return null;
|
|
857
|
+
return around.map(withAttrs).concat({ type: nodeType, attrs }).concat(inner.map(withAttrs));
|
|
708
858
|
}
|
|
709
|
-
function
|
|
710
|
-
return { type
|
|
859
|
+
function withAttrs(type) {
|
|
860
|
+
return { type, attrs: null };
|
|
711
861
|
}
|
|
712
|
-
function
|
|
713
|
-
let { parent
|
|
714
|
-
|
|
862
|
+
function findWrappingOutside(range, type) {
|
|
863
|
+
let { parent, startIndex, endIndex } = range;
|
|
864
|
+
let around = parent.contentMatchAt(startIndex).findWrapping(type);
|
|
865
|
+
if (!around)
|
|
715
866
|
return null;
|
|
716
|
-
let
|
|
717
|
-
return
|
|
867
|
+
let outer = around.length ? around[0] : type;
|
|
868
|
+
return parent.canReplaceWith(startIndex, endIndex, outer) ? around : null;
|
|
718
869
|
}
|
|
719
|
-
function
|
|
720
|
-
let { parent
|
|
721
|
-
|
|
870
|
+
function findWrappingInside(range, type) {
|
|
871
|
+
let { parent, startIndex, endIndex } = range;
|
|
872
|
+
let inner = parent.child(startIndex);
|
|
873
|
+
let inside = type.contentMatch.findWrapping(inner.type);
|
|
874
|
+
if (!inside)
|
|
875
|
+
return null;
|
|
876
|
+
let lastType = inside.length ? inside[inside.length - 1] : type;
|
|
877
|
+
let innerMatch = lastType.contentMatch;
|
|
878
|
+
for (let i = startIndex; innerMatch && i < endIndex; i++)
|
|
879
|
+
innerMatch = innerMatch.matchType(parent.child(i).type);
|
|
880
|
+
if (!innerMatch || !innerMatch.validEnd)
|
|
722
881
|
return null;
|
|
723
|
-
|
|
724
|
-
for (let h = r; a && h < n; h++)
|
|
725
|
-
a = a.matchType(t.child(h).type);
|
|
726
|
-
return !a || !a.validEnd ? null : o;
|
|
882
|
+
return inside;
|
|
727
883
|
}
|
|
728
|
-
function
|
|
729
|
-
let
|
|
730
|
-
for (let
|
|
731
|
-
if (
|
|
732
|
-
let
|
|
733
|
-
if (!
|
|
884
|
+
function wrap(tr, range, wrappers) {
|
|
885
|
+
let content = Fragment.empty;
|
|
886
|
+
for (let i = wrappers.length - 1; i >= 0; i--) {
|
|
887
|
+
if (content.size) {
|
|
888
|
+
let match = wrappers[i].type.contentMatch.matchFragment(content);
|
|
889
|
+
if (!match || !match.validEnd)
|
|
734
890
|
throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper");
|
|
735
891
|
}
|
|
736
|
-
|
|
892
|
+
content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));
|
|
737
893
|
}
|
|
738
|
-
let
|
|
739
|
-
|
|
894
|
+
let start = range.start, end = range.end;
|
|
895
|
+
tr.step(new ReplaceAroundStep(start, end, start, end, new Slice(content, 0, 0), wrappers.length, true));
|
|
740
896
|
}
|
|
741
|
-
function
|
|
742
|
-
if (!
|
|
897
|
+
function setBlockType(tr, from, to, type, attrs) {
|
|
898
|
+
if (!type.isTextblock)
|
|
743
899
|
throw new RangeError("Type given to setBlockType should be a textblock");
|
|
744
|
-
let
|
|
745
|
-
|
|
746
|
-
let
|
|
747
|
-
if (
|
|
748
|
-
let
|
|
749
|
-
if (
|
|
750
|
-
let
|
|
751
|
-
|
|
900
|
+
let mapFrom = tr.steps.length;
|
|
901
|
+
tr.doc.nodesBetween(from, to, (node, pos) => {
|
|
902
|
+
let attrsHere = typeof attrs == "function" ? attrs(node) : attrs;
|
|
903
|
+
if (node.isTextblock && !node.hasMarkup(type, attrsHere) && canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), type)) {
|
|
904
|
+
let convertNewlines = null;
|
|
905
|
+
if (type.schema.linebreakReplacement) {
|
|
906
|
+
let pre = type.whitespace == "pre", supportLinebreak = !!type.contentMatch.matchType(type.schema.linebreakReplacement);
|
|
907
|
+
if (pre && !supportLinebreak)
|
|
908
|
+
convertNewlines = false;
|
|
909
|
+
else if (!pre && supportLinebreak)
|
|
910
|
+
convertNewlines = true;
|
|
752
911
|
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
912
|
+
if (convertNewlines === false)
|
|
913
|
+
replaceLinebreaks(tr, node, pos, mapFrom);
|
|
914
|
+
clearIncompatible(tr, tr.mapping.slice(mapFrom).map(pos, 1), type, void 0, convertNewlines === null);
|
|
915
|
+
let mapping = tr.mapping.slice(mapFrom);
|
|
916
|
+
let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);
|
|
917
|
+
tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type.create(attrsHere, null, node.marks)), 0, 0), 1, true));
|
|
918
|
+
if (convertNewlines === true)
|
|
919
|
+
replaceNewlines(tr, node, pos, mapFrom);
|
|
920
|
+
return false;
|
|
756
921
|
}
|
|
757
922
|
});
|
|
758
923
|
}
|
|
759
|
-
function
|
|
760
|
-
|
|
761
|
-
if (
|
|
762
|
-
let
|
|
763
|
-
|
|
764
|
-
let
|
|
765
|
-
|
|
924
|
+
function replaceNewlines(tr, node, pos, mapFrom) {
|
|
925
|
+
node.forEach((child, offset) => {
|
|
926
|
+
if (child.isText) {
|
|
927
|
+
let m, newline = /\r?\n|\r/g;
|
|
928
|
+
while (m = newline.exec(child.text)) {
|
|
929
|
+
let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m.index);
|
|
930
|
+
tr.replaceWith(start, start + 1, node.type.schema.linebreakReplacement.create());
|
|
766
931
|
}
|
|
767
932
|
}
|
|
768
933
|
});
|
|
769
934
|
}
|
|
770
|
-
function
|
|
771
|
-
|
|
772
|
-
if (
|
|
773
|
-
let
|
|
774
|
-
|
|
775
|
-
`));
|
|
935
|
+
function replaceLinebreaks(tr, node, pos, mapFrom) {
|
|
936
|
+
node.forEach((child, offset) => {
|
|
937
|
+
if (child.type == child.type.schema.linebreakReplacement) {
|
|
938
|
+
let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset);
|
|
939
|
+
tr.replaceWith(start, start + 1, node.type.schema.text("\n"));
|
|
776
940
|
}
|
|
777
941
|
});
|
|
778
942
|
}
|
|
779
|
-
function
|
|
780
|
-
let
|
|
781
|
-
return
|
|
943
|
+
function canChangeType(doc, pos, type) {
|
|
944
|
+
let $pos = doc.resolve(pos), index = $pos.index();
|
|
945
|
+
return $pos.parent.canReplaceWith(index, index + 1, type);
|
|
782
946
|
}
|
|
783
|
-
function
|
|
784
|
-
let
|
|
785
|
-
if (!
|
|
947
|
+
function setNodeMarkup(tr, pos, type, attrs, marks) {
|
|
948
|
+
let node = tr.doc.nodeAt(pos);
|
|
949
|
+
if (!node)
|
|
786
950
|
throw new RangeError("No node at given position");
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
951
|
+
if (!type)
|
|
952
|
+
type = node.type;
|
|
953
|
+
let newNode = type.create(attrs, null, marks || node.marks);
|
|
954
|
+
if (node.isLeaf)
|
|
955
|
+
return tr.replaceWith(pos, pos + node.nodeSize, newNode);
|
|
956
|
+
if (!type.validContent(node.content))
|
|
957
|
+
throw new RangeError("Invalid content for node type " + type.name);
|
|
958
|
+
tr.step(new ReplaceAroundStep(pos, pos + node.nodeSize, pos + 1, pos + node.nodeSize - 1, new Slice(Fragment.from(newNode), 0, 0), 1, true));
|
|
794
959
|
}
|
|
795
|
-
function
|
|
796
|
-
let
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
let
|
|
806
|
-
if (
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
960
|
+
function canSplit(doc, pos, depth = 1, typesAfter) {
|
|
961
|
+
let $pos = doc.resolve(pos), base = $pos.depth - depth;
|
|
962
|
+
let innerType = typesAfter && typesAfter[typesAfter.length - 1] || $pos.parent;
|
|
963
|
+
if (base < 0 || $pos.parent.type.spec.isolating || !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) || !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount)))
|
|
964
|
+
return false;
|
|
965
|
+
for (let d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) {
|
|
966
|
+
let node = $pos.node(d), index2 = $pos.index(d);
|
|
967
|
+
if (node.type.spec.isolating)
|
|
968
|
+
return false;
|
|
969
|
+
let rest = node.content.cutByIndex(index2, node.childCount);
|
|
970
|
+
let overrideChild = typesAfter && typesAfter[i + 1];
|
|
971
|
+
if (overrideChild)
|
|
972
|
+
rest = rest.replaceChild(0, overrideChild.type.create(overrideChild.attrs));
|
|
973
|
+
let after = typesAfter && typesAfter[i] || node;
|
|
974
|
+
if (!node.canReplace(index2 + 1, node.childCount) || !after.type.validContent(rest))
|
|
975
|
+
return false;
|
|
976
|
+
}
|
|
977
|
+
let index = $pos.indexAfter(base);
|
|
978
|
+
let baseType = typesAfter && typesAfter[0];
|
|
979
|
+
return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type);
|
|
811
980
|
}
|
|
812
|
-
function
|
|
813
|
-
let
|
|
814
|
-
for (let
|
|
815
|
-
|
|
816
|
-
let
|
|
817
|
-
|
|
818
|
-
}
|
|
819
|
-
|
|
981
|
+
function split(tr, pos, depth = 1, typesAfter) {
|
|
982
|
+
let $pos = tr.doc.resolve(pos), before = Fragment.empty, after = Fragment.empty;
|
|
983
|
+
for (let d = $pos.depth, e = $pos.depth - depth, i = depth - 1; d > e; d--, i--) {
|
|
984
|
+
before = Fragment.from($pos.node(d).copy(before));
|
|
985
|
+
let typeAfter = typesAfter && typesAfter[i];
|
|
986
|
+
after = Fragment.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d).copy(after));
|
|
987
|
+
}
|
|
988
|
+
tr.step(new ReplaceStep(pos, pos, new Slice(before.append(after), depth, depth), true));
|
|
820
989
|
}
|
|
821
|
-
function
|
|
822
|
-
let
|
|
823
|
-
return
|
|
990
|
+
function canJoin(doc, pos) {
|
|
991
|
+
let $pos = doc.resolve(pos), index = $pos.index();
|
|
992
|
+
return joinable($pos.nodeBefore, $pos.nodeAfter) && $pos.parent.canReplace(index, index + 1);
|
|
824
993
|
}
|
|
825
|
-
function
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
994
|
+
function canAppendWithSubstitutedLinebreaks(a, b) {
|
|
995
|
+
if (!b.content.size)
|
|
996
|
+
a.type.compatibleContent(b.type);
|
|
997
|
+
let match = a.contentMatchAt(a.childCount);
|
|
998
|
+
let { linebreakReplacement } = a.type.schema;
|
|
999
|
+
for (let i = 0; i < b.childCount; i++) {
|
|
1000
|
+
let child = b.child(i);
|
|
1001
|
+
let type = child.type == linebreakReplacement ? a.type.schema.nodes.text : child.type;
|
|
1002
|
+
match = match.matchType(type);
|
|
1003
|
+
if (!match)
|
|
1004
|
+
return false;
|
|
1005
|
+
if (!a.type.allowsMarks(child.marks))
|
|
1006
|
+
return false;
|
|
1007
|
+
}
|
|
1008
|
+
return match.validEnd;
|
|
834
1009
|
}
|
|
835
|
-
function
|
|
836
|
-
return !!(
|
|
1010
|
+
function joinable(a, b) {
|
|
1011
|
+
return !!(a && b && !a.isLeaf && canAppendWithSubstitutedLinebreaks(a, b));
|
|
837
1012
|
}
|
|
838
|
-
function
|
|
839
|
-
let
|
|
840
|
-
for (let
|
|
841
|
-
let
|
|
842
|
-
if (
|
|
843
|
-
|
|
844
|
-
|
|
1013
|
+
function joinPoint(doc, pos, dir = -1) {
|
|
1014
|
+
let $pos = doc.resolve(pos);
|
|
1015
|
+
for (let d = $pos.depth; ; d--) {
|
|
1016
|
+
let before, after, index = $pos.index(d);
|
|
1017
|
+
if (d == $pos.depth) {
|
|
1018
|
+
before = $pos.nodeBefore;
|
|
1019
|
+
after = $pos.nodeAfter;
|
|
1020
|
+
} else if (dir > 0) {
|
|
1021
|
+
before = $pos.node(d + 1);
|
|
1022
|
+
index++;
|
|
1023
|
+
after = $pos.node(d).maybeChild(index);
|
|
1024
|
+
} else {
|
|
1025
|
+
before = $pos.node(d).maybeChild(index - 1);
|
|
1026
|
+
after = $pos.node(d + 1);
|
|
1027
|
+
}
|
|
1028
|
+
if (before && !before.isTextblock && joinable(before, after) && $pos.node(d).canReplace(index, index + 1))
|
|
1029
|
+
return pos;
|
|
1030
|
+
if (d == 0)
|
|
845
1031
|
break;
|
|
846
|
-
|
|
1032
|
+
pos = dir < 0 ? $pos.before(d) : $pos.after(d);
|
|
847
1033
|
}
|
|
848
1034
|
}
|
|
849
|
-
function
|
|
850
|
-
let
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
let
|
|
862
|
-
if (
|
|
863
|
-
let
|
|
864
|
-
|
|
865
|
-
}
|
|
866
|
-
|
|
1035
|
+
function join(tr, pos, depth) {
|
|
1036
|
+
let convertNewlines = null;
|
|
1037
|
+
let { linebreakReplacement } = tr.doc.type.schema;
|
|
1038
|
+
let $before = tr.doc.resolve(pos - depth), beforeType = $before.node().type;
|
|
1039
|
+
if (linebreakReplacement && beforeType.inlineContent) {
|
|
1040
|
+
let pre = beforeType.whitespace == "pre";
|
|
1041
|
+
let supportLinebreak = !!beforeType.contentMatch.matchType(linebreakReplacement);
|
|
1042
|
+
if (pre && !supportLinebreak)
|
|
1043
|
+
convertNewlines = false;
|
|
1044
|
+
else if (!pre && supportLinebreak)
|
|
1045
|
+
convertNewlines = true;
|
|
1046
|
+
}
|
|
1047
|
+
let mapFrom = tr.steps.length;
|
|
1048
|
+
if (convertNewlines === false) {
|
|
1049
|
+
let $after = tr.doc.resolve(pos + depth);
|
|
1050
|
+
replaceLinebreaks(tr, $after.node(), $after.before(), mapFrom);
|
|
1051
|
+
}
|
|
1052
|
+
if (beforeType.inlineContent)
|
|
1053
|
+
clearIncompatible(tr, pos + depth - 1, beforeType, $before.node().contentMatchAt($before.index()), convertNewlines == null);
|
|
1054
|
+
let mapping = tr.mapping.slice(mapFrom), start = mapping.map(pos - depth);
|
|
1055
|
+
tr.step(new ReplaceStep(start, mapping.map(pos + depth, -1), Slice.empty, true));
|
|
1056
|
+
if (convertNewlines === true) {
|
|
1057
|
+
let $full = tr.doc.resolve(start);
|
|
1058
|
+
replaceNewlines(tr, $full.node(), $full.before(), tr.steps.length);
|
|
1059
|
+
}
|
|
1060
|
+
return tr;
|
|
867
1061
|
}
|
|
868
|
-
function
|
|
869
|
-
let
|
|
870
|
-
if (
|
|
871
|
-
return
|
|
872
|
-
if (
|
|
873
|
-
for (let
|
|
874
|
-
let
|
|
875
|
-
if (
|
|
876
|
-
return
|
|
877
|
-
if (
|
|
1062
|
+
function insertPoint(doc, pos, nodeType) {
|
|
1063
|
+
let $pos = doc.resolve(pos);
|
|
1064
|
+
if ($pos.parent.canReplaceWith($pos.index(), $pos.index(), nodeType))
|
|
1065
|
+
return pos;
|
|
1066
|
+
if ($pos.parentOffset == 0)
|
|
1067
|
+
for (let d = $pos.depth - 1; d >= 0; d--) {
|
|
1068
|
+
let index = $pos.index(d);
|
|
1069
|
+
if ($pos.node(d).canReplaceWith(index, index, nodeType))
|
|
1070
|
+
return $pos.before(d + 1);
|
|
1071
|
+
if (index > 0)
|
|
878
1072
|
return null;
|
|
879
1073
|
}
|
|
880
|
-
if (
|
|
881
|
-
for (let
|
|
882
|
-
let
|
|
883
|
-
if (
|
|
884
|
-
return
|
|
885
|
-
if (
|
|
1074
|
+
if ($pos.parentOffset == $pos.parent.content.size)
|
|
1075
|
+
for (let d = $pos.depth - 1; d >= 0; d--) {
|
|
1076
|
+
let index = $pos.indexAfter(d);
|
|
1077
|
+
if ($pos.node(d).canReplaceWith(index, index, nodeType))
|
|
1078
|
+
return $pos.after(d + 1);
|
|
1079
|
+
if (index < $pos.node(d).childCount)
|
|
886
1080
|
return null;
|
|
887
1081
|
}
|
|
888
1082
|
return null;
|
|
889
1083
|
}
|
|
890
|
-
function
|
|
891
|
-
let
|
|
892
|
-
if (!
|
|
893
|
-
return
|
|
894
|
-
let
|
|
895
|
-
for (let i = 0; i <
|
|
896
|
-
|
|
897
|
-
for (let
|
|
898
|
-
for (let
|
|
899
|
-
let
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
1084
|
+
function dropPoint(doc, pos, slice) {
|
|
1085
|
+
let $pos = doc.resolve(pos);
|
|
1086
|
+
if (!slice.content.size)
|
|
1087
|
+
return pos;
|
|
1088
|
+
let content = slice.content;
|
|
1089
|
+
for (let i = 0; i < slice.openStart; i++)
|
|
1090
|
+
content = content.firstChild.content;
|
|
1091
|
+
for (let pass = 1; pass <= (slice.openStart == 0 && slice.size ? 2 : 1); pass++) {
|
|
1092
|
+
for (let d = $pos.depth; d >= 0; d--) {
|
|
1093
|
+
let bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1;
|
|
1094
|
+
let insertPos = $pos.index(d) + (bias > 0 ? 1 : 0);
|
|
1095
|
+
let parent = $pos.node(d), fits = false;
|
|
1096
|
+
if (pass == 1) {
|
|
1097
|
+
fits = parent.canReplace(insertPos, insertPos, content);
|
|
1098
|
+
} else {
|
|
1099
|
+
let wrapping = parent.contentMatchAt(insertPos).findWrapping(content.firstChild.type);
|
|
1100
|
+
fits = wrapping && parent.canReplaceWith(insertPos, insertPos, wrapping[0]);
|
|
905
1101
|
}
|
|
906
|
-
if (
|
|
907
|
-
return
|
|
1102
|
+
if (fits)
|
|
1103
|
+
return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d + 1) : $pos.after(d + 1);
|
|
908
1104
|
}
|
|
1105
|
+
}
|
|
909
1106
|
return null;
|
|
910
1107
|
}
|
|
911
|
-
function
|
|
912
|
-
if (
|
|
1108
|
+
function replaceStep(doc, from, to = from, slice = Slice.empty) {
|
|
1109
|
+
if (from == to && !slice.size)
|
|
913
1110
|
return null;
|
|
914
|
-
let
|
|
915
|
-
|
|
1111
|
+
let $from = doc.resolve(from), $to = doc.resolve(to);
|
|
1112
|
+
if (fitsTrivially($from, $to, slice))
|
|
1113
|
+
return new ReplaceStep(from, to, slice);
|
|
1114
|
+
return new Fitter($from, $to, slice).fit();
|
|
916
1115
|
}
|
|
917
|
-
function
|
|
918
|
-
return !
|
|
1116
|
+
function fitsTrivially($from, $to, slice) {
|
|
1117
|
+
return !slice.openStart && !slice.openEnd && $from.start() == $to.start() && $from.parent.canReplace($from.index(), $to.index(), slice.content);
|
|
919
1118
|
}
|
|
920
|
-
class
|
|
921
|
-
constructor(
|
|
922
|
-
this.$from =
|
|
923
|
-
|
|
924
|
-
|
|
1119
|
+
class Fitter {
|
|
1120
|
+
constructor($from, $to, unplaced) {
|
|
1121
|
+
this.$from = $from;
|
|
1122
|
+
this.$to = $to;
|
|
1123
|
+
this.unplaced = unplaced;
|
|
1124
|
+
this.frontier = [];
|
|
1125
|
+
this.placed = Fragment.empty;
|
|
1126
|
+
for (let i = 0; i <= $from.depth; i++) {
|
|
1127
|
+
let node = $from.node(i);
|
|
925
1128
|
this.frontier.push({
|
|
926
|
-
type:
|
|
927
|
-
match:
|
|
1129
|
+
type: node.type,
|
|
1130
|
+
match: node.contentMatchAt($from.indexAfter(i))
|
|
928
1131
|
});
|
|
929
1132
|
}
|
|
930
|
-
for (let
|
|
931
|
-
this.placed =
|
|
1133
|
+
for (let i = $from.depth; i > 0; i--)
|
|
1134
|
+
this.placed = Fragment.from($from.node(i).copy(this.placed));
|
|
932
1135
|
}
|
|
933
1136
|
get depth() {
|
|
934
1137
|
return this.frontier.length - 1;
|
|
935
1138
|
}
|
|
936
1139
|
fit() {
|
|
937
|
-
|
|
938
|
-
let
|
|
939
|
-
|
|
1140
|
+
while (this.unplaced.size) {
|
|
1141
|
+
let fit = this.findFittable();
|
|
1142
|
+
if (fit)
|
|
1143
|
+
this.placeNodes(fit);
|
|
1144
|
+
else
|
|
1145
|
+
this.openMore() || this.dropNode();
|
|
940
1146
|
}
|
|
941
|
-
let
|
|
942
|
-
|
|
1147
|
+
let moveInline = this.mustMoveInline(), placedSize = this.placed.size - this.depth - this.$from.depth;
|
|
1148
|
+
let $from = this.$from, $to = this.close(moveInline < 0 ? this.$to : $from.doc.resolve(moveInline));
|
|
1149
|
+
if (!$to)
|
|
943
1150
|
return null;
|
|
944
|
-
let
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
1151
|
+
let content = this.placed, openStart = $from.depth, openEnd = $to.depth;
|
|
1152
|
+
while (openStart && openEnd && content.childCount == 1) {
|
|
1153
|
+
content = content.firstChild.content;
|
|
1154
|
+
openStart--;
|
|
1155
|
+
openEnd--;
|
|
1156
|
+
}
|
|
1157
|
+
let slice = new Slice(content, openStart, openEnd);
|
|
1158
|
+
if (moveInline > -1)
|
|
1159
|
+
return new ReplaceAroundStep($from.pos, moveInline, this.$to.pos, this.$to.end(), slice, placedSize);
|
|
1160
|
+
if (slice.size || $from.pos != this.$to.pos)
|
|
1161
|
+
return new ReplaceStep($from.pos, $to.pos, slice);
|
|
1162
|
+
return null;
|
|
949
1163
|
}
|
|
950
1164
|
// Find a position on the start spine of `this.unplaced` that has
|
|
951
1165
|
// content that can be moved somewhere on the frontier. Returns two
|
|
952
1166
|
// depths, one for the slice and one for the frontier.
|
|
953
1167
|
findFittable() {
|
|
954
|
-
let
|
|
955
|
-
for (let
|
|
956
|
-
let
|
|
957
|
-
if (
|
|
958
|
-
|
|
1168
|
+
let startDepth = this.unplaced.openStart;
|
|
1169
|
+
for (let cur = this.unplaced.content, d = 0, openEnd = this.unplaced.openEnd; d < startDepth; d++) {
|
|
1170
|
+
let node = cur.firstChild;
|
|
1171
|
+
if (cur.childCount > 1)
|
|
1172
|
+
openEnd = 0;
|
|
1173
|
+
if (node.type.spec.isolating && openEnd <= d) {
|
|
1174
|
+
startDepth = d;
|
|
959
1175
|
break;
|
|
960
1176
|
}
|
|
961
|
-
|
|
1177
|
+
cur = node.content;
|
|
962
1178
|
}
|
|
963
|
-
for (let
|
|
964
|
-
for (let
|
|
965
|
-
let
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
1179
|
+
for (let pass = 1; pass <= 2; pass++) {
|
|
1180
|
+
for (let sliceDepth = pass == 1 ? startDepth : this.unplaced.openStart; sliceDepth >= 0; sliceDepth--) {
|
|
1181
|
+
let fragment, parent = null;
|
|
1182
|
+
if (sliceDepth) {
|
|
1183
|
+
parent = contentAt(this.unplaced.content, sliceDepth - 1).firstChild;
|
|
1184
|
+
fragment = parent.content;
|
|
1185
|
+
} else {
|
|
1186
|
+
fragment = this.unplaced.content;
|
|
1187
|
+
}
|
|
1188
|
+
let first = fragment.firstChild;
|
|
1189
|
+
for (let frontierDepth = this.depth; frontierDepth >= 0; frontierDepth--) {
|
|
1190
|
+
let { type, match } = this.frontier[frontierDepth], wrap2, inject = null;
|
|
1191
|
+
if (pass == 1 && (first ? match.matchType(first.type) || (inject = match.fillBefore(Fragment.from(first), false)) : parent && type.compatibleContent(parent.type)))
|
|
1192
|
+
return { sliceDepth, frontierDepth, parent, inject };
|
|
1193
|
+
else if (pass == 2 && first && (wrap2 = match.findWrapping(first.type)))
|
|
1194
|
+
return { sliceDepth, frontierDepth, parent, wrap: wrap2 };
|
|
1195
|
+
if (parent && match.matchType(parent.type))
|
|
975
1196
|
break;
|
|
976
1197
|
}
|
|
977
1198
|
}
|
|
1199
|
+
}
|
|
978
1200
|
}
|
|
979
1201
|
openMore() {
|
|
980
|
-
let { content
|
|
981
|
-
|
|
1202
|
+
let { content, openStart, openEnd } = this.unplaced;
|
|
1203
|
+
let inner = contentAt(content, openStart);
|
|
1204
|
+
if (!inner.childCount || inner.firstChild.isLeaf)
|
|
1205
|
+
return false;
|
|
1206
|
+
this.unplaced = new Slice(content, openStart + 1, Math.max(openEnd, inner.size + openStart >= content.size - openEnd ? openStart + 1 : 0));
|
|
1207
|
+
return true;
|
|
982
1208
|
}
|
|
983
1209
|
dropNode() {
|
|
984
|
-
let { content
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1210
|
+
let { content, openStart, openEnd } = this.unplaced;
|
|
1211
|
+
let inner = contentAt(content, openStart);
|
|
1212
|
+
if (inner.childCount <= 1 && openStart > 0) {
|
|
1213
|
+
let openAtEnd = content.size - openStart <= openStart + inner.size;
|
|
1214
|
+
this.unplaced = new Slice(dropFromFragment(content, openStart - 1, 1), openStart - 1, openAtEnd ? openStart - 1 : openEnd);
|
|
1215
|
+
} else {
|
|
1216
|
+
this.unplaced = new Slice(dropFromFragment(content, openStart, 1), openStart, openEnd);
|
|
1217
|
+
}
|
|
990
1218
|
}
|
|
991
1219
|
// Move content from the unplaced slice at `sliceDepth` to the
|
|
992
1220
|
// frontier node at `frontierDepth`. Close that frontier node when
|
|
993
1221
|
// applicable.
|
|
994
|
-
placeNodes({ sliceDepth
|
|
995
|
-
|
|
1222
|
+
placeNodes({ sliceDepth, frontierDepth, parent, inject, wrap: wrap2 }) {
|
|
1223
|
+
while (this.depth > frontierDepth)
|
|
996
1224
|
this.closeFrontierNode();
|
|
997
|
-
if (
|
|
998
|
-
for (let
|
|
999
|
-
this.openFrontierNode(i
|
|
1000
|
-
let
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1225
|
+
if (wrap2)
|
|
1226
|
+
for (let i = 0; i < wrap2.length; i++)
|
|
1227
|
+
this.openFrontierNode(wrap2[i]);
|
|
1228
|
+
let slice = this.unplaced, fragment = parent ? parent.content : slice.content;
|
|
1229
|
+
let openStart = slice.openStart - sliceDepth;
|
|
1230
|
+
let taken = 0, add = [];
|
|
1231
|
+
let { match, type } = this.frontier[frontierDepth];
|
|
1232
|
+
if (inject) {
|
|
1233
|
+
for (let i = 0; i < inject.childCount; i++)
|
|
1234
|
+
add.push(inject.child(i));
|
|
1235
|
+
match = match.matchFragment(inject);
|
|
1005
1236
|
}
|
|
1006
|
-
let
|
|
1007
|
-
|
|
1008
|
-
let
|
|
1009
|
-
if (!
|
|
1237
|
+
let openEndCount = fragment.size + sliceDepth - (slice.content.size - slice.openEnd);
|
|
1238
|
+
while (taken < fragment.childCount) {
|
|
1239
|
+
let next = fragment.child(taken), matches = match.matchType(next.type);
|
|
1240
|
+
if (!matches)
|
|
1010
1241
|
break;
|
|
1011
|
-
|
|
1242
|
+
taken++;
|
|
1243
|
+
if (taken > 1 || openStart == 0 || next.content.size) {
|
|
1244
|
+
match = matches;
|
|
1245
|
+
add.push(closeNodeStart(next.mark(type.allowedMarks(next.marks)), taken == 1 ? openStart : 0, taken == fragment.childCount ? openEndCount : -1));
|
|
1246
|
+
}
|
|
1012
1247
|
}
|
|
1013
|
-
let
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1248
|
+
let toEnd = taken == fragment.childCount;
|
|
1249
|
+
if (!toEnd)
|
|
1250
|
+
openEndCount = -1;
|
|
1251
|
+
this.placed = addToFragment(this.placed, frontierDepth, Fragment.from(add));
|
|
1252
|
+
this.frontier[frontierDepth].match = match;
|
|
1253
|
+
if (toEnd && openEndCount < 0 && parent && parent.type == this.frontier[this.depth].type && this.frontier.length > 1)
|
|
1254
|
+
this.closeFrontierNode();
|
|
1255
|
+
for (let i = 0, cur = fragment; i < openEndCount; i++) {
|
|
1256
|
+
let node = cur.lastChild;
|
|
1257
|
+
this.frontier.push({ type: node.type, match: node.contentMatchAt(node.childCount) });
|
|
1258
|
+
cur = node.content;
|
|
1018
1259
|
}
|
|
1019
|
-
this.unplaced =
|
|
1260
|
+
this.unplaced = !toEnd ? new Slice(dropFromFragment(slice.content, sliceDepth, taken), slice.openStart, slice.openEnd) : sliceDepth == 0 ? Slice.empty : new Slice(dropFromFragment(slice.content, sliceDepth - 1, 1), sliceDepth - 1, openEndCount < 0 ? slice.openEnd : sliceDepth - 1);
|
|
1020
1261
|
}
|
|
1021
1262
|
mustMoveInline() {
|
|
1022
1263
|
if (!this.$to.parent.isTextblock)
|
|
1023
1264
|
return -1;
|
|
1024
|
-
let
|
|
1025
|
-
if (!
|
|
1265
|
+
let top = this.frontier[this.depth], level;
|
|
1266
|
+
if (!top.type.isTextblock || !contentAfterFits(this.$to, this.$to.depth, top.type, top.match, false) || this.$to.depth == this.depth && (level = this.findCloseLevel(this.$to)) && level.depth == this.depth)
|
|
1026
1267
|
return -1;
|
|
1027
|
-
let { depth
|
|
1028
|
-
|
|
1029
|
-
++
|
|
1030
|
-
return
|
|
1031
|
-
}
|
|
1032
|
-
findCloseLevel(
|
|
1033
|
-
|
|
1034
|
-
let { match
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1268
|
+
let { depth } = this.$to, after = this.$to.after(depth);
|
|
1269
|
+
while (depth > 1 && after == this.$to.end(--depth))
|
|
1270
|
+
++after;
|
|
1271
|
+
return after;
|
|
1272
|
+
}
|
|
1273
|
+
findCloseLevel($to) {
|
|
1274
|
+
scan: for (let i = Math.min(this.depth, $to.depth); i >= 0; i--) {
|
|
1275
|
+
let { match, type } = this.frontier[i];
|
|
1276
|
+
let dropInner = i < $to.depth && $to.end(i + 1) == $to.pos + ($to.depth - (i + 1));
|
|
1277
|
+
let fit = contentAfterFits($to, i, type, match, dropInner);
|
|
1278
|
+
if (!fit)
|
|
1279
|
+
continue;
|
|
1280
|
+
for (let d = i - 1; d >= 0; d--) {
|
|
1281
|
+
let { match: match2, type: type2 } = this.frontier[d];
|
|
1282
|
+
let matches = contentAfterFits($to, d, type2, match2, true);
|
|
1283
|
+
if (!matches || matches.childCount)
|
|
1284
|
+
continue scan;
|
|
1042
1285
|
}
|
|
1286
|
+
return { depth: i, fit, move: dropInner ? $to.doc.resolve($to.after(i + 1)) : $to };
|
|
1043
1287
|
}
|
|
1044
1288
|
}
|
|
1045
|
-
close(
|
|
1046
|
-
let
|
|
1047
|
-
if (!
|
|
1289
|
+
close($to) {
|
|
1290
|
+
let close = this.findCloseLevel($to);
|
|
1291
|
+
if (!close)
|
|
1048
1292
|
return null;
|
|
1049
|
-
|
|
1293
|
+
while (this.depth > close.depth)
|
|
1050
1294
|
this.closeFrontierNode();
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1295
|
+
if (close.fit.childCount)
|
|
1296
|
+
this.placed = addToFragment(this.placed, close.depth, close.fit);
|
|
1297
|
+
$to = close.move;
|
|
1298
|
+
for (let d = close.depth + 1; d <= $to.depth; d++) {
|
|
1299
|
+
let node = $to.node(d), add = node.type.contentMatch.fillBefore(node.content, true, $to.index(d));
|
|
1300
|
+
this.openFrontierNode(node.type, node.attrs, add);
|
|
1055
1301
|
}
|
|
1056
|
-
return
|
|
1302
|
+
return $to;
|
|
1057
1303
|
}
|
|
1058
|
-
openFrontierNode(
|
|
1059
|
-
let
|
|
1060
|
-
|
|
1304
|
+
openFrontierNode(type, attrs = null, content) {
|
|
1305
|
+
let top = this.frontier[this.depth];
|
|
1306
|
+
top.match = top.match.matchType(type);
|
|
1307
|
+
this.placed = addToFragment(this.placed, this.depth, Fragment.from(type.create(attrs, content)));
|
|
1308
|
+
this.frontier.push({ type, match: type.contentMatch });
|
|
1061
1309
|
}
|
|
1062
1310
|
closeFrontierNode() {
|
|
1063
|
-
let
|
|
1064
|
-
|
|
1311
|
+
let open = this.frontier.pop();
|
|
1312
|
+
let add = open.match.fillBefore(Fragment.empty, true);
|
|
1313
|
+
if (add.childCount)
|
|
1314
|
+
this.placed = addToFragment(this.placed, this.frontier.length, add);
|
|
1065
1315
|
}
|
|
1066
1316
|
}
|
|
1067
|
-
function
|
|
1068
|
-
|
|
1317
|
+
function dropFromFragment(fragment, depth, count) {
|
|
1318
|
+
if (depth == 0)
|
|
1319
|
+
return fragment.cutByIndex(count, fragment.childCount);
|
|
1320
|
+
return fragment.replaceChild(0, fragment.firstChild.copy(dropFromFragment(fragment.firstChild.content, depth - 1, count)));
|
|
1069
1321
|
}
|
|
1070
|
-
function
|
|
1071
|
-
|
|
1322
|
+
function addToFragment(fragment, depth, content) {
|
|
1323
|
+
if (depth == 0)
|
|
1324
|
+
return fragment.append(content);
|
|
1325
|
+
return fragment.replaceChild(fragment.childCount - 1, fragment.lastChild.copy(addToFragment(fragment.lastChild.content, depth - 1, content)));
|
|
1072
1326
|
}
|
|
1073
|
-
function
|
|
1074
|
-
for (let
|
|
1075
|
-
|
|
1076
|
-
return
|
|
1327
|
+
function contentAt(fragment, depth) {
|
|
1328
|
+
for (let i = 0; i < depth; i++)
|
|
1329
|
+
fragment = fragment.firstChild.content;
|
|
1330
|
+
return fragment;
|
|
1077
1331
|
}
|
|
1078
|
-
function
|
|
1079
|
-
if (
|
|
1080
|
-
return
|
|
1081
|
-
let
|
|
1082
|
-
|
|
1332
|
+
function closeNodeStart(node, openStart, openEnd) {
|
|
1333
|
+
if (openStart <= 0)
|
|
1334
|
+
return node;
|
|
1335
|
+
let frag = node.content;
|
|
1336
|
+
if (openStart > 1)
|
|
1337
|
+
frag = frag.replaceChild(0, closeNodeStart(frag.firstChild, openStart - 1, frag.childCount == 1 ? openEnd - 1 : 0));
|
|
1338
|
+
if (openStart > 0) {
|
|
1339
|
+
frag = node.type.contentMatch.fillBefore(frag).append(frag);
|
|
1340
|
+
if (openEnd <= 0)
|
|
1341
|
+
frag = frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(Fragment.empty, true));
|
|
1342
|
+
}
|
|
1343
|
+
return node.copy(frag);
|
|
1083
1344
|
}
|
|
1084
|
-
function
|
|
1085
|
-
let
|
|
1086
|
-
if (
|
|
1345
|
+
function contentAfterFits($to, depth, type, match, open) {
|
|
1346
|
+
let node = $to.node(depth), index = open ? $to.indexAfter(depth) : $to.index(depth);
|
|
1347
|
+
if (index == node.childCount && !type.compatibleContent(node.type))
|
|
1087
1348
|
return null;
|
|
1088
|
-
let
|
|
1089
|
-
return
|
|
1349
|
+
let fit = match.fillBefore(node.content, true, index);
|
|
1350
|
+
return fit && !invalidMarks(type, node.content, index) ? fit : null;
|
|
1090
1351
|
}
|
|
1091
|
-
function
|
|
1092
|
-
for (let
|
|
1093
|
-
if (!
|
|
1094
|
-
return
|
|
1095
|
-
return
|
|
1352
|
+
function invalidMarks(type, fragment, start) {
|
|
1353
|
+
for (let i = start; i < fragment.childCount; i++)
|
|
1354
|
+
if (!type.allowsMarks(fragment.child(i).marks))
|
|
1355
|
+
return true;
|
|
1356
|
+
return false;
|
|
1096
1357
|
}
|
|
1097
|
-
function
|
|
1098
|
-
return
|
|
1358
|
+
function definesContent(type) {
|
|
1359
|
+
return type.spec.defining || type.spec.definingForContent;
|
|
1099
1360
|
}
|
|
1100
|
-
function
|
|
1101
|
-
if (!
|
|
1102
|
-
return
|
|
1103
|
-
let
|
|
1104
|
-
if (
|
|
1105
|
-
return
|
|
1106
|
-
let
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1361
|
+
function replaceRange(tr, from, to, slice) {
|
|
1362
|
+
if (!slice.size)
|
|
1363
|
+
return tr.deleteRange(from, to);
|
|
1364
|
+
let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);
|
|
1365
|
+
if (fitsTrivially($from, $to, slice))
|
|
1366
|
+
return tr.step(new ReplaceStep(from, to, slice));
|
|
1367
|
+
let targetDepths = coveredDepths($from, tr.doc.resolve(to));
|
|
1368
|
+
if (targetDepths[targetDepths.length - 1] == 0)
|
|
1369
|
+
targetDepths.pop();
|
|
1370
|
+
let preferredTarget = -($from.depth + 1);
|
|
1371
|
+
targetDepths.unshift(preferredTarget);
|
|
1372
|
+
for (let d = $from.depth, pos = $from.pos - 1; d > 0; d--, pos--) {
|
|
1373
|
+
let spec = $from.node(d).type.spec;
|
|
1374
|
+
if (spec.defining || spec.definingAsContext || spec.isolating)
|
|
1113
1375
|
break;
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1376
|
+
if (targetDepths.indexOf(d) > -1)
|
|
1377
|
+
preferredTarget = d;
|
|
1378
|
+
else if ($from.before(d) == pos)
|
|
1379
|
+
targetDepths.splice(1, 0, -d);
|
|
1380
|
+
}
|
|
1381
|
+
let preferredTargetIndex = targetDepths.indexOf(preferredTarget);
|
|
1382
|
+
let leftNodes = [], preferredDepth = slice.openStart;
|
|
1383
|
+
for (let content = slice.content, i = 0; ; i++) {
|
|
1384
|
+
let node = content.firstChild;
|
|
1385
|
+
leftNodes.push(node);
|
|
1386
|
+
if (i == slice.openStart)
|
|
1120
1387
|
break;
|
|
1121
|
-
|
|
1388
|
+
content = node.content;
|
|
1122
1389
|
}
|
|
1123
|
-
for (let
|
|
1124
|
-
let
|
|
1125
|
-
if (
|
|
1126
|
-
|
|
1127
|
-
else if (
|
|
1390
|
+
for (let d = preferredDepth - 1; d >= 0; d--) {
|
|
1391
|
+
let leftNode = leftNodes[d], def = definesContent(leftNode.type);
|
|
1392
|
+
if (def && !leftNode.sameMarkup($from.node(Math.abs(preferredTarget) - 1)))
|
|
1393
|
+
preferredDepth = d;
|
|
1394
|
+
else if (def || !leftNode.type.isTextblock)
|
|
1128
1395
|
break;
|
|
1129
1396
|
}
|
|
1130
|
-
for (let
|
|
1131
|
-
let
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1397
|
+
for (let j = slice.openStart; j >= 0; j--) {
|
|
1398
|
+
let openDepth = (j + preferredDepth + 1) % (slice.openStart + 1);
|
|
1399
|
+
let insert = leftNodes[openDepth];
|
|
1400
|
+
if (!insert)
|
|
1401
|
+
continue;
|
|
1402
|
+
for (let i = 0; i < targetDepths.length; i++) {
|
|
1403
|
+
let targetDepth = targetDepths[(i + preferredTargetIndex) % targetDepths.length], expand = true;
|
|
1404
|
+
if (targetDepth < 0) {
|
|
1405
|
+
expand = false;
|
|
1406
|
+
targetDepth = -targetDepth;
|
|
1139
1407
|
}
|
|
1408
|
+
let parent = $from.node(targetDepth - 1), index = $from.index(targetDepth - 1);
|
|
1409
|
+
if (parent.canReplaceWith(index, index, insert.type, insert.marks))
|
|
1410
|
+
return tr.replace($from.before(targetDepth), expand ? $to.after(targetDepth) : to, new Slice(closeFragment(slice.content, 0, slice.openStart, openDepth), openDepth, slice.openEnd));
|
|
1411
|
+
}
|
|
1140
1412
|
}
|
|
1141
|
-
let
|
|
1142
|
-
for (let
|
|
1143
|
-
|
|
1144
|
-
|
|
1413
|
+
let startSteps = tr.steps.length;
|
|
1414
|
+
for (let i = targetDepths.length - 1; i >= 0; i--) {
|
|
1415
|
+
tr.replace(from, to, slice);
|
|
1416
|
+
if (tr.steps.length > startSteps)
|
|
1417
|
+
break;
|
|
1418
|
+
let depth = targetDepths[i];
|
|
1419
|
+
if (depth < 0)
|
|
1420
|
+
continue;
|
|
1421
|
+
from = $from.before(depth);
|
|
1422
|
+
to = $to.after(depth);
|
|
1145
1423
|
}
|
|
1146
1424
|
}
|
|
1147
|
-
function
|
|
1148
|
-
if (
|
|
1149
|
-
let
|
|
1150
|
-
|
|
1425
|
+
function closeFragment(fragment, depth, oldOpen, newOpen, parent) {
|
|
1426
|
+
if (depth < oldOpen) {
|
|
1427
|
+
let first = fragment.firstChild;
|
|
1428
|
+
fragment = fragment.replaceChild(0, first.copy(closeFragment(first.content, depth + 1, oldOpen, newOpen, first)));
|
|
1151
1429
|
}
|
|
1152
|
-
if (
|
|
1153
|
-
let
|
|
1154
|
-
|
|
1430
|
+
if (depth > newOpen) {
|
|
1431
|
+
let match = parent.contentMatchAt(0);
|
|
1432
|
+
let start = match.fillBefore(fragment).append(fragment);
|
|
1433
|
+
fragment = start.append(match.matchFragment(start).fillBefore(Fragment.empty, true));
|
|
1155
1434
|
}
|
|
1156
|
-
return
|
|
1435
|
+
return fragment;
|
|
1157
1436
|
}
|
|
1158
|
-
function
|
|
1159
|
-
if (!
|
|
1160
|
-
let
|
|
1161
|
-
|
|
1437
|
+
function replaceRangeWith(tr, from, to, node) {
|
|
1438
|
+
if (!node.isInline && from == to && tr.doc.resolve(from).parent.content.size) {
|
|
1439
|
+
let point = insertPoint(tr.doc, from, node.type);
|
|
1440
|
+
if (point != null)
|
|
1441
|
+
from = to = point;
|
|
1162
1442
|
}
|
|
1163
|
-
|
|
1443
|
+
tr.replaceRange(from, to, new Slice(Fragment.from(node), 0, 0));
|
|
1164
1444
|
}
|
|
1165
|
-
function
|
|
1166
|
-
let
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1445
|
+
function deleteRange(tr, from, to) {
|
|
1446
|
+
let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);
|
|
1447
|
+
let covered = coveredDepths($from, $to);
|
|
1448
|
+
for (let i = 0; i < covered.length; i++) {
|
|
1449
|
+
let depth = covered[i], last = i == covered.length - 1;
|
|
1450
|
+
if (last && depth == 0 || $from.node(depth).type.contentMatch.validEnd)
|
|
1451
|
+
return tr.delete($from.start(depth), $to.end(depth));
|
|
1452
|
+
if (depth > 0 && (last || $from.node(depth - 1).canReplace($from.index(depth - 1), $to.indexAfter(depth - 1))))
|
|
1453
|
+
return tr.delete($from.before(depth), $to.after(depth));
|
|
1454
|
+
}
|
|
1455
|
+
for (let d = 1; d <= $from.depth && d <= $to.depth; d++) {
|
|
1456
|
+
if (from - $from.start(d) == $from.depth - d && to > $from.end(d) && $to.end(d) - to != $to.depth - d && $from.start(d - 1) == $to.start(d - 1) && $from.node(d - 1).canReplace($from.index(d - 1), $to.index(d - 1)))
|
|
1457
|
+
return tr.delete($from.before(d), to);
|
|
1458
|
+
}
|
|
1459
|
+
tr.delete(from, to);
|
|
1178
1460
|
}
|
|
1179
|
-
function
|
|
1180
|
-
let
|
|
1181
|
-
for (let
|
|
1182
|
-
let
|
|
1183
|
-
if (
|
|
1461
|
+
function coveredDepths($from, $to) {
|
|
1462
|
+
let result = [], minDepth = Math.min($from.depth, $to.depth);
|
|
1463
|
+
for (let d = minDepth; d >= 0; d--) {
|
|
1464
|
+
let start = $from.start(d);
|
|
1465
|
+
if (start < $from.pos - ($from.depth - d) || $to.end(d) > $to.pos + ($to.depth - d) || $from.node(d).type.spec.isolating || $to.node(d).type.spec.isolating)
|
|
1184
1466
|
break;
|
|
1185
|
-
(
|
|
1467
|
+
if (start == $to.start(d) || d == $from.depth && d == $to.depth && $from.parent.inlineContent && $to.parent.inlineContent && d && $to.start(d - 1) == start - 1)
|
|
1468
|
+
result.push(d);
|
|
1186
1469
|
}
|
|
1187
|
-
return
|
|
1470
|
+
return result;
|
|
1188
1471
|
}
|
|
1189
|
-
class
|
|
1472
|
+
class AttrStep extends Step {
|
|
1190
1473
|
/**
|
|
1191
1474
|
Construct an attribute step.
|
|
1192
1475
|
*/
|
|
1193
|
-
constructor(
|
|
1194
|
-
super()
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
let
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
let
|
|
1205
|
-
|
|
1476
|
+
constructor(pos, attr, value) {
|
|
1477
|
+
super();
|
|
1478
|
+
this.pos = pos;
|
|
1479
|
+
this.attr = attr;
|
|
1480
|
+
this.value = value;
|
|
1481
|
+
}
|
|
1482
|
+
apply(doc) {
|
|
1483
|
+
let node = doc.nodeAt(this.pos);
|
|
1484
|
+
if (!node)
|
|
1485
|
+
return StepResult.fail("No node at attribute step's position");
|
|
1486
|
+
let attrs = /* @__PURE__ */ Object.create(null);
|
|
1487
|
+
for (let name in node.attrs)
|
|
1488
|
+
attrs[name] = node.attrs[name];
|
|
1489
|
+
attrs[this.attr] = this.value;
|
|
1490
|
+
let updated = node.type.create(attrs, null, node.marks);
|
|
1491
|
+
return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));
|
|
1206
1492
|
}
|
|
1207
1493
|
getMap() {
|
|
1208
|
-
return
|
|
1494
|
+
return StepMap.empty;
|
|
1209
1495
|
}
|
|
1210
|
-
invert(
|
|
1211
|
-
return new
|
|
1496
|
+
invert(doc) {
|
|
1497
|
+
return new AttrStep(this.pos, this.attr, doc.nodeAt(this.pos).attrs[this.attr]);
|
|
1212
1498
|
}
|
|
1213
|
-
map(
|
|
1214
|
-
let
|
|
1215
|
-
return
|
|
1499
|
+
map(mapping) {
|
|
1500
|
+
let pos = mapping.mapResult(this.pos, 1);
|
|
1501
|
+
return pos.deletedAfter ? null : new AttrStep(pos.pos, this.attr, this.value);
|
|
1216
1502
|
}
|
|
1217
1503
|
toJSON() {
|
|
1218
1504
|
return { stepType: "attr", pos: this.pos, attr: this.attr, value: this.value };
|
|
1219
1505
|
}
|
|
1220
|
-
static fromJSON(
|
|
1221
|
-
if (typeof
|
|
1506
|
+
static fromJSON(schema, json) {
|
|
1507
|
+
if (typeof json.pos != "number" || typeof json.attr != "string")
|
|
1222
1508
|
throw new RangeError("Invalid input for AttrStep.fromJSON");
|
|
1223
|
-
return new
|
|
1509
|
+
return new AttrStep(json.pos, json.attr, json.value);
|
|
1224
1510
|
}
|
|
1225
1511
|
}
|
|
1226
|
-
|
|
1227
|
-
class
|
|
1512
|
+
Step.jsonID("attr", AttrStep);
|
|
1513
|
+
class DocAttrStep extends Step {
|
|
1228
1514
|
/**
|
|
1229
1515
|
Construct an attribute step.
|
|
1230
1516
|
*/
|
|
1231
|
-
constructor(
|
|
1232
|
-
super()
|
|
1517
|
+
constructor(attr, value) {
|
|
1518
|
+
super();
|
|
1519
|
+
this.attr = attr;
|
|
1520
|
+
this.value = value;
|
|
1233
1521
|
}
|
|
1234
|
-
apply(
|
|
1235
|
-
let
|
|
1236
|
-
for (let
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
let
|
|
1240
|
-
return
|
|
1522
|
+
apply(doc) {
|
|
1523
|
+
let attrs = /* @__PURE__ */ Object.create(null);
|
|
1524
|
+
for (let name in doc.attrs)
|
|
1525
|
+
attrs[name] = doc.attrs[name];
|
|
1526
|
+
attrs[this.attr] = this.value;
|
|
1527
|
+
let updated = doc.type.create(attrs, doc.content, doc.marks);
|
|
1528
|
+
return StepResult.ok(updated);
|
|
1241
1529
|
}
|
|
1242
1530
|
getMap() {
|
|
1243
|
-
return
|
|
1531
|
+
return StepMap.empty;
|
|
1244
1532
|
}
|
|
1245
|
-
invert(
|
|
1246
|
-
return new
|
|
1533
|
+
invert(doc) {
|
|
1534
|
+
return new DocAttrStep(this.attr, doc.attrs[this.attr]);
|
|
1247
1535
|
}
|
|
1248
|
-
map(
|
|
1536
|
+
map(mapping) {
|
|
1249
1537
|
return this;
|
|
1250
1538
|
}
|
|
1251
1539
|
toJSON() {
|
|
1252
1540
|
return { stepType: "docAttr", attr: this.attr, value: this.value };
|
|
1253
1541
|
}
|
|
1254
|
-
static fromJSON(
|
|
1255
|
-
if (typeof
|
|
1542
|
+
static fromJSON(schema, json) {
|
|
1543
|
+
if (typeof json.attr != "string")
|
|
1256
1544
|
throw new RangeError("Invalid input for DocAttrStep.fromJSON");
|
|
1257
|
-
return new
|
|
1545
|
+
return new DocAttrStep(json.attr, json.value);
|
|
1258
1546
|
}
|
|
1259
1547
|
}
|
|
1260
|
-
|
|
1261
|
-
let
|
|
1548
|
+
Step.jsonID("docAttr", DocAttrStep);
|
|
1549
|
+
let TransformError = class extends Error {
|
|
1262
1550
|
};
|
|
1263
|
-
|
|
1264
|
-
let
|
|
1265
|
-
|
|
1551
|
+
TransformError = function TransformError2(message) {
|
|
1552
|
+
let err = Error.call(this, message);
|
|
1553
|
+
err.__proto__ = TransformError2.prototype;
|
|
1554
|
+
return err;
|
|
1266
1555
|
};
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
class
|
|
1556
|
+
TransformError.prototype = Object.create(Error.prototype);
|
|
1557
|
+
TransformError.prototype.constructor = TransformError;
|
|
1558
|
+
TransformError.prototype.name = "TransformError";
|
|
1559
|
+
class Transform {
|
|
1271
1560
|
/**
|
|
1272
1561
|
Create a transform that starts with the given document.
|
|
1273
1562
|
*/
|
|
1274
|
-
constructor(
|
|
1275
|
-
this.doc =
|
|
1563
|
+
constructor(doc) {
|
|
1564
|
+
this.doc = doc;
|
|
1565
|
+
this.steps = [];
|
|
1566
|
+
this.docs = [];
|
|
1567
|
+
this.mapping = new Mapping();
|
|
1276
1568
|
}
|
|
1277
1569
|
/**
|
|
1278
1570
|
The starting document.
|
|
@@ -1284,19 +1576,21 @@ class De {
|
|
|
1284
1576
|
Apply a new step in this transform, saving the result. Throws an
|
|
1285
1577
|
error when the step fails.
|
|
1286
1578
|
*/
|
|
1287
|
-
step(
|
|
1288
|
-
let
|
|
1289
|
-
if (
|
|
1290
|
-
throw new
|
|
1579
|
+
step(step) {
|
|
1580
|
+
let result = this.maybeStep(step);
|
|
1581
|
+
if (result.failed)
|
|
1582
|
+
throw new TransformError(result.failed);
|
|
1291
1583
|
return this;
|
|
1292
1584
|
}
|
|
1293
1585
|
/**
|
|
1294
1586
|
Try to apply a step in this transformation, ignoring it if it
|
|
1295
1587
|
fails. Returns the step result.
|
|
1296
1588
|
*/
|
|
1297
|
-
maybeStep(
|
|
1298
|
-
let
|
|
1299
|
-
|
|
1589
|
+
maybeStep(step) {
|
|
1590
|
+
let result = step.apply(this.doc);
|
|
1591
|
+
if (!result.failed)
|
|
1592
|
+
this.addStep(step, result.doc);
|
|
1593
|
+
return result;
|
|
1300
1594
|
}
|
|
1301
1595
|
/**
|
|
1302
1596
|
True when the document has been changed (when there are any
|
|
@@ -1308,35 +1602,40 @@ class De {
|
|
|
1308
1602
|
/**
|
|
1309
1603
|
@internal
|
|
1310
1604
|
*/
|
|
1311
|
-
addStep(
|
|
1312
|
-
this.docs.push(this.doc)
|
|
1605
|
+
addStep(step, doc) {
|
|
1606
|
+
this.docs.push(this.doc);
|
|
1607
|
+
this.steps.push(step);
|
|
1608
|
+
this.mapping.appendMap(step.getMap());
|
|
1609
|
+
this.doc = doc;
|
|
1313
1610
|
}
|
|
1314
1611
|
/**
|
|
1315
1612
|
Replace the part of the document between `from` and `to` with the
|
|
1316
1613
|
given `slice`.
|
|
1317
1614
|
*/
|
|
1318
|
-
replace(
|
|
1319
|
-
let
|
|
1320
|
-
|
|
1615
|
+
replace(from, to = from, slice = Slice.empty) {
|
|
1616
|
+
let step = replaceStep(this.doc, from, to, slice);
|
|
1617
|
+
if (step)
|
|
1618
|
+
this.step(step);
|
|
1619
|
+
return this;
|
|
1321
1620
|
}
|
|
1322
1621
|
/**
|
|
1323
1622
|
Replace the given range with the given content, which may be a
|
|
1324
1623
|
fragment, node, or array of nodes.
|
|
1325
1624
|
*/
|
|
1326
|
-
replaceWith(
|
|
1327
|
-
return this.replace(
|
|
1625
|
+
replaceWith(from, to, content) {
|
|
1626
|
+
return this.replace(from, to, new Slice(Fragment.from(content), 0, 0));
|
|
1328
1627
|
}
|
|
1329
1628
|
/**
|
|
1330
1629
|
Delete the content between the given positions.
|
|
1331
1630
|
*/
|
|
1332
|
-
delete(
|
|
1333
|
-
return this.replace(
|
|
1631
|
+
delete(from, to) {
|
|
1632
|
+
return this.replace(from, to, Slice.empty);
|
|
1334
1633
|
}
|
|
1335
1634
|
/**
|
|
1336
1635
|
Insert the given content at the given position.
|
|
1337
1636
|
*/
|
|
1338
|
-
insert(
|
|
1339
|
-
return this.replaceWith(
|
|
1637
|
+
insert(pos, content) {
|
|
1638
|
+
return this.replaceWith(pos, pos, content);
|
|
1340
1639
|
}
|
|
1341
1640
|
/**
|
|
1342
1641
|
Replace a range of the document with a given slice, using
|
|
@@ -1357,8 +1656,9 @@ class De {
|
|
|
1357
1656
|
range, and is useful in situations where you need more precise
|
|
1358
1657
|
control over what happens.
|
|
1359
1658
|
*/
|
|
1360
|
-
replaceRange(
|
|
1361
|
-
|
|
1659
|
+
replaceRange(from, to, slice) {
|
|
1660
|
+
replaceRange(this, from, to, slice);
|
|
1661
|
+
return this;
|
|
1362
1662
|
}
|
|
1363
1663
|
/**
|
|
1364
1664
|
Replace the given range with a node, but use `from` and `to` as
|
|
@@ -1369,15 +1669,17 @@ class De {
|
|
|
1369
1669
|
completely covers a parent node, this method may completely replace
|
|
1370
1670
|
that parent node.
|
|
1371
1671
|
*/
|
|
1372
|
-
replaceRangeWith(
|
|
1373
|
-
|
|
1672
|
+
replaceRangeWith(from, to, node) {
|
|
1673
|
+
replaceRangeWith(this, from, to, node);
|
|
1674
|
+
return this;
|
|
1374
1675
|
}
|
|
1375
1676
|
/**
|
|
1376
1677
|
Delete the given range, expanding it to cover fully covered
|
|
1377
1678
|
parent nodes until a valid replace is found.
|
|
1378
1679
|
*/
|
|
1379
|
-
deleteRange(
|
|
1380
|
-
|
|
1680
|
+
deleteRange(from, to) {
|
|
1681
|
+
deleteRange(this, from, to);
|
|
1682
|
+
return this;
|
|
1381
1683
|
}
|
|
1382
1684
|
/**
|
|
1383
1685
|
Split the content in the given range off from its parent, if there
|
|
@@ -1386,74 +1688,85 @@ class De {
|
|
|
1386
1688
|
[`liftTarget`](https://prosemirror.net/docs/ref/#transform.liftTarget) to compute `target`, to make
|
|
1387
1689
|
sure the lift is valid.
|
|
1388
1690
|
*/
|
|
1389
|
-
lift(
|
|
1390
|
-
|
|
1691
|
+
lift(range, target) {
|
|
1692
|
+
lift(this, range, target);
|
|
1693
|
+
return this;
|
|
1391
1694
|
}
|
|
1392
1695
|
/**
|
|
1393
1696
|
Join the blocks around the given position. If depth is 2, their
|
|
1394
1697
|
last and first siblings are also joined, and so on.
|
|
1395
1698
|
*/
|
|
1396
|
-
join(
|
|
1397
|
-
|
|
1699
|
+
join(pos, depth = 1) {
|
|
1700
|
+
join(this, pos, depth);
|
|
1701
|
+
return this;
|
|
1398
1702
|
}
|
|
1399
1703
|
/**
|
|
1400
1704
|
Wrap the given [range](https://prosemirror.net/docs/ref/#model.NodeRange) in the given set of wrappers.
|
|
1401
1705
|
The wrappers are assumed to be valid in this position, and should
|
|
1402
1706
|
probably be computed with [`findWrapping`](https://prosemirror.net/docs/ref/#transform.findWrapping).
|
|
1403
1707
|
*/
|
|
1404
|
-
wrap(
|
|
1405
|
-
|
|
1708
|
+
wrap(range, wrappers) {
|
|
1709
|
+
wrap(this, range, wrappers);
|
|
1710
|
+
return this;
|
|
1406
1711
|
}
|
|
1407
1712
|
/**
|
|
1408
1713
|
Set the type of all textblocks (partly) between `from` and `to` to
|
|
1409
1714
|
the given node type with the given attributes.
|
|
1410
1715
|
*/
|
|
1411
|
-
setBlockType(
|
|
1412
|
-
|
|
1716
|
+
setBlockType(from, to = from, type, attrs = null) {
|
|
1717
|
+
setBlockType(this, from, to, type, attrs);
|
|
1718
|
+
return this;
|
|
1413
1719
|
}
|
|
1414
1720
|
/**
|
|
1415
1721
|
Change the type, attributes, and/or marks of the node at `pos`.
|
|
1416
1722
|
When `type` isn't given, the existing node type is preserved,
|
|
1417
1723
|
*/
|
|
1418
|
-
setNodeMarkup(
|
|
1419
|
-
|
|
1724
|
+
setNodeMarkup(pos, type, attrs = null, marks) {
|
|
1725
|
+
setNodeMarkup(this, pos, type, attrs, marks);
|
|
1726
|
+
return this;
|
|
1420
1727
|
}
|
|
1421
1728
|
/**
|
|
1422
1729
|
Set a single attribute on a given node to a new value.
|
|
1423
1730
|
The `pos` addresses the document content. Use `setDocAttribute`
|
|
1424
1731
|
to set attributes on the document itself.
|
|
1425
1732
|
*/
|
|
1426
|
-
setNodeAttribute(
|
|
1427
|
-
|
|
1733
|
+
setNodeAttribute(pos, attr, value) {
|
|
1734
|
+
this.step(new AttrStep(pos, attr, value));
|
|
1735
|
+
return this;
|
|
1428
1736
|
}
|
|
1429
1737
|
/**
|
|
1430
1738
|
Set a single attribute on the document to a new value.
|
|
1431
1739
|
*/
|
|
1432
|
-
setDocAttribute(
|
|
1433
|
-
|
|
1740
|
+
setDocAttribute(attr, value) {
|
|
1741
|
+
this.step(new DocAttrStep(attr, value));
|
|
1742
|
+
return this;
|
|
1434
1743
|
}
|
|
1435
1744
|
/**
|
|
1436
1745
|
Add a mark to the node at position `pos`.
|
|
1437
1746
|
*/
|
|
1438
|
-
addNodeMark(
|
|
1439
|
-
|
|
1747
|
+
addNodeMark(pos, mark) {
|
|
1748
|
+
this.step(new AddNodeMarkStep(pos, mark));
|
|
1749
|
+
return this;
|
|
1440
1750
|
}
|
|
1441
1751
|
/**
|
|
1442
1752
|
Remove a mark (or all marks of the given type) from the node at
|
|
1443
1753
|
position `pos`.
|
|
1444
1754
|
*/
|
|
1445
|
-
removeNodeMark(
|
|
1446
|
-
let
|
|
1447
|
-
if (!
|
|
1448
|
-
throw new RangeError("No node at position " +
|
|
1449
|
-
if (
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1755
|
+
removeNodeMark(pos, mark) {
|
|
1756
|
+
let node = this.doc.nodeAt(pos);
|
|
1757
|
+
if (!node)
|
|
1758
|
+
throw new RangeError("No node at position " + pos);
|
|
1759
|
+
if (mark instanceof Mark) {
|
|
1760
|
+
if (mark.isInSet(node.marks))
|
|
1761
|
+
this.step(new RemoveNodeMarkStep(pos, mark));
|
|
1762
|
+
} else {
|
|
1763
|
+
let set = node.marks, found, steps = [];
|
|
1764
|
+
while (found = mark.isInSet(set)) {
|
|
1765
|
+
steps.push(new RemoveNodeMarkStep(pos, found));
|
|
1766
|
+
set = found.removeFromSet(set);
|
|
1767
|
+
}
|
|
1768
|
+
for (let i = steps.length - 1; i >= 0; i--)
|
|
1769
|
+
this.step(steps[i]);
|
|
1457
1770
|
}
|
|
1458
1771
|
return this;
|
|
1459
1772
|
}
|
|
@@ -1464,14 +1777,16 @@ class De {
|
|
|
1464
1777
|
This can be changed by passing an array of types and attributes to
|
|
1465
1778
|
use after the split (with the outermost nodes coming first).
|
|
1466
1779
|
*/
|
|
1467
|
-
split(
|
|
1468
|
-
|
|
1780
|
+
split(pos, depth = 1, typesAfter) {
|
|
1781
|
+
split(this, pos, depth, typesAfter);
|
|
1782
|
+
return this;
|
|
1469
1783
|
}
|
|
1470
1784
|
/**
|
|
1471
1785
|
Add the given mark to the inline content between `from` and `to`.
|
|
1472
1786
|
*/
|
|
1473
|
-
addMark(
|
|
1474
|
-
|
|
1787
|
+
addMark(from, to, mark) {
|
|
1788
|
+
addMark(this, from, to, mark);
|
|
1789
|
+
return this;
|
|
1475
1790
|
}
|
|
1476
1791
|
/**
|
|
1477
1792
|
Remove marks from inline nodes between `from` and `to`. When
|
|
@@ -1479,8 +1794,9 @@ class De {
|
|
|
1479
1794
|
a mark type, remove all marks of that type. When it is null,
|
|
1480
1795
|
remove all marks of any type.
|
|
1481
1796
|
*/
|
|
1482
|
-
removeMark(
|
|
1483
|
-
|
|
1797
|
+
removeMark(from, to, mark) {
|
|
1798
|
+
removeMark(this, from, to, mark);
|
|
1799
|
+
return this;
|
|
1484
1800
|
}
|
|
1485
1801
|
/**
|
|
1486
1802
|
Removes all marks and nodes from the content of the node at
|
|
@@ -1488,20 +1804,21 @@ class De {
|
|
|
1488
1804
|
an optional starting [content match](https://prosemirror.net/docs/ref/#model.ContentMatch) as
|
|
1489
1805
|
third argument.
|
|
1490
1806
|
*/
|
|
1491
|
-
clearIncompatible(
|
|
1492
|
-
|
|
1807
|
+
clearIncompatible(pos, parentType, match) {
|
|
1808
|
+
clearIncompatible(this, pos, parentType, match);
|
|
1809
|
+
return this;
|
|
1493
1810
|
}
|
|
1494
1811
|
}
|
|
1495
1812
|
export {
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1813
|
+
Mapping as M,
|
|
1814
|
+
ReplaceStep as R,
|
|
1815
|
+
Transform as T,
|
|
1816
|
+
canSplit as a,
|
|
1817
|
+
ReplaceAroundStep as b,
|
|
1818
|
+
canJoin as c,
|
|
1819
|
+
dropPoint as d,
|
|
1820
|
+
findWrapping as f,
|
|
1821
|
+
joinPoint as j,
|
|
1822
|
+
liftTarget as l,
|
|
1823
|
+
replaceStep as r
|
|
1507
1824
|
};
|