@soul-refiner/design-system 2.0.0-alpha.18 → 2.0.0-alpha.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_cloneBuffer.js +5 -0
- package/dist/_virtual/_commonjsHelpers.js +10 -0
- package/dist/_virtual/_nodeUtil.js +5 -0
- package/dist/_virtual/index.js +5 -0
- package/dist/_virtual/index2.js +5 -0
- package/dist/_virtual/index3.js +5 -0
- package/dist/_virtual/isBuffer.js +5 -0
- package/dist/_virtual/use-sync-external-store-shim.development.js +5 -0
- package/dist/_virtual/use-sync-external-store-shim.production.min.js +5 -0
- package/dist/_virtual/util.js +5 -0
- package/dist/_virtual/with-selector.development.js +5 -0
- package/dist/_virtual/with-selector.js +5 -0
- package/dist/_virtual/with-selector.production.min.js +5 -0
- package/dist/node_modules/@udecode/plate-alignment/dist/index.js +98 -0
- package/dist/node_modules/@udecode/plate-core/dist/index.js +2656 -0
- package/dist/node_modules/@udecode/plate-link/dist/index.js +585 -0
- package/dist/node_modules/@udecode/plate-media/dist/index.js +211 -0
- package/dist/node_modules/@udecode/plate-normalizers/dist/index.js +20 -0
- package/dist/node_modules/@udecode/plate-resizable/dist/index.js +334 -0
- package/dist/node_modules/@udecode/plate-table/dist/index.js +1371 -0
- package/dist/node_modules/@udecode/plate-utils/dist/index.js +127 -0
- package/dist/node_modules/@udecode/slate/dist/index.js +316 -0
- package/dist/node_modules/@udecode/slate-react/dist/index.js +35 -0
- package/dist/node_modules/@udecode/slate-utils/dist/index.js +230 -0
- package/dist/node_modules/@udecode/utils/dist/index.js +61 -0
- package/dist/node_modules/clsx/dist/clsx.m.js +8 -0
- package/dist/node_modules/dequal/dist/index.js +88 -0
- package/dist/node_modules/immer/dist/immer.js +968 -0
- package/dist/node_modules/is-hotkey/lib/index.js +253 -0
- package/dist/node_modules/jotai/esm/react/utils.js +29 -0
- package/dist/node_modules/jotai/esm/react.js +116 -0
- package/dist/node_modules/jotai/esm/vanilla/utils.js +44 -0
- package/dist/node_modules/jotai/esm/vanilla.js +602 -0
- package/dist/node_modules/jotai-optics/dist/index.modern.js +8 -0
- package/dist/node_modules/jotai-x/dist/index.js +259 -0
- package/dist/node_modules/js-video-url-parser/lib/base.js +9 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/allocine.js +38 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/canalplus.js +50 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/coub.js +58 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/dailymotion.js +74 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/facebook.js +82 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/loom.js +55 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/soundcloud.js +129 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/teachertube.js +114 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/ted.js +100 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/tiktok.js +54 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/twitch.js +154 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/vimeo.js +93 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/wistia.js +116 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/youku.js +87 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/youtube.js +209 -0
- package/dist/node_modules/js-video-url-parser/lib/urlParser.js +88 -0
- package/dist/node_modules/js-video-url-parser/lib/util.js +112 -0
- package/dist/node_modules/lodash/_DataView.js +14 -0
- package/dist/node_modules/lodash/_Hash.js +42 -0
- package/dist/node_modules/lodash/_ListCache.js +42 -0
- package/dist/node_modules/lodash/_Map.js +14 -0
- package/dist/node_modules/lodash/_MapCache.js +42 -0
- package/dist/node_modules/lodash/_Promise.js +14 -0
- package/dist/node_modules/lodash/_Set.js +14 -0
- package/dist/node_modules/lodash/_SetCache.js +35 -0
- package/dist/node_modules/lodash/_Stack.js +38 -0
- package/dist/node_modules/lodash/_Symbol.js +12 -0
- package/dist/node_modules/lodash/_Uint8Array.js +12 -0
- package/dist/node_modules/lodash/_WeakMap.js +14 -0
- package/dist/node_modules/lodash/_apply.js +26 -0
- package/dist/node_modules/lodash/_arrayAggregator.js +27 -0
- package/dist/node_modules/lodash/_arrayEach.js +27 -0
- package/dist/node_modules/lodash/_arrayFilter.js +30 -0
- package/dist/node_modules/lodash/_arrayLikeKeys.js +60 -0
- package/dist/node_modules/lodash/_arrayMap.js +26 -0
- package/dist/node_modules/lodash/_arrayPush.js +25 -0
- package/dist/node_modules/lodash/_arraySome.js +28 -0
- package/dist/node_modules/lodash/_assignMergeValue.js +27 -0
- package/dist/node_modules/lodash/_assignValue.js +35 -0
- package/dist/node_modules/lodash/_assocIndexOf.js +27 -0
- package/dist/node_modules/lodash/_baseAggregator.js +27 -0
- package/dist/node_modules/lodash/_baseAssign.js +24 -0
- package/dist/node_modules/lodash/_baseAssignIn.js +24 -0
- package/dist/node_modules/lodash/_baseAssignValue.js +31 -0
- package/dist/node_modules/lodash/_baseClone.js +193 -0
- package/dist/node_modules/lodash/_baseCreate.js +36 -0
- package/dist/node_modules/lodash/_baseEach.js +21 -0
- package/dist/node_modules/lodash/_baseFlatten.js +45 -0
- package/dist/node_modules/lodash/_baseFor.js +22 -0
- package/dist/node_modules/lodash/_baseForOwn.js +23 -0
- package/dist/node_modules/lodash/_baseGet.js +31 -0
- package/dist/node_modules/lodash/_baseGetAllKeys.js +27 -0
- package/dist/node_modules/lodash/_baseGetTag.js +36 -0
- package/dist/node_modules/lodash/_baseHasIn.js +18 -0
- package/dist/node_modules/lodash/_baseIsArguments.js +25 -0
- package/dist/node_modules/lodash/_baseIsEqual.js +35 -0
- package/dist/node_modules/lodash/_baseIsEqualDeep.js +96 -0
- package/dist/node_modules/lodash/_baseIsMap.js +25 -0
- package/dist/node_modules/lodash/_baseIsMatch.js +69 -0
- package/dist/node_modules/lodash/_baseIsNative.js +56 -0
- package/dist/node_modules/lodash/_baseIsSet.js +25 -0
- package/dist/node_modules/lodash/_baseIsTypedArray.js +68 -0
- package/dist/node_modules/lodash/_baseIteratee.js +41 -0
- package/dist/node_modules/lodash/_baseKeys.js +37 -0
- package/dist/node_modules/lodash/_baseKeysIn.js +41 -0
- package/dist/node_modules/lodash/_baseMap.js +29 -0
- package/dist/node_modules/lodash/_baseMatches.js +30 -0
- package/dist/node_modules/lodash/_baseMatchesProperty.js +45 -0
- package/dist/node_modules/lodash/_baseMerge.js +54 -0
- package/dist/node_modules/lodash/_baseMergeDeep.js +114 -0
- package/dist/node_modules/lodash/_baseProperty.js +19 -0
- package/dist/node_modules/lodash/_basePropertyDeep.js +22 -0
- package/dist/node_modules/lodash/_baseRest.js +25 -0
- package/dist/node_modules/lodash/_baseSetToString.js +30 -0
- package/dist/node_modules/lodash/_baseSlice.js +36 -0
- package/dist/node_modules/lodash/_baseTimes.js +25 -0
- package/dist/node_modules/lodash/_baseToString.js +46 -0
- package/dist/node_modules/lodash/_baseUnary.js +19 -0
- package/dist/node_modules/lodash/_baseUnset.js +29 -0
- package/dist/node_modules/lodash/_baseValues.js +25 -0
- package/dist/node_modules/lodash/_cacheHas.js +18 -0
- package/dist/node_modules/lodash/_castPath.js +30 -0
- package/dist/node_modules/lodash/_cloneArrayBuffer.js +22 -0
- package/dist/node_modules/lodash/_cloneBuffer.js +48 -0
- package/dist/node_modules/lodash/_cloneDataView.js +22 -0
- package/dist/node_modules/lodash/_cloneRegExp.js +22 -0
- package/dist/node_modules/lodash/_cloneSymbol.js +24 -0
- package/dist/node_modules/lodash/_cloneTypedArray.js +22 -0
- package/dist/node_modules/lodash/_copyArray.js +25 -0
- package/dist/node_modules/lodash/_copyObject.js +47 -0
- package/dist/node_modules/lodash/_copySymbols.js +23 -0
- package/dist/node_modules/lodash/_copySymbolsIn.js +23 -0
- package/dist/node_modules/lodash/_coreJsData.js +12 -0
- package/dist/node_modules/lodash/_createAggregator.js +32 -0
- package/dist/node_modules/lodash/_createAssigner.js +44 -0
- package/dist/node_modules/lodash/_createBaseEach.js +38 -0
- package/dist/node_modules/lodash/_createBaseFor.js +30 -0
- package/dist/node_modules/lodash/_customDefaultsMerge.js +35 -0
- package/dist/node_modules/lodash/_customOmitClone.js +22 -0
- package/dist/node_modules/lodash/_defineProperty.js +17 -0
- package/dist/node_modules/lodash/_equalArrays.js +92 -0
- package/dist/node_modules/lodash/_equalByTag.js +123 -0
- package/dist/node_modules/lodash/_equalObjects.js +96 -0
- package/dist/node_modules/lodash/_flatRest.js +24 -0
- package/dist/node_modules/lodash/_freeGlobal.js +11 -0
- package/dist/node_modules/lodash/_getAllKeys.js +24 -0
- package/dist/node_modules/lodash/_getAllKeysIn.js +25 -0
- package/dist/node_modules/lodash/_getMapData.js +24 -0
- package/dist/node_modules/lodash/_getMatchData.js +31 -0
- package/dist/node_modules/lodash/_getNative.js +24 -0
- package/dist/node_modules/lodash/_getPrototype.js +12 -0
- package/dist/node_modules/lodash/_getRawTag.js +52 -0
- package/dist/node_modules/lodash/_getSymbols.js +37 -0
- package/dist/node_modules/lodash/_getSymbolsIn.js +34 -0
- package/dist/node_modules/lodash/_getTag.js +70 -0
- package/dist/node_modules/lodash/_getValue.js +18 -0
- package/dist/node_modules/lodash/_hasPath.js +50 -0
- package/dist/node_modules/lodash/_hashClear.js +21 -0
- package/dist/node_modules/lodash/_hashDelete.js +22 -0
- package/dist/node_modules/lodash/_hashGet.js +36 -0
- package/dist/node_modules/lodash/_hashHas.js +29 -0
- package/dist/node_modules/lodash/_hashSet.js +29 -0
- package/dist/node_modules/lodash/_initCloneArray.js +31 -0
- package/dist/node_modules/lodash/_initCloneByTag.js +87 -0
- package/dist/node_modules/lodash/_initCloneObject.js +26 -0
- package/dist/node_modules/lodash/_isFlattenable.js +28 -0
- package/dist/node_modules/lodash/_isIndex.js +30 -0
- package/dist/node_modules/lodash/_isIterateeCall.js +39 -0
- package/dist/node_modules/lodash/_isKey.js +36 -0
- package/dist/node_modules/lodash/_isKeyable.js +20 -0
- package/dist/node_modules/lodash/_isMasked.js +26 -0
- package/dist/node_modules/lodash/_isPrototype.js +23 -0
- package/dist/node_modules/lodash/_isStrictComparable.js +21 -0
- package/dist/node_modules/lodash/_listCacheClear.js +18 -0
- package/dist/node_modules/lodash/_listCacheDelete.js +41 -0
- package/dist/node_modules/lodash/_listCacheGet.js +25 -0
- package/dist/node_modules/lodash/_listCacheHas.js +22 -0
- package/dist/node_modules/lodash/_listCacheSet.js +32 -0
- package/dist/node_modules/lodash/_mapCacheClear.js +29 -0
- package/dist/node_modules/lodash/_mapCacheDelete.js +24 -0
- package/dist/node_modules/lodash/_mapCacheGet.js +22 -0
- package/dist/node_modules/lodash/_mapCacheHas.js +22 -0
- package/dist/node_modules/lodash/_mapCacheSet.js +28 -0
- package/dist/node_modules/lodash/_mapToArray.js +23 -0
- package/dist/node_modules/lodash/_matchesStrictComparable.js +25 -0
- package/dist/node_modules/lodash/_memoizeCapped.js +32 -0
- package/dist/node_modules/lodash/_nativeCreate.js +12 -0
- package/dist/node_modules/lodash/_nativeKeys.js +12 -0
- package/dist/node_modules/lodash/_nativeKeysIn.js +25 -0
- package/dist/node_modules/lodash/_nodeUtil.js +43 -0
- package/dist/node_modules/lodash/_objectToString.js +27 -0
- package/dist/node_modules/lodash/_overArg.js +20 -0
- package/dist/node_modules/lodash/_overRest.js +42 -0
- package/dist/node_modules/lodash/_parent.js +23 -0
- package/dist/node_modules/lodash/_root.js +15 -0
- package/dist/node_modules/lodash/_safeGet.js +26 -0
- package/dist/node_modules/lodash/_setCacheAdd.js +24 -0
- package/dist/node_modules/lodash/_setCacheHas.js +19 -0
- package/dist/node_modules/lodash/_setToArray.js +23 -0
- package/dist/node_modules/lodash/_setToString.js +21 -0
- package/dist/node_modules/lodash/_shortOut.js +42 -0
- package/dist/node_modules/lodash/_stackClear.js +21 -0
- package/dist/node_modules/lodash/_stackDelete.js +23 -0
- package/dist/node_modules/lodash/_stackGet.js +19 -0
- package/dist/node_modules/lodash/_stackHas.js +19 -0
- package/dist/node_modules/lodash/_stackSet.js +42 -0
- package/dist/node_modules/lodash/_stringToPath.js +33 -0
- package/dist/node_modules/lodash/_toKey.js +27 -0
- package/dist/node_modules/lodash/_toSource.js +31 -0
- package/dist/node_modules/lodash/castArray.js +55 -0
- package/dist/node_modules/lodash/cloneDeep.js +40 -0
- package/dist/node_modules/lodash/constant.js +31 -0
- package/dist/node_modules/lodash/defaults.js +69 -0
- package/dist/node_modules/lodash/defaultsDeep.js +44 -0
- package/dist/node_modules/lodash/eq.js +42 -0
- package/dist/node_modules/lodash/flatten.js +28 -0
- package/dist/node_modules/lodash/get.js +39 -0
- package/dist/node_modules/lodash/hasIn.js +41 -0
- package/dist/node_modules/lodash/identity.js +26 -0
- package/dist/node_modules/lodash/isArguments.js +43 -0
- package/dist/node_modules/lodash/isArray.js +31 -0
- package/dist/node_modules/lodash/isArrayLike.js +40 -0
- package/dist/node_modules/lodash/isArrayLikeObject.js +40 -0
- package/dist/node_modules/lodash/isBuffer.js +52 -0
- package/dist/node_modules/lodash/isFunction.js +44 -0
- package/dist/node_modules/lodash/isLength.js +40 -0
- package/dist/node_modules/lodash/isMap.js +35 -0
- package/dist/node_modules/lodash/isObject.js +36 -0
- package/dist/node_modules/lodash/isObjectLike.js +34 -0
- package/dist/node_modules/lodash/isPlainObject.js +70 -0
- package/dist/node_modules/lodash/isSet.js +35 -0
- package/dist/node_modules/lodash/isSymbol.js +36 -0
- package/dist/node_modules/lodash/isTypedArray.js +35 -0
- package/dist/node_modules/lodash/keyBy.js +48 -0
- package/dist/node_modules/lodash/keys.js +45 -0
- package/dist/node_modules/lodash/keysIn.js +40 -0
- package/dist/node_modules/lodash/last.js +25 -0
- package/dist/node_modules/lodash/map.js +67 -0
- package/dist/node_modules/lodash/memoize.js +79 -0
- package/dist/node_modules/lodash/merge.js +51 -0
- package/dist/node_modules/lodash/mergeWith.js +46 -0
- package/dist/node_modules/lodash/omit.js +75 -0
- package/dist/node_modules/lodash/property.js +41 -0
- package/dist/node_modules/lodash/stubArray.js +28 -0
- package/dist/node_modules/lodash/stubFalse.js +23 -0
- package/dist/node_modules/lodash/toPlainObject.js +39 -0
- package/dist/node_modules/lodash/toString.js +34 -0
- package/dist/node_modules/lodash/values.js +46 -0
- package/dist/node_modules/lodash.mapvalues/index.js +2290 -0
- package/dist/node_modules/optics-ts/dist/mjs/index.js +31 -0
- package/dist/node_modules/optics-ts/dist/mjs/internals.js +460 -0
- package/dist/node_modules/proxy-compare/dist/index.modern.js +7 -0
- package/dist/node_modules/react-hotkeys-hook/dist/react-hotkeys-hook.esm.js +395 -0
- package/dist/node_modules/react-tracked/dist/index.modern.js +48 -0
- package/dist/node_modules/use-deep-compare/dist-web/index.js +35 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +181 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +32 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +254 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +30 -0
- package/dist/node_modules/use-sync-external-store/shim/index.js +21 -0
- package/dist/node_modules/use-sync-external-store/shim/with-selector.js +19 -0
- package/dist/node_modules/zustand/esm/middleware.js +551 -0
- package/dist/node_modules/zustand/esm/traditional.js +25 -0
- package/dist/node_modules/zustand/esm/vanilla.js +34 -0
- package/dist/node_modules/zustand-x/dist/index.js +217 -0
- package/dist/src/common/styles.js +12 -12
- package/dist/src/components/actions/button/button.js +11 -10
- package/dist/src/components/actions/dropdown/dropdown.js +5 -5
- package/dist/src/components/actions/rate/rate.js +2 -2
- package/dist/src/components/actions/switch/switch.js +3 -3
- package/dist/src/components/actions/toggle/toggle.js +4 -4
- package/dist/src/components/actions/upload/upload.js +3 -3
- package/dist/src/components/atoms/box/box.js +2 -2
- package/dist/src/components/atoms/typography/display.js +2 -2
- package/dist/src/components/atoms/typography/heading.js +2 -2
- package/dist/src/components/atoms/typography/paragraph.js +2 -2
- package/dist/src/components/atoms/typography/typography.js +2 -2
- package/dist/src/components/card/action/action.js +6 -6
- package/dist/src/components/card/audio/audio.js +5 -5
- package/dist/src/components/card/feature/feature.js +7 -7
- package/dist/src/components/card/meeting/meeting.js +6 -6
- package/dist/src/components/card/person/person.js +5 -5
- package/dist/src/components/card/price/price.js +4 -4
- package/dist/src/components/card/regular/regular.js +2 -2
- package/dist/src/components/card/styles.js +2 -2
- package/dist/src/components/card/video/video.js +5 -5
- package/dist/src/components/card/written/written.js +5 -5
- package/dist/src/components/custom/courses_selection/courses_selection.js +5 -5
- package/dist/src/components/custom/users_selection/users_selection.js +6 -6
- package/dist/src/components/editor/editor.js +2 -2
- package/dist/src/components/editor/navbar/alignment_dropdown.js +3 -3
- package/dist/src/components/editor/navbar/button_modal.js +2 -2
- package/dist/src/components/editor/navbar/navbar.js +6 -6
- package/dist/src/components/editor/plugins/blocks/buttons.js +3 -3
- package/dist/src/components/editor/plugins/blocks/image.js +12 -11
- package/dist/src/components/editor/plugins/blocks/list.js +2 -2
- package/dist/src/components/editor/plugins/blocks/media-popover.js +9 -7
- package/dist/src/components/editor/plugins/blocks/qa.js +2 -2
- package/dist/src/components/editor/plugins/blocks/resizable.js +3 -3
- package/dist/src/components/editor/plugins/blocks/table-cell.js +7 -7
- package/dist/src/components/editor/plugins/blocks/table-row.js +2 -2
- package/dist/src/components/editor/plugins/blocks/table.js +16 -14
- package/dist/src/components/editor/plugins/leafs/leafs.js +2 -2
- package/dist/src/components/editor/plugins/leafs/link.js +2 -2
- package/dist/src/components/editor/plugins/plate.js +3 -3
- package/dist/src/components/editor/simple_editor/navbar.js +4 -4
- package/dist/src/components/editor/simple_editor/simple_editor.js +3 -3
- package/dist/src/components/editor/styles/menu_button.js +2 -2
- package/dist/src/components/feedback/animated_toast/animated_toast.js +3 -3
- package/dist/src/components/feedback/badge/badge.js +3 -3
- package/dist/src/components/feedback/banner/banner.js +2 -2
- package/dist/src/components/feedback/chip/chip.js +3 -3
- package/dist/src/components/feedback/loader/loader.js +4 -3
- package/dist/src/components/feedback/notification/notification.js +2 -2
- package/dist/src/components/feedback/progress/progress.js +5 -5
- package/dist/src/components/feedback/toast/toast.js +3 -3
- package/dist/src/components/iconography/avatar/avatar.js +6 -6
- package/dist/src/components/iconography/icon/icon.js +2 -2
- package/dist/src/components/input/calendar/calendar.js +13 -13
- package/dist/src/components/input/checkbox/checkbox.js +2 -2
- package/dist/src/components/input/date/date.js +13 -13
- package/dist/src/components/input/filter/filter.js +11 -10
- package/dist/src/components/input/filter/filter_option.js +3 -3
- package/dist/src/components/input/radio/radio.js +3 -3
- package/dist/src/components/input/search/search.js +4 -4
- package/dist/src/components/input/select/select.js +3 -3
- package/dist/src/components/input/text_area/text_area.js +6 -6
- package/dist/src/components/input/text_input/text_input.js +7 -7
- package/dist/src/components/input/time/time.js +3 -3
- package/dist/src/components/media/video-player/playlist-item.js +3 -3
- package/dist/src/components/media/video-player/video.js +6 -6
- package/dist/src/components/navigation/breadcrumb/breadcrumb.js +3 -3
- package/dist/src/components/navigation/inner/inner.js +8 -8
- package/dist/src/components/navigation/tabs/tabs.js +4 -4
- package/dist/src/components/surfaces/accordion/accordion.js +3 -3
- package/dist/src/components/surfaces/calendar_date/calendar_date.js +6 -6
- package/dist/src/components/surfaces/carousel/card/card.js +4 -4
- package/dist/src/components/surfaces/comment/comment.js +10 -10
- package/dist/src/components/surfaces/drawer/drawer.js +6 -6
- package/dist/src/components/surfaces/message/message.js +2 -2
- package/dist/src/components/surfaces/modal/modal.js +3 -3
- package/dist/src/components/surfaces/post/post.js +9 -9
- package/dist/src/components/table/table/table.js +7 -7
- package/dist/src/index.js +0 -1
- package/package.json +2 -1
|
@@ -0,0 +1,585 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
require('slate-react');
|
|
5
|
+
var index$5 = require('../../plate-normalizers/dist/index.js');
|
|
6
|
+
var slate = require('slate');
|
|
7
|
+
var index$1 = require('../../plate-core/dist/index.js');
|
|
8
|
+
var index$3 = require('../../utils/dist/index.js');
|
|
9
|
+
var index$2 = require('../../slate/dist/index.js');
|
|
10
|
+
var index$4 = require('../../slate-utils/dist/index.js');
|
|
11
|
+
var index = require('../../../zustand-x/dist/index.js');
|
|
12
|
+
var reactUtils = require('@udecode/react-utils');
|
|
13
|
+
|
|
14
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
15
|
+
|
|
16
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
17
|
+
|
|
18
|
+
var __defProp = Object.defineProperty;
|
|
19
|
+
var __defProps = Object.defineProperties;
|
|
20
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
21
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
22
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
23
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
24
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
25
|
+
var __spreadValues = (a, b) => {
|
|
26
|
+
for (var prop in b || (b = {}))
|
|
27
|
+
if (__hasOwnProp.call(b, prop))
|
|
28
|
+
__defNormalProp(a, prop, b[prop]);
|
|
29
|
+
if (__getOwnPropSymbols)
|
|
30
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
31
|
+
if (__propIsEnum.call(b, prop))
|
|
32
|
+
__defNormalProp(a, prop, b[prop]);
|
|
33
|
+
}
|
|
34
|
+
return a;
|
|
35
|
+
};
|
|
36
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
37
|
+
var __objRest = (source, exclude) => {
|
|
38
|
+
var target = {};
|
|
39
|
+
for (var prop in source)
|
|
40
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
41
|
+
target[prop] = source[prop];
|
|
42
|
+
if (source != null && __getOwnPropSymbols)
|
|
43
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
44
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
45
|
+
target[prop] = source[prop];
|
|
46
|
+
}
|
|
47
|
+
return target;
|
|
48
|
+
};
|
|
49
|
+
var createLinkNode = (editor, { url, text = "", target, children }) => {
|
|
50
|
+
const type = index$1.getPluginType(editor, ELEMENT_LINK);
|
|
51
|
+
return {
|
|
52
|
+
type,
|
|
53
|
+
url,
|
|
54
|
+
target,
|
|
55
|
+
children: children != null ? children : [{ text }]
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
var getLinkAttributes = (editor, link) => {
|
|
59
|
+
const { allowedSchemes, defaultLinkAttributes, dangerouslySkipSanitization } = index$1.getPluginOptions(editor, ELEMENT_LINK);
|
|
60
|
+
const attributes = __spreadValues({}, defaultLinkAttributes);
|
|
61
|
+
const href = dangerouslySkipSanitization ? link.url : index$3.sanitizeUrl(link.url, { allowedSchemes }) || void 0;
|
|
62
|
+
if (href !== void 0) {
|
|
63
|
+
attributes.href = href;
|
|
64
|
+
}
|
|
65
|
+
if ("target" in link) {
|
|
66
|
+
attributes.target = link.target;
|
|
67
|
+
}
|
|
68
|
+
return attributes;
|
|
69
|
+
};
|
|
70
|
+
var floatingLinkStore = index.createZustandStore("floatingLink")({
|
|
71
|
+
openEditorId: null,
|
|
72
|
+
mouseDown: false,
|
|
73
|
+
updated: false,
|
|
74
|
+
url: "",
|
|
75
|
+
text: "",
|
|
76
|
+
newTab: false,
|
|
77
|
+
mode: "",
|
|
78
|
+
isEditing: false
|
|
79
|
+
}).extendActions((set) => ({
|
|
80
|
+
reset: () => {
|
|
81
|
+
set.url("");
|
|
82
|
+
set.text("");
|
|
83
|
+
set.newTab(false);
|
|
84
|
+
set.mode("");
|
|
85
|
+
set.isEditing(false);
|
|
86
|
+
}
|
|
87
|
+
})).extendActions((set) => ({
|
|
88
|
+
show: (mode, editorId) => {
|
|
89
|
+
set.mode(mode);
|
|
90
|
+
set.isEditing(false);
|
|
91
|
+
set.openEditorId(editorId);
|
|
92
|
+
},
|
|
93
|
+
hide: () => {
|
|
94
|
+
set.openEditorId(null);
|
|
95
|
+
set.reset();
|
|
96
|
+
}
|
|
97
|
+
})).extendSelectors((state) => ({
|
|
98
|
+
isOpen: (editorId) => state.openEditorId === editorId
|
|
99
|
+
}));
|
|
100
|
+
var floatingLinkActions = floatingLinkStore.set;
|
|
101
|
+
var floatingLinkSelectors = floatingLinkStore.get;
|
|
102
|
+
var useFloatingLinkSelectors = () => floatingLinkStore.use;
|
|
103
|
+
|
|
104
|
+
// src/components/FloatingLink/FloatingLinkNewTabInput.tsx
|
|
105
|
+
var useFloatingLinkNewTabInputState = () => {
|
|
106
|
+
const updated = useFloatingLinkSelectors().updated();
|
|
107
|
+
const ref = React__default.default.useRef(null);
|
|
108
|
+
const [checked, setChecked] = React__default.default.useState(
|
|
109
|
+
floatingLinkSelectors.newTab()
|
|
110
|
+
);
|
|
111
|
+
React__default.default.useEffect(() => {
|
|
112
|
+
if (ref.current && updated) {
|
|
113
|
+
setTimeout(() => {
|
|
114
|
+
var _a;
|
|
115
|
+
(_a = ref.current) == null ? void 0 : _a.focus();
|
|
116
|
+
}, 0);
|
|
117
|
+
}
|
|
118
|
+
}, [updated]);
|
|
119
|
+
return {
|
|
120
|
+
ref,
|
|
121
|
+
checked,
|
|
122
|
+
setChecked
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
var useFloatingLinkNewTabInput = ({
|
|
126
|
+
checked,
|
|
127
|
+
ref,
|
|
128
|
+
setChecked
|
|
129
|
+
}) => {
|
|
130
|
+
const onChange = React__default.default.useCallback(
|
|
131
|
+
(e) => {
|
|
132
|
+
setChecked(e.target.checked);
|
|
133
|
+
floatingLinkActions.newTab(e.target.checked);
|
|
134
|
+
},
|
|
135
|
+
[setChecked]
|
|
136
|
+
);
|
|
137
|
+
return {
|
|
138
|
+
ref,
|
|
139
|
+
props: {
|
|
140
|
+
onChange,
|
|
141
|
+
checked,
|
|
142
|
+
type: "checkbox"
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
reactUtils.createPrimitiveComponent("input")({
|
|
147
|
+
propsHook: useFloatingLinkNewTabInput,
|
|
148
|
+
stateHook: useFloatingLinkNewTabInputState
|
|
149
|
+
});
|
|
150
|
+
var useFloatingLinkUrlInputState = () => {
|
|
151
|
+
const updated = useFloatingLinkSelectors().updated();
|
|
152
|
+
const ref = React__default.default.useRef(null);
|
|
153
|
+
React__default.default.useEffect(() => {
|
|
154
|
+
if (ref.current && updated) {
|
|
155
|
+
setTimeout(() => {
|
|
156
|
+
var _a;
|
|
157
|
+
(_a = ref.current) == null ? void 0 : _a.focus();
|
|
158
|
+
}, 0);
|
|
159
|
+
}
|
|
160
|
+
}, [updated]);
|
|
161
|
+
return {
|
|
162
|
+
ref
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
var useFloatingLinkUrlInput = (state) => {
|
|
166
|
+
const onChange = React__default.default.useCallback((e) => {
|
|
167
|
+
floatingLinkActions.url(e.target.value);
|
|
168
|
+
}, []);
|
|
169
|
+
return {
|
|
170
|
+
ref: state.ref,
|
|
171
|
+
props: {
|
|
172
|
+
onChange,
|
|
173
|
+
defaultValue: floatingLinkSelectors.url()
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
reactUtils.createPrimitiveComponent("input")({
|
|
178
|
+
propsHook: useFloatingLinkUrlInput,
|
|
179
|
+
stateHook: useFloatingLinkUrlInputState
|
|
180
|
+
});
|
|
181
|
+
var useLinkOpenButtonState = () => {
|
|
182
|
+
const editor = index$1.useEditorRef();
|
|
183
|
+
const selection = index$1.useEditorSelection();
|
|
184
|
+
const entry = React__default.default.useMemo(
|
|
185
|
+
() => index$2.findNode(editor, {
|
|
186
|
+
match: { type: index$1.getPluginType(editor, ELEMENT_LINK) }
|
|
187
|
+
}),
|
|
188
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
189
|
+
[editor, selection]
|
|
190
|
+
);
|
|
191
|
+
if (!entry) {
|
|
192
|
+
return {};
|
|
193
|
+
}
|
|
194
|
+
const [element] = entry;
|
|
195
|
+
return {
|
|
196
|
+
element
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
var useLinkOpenButton = ({ element }) => {
|
|
200
|
+
const editor = index$1.useEditorRef();
|
|
201
|
+
if (!element) {
|
|
202
|
+
return {
|
|
203
|
+
props: {}
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
const linkAttributes = getLinkAttributes(editor, element);
|
|
207
|
+
return {
|
|
208
|
+
props: __spreadProps(__spreadValues({}, linkAttributes), {
|
|
209
|
+
target: "_blank",
|
|
210
|
+
"aria-label": "Open link in a new tab",
|
|
211
|
+
onMouseOver: (e) => {
|
|
212
|
+
e.stopPropagation();
|
|
213
|
+
}
|
|
214
|
+
})
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
reactUtils.createPrimitiveComponent("a")({
|
|
218
|
+
stateHook: useLinkOpenButtonState,
|
|
219
|
+
propsHook: useLinkOpenButton
|
|
220
|
+
});
|
|
221
|
+
var insertLink = (editor, createLinkNodeOptions, options) => {
|
|
222
|
+
index$2.insertNodes(
|
|
223
|
+
editor,
|
|
224
|
+
[createLinkNode(editor, createLinkNodeOptions)],
|
|
225
|
+
options
|
|
226
|
+
);
|
|
227
|
+
};
|
|
228
|
+
var unwrapLink = (editor, options) => {
|
|
229
|
+
return index$2.withoutNormalizing(editor, () => {
|
|
230
|
+
var _a, _b, _c, _d, _e, _f;
|
|
231
|
+
if (options == null ? void 0 : options.split) {
|
|
232
|
+
const linkAboveAnchor = index$2.getAboveNode(editor, {
|
|
233
|
+
at: (_a = editor.selection) == null ? void 0 : _a.anchor,
|
|
234
|
+
match: { type: index$1.getPluginType(editor, ELEMENT_LINK) }
|
|
235
|
+
});
|
|
236
|
+
if (linkAboveAnchor) {
|
|
237
|
+
index$2.splitNodes(editor, {
|
|
238
|
+
at: (_b = editor.selection) == null ? void 0 : _b.anchor,
|
|
239
|
+
match: (n) => index$2.isElement(n) && n.type === index$1.getPluginType(editor, ELEMENT_LINK)
|
|
240
|
+
});
|
|
241
|
+
unwrapLink(editor, {
|
|
242
|
+
at: (_c = editor.selection) == null ? void 0 : _c.anchor
|
|
243
|
+
});
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
const linkAboveFocus = index$2.getAboveNode(editor, {
|
|
247
|
+
at: (_d = editor.selection) == null ? void 0 : _d.focus,
|
|
248
|
+
match: { type: index$1.getPluginType(editor, ELEMENT_LINK) }
|
|
249
|
+
});
|
|
250
|
+
if (linkAboveFocus) {
|
|
251
|
+
index$2.splitNodes(editor, {
|
|
252
|
+
at: (_e = editor.selection) == null ? void 0 : _e.focus,
|
|
253
|
+
match: (n) => index$2.isElement(n) && n.type === index$1.getPluginType(editor, ELEMENT_LINK)
|
|
254
|
+
});
|
|
255
|
+
unwrapLink(editor, {
|
|
256
|
+
at: (_f = editor.selection) == null ? void 0 : _f.focus
|
|
257
|
+
});
|
|
258
|
+
return true;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
index$2.unwrapNodes(editor, __spreadValues({
|
|
262
|
+
match: { type: index$1.getPluginType(editor, ELEMENT_LINK) }
|
|
263
|
+
}, options));
|
|
264
|
+
});
|
|
265
|
+
};
|
|
266
|
+
var upsertLinkText = (editor, { text }) => {
|
|
267
|
+
const newLink = index$2.getAboveNode(editor, {
|
|
268
|
+
match: { type: index$1.getPluginType(editor, ELEMENT_LINK) }
|
|
269
|
+
});
|
|
270
|
+
if (newLink) {
|
|
271
|
+
const [newLinkNode, newLinkPath] = newLink;
|
|
272
|
+
if ((text == null ? void 0 : text.length) && text !== index$2.getEditorString(editor, newLinkPath)) {
|
|
273
|
+
const firstText = newLinkNode.children[0];
|
|
274
|
+
index$4.replaceNodeChildren(editor, {
|
|
275
|
+
at: newLinkPath,
|
|
276
|
+
nodes: __spreadProps(__spreadValues({}, firstText), { text }),
|
|
277
|
+
insertOptions: {
|
|
278
|
+
select: true
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
var wrapLink = (editor, _a) => {
|
|
285
|
+
var _b = _a, { url, target } = _b, options = __objRest(_b, ["url", "target"]);
|
|
286
|
+
index$2.wrapNodes(
|
|
287
|
+
editor,
|
|
288
|
+
{
|
|
289
|
+
type: index$1.getPluginType(editor, ELEMENT_LINK),
|
|
290
|
+
url,
|
|
291
|
+
target,
|
|
292
|
+
children: []
|
|
293
|
+
},
|
|
294
|
+
__spreadValues({ split: true }, options)
|
|
295
|
+
);
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
// src/transforms/upsertLink.ts
|
|
299
|
+
var upsertLink = (editor, {
|
|
300
|
+
url,
|
|
301
|
+
text,
|
|
302
|
+
target,
|
|
303
|
+
insertTextInLink,
|
|
304
|
+
insertNodesOptions,
|
|
305
|
+
skipValidation = false
|
|
306
|
+
}) => {
|
|
307
|
+
var _a, _b, _c;
|
|
308
|
+
const at = editor.selection;
|
|
309
|
+
if (!at)
|
|
310
|
+
return;
|
|
311
|
+
const linkAbove = index$2.getAboveNode(editor, {
|
|
312
|
+
at,
|
|
313
|
+
match: { type: index$1.getPluginType(editor, ELEMENT_LINK) }
|
|
314
|
+
});
|
|
315
|
+
if (insertTextInLink && linkAbove) {
|
|
316
|
+
editor.insertText(url);
|
|
317
|
+
return true;
|
|
318
|
+
}
|
|
319
|
+
if (!skipValidation && !validateUrl(editor, url))
|
|
320
|
+
return;
|
|
321
|
+
if (index$3.isDefined(text) && text.length === 0) {
|
|
322
|
+
text = url;
|
|
323
|
+
}
|
|
324
|
+
if (linkAbove) {
|
|
325
|
+
if (url !== ((_a = linkAbove[0]) == null ? void 0 : _a.url) || target !== ((_b = linkAbove[0]) == null ? void 0 : _b.target)) {
|
|
326
|
+
index$2.setNodes(
|
|
327
|
+
editor,
|
|
328
|
+
{ url, target },
|
|
329
|
+
{
|
|
330
|
+
at: linkAbove[1]
|
|
331
|
+
}
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
upsertLinkText(editor, { url, text, target });
|
|
335
|
+
return true;
|
|
336
|
+
}
|
|
337
|
+
const linkEntry = index$2.findNode(editor, {
|
|
338
|
+
at,
|
|
339
|
+
match: { type: index$1.getPluginType(editor, ELEMENT_LINK) }
|
|
340
|
+
});
|
|
341
|
+
const [linkNode, linkPath] = linkEntry != null ? linkEntry : [];
|
|
342
|
+
let shouldReplaceText = false;
|
|
343
|
+
if (linkPath && (text == null ? void 0 : text.length)) {
|
|
344
|
+
const linkText = index$2.getEditorString(editor, linkPath);
|
|
345
|
+
if (text !== linkText) {
|
|
346
|
+
shouldReplaceText = true;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (index$2.isExpanded(at)) {
|
|
350
|
+
if (linkAbove) {
|
|
351
|
+
unwrapLink(editor, {
|
|
352
|
+
at: linkAbove[1]
|
|
353
|
+
});
|
|
354
|
+
} else {
|
|
355
|
+
unwrapLink(editor, {
|
|
356
|
+
split: true
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
wrapLink(editor, {
|
|
360
|
+
url,
|
|
361
|
+
target
|
|
362
|
+
});
|
|
363
|
+
upsertLinkText(editor, { url, target, text });
|
|
364
|
+
return true;
|
|
365
|
+
}
|
|
366
|
+
if (shouldReplaceText) {
|
|
367
|
+
index$2.removeNodes(editor, {
|
|
368
|
+
at: linkPath
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
const props = index$2.getNodeProps(linkNode != null ? linkNode : {});
|
|
372
|
+
const path = (_c = editor.selection) == null ? void 0 : _c.focus.path;
|
|
373
|
+
if (!path)
|
|
374
|
+
return;
|
|
375
|
+
const leaf = index$2.getNodeLeaf(editor, path);
|
|
376
|
+
if (!(text == null ? void 0 : text.length)) {
|
|
377
|
+
text = url;
|
|
378
|
+
}
|
|
379
|
+
insertLink(
|
|
380
|
+
editor,
|
|
381
|
+
__spreadProps(__spreadValues({}, props), {
|
|
382
|
+
url,
|
|
383
|
+
target,
|
|
384
|
+
children: [
|
|
385
|
+
__spreadProps(__spreadValues({}, leaf), {
|
|
386
|
+
text
|
|
387
|
+
})
|
|
388
|
+
]
|
|
389
|
+
}),
|
|
390
|
+
insertNodesOptions
|
|
391
|
+
);
|
|
392
|
+
return true;
|
|
393
|
+
};
|
|
394
|
+
var validateUrl = (editor, url) => {
|
|
395
|
+
const { allowedSchemes, isUrl: isUrl2, dangerouslySkipSanitization } = index$1.getPluginOptions(editor, ELEMENT_LINK);
|
|
396
|
+
if (isUrl2 && !isUrl2(url))
|
|
397
|
+
return false;
|
|
398
|
+
if (!dangerouslySkipSanitization && !index$3.sanitizeUrl(url, {
|
|
399
|
+
allowedSchemes,
|
|
400
|
+
permitInvalid: true
|
|
401
|
+
}))
|
|
402
|
+
return false;
|
|
403
|
+
return true;
|
|
404
|
+
};
|
|
405
|
+
var withLink = (editor, {
|
|
406
|
+
type,
|
|
407
|
+
options: { isUrl: isUrl2, getUrlHref, rangeBeforeOptions, keepSelectedTextOnPaste }
|
|
408
|
+
}) => {
|
|
409
|
+
const { insertData, insertText, apply, normalizeNode, insertBreak } = editor;
|
|
410
|
+
const wrapLink2 = () => {
|
|
411
|
+
index$2.withoutNormalizing(editor, () => {
|
|
412
|
+
var _a;
|
|
413
|
+
const selection = editor.selection;
|
|
414
|
+
let beforeWordRange = index$4.getRangeBefore(
|
|
415
|
+
editor,
|
|
416
|
+
selection,
|
|
417
|
+
rangeBeforeOptions
|
|
418
|
+
);
|
|
419
|
+
if (!beforeWordRange) {
|
|
420
|
+
beforeWordRange = index$4.getRangeFromBlockStart(editor);
|
|
421
|
+
}
|
|
422
|
+
if (!beforeWordRange)
|
|
423
|
+
return;
|
|
424
|
+
const hasLink = index$2.someNode(editor, {
|
|
425
|
+
at: beforeWordRange,
|
|
426
|
+
match: { type: index$1.getPluginType(editor, ELEMENT_LINK) }
|
|
427
|
+
});
|
|
428
|
+
if (hasLink)
|
|
429
|
+
return;
|
|
430
|
+
let beforeWordText = index$2.getEditorString(editor, beforeWordRange);
|
|
431
|
+
beforeWordText = (_a = getUrlHref == null ? void 0 : getUrlHref(beforeWordText)) != null ? _a : beforeWordText;
|
|
432
|
+
if (!isUrl2(beforeWordText))
|
|
433
|
+
return;
|
|
434
|
+
index$2.select(editor, beforeWordRange);
|
|
435
|
+
upsertLink(editor, {
|
|
436
|
+
url: beforeWordText
|
|
437
|
+
});
|
|
438
|
+
index$2.collapseSelection(editor, { edge: "end" });
|
|
439
|
+
});
|
|
440
|
+
};
|
|
441
|
+
editor.insertBreak = () => {
|
|
442
|
+
if (!index$2.isCollapsed(editor.selection))
|
|
443
|
+
return insertBreak();
|
|
444
|
+
wrapLink2();
|
|
445
|
+
insertBreak();
|
|
446
|
+
};
|
|
447
|
+
editor.insertText = (text) => {
|
|
448
|
+
if (text === " " && index$2.isCollapsed(editor.selection)) {
|
|
449
|
+
wrapLink2();
|
|
450
|
+
}
|
|
451
|
+
insertText(text);
|
|
452
|
+
};
|
|
453
|
+
editor.insertData = (data) => {
|
|
454
|
+
const text = data.getData("text/plain");
|
|
455
|
+
const textHref = getUrlHref == null ? void 0 : getUrlHref(text);
|
|
456
|
+
if (text) {
|
|
457
|
+
const value = textHref || text;
|
|
458
|
+
const inserted = upsertLink(editor, {
|
|
459
|
+
text: keepSelectedTextOnPaste ? void 0 : value,
|
|
460
|
+
url: value,
|
|
461
|
+
insertTextInLink: true
|
|
462
|
+
});
|
|
463
|
+
if (inserted)
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
insertData(data);
|
|
467
|
+
};
|
|
468
|
+
editor.apply = (operation) => {
|
|
469
|
+
if (operation.type === "set_selection") {
|
|
470
|
+
const range = operation.newProperties;
|
|
471
|
+
if (range && range.focus && range.anchor && index$2.isCollapsed(range)) {
|
|
472
|
+
const entry = index$2.getAboveNode(editor, {
|
|
473
|
+
at: range,
|
|
474
|
+
match: { type: index$1.getPluginType(editor, ELEMENT_LINK) }
|
|
475
|
+
});
|
|
476
|
+
if (entry) {
|
|
477
|
+
const [, path] = entry;
|
|
478
|
+
let newPoint;
|
|
479
|
+
if (index$2.isStartPoint(editor, range.focus, path)) {
|
|
480
|
+
newPoint = index$4.getPreviousNodeEndPoint(editor, path);
|
|
481
|
+
}
|
|
482
|
+
if (index$2.isEndPoint(editor, range.focus, path)) {
|
|
483
|
+
newPoint = index$4.getNextNodeStartPoint(editor, path);
|
|
484
|
+
}
|
|
485
|
+
if (newPoint) {
|
|
486
|
+
operation.newProperties = {
|
|
487
|
+
anchor: newPoint,
|
|
488
|
+
focus: newPoint
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
apply(operation);
|
|
495
|
+
};
|
|
496
|
+
editor.normalizeNode = ([node, path]) => {
|
|
497
|
+
if (node.type === index$1.getPluginType(editor, ELEMENT_LINK)) {
|
|
498
|
+
const range = editor.selection;
|
|
499
|
+
if (range && index$2.isCollapsed(range) && index$2.isEndPoint(editor, range.focus, path)) {
|
|
500
|
+
const nextPoint = index$4.getNextNodeStartPoint(editor, path);
|
|
501
|
+
if (nextPoint) {
|
|
502
|
+
index$2.select(editor, nextPoint);
|
|
503
|
+
} else {
|
|
504
|
+
const nextPath = slate.Path.next(path);
|
|
505
|
+
index$2.insertNodes(editor, { text: "" }, { at: nextPath });
|
|
506
|
+
index$2.select(editor, nextPath);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
normalizeNode([node, path]);
|
|
511
|
+
};
|
|
512
|
+
editor = index$5.withRemoveEmptyNodes(
|
|
513
|
+
editor,
|
|
514
|
+
index$1.mockPlugin({
|
|
515
|
+
options: { types: type }
|
|
516
|
+
})
|
|
517
|
+
);
|
|
518
|
+
return editor;
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
// src/createLinkPlugin.ts
|
|
522
|
+
var ELEMENT_LINK = "a";
|
|
523
|
+
var createLinkPlugin = index$1.createPluginFactory({
|
|
524
|
+
key: ELEMENT_LINK,
|
|
525
|
+
isElement: true,
|
|
526
|
+
isInline: true,
|
|
527
|
+
withOverrides: withLink,
|
|
528
|
+
options: {
|
|
529
|
+
allowedSchemes: ["http", "https", "mailto", "tel"],
|
|
530
|
+
dangerouslySkipSanitization: false,
|
|
531
|
+
defaultLinkAttributes: {},
|
|
532
|
+
isUrl: index$3.isUrl,
|
|
533
|
+
rangeBeforeOptions: {
|
|
534
|
+
matchString: " ",
|
|
535
|
+
skipInvalid: true,
|
|
536
|
+
afterMatch: true
|
|
537
|
+
},
|
|
538
|
+
triggerFloatingLinkHotkeys: "meta+k, ctrl+k",
|
|
539
|
+
keepSelectedTextOnPaste: true
|
|
540
|
+
},
|
|
541
|
+
then: (editor, { type }) => ({
|
|
542
|
+
props: ({ element }) => ({
|
|
543
|
+
nodeProps: getLinkAttributes(editor, element)
|
|
544
|
+
}),
|
|
545
|
+
deserializeHtml: {
|
|
546
|
+
rules: [
|
|
547
|
+
{
|
|
548
|
+
validNodeName: "A"
|
|
549
|
+
}
|
|
550
|
+
],
|
|
551
|
+
getNode: (el) => {
|
|
552
|
+
const url = el.getAttribute("href");
|
|
553
|
+
if (url && validateUrl(editor, url)) {
|
|
554
|
+
return {
|
|
555
|
+
type,
|
|
556
|
+
url,
|
|
557
|
+
target: el.getAttribute("target") || "_blank"
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
})
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
exports.ELEMENT_LINK = ELEMENT_LINK;
|
|
566
|
+
exports.createLinkNode = createLinkNode;
|
|
567
|
+
exports.createLinkPlugin = createLinkPlugin;
|
|
568
|
+
exports.floatingLinkActions = floatingLinkActions;
|
|
569
|
+
exports.floatingLinkSelectors = floatingLinkSelectors;
|
|
570
|
+
exports.floatingLinkStore = floatingLinkStore;
|
|
571
|
+
exports.getLinkAttributes = getLinkAttributes;
|
|
572
|
+
exports.insertLink = insertLink;
|
|
573
|
+
exports.unwrapLink = unwrapLink;
|
|
574
|
+
exports.upsertLink = upsertLink;
|
|
575
|
+
exports.upsertLinkText = upsertLinkText;
|
|
576
|
+
exports.useFloatingLinkNewTabInput = useFloatingLinkNewTabInput;
|
|
577
|
+
exports.useFloatingLinkNewTabInputState = useFloatingLinkNewTabInputState;
|
|
578
|
+
exports.useFloatingLinkSelectors = useFloatingLinkSelectors;
|
|
579
|
+
exports.useFloatingLinkUrlInput = useFloatingLinkUrlInput;
|
|
580
|
+
exports.useFloatingLinkUrlInputState = useFloatingLinkUrlInputState;
|
|
581
|
+
exports.useLinkOpenButton = useLinkOpenButton;
|
|
582
|
+
exports.useLinkOpenButtonState = useLinkOpenButtonState;
|
|
583
|
+
exports.validateUrl = validateUrl;
|
|
584
|
+
exports.withLink = withLink;
|
|
585
|
+
exports.wrapLink = wrapLink;
|