@fewangsit/wangsvue 1.5.219-alpha.1 → 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 +1 -1
- 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 +67705 -0
- 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-DbLuqCHa.js +0 -1
- package/loading-plane-CgfbWppy.js +0 -1
- package/loading-table-Bdr9ZhtP.js +0 -1
- package/loading-table-BzrSQlA0.js +0 -1
- package/loading-table-chOgXi94.js +0 -1
- package/no-data-Cgze_Rvp.js +0 -1
- package/no-data-Dep79CBh.js +0 -1
- 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,14 +1,16 @@
|
|
|
1
|
-
import { b as
|
|
2
|
-
import { R as
|
|
3
|
-
const
|
|
4
|
-
class
|
|
1
|
+
import { b as Slice, F as Fragment, N as Node, M as Mark } from "../../prosemirror-model/dist/index.es.js";
|
|
2
|
+
import { R as ReplaceStep, b as ReplaceAroundStep, T as Transform } from "../../prosemirror-transform/dist/index.es.js";
|
|
3
|
+
const classesById = /* @__PURE__ */ Object.create(null);
|
|
4
|
+
class Selection {
|
|
5
5
|
/**
|
|
6
6
|
Initialize a selection with the head and anchor and ranges. If no
|
|
7
7
|
ranges are given, constructs a single range across `$anchor` and
|
|
8
8
|
`$head`.
|
|
9
9
|
*/
|
|
10
|
-
constructor(
|
|
11
|
-
this.$anchor =
|
|
10
|
+
constructor($anchor, $head, ranges) {
|
|
11
|
+
this.$anchor = $anchor;
|
|
12
|
+
this.$head = $head;
|
|
13
|
+
this.ranges = ranges || [new SelectionRange($anchor.min($head), $anchor.max($head))];
|
|
12
14
|
}
|
|
13
15
|
/**
|
|
14
16
|
The selection's anchor, as an unresolved position.
|
|
@@ -50,41 +52,51 @@ class l {
|
|
|
50
52
|
Indicates whether the selection contains any content.
|
|
51
53
|
*/
|
|
52
54
|
get empty() {
|
|
53
|
-
let
|
|
54
|
-
for (let
|
|
55
|
-
if (
|
|
56
|
-
return
|
|
57
|
-
return
|
|
55
|
+
let ranges = this.ranges;
|
|
56
|
+
for (let i = 0; i < ranges.length; i++)
|
|
57
|
+
if (ranges[i].$from.pos != ranges[i].$to.pos)
|
|
58
|
+
return false;
|
|
59
|
+
return true;
|
|
58
60
|
}
|
|
59
61
|
/**
|
|
60
62
|
Get the content of this selection as a slice.
|
|
61
63
|
*/
|
|
62
64
|
content() {
|
|
63
|
-
return this.$from.doc.slice(this.from, this.to,
|
|
65
|
+
return this.$from.doc.slice(this.from, this.to, true);
|
|
64
66
|
}
|
|
65
67
|
/**
|
|
66
68
|
Replace the selection with a slice or, if no slice is given,
|
|
67
69
|
delete the selection. Will append to the given transaction.
|
|
68
70
|
*/
|
|
69
|
-
replace(
|
|
70
|
-
let
|
|
71
|
-
for (let
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
replace(tr, content = Slice.empty) {
|
|
72
|
+
let lastNode = content.content.lastChild, lastParent = null;
|
|
73
|
+
for (let i = 0; i < content.openEnd; i++) {
|
|
74
|
+
lastParent = lastNode;
|
|
75
|
+
lastNode = lastNode.lastChild;
|
|
76
|
+
}
|
|
77
|
+
let mapFrom = tr.steps.length, ranges = this.ranges;
|
|
78
|
+
for (let i = 0; i < ranges.length; i++) {
|
|
79
|
+
let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);
|
|
80
|
+
tr.replaceRange(mapping.map($from.pos), mapping.map($to.pos), i ? Slice.empty : content);
|
|
81
|
+
if (i == 0)
|
|
82
|
+
selectionToInsertionEnd(tr, mapFrom, (lastNode ? lastNode.isInline : lastParent && lastParent.isTextblock) ? -1 : 1);
|
|
77
83
|
}
|
|
78
84
|
}
|
|
79
85
|
/**
|
|
80
86
|
Replace the selection with the given node, appending the changes
|
|
81
87
|
to the given transaction.
|
|
82
88
|
*/
|
|
83
|
-
replaceWith(
|
|
84
|
-
let
|
|
85
|
-
for (let
|
|
86
|
-
let { $from
|
|
87
|
-
|
|
89
|
+
replaceWith(tr, node) {
|
|
90
|
+
let mapFrom = tr.steps.length, ranges = this.ranges;
|
|
91
|
+
for (let i = 0; i < ranges.length; i++) {
|
|
92
|
+
let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);
|
|
93
|
+
let from = mapping.map($from.pos), to = mapping.map($to.pos);
|
|
94
|
+
if (i) {
|
|
95
|
+
tr.deleteRange(from, to);
|
|
96
|
+
} else {
|
|
97
|
+
tr.replaceRangeWith(from, to, node);
|
|
98
|
+
selectionToInsertionEnd(tr, mapFrom, node.isInline ? -1 : 1);
|
|
99
|
+
}
|
|
88
100
|
}
|
|
89
101
|
}
|
|
90
102
|
/**
|
|
@@ -94,14 +106,14 @@ class l {
|
|
|
94
106
|
selections. Will return null when no valid selection position is
|
|
95
107
|
found.
|
|
96
108
|
*/
|
|
97
|
-
static findFrom(
|
|
98
|
-
let
|
|
99
|
-
if (
|
|
100
|
-
return
|
|
101
|
-
for (let
|
|
102
|
-
let
|
|
103
|
-
if (
|
|
104
|
-
return
|
|
109
|
+
static findFrom($pos, dir, textOnly = false) {
|
|
110
|
+
let inner = $pos.parent.inlineContent ? new TextSelection($pos) : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly);
|
|
111
|
+
if (inner)
|
|
112
|
+
return inner;
|
|
113
|
+
for (let depth = $pos.depth - 1; depth >= 0; depth--) {
|
|
114
|
+
let found = dir < 0 ? findSelectionIn($pos.node(0), $pos.node(depth), $pos.before(depth + 1), $pos.index(depth), dir, textOnly) : findSelectionIn($pos.node(0), $pos.node(depth), $pos.after(depth + 1), $pos.index(depth) + 1, dir, textOnly);
|
|
115
|
+
if (found)
|
|
116
|
+
return found;
|
|
105
117
|
}
|
|
106
118
|
return null;
|
|
107
119
|
}
|
|
@@ -110,8 +122,8 @@ class l {
|
|
|
110
122
|
position. Searches forward first by default, but if `bias` is
|
|
111
123
|
negative, it will search backwards first.
|
|
112
124
|
*/
|
|
113
|
-
static near(
|
|
114
|
-
return this.findFrom(
|
|
125
|
+
static near($pos, bias = 1) {
|
|
126
|
+
return this.findFrom($pos, bias) || this.findFrom($pos, -bias) || new AllSelection($pos.node(0));
|
|
115
127
|
}
|
|
116
128
|
/**
|
|
117
129
|
Find the cursor or leaf node selection closest to the start of
|
|
@@ -119,27 +131,27 @@ class l {
|
|
|
119
131
|
[`AllSelection`](https://prosemirror.net/docs/ref/#state.AllSelection) if no valid position
|
|
120
132
|
exists.
|
|
121
133
|
*/
|
|
122
|
-
static atStart(
|
|
123
|
-
return
|
|
134
|
+
static atStart(doc) {
|
|
135
|
+
return findSelectionIn(doc, doc, 0, 0, 1) || new AllSelection(doc);
|
|
124
136
|
}
|
|
125
137
|
/**
|
|
126
138
|
Find the cursor or leaf node selection closest to the end of the
|
|
127
139
|
given document.
|
|
128
140
|
*/
|
|
129
|
-
static atEnd(
|
|
130
|
-
return
|
|
141
|
+
static atEnd(doc) {
|
|
142
|
+
return findSelectionIn(doc, doc, doc.content.size, doc.childCount, -1) || new AllSelection(doc);
|
|
131
143
|
}
|
|
132
144
|
/**
|
|
133
145
|
Deserialize the JSON representation of a selection. Must be
|
|
134
146
|
implemented for custom classes (as a static class method).
|
|
135
147
|
*/
|
|
136
|
-
static fromJSON(
|
|
137
|
-
if (!
|
|
148
|
+
static fromJSON(doc, json) {
|
|
149
|
+
if (!json || !json.type)
|
|
138
150
|
throw new RangeError("Invalid input for Selection.fromJSON");
|
|
139
|
-
let
|
|
140
|
-
if (!
|
|
141
|
-
throw new RangeError(`No selection type ${
|
|
142
|
-
return
|
|
151
|
+
let cls = classesById[json.type];
|
|
152
|
+
if (!cls)
|
|
153
|
+
throw new RangeError(`No selection type ${json.type} defined`);
|
|
154
|
+
return cls.fromJSON(doc, json);
|
|
143
155
|
}
|
|
144
156
|
/**
|
|
145
157
|
To be able to deserialize selections from JSON, custom selection
|
|
@@ -147,10 +159,12 @@ class l {
|
|
|
147
159
|
can be disambiguated. Try to pick something that's unlikely to
|
|
148
160
|
clash with classes from other modules.
|
|
149
161
|
*/
|
|
150
|
-
static jsonID(
|
|
151
|
-
if (
|
|
152
|
-
throw new RangeError("Duplicate use of selection JSON ID " +
|
|
153
|
-
|
|
162
|
+
static jsonID(id, selectionClass) {
|
|
163
|
+
if (id in classesById)
|
|
164
|
+
throw new RangeError("Duplicate use of selection JSON ID " + id);
|
|
165
|
+
classesById[id] = selectionClass;
|
|
166
|
+
selectionClass.prototype.jsonID = id;
|
|
167
|
+
return selectionClass;
|
|
154
168
|
}
|
|
155
169
|
/**
|
|
156
170
|
Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection,
|
|
@@ -162,28 +176,34 @@ class l {
|
|
|
162
176
|
returns the bookmark for that.
|
|
163
177
|
*/
|
|
164
178
|
getBookmark() {
|
|
165
|
-
return
|
|
179
|
+
return TextSelection.between(this.$anchor, this.$head).getBookmark();
|
|
166
180
|
}
|
|
167
181
|
}
|
|
168
|
-
|
|
169
|
-
class
|
|
182
|
+
Selection.prototype.visible = true;
|
|
183
|
+
class SelectionRange {
|
|
170
184
|
/**
|
|
171
185
|
Create a range.
|
|
172
186
|
*/
|
|
173
|
-
constructor(
|
|
174
|
-
this.$from =
|
|
187
|
+
constructor($from, $to) {
|
|
188
|
+
this.$from = $from;
|
|
189
|
+
this.$to = $to;
|
|
175
190
|
}
|
|
176
191
|
}
|
|
177
|
-
let
|
|
178
|
-
function
|
|
179
|
-
!
|
|
192
|
+
let warnedAboutTextSelection = false;
|
|
193
|
+
function checkTextSelection($pos) {
|
|
194
|
+
if (!warnedAboutTextSelection && !$pos.parent.inlineContent) {
|
|
195
|
+
warnedAboutTextSelection = true;
|
|
196
|
+
console["warn"]("TextSelection endpoint not pointing into a node with inline content (" + $pos.parent.type.name + ")");
|
|
197
|
+
}
|
|
180
198
|
}
|
|
181
|
-
class
|
|
199
|
+
class TextSelection extends Selection {
|
|
182
200
|
/**
|
|
183
201
|
Construct a text selection between the given points.
|
|
184
202
|
*/
|
|
185
|
-
constructor(
|
|
186
|
-
|
|
203
|
+
constructor($anchor, $head = $anchor) {
|
|
204
|
+
checkTextSelection($anchor);
|
|
205
|
+
checkTextSelection($head);
|
|
206
|
+
super($anchor, $head);
|
|
187
207
|
}
|
|
188
208
|
/**
|
|
189
209
|
Returns a resolved position if this is a cursor selection (an
|
|
@@ -192,24 +212,26 @@ class f extends l {
|
|
|
192
212
|
get $cursor() {
|
|
193
213
|
return this.$anchor.pos == this.$head.pos ? this.$head : null;
|
|
194
214
|
}
|
|
195
|
-
map(
|
|
196
|
-
let
|
|
197
|
-
if (
|
|
198
|
-
return
|
|
199
|
-
let
|
|
200
|
-
return new
|
|
201
|
-
}
|
|
202
|
-
replace(
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
215
|
+
map(doc, mapping) {
|
|
216
|
+
let $head = doc.resolve(mapping.map(this.head));
|
|
217
|
+
if (!$head.parent.inlineContent)
|
|
218
|
+
return Selection.near($head);
|
|
219
|
+
let $anchor = doc.resolve(mapping.map(this.anchor));
|
|
220
|
+
return new TextSelection($anchor.parent.inlineContent ? $anchor : $head, $head);
|
|
221
|
+
}
|
|
222
|
+
replace(tr, content = Slice.empty) {
|
|
223
|
+
super.replace(tr, content);
|
|
224
|
+
if (content == Slice.empty) {
|
|
225
|
+
let marks = this.$from.marksAcross(this.$to);
|
|
226
|
+
if (marks)
|
|
227
|
+
tr.ensureMarks(marks);
|
|
206
228
|
}
|
|
207
229
|
}
|
|
208
|
-
eq(
|
|
209
|
-
return
|
|
230
|
+
eq(other) {
|
|
231
|
+
return other instanceof TextSelection && other.anchor == this.anchor && other.head == this.head;
|
|
210
232
|
}
|
|
211
233
|
getBookmark() {
|
|
212
|
-
return new
|
|
234
|
+
return new TextBookmark(this.anchor, this.head);
|
|
213
235
|
}
|
|
214
236
|
toJSON() {
|
|
215
237
|
return { type: "text", anchor: this.anchor, head: this.head };
|
|
@@ -217,17 +239,17 @@ class f extends l {
|
|
|
217
239
|
/**
|
|
218
240
|
@internal
|
|
219
241
|
*/
|
|
220
|
-
static fromJSON(
|
|
221
|
-
if (typeof
|
|
242
|
+
static fromJSON(doc, json) {
|
|
243
|
+
if (typeof json.anchor != "number" || typeof json.head != "number")
|
|
222
244
|
throw new RangeError("Invalid input for TextSelection.fromJSON");
|
|
223
|
-
return new
|
|
245
|
+
return new TextSelection(doc.resolve(json.anchor), doc.resolve(json.head));
|
|
224
246
|
}
|
|
225
247
|
/**
|
|
226
248
|
Create a text selection from non-resolved positions.
|
|
227
249
|
*/
|
|
228
|
-
static create(
|
|
229
|
-
let
|
|
230
|
-
return new this(
|
|
250
|
+
static create(doc, anchor, head = anchor) {
|
|
251
|
+
let $anchor = doc.resolve(anchor);
|
|
252
|
+
return new this($anchor, head == anchor ? $anchor : doc.resolve(head));
|
|
231
253
|
}
|
|
232
254
|
/**
|
|
233
255
|
Return a text selection that spans the given positions or, if
|
|
@@ -237,106 +259,127 @@ class f extends l {
|
|
|
237
259
|
[`Selection.near`](https://prosemirror.net/docs/ref/#state.Selection^near) when the document
|
|
238
260
|
doesn't contain a valid text position.
|
|
239
261
|
*/
|
|
240
|
-
static between(
|
|
241
|
-
let
|
|
242
|
-
if (
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
262
|
+
static between($anchor, $head, bias) {
|
|
263
|
+
let dPos = $anchor.pos - $head.pos;
|
|
264
|
+
if (!bias || dPos)
|
|
265
|
+
bias = dPos >= 0 ? 1 : -1;
|
|
266
|
+
if (!$head.parent.inlineContent) {
|
|
267
|
+
let found = Selection.findFrom($head, bias, true) || Selection.findFrom($head, -bias, true);
|
|
268
|
+
if (found)
|
|
269
|
+
$head = found.$head;
|
|
246
270
|
else
|
|
247
|
-
return
|
|
271
|
+
return Selection.near($head, bias);
|
|
248
272
|
}
|
|
249
|
-
|
|
273
|
+
if (!$anchor.parent.inlineContent) {
|
|
274
|
+
if (dPos == 0) {
|
|
275
|
+
$anchor = $head;
|
|
276
|
+
} else {
|
|
277
|
+
$anchor = (Selection.findFrom($anchor, -bias, true) || Selection.findFrom($anchor, bias, true)).$anchor;
|
|
278
|
+
if ($anchor.pos < $head.pos != dPos < 0)
|
|
279
|
+
$anchor = $head;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return new TextSelection($anchor, $head);
|
|
250
283
|
}
|
|
251
284
|
}
|
|
252
|
-
|
|
253
|
-
class
|
|
254
|
-
constructor(
|
|
255
|
-
this.anchor =
|
|
285
|
+
Selection.jsonID("text", TextSelection);
|
|
286
|
+
class TextBookmark {
|
|
287
|
+
constructor(anchor, head) {
|
|
288
|
+
this.anchor = anchor;
|
|
289
|
+
this.head = head;
|
|
256
290
|
}
|
|
257
|
-
map(
|
|
258
|
-
return new
|
|
291
|
+
map(mapping) {
|
|
292
|
+
return new TextBookmark(mapping.map(this.anchor), mapping.map(this.head));
|
|
259
293
|
}
|
|
260
|
-
resolve(
|
|
261
|
-
return
|
|
294
|
+
resolve(doc) {
|
|
295
|
+
return TextSelection.between(doc.resolve(this.anchor), doc.resolve(this.head));
|
|
262
296
|
}
|
|
263
297
|
}
|
|
264
|
-
class
|
|
298
|
+
class NodeSelection extends Selection {
|
|
265
299
|
/**
|
|
266
300
|
Create a node selection. Does not verify the validity of its
|
|
267
301
|
argument.
|
|
268
302
|
*/
|
|
269
|
-
constructor(
|
|
270
|
-
let
|
|
271
|
-
|
|
303
|
+
constructor($pos) {
|
|
304
|
+
let node = $pos.nodeAfter;
|
|
305
|
+
let $end = $pos.node(0).resolve($pos.pos + node.nodeSize);
|
|
306
|
+
super($pos, $end);
|
|
307
|
+
this.node = node;
|
|
272
308
|
}
|
|
273
|
-
map(
|
|
274
|
-
let { deleted
|
|
275
|
-
|
|
309
|
+
map(doc, mapping) {
|
|
310
|
+
let { deleted, pos } = mapping.mapResult(this.anchor);
|
|
311
|
+
let $pos = doc.resolve(pos);
|
|
312
|
+
if (deleted)
|
|
313
|
+
return Selection.near($pos);
|
|
314
|
+
return new NodeSelection($pos);
|
|
276
315
|
}
|
|
277
316
|
content() {
|
|
278
|
-
return new
|
|
317
|
+
return new Slice(Fragment.from(this.node), 0, 0);
|
|
279
318
|
}
|
|
280
|
-
eq(
|
|
281
|
-
return
|
|
319
|
+
eq(other) {
|
|
320
|
+
return other instanceof NodeSelection && other.anchor == this.anchor;
|
|
282
321
|
}
|
|
283
322
|
toJSON() {
|
|
284
323
|
return { type: "node", anchor: this.anchor };
|
|
285
324
|
}
|
|
286
325
|
getBookmark() {
|
|
287
|
-
return new
|
|
326
|
+
return new NodeBookmark(this.anchor);
|
|
288
327
|
}
|
|
289
328
|
/**
|
|
290
329
|
@internal
|
|
291
330
|
*/
|
|
292
|
-
static fromJSON(
|
|
293
|
-
if (typeof
|
|
331
|
+
static fromJSON(doc, json) {
|
|
332
|
+
if (typeof json.anchor != "number")
|
|
294
333
|
throw new RangeError("Invalid input for NodeSelection.fromJSON");
|
|
295
|
-
return new
|
|
334
|
+
return new NodeSelection(doc.resolve(json.anchor));
|
|
296
335
|
}
|
|
297
336
|
/**
|
|
298
337
|
Create a node selection from non-resolved positions.
|
|
299
338
|
*/
|
|
300
|
-
static create(
|
|
301
|
-
return new
|
|
339
|
+
static create(doc, from) {
|
|
340
|
+
return new NodeSelection(doc.resolve(from));
|
|
302
341
|
}
|
|
303
342
|
/**
|
|
304
343
|
Determines whether the given node may be selected as a node
|
|
305
344
|
selection.
|
|
306
345
|
*/
|
|
307
|
-
static isSelectable(
|
|
308
|
-
return !
|
|
346
|
+
static isSelectable(node) {
|
|
347
|
+
return !node.isText && node.type.spec.selectable !== false;
|
|
309
348
|
}
|
|
310
349
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
class
|
|
314
|
-
constructor(
|
|
315
|
-
this.anchor =
|
|
316
|
-
}
|
|
317
|
-
map(
|
|
318
|
-
let { deleted
|
|
319
|
-
return
|
|
320
|
-
}
|
|
321
|
-
resolve(
|
|
322
|
-
let
|
|
323
|
-
|
|
350
|
+
NodeSelection.prototype.visible = false;
|
|
351
|
+
Selection.jsonID("node", NodeSelection);
|
|
352
|
+
class NodeBookmark {
|
|
353
|
+
constructor(anchor) {
|
|
354
|
+
this.anchor = anchor;
|
|
355
|
+
}
|
|
356
|
+
map(mapping) {
|
|
357
|
+
let { deleted, pos } = mapping.mapResult(this.anchor);
|
|
358
|
+
return deleted ? new TextBookmark(pos, pos) : new NodeBookmark(pos);
|
|
359
|
+
}
|
|
360
|
+
resolve(doc) {
|
|
361
|
+
let $pos = doc.resolve(this.anchor), node = $pos.nodeAfter;
|
|
362
|
+
if (node && NodeSelection.isSelectable(node))
|
|
363
|
+
return new NodeSelection($pos);
|
|
364
|
+
return Selection.near($pos);
|
|
324
365
|
}
|
|
325
366
|
}
|
|
326
|
-
class
|
|
367
|
+
class AllSelection extends Selection {
|
|
327
368
|
/**
|
|
328
369
|
Create an all-selection over the given document.
|
|
329
370
|
*/
|
|
330
|
-
constructor(
|
|
331
|
-
super(
|
|
371
|
+
constructor(doc) {
|
|
372
|
+
super(doc.resolve(0), doc.resolve(doc.content.size));
|
|
332
373
|
}
|
|
333
|
-
replace(
|
|
334
|
-
if (
|
|
335
|
-
|
|
336
|
-
let
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
374
|
+
replace(tr, content = Slice.empty) {
|
|
375
|
+
if (content == Slice.empty) {
|
|
376
|
+
tr.delete(0, tr.doc.content.size);
|
|
377
|
+
let sel = Selection.atStart(tr.doc);
|
|
378
|
+
if (!sel.eq(tr.selection))
|
|
379
|
+
tr.setSelection(sel);
|
|
380
|
+
} else {
|
|
381
|
+
super.replace(tr, content);
|
|
382
|
+
}
|
|
340
383
|
}
|
|
341
384
|
toJSON() {
|
|
342
385
|
return { type: "all" };
|
|
@@ -344,64 +387,71 @@ class d extends l {
|
|
|
344
387
|
/**
|
|
345
388
|
@internal
|
|
346
389
|
*/
|
|
347
|
-
static fromJSON(
|
|
348
|
-
return new
|
|
390
|
+
static fromJSON(doc) {
|
|
391
|
+
return new AllSelection(doc);
|
|
349
392
|
}
|
|
350
|
-
map(
|
|
351
|
-
return new
|
|
393
|
+
map(doc) {
|
|
394
|
+
return new AllSelection(doc);
|
|
352
395
|
}
|
|
353
|
-
eq(
|
|
354
|
-
return
|
|
396
|
+
eq(other) {
|
|
397
|
+
return other instanceof AllSelection;
|
|
355
398
|
}
|
|
356
399
|
getBookmark() {
|
|
357
|
-
return
|
|
400
|
+
return AllBookmark;
|
|
358
401
|
}
|
|
359
402
|
}
|
|
360
|
-
|
|
361
|
-
const
|
|
403
|
+
Selection.jsonID("all", AllSelection);
|
|
404
|
+
const AllBookmark = {
|
|
362
405
|
map() {
|
|
363
406
|
return this;
|
|
364
407
|
},
|
|
365
|
-
resolve(
|
|
366
|
-
return new
|
|
408
|
+
resolve(doc) {
|
|
409
|
+
return new AllSelection(doc);
|
|
367
410
|
}
|
|
368
411
|
};
|
|
369
|
-
function
|
|
370
|
-
if (
|
|
371
|
-
return
|
|
372
|
-
for (let
|
|
373
|
-
let
|
|
374
|
-
if (
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
return c;
|
|
412
|
+
function findSelectionIn(doc, node, pos, index, dir, text = false) {
|
|
413
|
+
if (node.inlineContent)
|
|
414
|
+
return TextSelection.create(doc, pos);
|
|
415
|
+
for (let i = index - (dir > 0 ? 0 : 1); dir > 0 ? i < node.childCount : i >= 0; i += dir) {
|
|
416
|
+
let child = node.child(i);
|
|
417
|
+
if (!child.isAtom) {
|
|
418
|
+
let inner = findSelectionIn(doc, child, pos + dir, dir < 0 ? child.childCount : 0, dir, text);
|
|
419
|
+
if (inner)
|
|
420
|
+
return inner;
|
|
421
|
+
} else if (!text && NodeSelection.isSelectable(child)) {
|
|
422
|
+
return NodeSelection.create(doc, pos - (dir < 0 ? child.nodeSize : 0));
|
|
381
423
|
}
|
|
382
|
-
|
|
424
|
+
pos += child.nodeSize * dir;
|
|
383
425
|
}
|
|
384
426
|
return null;
|
|
385
427
|
}
|
|
386
|
-
function
|
|
387
|
-
let
|
|
388
|
-
if (
|
|
428
|
+
function selectionToInsertionEnd(tr, startLen, bias) {
|
|
429
|
+
let last = tr.steps.length - 1;
|
|
430
|
+
if (last < startLen)
|
|
389
431
|
return;
|
|
390
|
-
let
|
|
391
|
-
if (!(
|
|
432
|
+
let step = tr.steps[last];
|
|
433
|
+
if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep))
|
|
392
434
|
return;
|
|
393
|
-
let
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
435
|
+
let map = tr.mapping.maps[last], end;
|
|
436
|
+
map.forEach((_from, _to, _newFrom, newTo) => {
|
|
437
|
+
if (end == null)
|
|
438
|
+
end = newTo;
|
|
439
|
+
});
|
|
440
|
+
tr.setSelection(Selection.near(tr.doc.resolve(end), bias));
|
|
397
441
|
}
|
|
398
|
-
const
|
|
399
|
-
class
|
|
442
|
+
const UPDATED_SEL = 1, UPDATED_MARKS = 2, UPDATED_SCROLL = 4;
|
|
443
|
+
class Transaction extends Transform {
|
|
400
444
|
/**
|
|
401
445
|
@internal
|
|
402
446
|
*/
|
|
403
|
-
constructor(
|
|
404
|
-
super(
|
|
447
|
+
constructor(state) {
|
|
448
|
+
super(state.doc);
|
|
449
|
+
this.curSelectionFor = 0;
|
|
450
|
+
this.updated = 0;
|
|
451
|
+
this.meta = /* @__PURE__ */ Object.create(null);
|
|
452
|
+
this.time = Date.now();
|
|
453
|
+
this.curSelection = state.selection;
|
|
454
|
+
this.storedMarks = state.storedMarks;
|
|
405
455
|
}
|
|
406
456
|
/**
|
|
407
457
|
The transaction's current selection. This defaults to the editor
|
|
@@ -410,200 +460,240 @@ class W extends $ {
|
|
|
410
460
|
[`setSelection`](https://prosemirror.net/docs/ref/#state.Transaction.setSelection).
|
|
411
461
|
*/
|
|
412
462
|
get selection() {
|
|
413
|
-
|
|
463
|
+
if (this.curSelectionFor < this.steps.length) {
|
|
464
|
+
this.curSelection = this.curSelection.map(this.doc, this.mapping.slice(this.curSelectionFor));
|
|
465
|
+
this.curSelectionFor = this.steps.length;
|
|
466
|
+
}
|
|
467
|
+
return this.curSelection;
|
|
414
468
|
}
|
|
415
469
|
/**
|
|
416
470
|
Update the transaction's current selection. Will determine the
|
|
417
471
|
selection that the editor gets when the transaction is applied.
|
|
418
472
|
*/
|
|
419
|
-
setSelection(
|
|
420
|
-
if (
|
|
473
|
+
setSelection(selection) {
|
|
474
|
+
if (selection.$from.doc != this.doc)
|
|
421
475
|
throw new RangeError("Selection passed to setSelection must point at the current document");
|
|
422
|
-
|
|
476
|
+
this.curSelection = selection;
|
|
477
|
+
this.curSelectionFor = this.steps.length;
|
|
478
|
+
this.updated = (this.updated | UPDATED_SEL) & -3;
|
|
479
|
+
this.storedMarks = null;
|
|
480
|
+
return this;
|
|
423
481
|
}
|
|
424
482
|
/**
|
|
425
483
|
Whether the selection was explicitly updated by this transaction.
|
|
426
484
|
*/
|
|
427
485
|
get selectionSet() {
|
|
428
|
-
return (this.updated &
|
|
486
|
+
return (this.updated & UPDATED_SEL) > 0;
|
|
429
487
|
}
|
|
430
488
|
/**
|
|
431
489
|
Set the current stored marks.
|
|
432
490
|
*/
|
|
433
|
-
setStoredMarks(
|
|
434
|
-
|
|
491
|
+
setStoredMarks(marks) {
|
|
492
|
+
this.storedMarks = marks;
|
|
493
|
+
this.updated |= UPDATED_MARKS;
|
|
494
|
+
return this;
|
|
435
495
|
}
|
|
436
496
|
/**
|
|
437
497
|
Make sure the current stored marks or, if that is null, the marks
|
|
438
498
|
at the selection, match the given set of marks. Does nothing if
|
|
439
499
|
this is already the case.
|
|
440
500
|
*/
|
|
441
|
-
ensureMarks(
|
|
442
|
-
|
|
501
|
+
ensureMarks(marks) {
|
|
502
|
+
if (!Mark.sameSet(this.storedMarks || this.selection.$from.marks(), marks))
|
|
503
|
+
this.setStoredMarks(marks);
|
|
504
|
+
return this;
|
|
443
505
|
}
|
|
444
506
|
/**
|
|
445
507
|
Add a mark to the set of stored marks.
|
|
446
508
|
*/
|
|
447
|
-
addStoredMark(
|
|
448
|
-
return this.ensureMarks(
|
|
509
|
+
addStoredMark(mark) {
|
|
510
|
+
return this.ensureMarks(mark.addToSet(this.storedMarks || this.selection.$head.marks()));
|
|
449
511
|
}
|
|
450
512
|
/**
|
|
451
513
|
Remove a mark or mark type from the set of stored marks.
|
|
452
514
|
*/
|
|
453
|
-
removeStoredMark(
|
|
454
|
-
return this.ensureMarks(
|
|
515
|
+
removeStoredMark(mark) {
|
|
516
|
+
return this.ensureMarks(mark.removeFromSet(this.storedMarks || this.selection.$head.marks()));
|
|
455
517
|
}
|
|
456
518
|
/**
|
|
457
519
|
Whether the stored marks were explicitly set for this transaction.
|
|
458
520
|
*/
|
|
459
521
|
get storedMarksSet() {
|
|
460
|
-
return (this.updated &
|
|
522
|
+
return (this.updated & UPDATED_MARKS) > 0;
|
|
461
523
|
}
|
|
462
524
|
/**
|
|
463
525
|
@internal
|
|
464
526
|
*/
|
|
465
|
-
addStep(
|
|
466
|
-
super.addStep(
|
|
527
|
+
addStep(step, doc) {
|
|
528
|
+
super.addStep(step, doc);
|
|
529
|
+
this.updated = this.updated & -3;
|
|
530
|
+
this.storedMarks = null;
|
|
467
531
|
}
|
|
468
532
|
/**
|
|
469
533
|
Update the timestamp for the transaction.
|
|
470
534
|
*/
|
|
471
|
-
setTime(
|
|
472
|
-
|
|
535
|
+
setTime(time) {
|
|
536
|
+
this.time = time;
|
|
537
|
+
return this;
|
|
473
538
|
}
|
|
474
539
|
/**
|
|
475
540
|
Replace the current selection with the given slice.
|
|
476
541
|
*/
|
|
477
|
-
replaceSelection(
|
|
478
|
-
|
|
542
|
+
replaceSelection(slice) {
|
|
543
|
+
this.selection.replace(this, slice);
|
|
544
|
+
return this;
|
|
479
545
|
}
|
|
480
546
|
/**
|
|
481
547
|
Replace the selection with the given node. When `inheritMarks` is
|
|
482
548
|
true and the content is inline, it inherits the marks from the
|
|
483
549
|
place where it is inserted.
|
|
484
550
|
*/
|
|
485
|
-
replaceSelectionWith(
|
|
486
|
-
let
|
|
487
|
-
|
|
551
|
+
replaceSelectionWith(node, inheritMarks = true) {
|
|
552
|
+
let selection = this.selection;
|
|
553
|
+
if (inheritMarks)
|
|
554
|
+
node = node.mark(this.storedMarks || (selection.empty ? selection.$from.marks() : selection.$from.marksAcross(selection.$to) || Mark.none));
|
|
555
|
+
selection.replaceWith(this, node);
|
|
556
|
+
return this;
|
|
488
557
|
}
|
|
489
558
|
/**
|
|
490
559
|
Delete the selection.
|
|
491
560
|
*/
|
|
492
561
|
deleteSelection() {
|
|
493
|
-
|
|
562
|
+
this.selection.replace(this);
|
|
563
|
+
return this;
|
|
494
564
|
}
|
|
495
565
|
/**
|
|
496
566
|
Replace the given range, or the selection if no range is given,
|
|
497
567
|
with a text node containing the given string.
|
|
498
568
|
*/
|
|
499
|
-
insertText(
|
|
500
|
-
let
|
|
501
|
-
if (
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
569
|
+
insertText(text, from, to) {
|
|
570
|
+
let schema = this.doc.type.schema;
|
|
571
|
+
if (from == null) {
|
|
572
|
+
if (!text)
|
|
573
|
+
return this.deleteSelection();
|
|
574
|
+
return this.replaceSelectionWith(schema.text(text), true);
|
|
575
|
+
} else {
|
|
576
|
+
if (to == null)
|
|
577
|
+
to = from;
|
|
578
|
+
to = to == null ? from : to;
|
|
579
|
+
if (!text)
|
|
580
|
+
return this.deleteRange(from, to);
|
|
581
|
+
let marks = this.storedMarks;
|
|
582
|
+
if (!marks) {
|
|
583
|
+
let $from = this.doc.resolve(from);
|
|
584
|
+
marks = to == from ? $from.marks() : $from.marksAcross(this.doc.resolve(to));
|
|
510
585
|
}
|
|
511
|
-
|
|
586
|
+
this.replaceRangeWith(from, to, schema.text(text, marks));
|
|
587
|
+
if (!this.selection.empty)
|
|
588
|
+
this.setSelection(Selection.near(this.selection.$to));
|
|
589
|
+
return this;
|
|
512
590
|
}
|
|
513
591
|
}
|
|
514
592
|
/**
|
|
515
593
|
Store a metadata property in this transaction, keyed either by
|
|
516
594
|
name or by plugin.
|
|
517
595
|
*/
|
|
518
|
-
setMeta(
|
|
519
|
-
|
|
596
|
+
setMeta(key, value) {
|
|
597
|
+
this.meta[typeof key == "string" ? key : key.key] = value;
|
|
598
|
+
return this;
|
|
520
599
|
}
|
|
521
600
|
/**
|
|
522
601
|
Retrieve a metadata property for a given name or plugin.
|
|
523
602
|
*/
|
|
524
|
-
getMeta(
|
|
525
|
-
return this.meta[typeof
|
|
603
|
+
getMeta(key) {
|
|
604
|
+
return this.meta[typeof key == "string" ? key : key.key];
|
|
526
605
|
}
|
|
527
606
|
/**
|
|
528
607
|
Returns true if this transaction doesn't contain any metadata,
|
|
529
608
|
and can thus safely be extended.
|
|
530
609
|
*/
|
|
531
610
|
get isGeneric() {
|
|
532
|
-
for (let
|
|
533
|
-
return
|
|
534
|
-
return
|
|
611
|
+
for (let _ in this.meta)
|
|
612
|
+
return false;
|
|
613
|
+
return true;
|
|
535
614
|
}
|
|
536
615
|
/**
|
|
537
616
|
Indicate that the editor should scroll the selection into view
|
|
538
617
|
when updated to the state produced by this transaction.
|
|
539
618
|
*/
|
|
540
619
|
scrollIntoView() {
|
|
541
|
-
|
|
620
|
+
this.updated |= UPDATED_SCROLL;
|
|
621
|
+
return this;
|
|
542
622
|
}
|
|
543
623
|
/**
|
|
544
624
|
True when this transaction has had `scrollIntoView` called on it.
|
|
545
625
|
*/
|
|
546
626
|
get scrolledIntoView() {
|
|
547
|
-
return (this.updated &
|
|
627
|
+
return (this.updated & UPDATED_SCROLL) > 0;
|
|
548
628
|
}
|
|
549
629
|
}
|
|
550
|
-
function
|
|
551
|
-
return !
|
|
630
|
+
function bind(f, self) {
|
|
631
|
+
return !self || !f ? f : f.bind(self);
|
|
552
632
|
}
|
|
553
|
-
class
|
|
554
|
-
constructor(
|
|
555
|
-
this.name =
|
|
633
|
+
class FieldDesc {
|
|
634
|
+
constructor(name, desc, self) {
|
|
635
|
+
this.name = name;
|
|
636
|
+
this.init = bind(desc.init, self);
|
|
637
|
+
this.apply = bind(desc.apply, self);
|
|
556
638
|
}
|
|
557
639
|
}
|
|
558
|
-
const
|
|
559
|
-
new
|
|
560
|
-
init(
|
|
561
|
-
return
|
|
640
|
+
const baseFields = [
|
|
641
|
+
new FieldDesc("doc", {
|
|
642
|
+
init(config) {
|
|
643
|
+
return config.doc || config.schema.topNodeType.createAndFill();
|
|
562
644
|
},
|
|
563
|
-
apply(
|
|
564
|
-
return
|
|
645
|
+
apply(tr) {
|
|
646
|
+
return tr.doc;
|
|
565
647
|
}
|
|
566
648
|
}),
|
|
567
|
-
new
|
|
568
|
-
init(
|
|
569
|
-
return
|
|
649
|
+
new FieldDesc("selection", {
|
|
650
|
+
init(config, instance) {
|
|
651
|
+
return config.selection || Selection.atStart(instance.doc);
|
|
570
652
|
},
|
|
571
|
-
apply(
|
|
572
|
-
return
|
|
653
|
+
apply(tr) {
|
|
654
|
+
return tr.selection;
|
|
573
655
|
}
|
|
574
656
|
}),
|
|
575
|
-
new
|
|
576
|
-
init(
|
|
577
|
-
return
|
|
657
|
+
new FieldDesc("storedMarks", {
|
|
658
|
+
init(config) {
|
|
659
|
+
return config.storedMarks || null;
|
|
578
660
|
},
|
|
579
|
-
apply(
|
|
580
|
-
return
|
|
661
|
+
apply(tr, _marks, _old, state) {
|
|
662
|
+
return state.selection.$cursor ? tr.storedMarks : null;
|
|
581
663
|
}
|
|
582
664
|
}),
|
|
583
|
-
new
|
|
665
|
+
new FieldDesc("scrollToSelection", {
|
|
584
666
|
init() {
|
|
585
667
|
return 0;
|
|
586
668
|
},
|
|
587
|
-
apply(
|
|
588
|
-
return
|
|
669
|
+
apply(tr, prev) {
|
|
670
|
+
return tr.scrolledIntoView ? prev + 1 : prev;
|
|
589
671
|
}
|
|
590
672
|
})
|
|
591
673
|
];
|
|
592
|
-
class
|
|
593
|
-
constructor(
|
|
594
|
-
this.schema =
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
674
|
+
class Configuration {
|
|
675
|
+
constructor(schema, plugins) {
|
|
676
|
+
this.schema = schema;
|
|
677
|
+
this.plugins = [];
|
|
678
|
+
this.pluginsByKey = /* @__PURE__ */ Object.create(null);
|
|
679
|
+
this.fields = baseFields.slice();
|
|
680
|
+
if (plugins)
|
|
681
|
+
plugins.forEach((plugin) => {
|
|
682
|
+
if (this.pluginsByKey[plugin.key])
|
|
683
|
+
throw new RangeError("Adding different instances of a keyed plugin (" + plugin.key + ")");
|
|
684
|
+
this.plugins.push(plugin);
|
|
685
|
+
this.pluginsByKey[plugin.key] = plugin;
|
|
686
|
+
if (plugin.spec.state)
|
|
687
|
+
this.fields.push(new FieldDesc(plugin.key, plugin.spec.state, plugin));
|
|
688
|
+
});
|
|
599
689
|
}
|
|
600
690
|
}
|
|
601
|
-
class
|
|
691
|
+
class EditorState {
|
|
602
692
|
/**
|
|
603
693
|
@internal
|
|
604
694
|
*/
|
|
605
|
-
constructor(
|
|
606
|
-
this.config =
|
|
695
|
+
constructor(config) {
|
|
696
|
+
this.config = config;
|
|
607
697
|
}
|
|
608
698
|
/**
|
|
609
699
|
The schema of the state's document.
|
|
@@ -620,20 +710,20 @@ class w {
|
|
|
620
710
|
/**
|
|
621
711
|
Apply the given transaction to produce a new state.
|
|
622
712
|
*/
|
|
623
|
-
apply(
|
|
624
|
-
return this.applyTransaction(
|
|
713
|
+
apply(tr) {
|
|
714
|
+
return this.applyTransaction(tr).state;
|
|
625
715
|
}
|
|
626
716
|
/**
|
|
627
717
|
@internal
|
|
628
718
|
*/
|
|
629
|
-
filterTransaction(
|
|
630
|
-
for (let
|
|
631
|
-
if (
|
|
632
|
-
let
|
|
633
|
-
if (
|
|
634
|
-
return
|
|
719
|
+
filterTransaction(tr, ignore = -1) {
|
|
720
|
+
for (let i = 0; i < this.config.plugins.length; i++)
|
|
721
|
+
if (i != ignore) {
|
|
722
|
+
let plugin = this.config.plugins[i];
|
|
723
|
+
if (plugin.spec.filterTransaction && !plugin.spec.filterTransaction.call(plugin, tr, this))
|
|
724
|
+
return false;
|
|
635
725
|
}
|
|
636
|
-
return
|
|
726
|
+
return true;
|
|
637
727
|
}
|
|
638
728
|
/**
|
|
639
729
|
Verbose variant of [`apply`](https://prosemirror.net/docs/ref/#state.EditorState.apply) that
|
|
@@ -642,58 +732,64 @@ class w {
|
|
|
642
732
|
hooks](https://prosemirror.net/docs/ref/#state.PluginSpec.filterTransaction) of
|
|
643
733
|
plugins) along with the new state.
|
|
644
734
|
*/
|
|
645
|
-
applyTransaction(
|
|
646
|
-
if (!this.filterTransaction(
|
|
735
|
+
applyTransaction(rootTr) {
|
|
736
|
+
if (!this.filterTransaction(rootTr))
|
|
647
737
|
return { state: this, transactions: [] };
|
|
648
|
-
let
|
|
738
|
+
let trs = [rootTr], newState = this.applyInner(rootTr), seen = null;
|
|
649
739
|
for (; ; ) {
|
|
650
|
-
let
|
|
651
|
-
for (let
|
|
652
|
-
let
|
|
653
|
-
if (
|
|
654
|
-
let
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
740
|
+
let haveNew = false;
|
|
741
|
+
for (let i = 0; i < this.config.plugins.length; i++) {
|
|
742
|
+
let plugin = this.config.plugins[i];
|
|
743
|
+
if (plugin.spec.appendTransaction) {
|
|
744
|
+
let n = seen ? seen[i].n : 0, oldState = seen ? seen[i].state : this;
|
|
745
|
+
let tr = n < trs.length && plugin.spec.appendTransaction.call(plugin, n ? trs.slice(n) : trs, oldState, newState);
|
|
746
|
+
if (tr && newState.filterTransaction(tr, i)) {
|
|
747
|
+
tr.setMeta("appendedTransaction", rootTr);
|
|
748
|
+
if (!seen) {
|
|
749
|
+
seen = [];
|
|
750
|
+
for (let j = 0; j < this.config.plugins.length; j++)
|
|
751
|
+
seen.push(j < i ? { state: newState, n: trs.length } : { state: this, n: 0 });
|
|
660
752
|
}
|
|
661
|
-
|
|
753
|
+
trs.push(tr);
|
|
754
|
+
newState = newState.applyInner(tr);
|
|
755
|
+
haveNew = true;
|
|
662
756
|
}
|
|
663
|
-
|
|
757
|
+
if (seen)
|
|
758
|
+
seen[i] = { state: newState, n: trs.length };
|
|
664
759
|
}
|
|
665
760
|
}
|
|
666
|
-
if (!
|
|
667
|
-
return { state:
|
|
761
|
+
if (!haveNew)
|
|
762
|
+
return { state: newState, transactions: trs };
|
|
668
763
|
}
|
|
669
764
|
}
|
|
670
765
|
/**
|
|
671
766
|
@internal
|
|
672
767
|
*/
|
|
673
|
-
applyInner(
|
|
674
|
-
if (!
|
|
768
|
+
applyInner(tr) {
|
|
769
|
+
if (!tr.before.eq(this.doc))
|
|
675
770
|
throw new RangeError("Applying a mismatched transaction");
|
|
676
|
-
let
|
|
677
|
-
for (let
|
|
678
|
-
let
|
|
679
|
-
|
|
771
|
+
let newInstance = new EditorState(this.config), fields = this.config.fields;
|
|
772
|
+
for (let i = 0; i < fields.length; i++) {
|
|
773
|
+
let field = fields[i];
|
|
774
|
+
newInstance[field.name] = field.apply(tr, this[field.name], this, newInstance);
|
|
680
775
|
}
|
|
681
|
-
return
|
|
776
|
+
return newInstance;
|
|
682
777
|
}
|
|
683
778
|
/**
|
|
684
779
|
Start a [transaction](https://prosemirror.net/docs/ref/#state.Transaction) from this state.
|
|
685
780
|
*/
|
|
686
781
|
get tr() {
|
|
687
|
-
return new
|
|
782
|
+
return new Transaction(this);
|
|
688
783
|
}
|
|
689
784
|
/**
|
|
690
785
|
Create a new state.
|
|
691
786
|
*/
|
|
692
|
-
static create(
|
|
693
|
-
let
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
787
|
+
static create(config) {
|
|
788
|
+
let $config = new Configuration(config.doc ? config.doc.type.schema : config.schema, config.plugins);
|
|
789
|
+
let instance = new EditorState($config);
|
|
790
|
+
for (let i = 0; i < $config.fields.length; i++)
|
|
791
|
+
instance[$config.fields[i].name] = $config.fields[i].init(config, instance);
|
|
792
|
+
return instance;
|
|
697
793
|
}
|
|
698
794
|
/**
|
|
699
795
|
Create a new state based on this one, but with an adjusted set
|
|
@@ -703,13 +799,14 @@ class w {
|
|
|
703
799
|
[`init`](https://prosemirror.net/docs/ref/#state.StateField.init) method, passing in the new
|
|
704
800
|
configuration object..
|
|
705
801
|
*/
|
|
706
|
-
reconfigure(
|
|
707
|
-
let
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
802
|
+
reconfigure(config) {
|
|
803
|
+
let $config = new Configuration(this.schema, config.plugins);
|
|
804
|
+
let fields = $config.fields, instance = new EditorState($config);
|
|
805
|
+
for (let i = 0; i < fields.length; i++) {
|
|
806
|
+
let name = fields[i].name;
|
|
807
|
+
instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i].init(config, instance);
|
|
711
808
|
}
|
|
712
|
-
return
|
|
809
|
+
return instance;
|
|
713
810
|
}
|
|
714
811
|
/**
|
|
715
812
|
Serialize this state to JSON. If you want to serialize the state
|
|
@@ -718,16 +815,19 @@ class w {
|
|
|
718
815
|
a string or number, in which case it is ignored, to support the
|
|
719
816
|
way `JSON.stringify` calls `toString` methods.
|
|
720
817
|
*/
|
|
721
|
-
toJSON(
|
|
722
|
-
let
|
|
723
|
-
if (this.storedMarks
|
|
724
|
-
|
|
725
|
-
|
|
818
|
+
toJSON(pluginFields) {
|
|
819
|
+
let result = { doc: this.doc.toJSON(), selection: this.selection.toJSON() };
|
|
820
|
+
if (this.storedMarks)
|
|
821
|
+
result.storedMarks = this.storedMarks.map((m) => m.toJSON());
|
|
822
|
+
if (pluginFields && typeof pluginFields == "object")
|
|
823
|
+
for (let prop in pluginFields) {
|
|
824
|
+
if (prop == "doc" || prop == "selection")
|
|
726
825
|
throw new RangeError("The JSON fields `doc` and `selection` are reserved");
|
|
727
|
-
let
|
|
728
|
-
|
|
826
|
+
let plugin = pluginFields[prop], state = plugin.spec.state;
|
|
827
|
+
if (state && state.toJSON)
|
|
828
|
+
result[prop] = state.toJSON.call(plugin, this[plugin.key]);
|
|
729
829
|
}
|
|
730
|
-
return
|
|
830
|
+
return result;
|
|
731
831
|
}
|
|
732
832
|
/**
|
|
733
833
|
Deserialize a JSON representation of a state. `config` should
|
|
@@ -736,85 +836,99 @@ class w {
|
|
|
736
836
|
to deserialize the state of plugins, by associating plugin
|
|
737
837
|
instances with the property names they use in the JSON object.
|
|
738
838
|
*/
|
|
739
|
-
static fromJSON(
|
|
740
|
-
if (!
|
|
839
|
+
static fromJSON(config, json, pluginFields) {
|
|
840
|
+
if (!json)
|
|
741
841
|
throw new RangeError("Invalid input for EditorState.fromJSON");
|
|
742
|
-
if (!
|
|
842
|
+
if (!config.schema)
|
|
743
843
|
throw new RangeError("Required config field 'schema' missing");
|
|
744
|
-
let
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
844
|
+
let $config = new Configuration(config.schema, config.plugins);
|
|
845
|
+
let instance = new EditorState($config);
|
|
846
|
+
$config.fields.forEach((field) => {
|
|
847
|
+
if (field.name == "doc") {
|
|
848
|
+
instance.doc = Node.fromJSON(config.schema, json.doc);
|
|
849
|
+
} else if (field.name == "selection") {
|
|
850
|
+
instance.selection = Selection.fromJSON(instance.doc, json.selection);
|
|
851
|
+
} else if (field.name == "storedMarks") {
|
|
852
|
+
if (json.storedMarks)
|
|
853
|
+
instance.storedMarks = json.storedMarks.map(config.schema.markFromJSON);
|
|
854
|
+
} else {
|
|
855
|
+
if (pluginFields)
|
|
856
|
+
for (let prop in pluginFields) {
|
|
857
|
+
let plugin = pluginFields[prop], state = plugin.spec.state;
|
|
858
|
+
if (plugin.key == field.name && state && state.fromJSON && Object.prototype.hasOwnProperty.call(json, prop)) {
|
|
859
|
+
instance[field.name] = state.fromJSON.call(plugin, config, json[prop], instance);
|
|
758
860
|
return;
|
|
759
861
|
}
|
|
760
862
|
}
|
|
761
|
-
|
|
863
|
+
instance[field.name] = field.init(config, instance);
|
|
762
864
|
}
|
|
763
|
-
})
|
|
865
|
+
});
|
|
866
|
+
return instance;
|
|
764
867
|
}
|
|
765
868
|
}
|
|
766
|
-
function
|
|
767
|
-
for (let
|
|
768
|
-
let
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
869
|
+
function bindProps(obj, self, target) {
|
|
870
|
+
for (let prop in obj) {
|
|
871
|
+
let val = obj[prop];
|
|
872
|
+
if (val instanceof Function)
|
|
873
|
+
val = val.bind(self);
|
|
874
|
+
else if (prop == "handleDOMEvents")
|
|
875
|
+
val = bindProps(val, self, {});
|
|
876
|
+
target[prop] = val;
|
|
877
|
+
}
|
|
878
|
+
return target;
|
|
772
879
|
}
|
|
773
|
-
class
|
|
880
|
+
class Plugin {
|
|
774
881
|
/**
|
|
775
882
|
Create a plugin.
|
|
776
883
|
*/
|
|
777
|
-
constructor(
|
|
778
|
-
this.spec =
|
|
884
|
+
constructor(spec) {
|
|
885
|
+
this.spec = spec;
|
|
886
|
+
this.props = {};
|
|
887
|
+
if (spec.props)
|
|
888
|
+
bindProps(spec.props, this, this.props);
|
|
889
|
+
this.key = spec.key ? spec.key.key : createKey("plugin");
|
|
779
890
|
}
|
|
780
891
|
/**
|
|
781
892
|
Extract the plugin's state field from an editor state.
|
|
782
893
|
*/
|
|
783
|
-
getState(
|
|
784
|
-
return
|
|
894
|
+
getState(state) {
|
|
895
|
+
return state[this.key];
|
|
785
896
|
}
|
|
786
897
|
}
|
|
787
|
-
const
|
|
788
|
-
function
|
|
789
|
-
|
|
898
|
+
const keys = /* @__PURE__ */ Object.create(null);
|
|
899
|
+
function createKey(name) {
|
|
900
|
+
if (name in keys)
|
|
901
|
+
return name + "$" + ++keys[name];
|
|
902
|
+
keys[name] = 0;
|
|
903
|
+
return name + "$";
|
|
790
904
|
}
|
|
791
|
-
class
|
|
905
|
+
class PluginKey {
|
|
792
906
|
/**
|
|
793
907
|
Create a plugin key.
|
|
794
908
|
*/
|
|
795
|
-
constructor(
|
|
796
|
-
this.key =
|
|
909
|
+
constructor(name = "key") {
|
|
910
|
+
this.key = createKey(name);
|
|
797
911
|
}
|
|
798
912
|
/**
|
|
799
913
|
Get the active plugin with this key, if any, from an editor
|
|
800
914
|
state.
|
|
801
915
|
*/
|
|
802
|
-
get(
|
|
803
|
-
return
|
|
916
|
+
get(state) {
|
|
917
|
+
return state.config.pluginsByKey[this.key];
|
|
804
918
|
}
|
|
805
919
|
/**
|
|
806
920
|
Get the plugin's state from an editor state.
|
|
807
921
|
*/
|
|
808
|
-
getState(
|
|
809
|
-
return
|
|
922
|
+
getState(state) {
|
|
923
|
+
return state[this.key];
|
|
810
924
|
}
|
|
811
925
|
}
|
|
812
926
|
export {
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
927
|
+
AllSelection as A,
|
|
928
|
+
EditorState as E,
|
|
929
|
+
NodeSelection as N,
|
|
930
|
+
Plugin as P,
|
|
931
|
+
Selection as S,
|
|
932
|
+
TextSelection as T,
|
|
933
|
+
PluginKey as a
|
|
820
934
|
};
|