@burdenoff/microfe-support 2026.1029.3 → 2026.1031.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/global-operations.js +1 -2
- package/dist/generated/global-operations.js.map +1 -1
- package/dist/generated/global-types.js +1 -2
- package/dist/generated/global-types.js.map +1 -1
- package/dist/node_modules/@tiptap/core/dist/index.js +701 -712
- package/dist/node_modules/@tiptap/core/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +1 -2
- package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +1 -1
- package/dist/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js +1 -2
- package/dist/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +15 -16
- package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-bold/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-bold/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-code/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-code/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +25 -26
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-document/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-document/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +16 -17
- package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-italic/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-italic/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-link/dist/index.js +71 -80
- package/dist/node_modules/@tiptap/extension-link/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-list/dist/index.js +77 -90
- package/dist/node_modules/@tiptap/extension-list/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-strike/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-strike/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-text/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-text/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-underline/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/extension-underline/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extensions/dist/index.js +112 -113
- package/dist/node_modules/@tiptap/extensions/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/react/dist/index.js +5 -10
- package/dist/node_modules/@tiptap/react/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/starter-kit/dist/index.js +1 -2
- package/dist/node_modules/@tiptap/starter-kit/dist/index.js.map +1 -1
- package/dist/node_modules/clsx/dist/clsx.js +1 -2
- package/dist/node_modules/clsx/dist/clsx.js.map +1 -1
- package/dist/node_modules/dompurify/dist/purify.es.js +357 -347
- package/dist/node_modules/dompurify/dist/purify.es.js.map +1 -1
- package/dist/node_modules/fast-equals/dist/es/index.js +1 -2
- package/dist/node_modules/fast-equals/dist/es/index.js.map +1 -1
- package/dist/node_modules/linkifyjs/dist/linkify.js +1 -2
- package/dist/node_modules/linkifyjs/dist/linkify.js.map +1 -1
- package/dist/node_modules/marked/lib/marked.esm.js +10 -70
- package/dist/node_modules/marked/lib/marked.esm.js.map +1 -1
- package/dist/node_modules/orderedmap/dist/index.js +1 -2
- package/dist/node_modules/orderedmap/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-commands/dist/index.js +107 -108
- package/dist/node_modules/prosemirror-commands/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js +12 -13
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-gapcursor/dist/index.js +42 -47
- package/dist/node_modules/prosemirror-gapcursor/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-history/dist/index.js +47 -49
- package/dist/node_modules/prosemirror-history/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-keymap/dist/index.js +15 -16
- package/dist/node_modules/prosemirror-keymap/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-model/dist/index.js +37 -41
- package/dist/node_modules/prosemirror-model/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-schema-list/dist/index.js +36 -37
- package/dist/node_modules/prosemirror-schema-list/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-state/dist/index.js +1 -2
- package/dist/node_modules/prosemirror-state/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-transform/dist/index.js +1 -2
- package/dist/node_modules/prosemirror-transform/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-view/dist/index.js +302 -304
- package/dist/node_modules/prosemirror-view/dist/index.js.map +1 -1
- package/dist/node_modules/rope-sequence/dist/index.js +1 -2
- package/dist/node_modules/rope-sequence/dist/index.js.map +1 -1
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +4 -21
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -1
- package/dist/node_modules/w3c-keyname/index.js +0 -1
- package/dist/node_modules/w3c-keyname/index.js.map +1 -1
- package/dist/support/SupportAdminRoot.js +14 -15
- package/dist/support/SupportAdminRoot.js.map +1 -1
- package/dist/support/SupportAdminRoutes.js +5 -6
- package/dist/support/SupportAdminRoutes.js.map +1 -1
- package/dist/support/SupportUserRoot.js +10 -11
- package/dist/support/SupportUserRoot.js.map +1 -1
- package/dist/support/SupportUserRoutes.js +1 -2
- package/dist/support/SupportUserRoutes.js.map +1 -1
- package/dist/support/components/NotificationToast.js +1 -2
- package/dist/support/components/NotificationToast.js.map +1 -1
- package/dist/support/components/PageLayout.js +15 -16
- package/dist/support/components/PageLayout.js.map +1 -1
- package/dist/support/components/RouteHelpers.js +1 -2
- package/dist/support/components/RouteHelpers.js.map +1 -1
- package/dist/support/components/analytics/CategoryBreakdown.js +9 -10
- package/dist/support/components/analytics/CategoryBreakdown.js.map +1 -1
- package/dist/support/components/analytics/MetricCard.js +1 -2
- package/dist/support/components/analytics/MetricCard.js.map +1 -1
- package/dist/support/components/analytics/PriorityBreakdown.js +9 -10
- package/dist/support/components/analytics/PriorityBreakdown.js.map +1 -1
- package/dist/support/components/analytics/SLAReport.js +5 -6
- package/dist/support/components/analytics/SLAReport.js.map +1 -1
- package/dist/support/components/analytics/SatisfactionDistribution.js +5 -6
- package/dist/support/components/analytics/SatisfactionDistribution.js.map +1 -1
- package/dist/support/components/analytics/TopAgents.js +5 -6
- package/dist/support/components/analytics/TopAgents.js.map +1 -1
- package/dist/support/components/analytics/TrendChart.js +5 -6
- package/dist/support/components/analytics/TrendChart.js.map +1 -1
- package/dist/support/components/careers/BulkCandidateActionGuidance.js +1 -2
- package/dist/support/components/careers/BulkCandidateActionGuidance.js.map +1 -1
- package/dist/support/components/careers/BulkCandidateDialogs.js +321 -322
- package/dist/support/components/careers/BulkCandidateDialogs.js.map +1 -1
- package/dist/support/components/careers/BulkOperationFeedback.js +1 -2
- package/dist/support/components/careers/BulkOperationFeedback.js.map +1 -1
- package/dist/support/components/careers/BulkSelectionSummary.js +1 -2
- package/dist/support/components/careers/BulkSelectionSummary.js.map +1 -1
- package/dist/support/components/careers/JobApplicationFilterContextGuard.js +1 -2
- package/dist/support/components/careers/JobApplicationFilterContextGuard.js.map +1 -1
- package/dist/support/components/careers/RichTextEditor.js +17 -18
- package/dist/support/components/careers/RichTextEditor.js.map +1 -1
- package/dist/support/components/kb/ArticleForm.js +10 -11
- package/dist/support/components/kb/ArticleForm.js.map +1 -1
- package/dist/support/components/settings/CannedResponsesSettings.js +2 -3
- package/dist/support/components/settings/CannedResponsesSettings.js.map +1 -1
- package/dist/support/components/settings/SLAPoliciesSettings.js +1 -2
- package/dist/support/components/settings/SLAPoliciesSettings.js.map +1 -1
- package/dist/support/components/settings/TicketCategoriesSettings.js +3 -8
- package/dist/support/components/settings/TicketCategoriesSettings.js.map +1 -1
- package/dist/support/components/tickets/AttachmentList.js +4 -5
- package/dist/support/components/tickets/AttachmentList.js.map +1 -1
- package/dist/support/components/tickets/MarkdownContent.js +1 -2
- package/dist/support/components/tickets/MarkdownContent.js.map +1 -1
- package/dist/support/components/tickets/MessageComposer.js +1 -2
- package/dist/support/components/tickets/MessageComposer.js.map +1 -1
- package/dist/support/components/tickets/MessageThread.js +13 -14
- package/dist/support/components/tickets/MessageThread.js.map +1 -1
- package/dist/support/components/tickets/TicketDetailHeader.js +13 -14
- package/dist/support/components/tickets/TicketDetailHeader.js.map +1 -1
- package/dist/support/components/tickets/TicketHeader.js +1 -2
- package/dist/support/components/tickets/TicketHeader.js.map +1 -1
- package/dist/support/components/tickets/TicketSidebar.js +6 -7
- package/dist/support/components/tickets/TicketSidebar.js.map +1 -1
- package/dist/support/components/tickets/TriagePanel.js +25 -26
- package/dist/support/components/tickets/TriagePanel.js.map +1 -1
- package/dist/support/components/ui.js +1 -2
- package/dist/support/constants/pipeline.js +1 -2
- package/dist/support/constants/pipeline.js.map +1 -1
- package/dist/support/constants.js +1 -2
- package/dist/support/constants.js.map +1 -1
- package/dist/support/events/rybbit.js +1 -2
- package/dist/support/events/rybbit.js.map +1 -1
- package/dist/support/hooks/index.js +6 -6
- package/dist/support/hooks/useAnalyticsOperations.js +1 -2
- package/dist/support/hooks/useAnalyticsOperations.js.map +1 -1
- package/dist/support/hooks/useAttachmentsFailedToast.js +1 -2
- package/dist/support/hooks/useAttachmentsFailedToast.js.map +1 -1
- package/dist/support/hooks/useChatOperations.js +14 -15
- package/dist/support/hooks/useChatOperations.js.map +1 -1
- package/dist/support/hooks/useDebouncedUrlText.js +1 -2
- package/dist/support/hooks/useDebouncedUrlText.js.map +1 -1
- package/dist/support/hooks/useKnowledgeBaseOperations.js +62 -63
- package/dist/support/hooks/useKnowledgeBaseOperations.js.map +1 -1
- package/dist/support/hooks/useNotification.js +1 -2
- package/dist/support/hooks/useNotification.js.map +1 -1
- package/dist/support/hooks/useRegisterFooter.js +1 -2
- package/dist/support/hooks/useRegisterFooter.js.map +1 -1
- package/dist/support/hooks/useSettingsOperations.js +1 -2
- package/dist/support/hooks/useSettingsOperations.js.map +1 -1
- package/dist/support/hooks/useSupportAttachments.js +1 -2
- package/dist/support/hooks/useSupportAttachments.js.map +1 -1
- package/dist/support/hooks/useTicketListOperations.js +9 -10
- package/dist/support/hooks/useTicketListOperations.js.map +1 -1
- package/dist/support/hooks/useTicketOperations.js +57 -58
- package/dist/support/hooks/useTicketOperations.js.map +1 -1
- package/dist/support/hooks/useTr.js +1 -2
- package/dist/support/hooks/useTr.js.map +1 -1
- package/dist/support/index.js +4 -4
- package/dist/support/pages/AnalyticsPage.js +34 -35
- package/dist/support/pages/AnalyticsPage.js.map +1 -1
- package/dist/support/pages/ArticleDetailAdminPage.js +33 -38
- package/dist/support/pages/ArticleDetailAdminPage.js.map +1 -1
- package/dist/support/pages/ArticleDetailUserPage.js +22 -23
- package/dist/support/pages/ArticleDetailUserPage.js.map +1 -1
- package/dist/support/pages/ContactInquiriesPage.js +5 -6
- package/dist/support/pages/ContactInquiriesPage.js.map +1 -1
- package/dist/support/pages/ContactInquiryDetailPage.js +13 -14
- package/dist/support/pages/ContactInquiryDetailPage.js.map +1 -1
- package/dist/support/pages/CreateArticlePage.js +15 -16
- package/dist/support/pages/CreateArticlePage.js.map +1 -1
- package/dist/support/pages/CreateTicketPage.js +37 -44
- package/dist/support/pages/CreateTicketPage.js.map +1 -1
- package/dist/support/pages/EditArticlePage.js +20 -21
- package/dist/support/pages/EditArticlePage.js.map +1 -1
- package/dist/support/pages/InterviewersPage.js +121 -122
- package/dist/support/pages/InterviewersPage.js.map +1 -1
- package/dist/support/pages/JobApplicationDetailPage.js +322 -332
- package/dist/support/pages/JobApplicationDetailPage.js.map +1 -1
- package/dist/support/pages/JobApplicationsPage.js +556 -561
- package/dist/support/pages/JobApplicationsPage.js.map +1 -1
- package/dist/support/pages/JobPostingDetailPage.js +489 -490
- package/dist/support/pages/JobPostingDetailPage.js.map +1 -1
- package/dist/support/pages/JobPostingsPage.js +279 -280
- package/dist/support/pages/JobPostingsPage.js.map +1 -1
- package/dist/support/pages/KnowledgeBaseAdminPage.js +26 -27
- package/dist/support/pages/KnowledgeBaseAdminPage.js.map +1 -1
- package/dist/support/pages/KnowledgeBaseUserPage.js +23 -24
- package/dist/support/pages/KnowledgeBaseUserPage.js.map +1 -1
- package/dist/support/pages/SettingsPage.js +43 -44
- package/dist/support/pages/SettingsPage.js.map +1 -1
- package/dist/support/pages/TicketDetailAdminPage.js +54 -55
- package/dist/support/pages/TicketDetailAdminPage.js.map +1 -1
- package/dist/support/pages/TicketDetailUserPage.js +61 -62
- package/dist/support/pages/TicketDetailUserPage.js.map +1 -1
- package/dist/support/pages/TicketListPage.js +77 -78
- package/dist/support/pages/TicketListPage.js.map +1 -1
- package/dist/support/providers/SupportProvider.js +1 -2
- package/dist/support/providers/SupportProvider.js.map +1 -1
- package/dist/support/store/supportStore.js +1 -2
- package/dist/support/store/supportStore.js.map +1 -1
- package/dist/support/translations/en.js +1 -2
- package/dist/support/translations/en.js.map +1 -1
- package/dist/support/utils/attachments.js +1 -2
- package/dist/support/utils/attachments.js.map +1 -1
- package/dist/support/utils/breadcrumbRegistry.js +3 -4
- package/dist/support/utils/breadcrumbRegistry.js.map +1 -1
- package/dist/support/utils/bulkCandidateOperations.js +0 -1
- package/dist/support/utils/bulkCandidateOperations.js.map +1 -1
- package/dist/support/utils/bulkCandidateTargetQuery.js +1 -2
- package/dist/support/utils/bulkCandidateTargetQuery.js.map +1 -1
- package/dist/support/utils/categoryColors.js +1 -2
- package/dist/support/utils/categoryColors.js.map +1 -1
- package/dist/support/utils/cn.js +1 -2
- package/dist/support/utils/cn.js.map +1 -1
- package/dist/support/utils/context.js +3 -4
- package/dist/support/utils/context.js.map +1 -1
- package/dist/support/utils/errors.js +1 -2
- package/dist/support/utils/errors.js.map +1 -1
- package/dist/support/utils/i18n.js +1 -2
- package/dist/support/utils/i18n.js.map +1 -1
- package/dist/support/utils/index.js +1 -2
- package/dist/support/utils/index.js.map +1 -1
- package/dist/support/utils/jobApplicationFilterParams.js +1 -2
- package/dist/support/utils/jobApplicationFilterParams.js.map +1 -1
- package/dist/support/utils/markdown.js +1 -2
- package/dist/support/utils/markdown.js.map +1 -1
- package/dist/support/utils/supportFiles.js +2 -11
- package/dist/support/utils/supportFiles.js.map +1 -1
- package/dist/support/utils/ticketFilters.js +1 -2
- package/dist/support/utils/ticketFilters.js.map +1 -1
- package/dist/support/utils/uiTokens.js +1 -2
- package/dist/support/utils/uiTokens.js.map +1 -1
- package/dist/utils/nativeBridge.js +1 -2
- package/package.json +21 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../node_modules/prosemirror-dropcursor/dist/index.js"],"sourcesContent":["import { Plugin } from 'prosemirror-state';\nimport { dropPoint } from 'prosemirror-transform';\n\n/**\nCreate a plugin that, when added to a ProseMirror instance,\ncauses a decoration to show up at the drop position when something\nis dragged over the editor.\n\nNodes may add a `disableDropCursor` property to their spec to\ncontrol the showing of a drop cursor inside them. This may be a\nboolean or a function, which will be called with a view and a\nposition, and should return a boolean.\n*/\nfunction dropCursor(options = {}) {\n return new Plugin({\n view(editorView) { return new DropCursorView(editorView, options); }\n });\n}\nclass DropCursorView {\n constructor(editorView, options) {\n var _a;\n this.editorView = editorView;\n this.cursorPos = null;\n this.element = null;\n this.timeout = -1;\n this.lastDragEvent = null;\n this.width = (_a = options.width) !== null && _a !== void 0 ? _a : 1;\n this.color = options.color === false ? undefined : (options.color || \"black\");\n this.class = options.class;\n this.handlers = [\"dragover\", \"dragend\", \"drop\", \"dragleave\"].map(name => {\n let handler = (e) => { this[name](e); };\n editorView.dom.addEventListener(name, handler);\n return { name, handler };\n });\n }\n destroy() {\n this.handlers.forEach(({ name, handler }) => this.editorView.dom.removeEventListener(name, handler));\n }\n update(editorView, prevState) {\n if (this.cursorPos != null && prevState.doc != editorView.state.doc) {\n // if we currently have an on-going drag event\n // we need to update the cursor position again and update the overlay\n if (this.lastDragEvent) {\n let target = this.computeTarget(this.lastDragEvent);\n if (target == this.cursorPos)\n this.updateOverlay();\n else\n this.setCursor(target);\n }\n else {\n this.updateOverlay();\n }\n }\n }\n setCursor(pos) {\n if (pos == this.cursorPos)\n return;\n this.cursorPos = pos;\n if (pos == null) {\n this.element.parentNode.removeChild(this.element);\n this.element = null;\n }\n else {\n this.updateOverlay();\n }\n }\n updateOverlay() {\n let $pos = this.editorView.state.doc.resolve(this.cursorPos);\n let isBlock = !$pos.parent.inlineContent, rect;\n let editorDOM = this.editorView.dom, editorRect = editorDOM.getBoundingClientRect();\n let scaleX = editorRect.width / editorDOM.offsetWidth, scaleY = editorRect.height / editorDOM.offsetHeight;\n if (isBlock) {\n let before = $pos.nodeBefore, after = $pos.nodeAfter;\n if (before || after) {\n let node = this.editorView.nodeDOM(this.cursorPos - (before ? before.nodeSize : 0));\n if (node) {\n let nodeRect = node.getBoundingClientRect();\n let top = before ? nodeRect.bottom : nodeRect.top;\n if (before && after)\n top = (top + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2;\n let halfWidth = (this.width / 2) * scaleY;\n rect = { left: nodeRect.left, right: nodeRect.right, top: top - halfWidth, bottom: top + halfWidth };\n }\n }\n }\n if (!rect) {\n let coords = this.editorView.coordsAtPos(this.cursorPos);\n let halfWidth = (this.width / 2) * scaleX;\n rect = { left: coords.left - halfWidth, right: coords.left + halfWidth, top: coords.top, bottom: coords.bottom };\n }\n let parent = this.editorView.dom.offsetParent;\n if (!this.element) {\n this.element = parent.appendChild(document.createElement(\"div\"));\n if (this.class)\n this.element.className = this.class;\n this.element.style.cssText = \"position: absolute; z-index: 50; pointer-events: none;\";\n if (this.color) {\n this.element.style.backgroundColor = this.color;\n }\n }\n this.element.classList.toggle(\"prosemirror-dropcursor-block\", isBlock);\n this.element.classList.toggle(\"prosemirror-dropcursor-inline\", !isBlock);\n let parentLeft, parentTop;\n if (!parent || parent == document.body && getComputedStyle(parent).position == \"static\") {\n parentLeft = -pageXOffset;\n parentTop = -pageYOffset;\n }\n else {\n let rect = parent.getBoundingClientRect();\n let parentScaleX = rect.width / parent.offsetWidth, parentScaleY = rect.height / parent.offsetHeight;\n parentLeft = rect.left - parent.scrollLeft * parentScaleX;\n parentTop = rect.top - parent.scrollTop * parentScaleY;\n }\n this.element.style.left = (rect.left - parentLeft) / scaleX + \"px\";\n this.element.style.top = (rect.top - parentTop) / scaleY + \"px\";\n this.element.style.width = (rect.right - rect.left) / scaleX + \"px\";\n this.element.style.height = (rect.bottom - rect.top) / scaleY + \"px\";\n }\n scheduleRemoval(timeout) {\n clearTimeout(this.timeout);\n this.timeout = setTimeout(() => this.setCursor(null), timeout);\n }\n computeTarget(event) {\n let pos = this.editorView.posAtCoords({ left: event.clientX, top: event.clientY });\n let node = pos && pos.inside >= 0 && this.editorView.state.doc.nodeAt(pos.inside);\n let disableDropCursor = node && node.type.spec.disableDropCursor;\n let disabled = typeof disableDropCursor == \"function\"\n ? disableDropCursor(this.editorView, pos, event)\n : disableDropCursor;\n if (!pos || disabled)\n return null;\n let target = pos.pos;\n if (this.editorView.dragging && this.editorView.dragging.slice) {\n let point = dropPoint(this.editorView.state.doc, target, this.editorView.dragging.slice);\n if (point != null)\n target = point;\n }\n return target;\n }\n dragover(event) {\n if (!this.editorView.editable)\n return;\n this.lastDragEvent = event;\n let target = this.computeTarget(event);\n if (target != null) {\n this.setCursor(target);\n this.scheduleRemoval(5000);\n }\n }\n dragend() {\n this.scheduleRemoval(20);\n }\n drop() {\n this.scheduleRemoval(20);\n }\n dragleave(event) {\n if (!this.editorView.dom.contains(event.relatedTarget))\n this.setCursor(null);\n }\n}\n\nexport { dropCursor };\n"],"x_google_ignoreList":[0],"mappings":";;;AAaA,SAAS,EAAW,IAAU,CAAC,GAAG;CAC9B,OAAO,IAAI,EAAO,EACd,KAAK,GAAY;EAAE,OAAO,IAAI,EAAe,GAAY,CAAO;CAAG,EACvE,CAAC;AACL;AACA,IAAM,IAAN,MAAqB;CACjB,YAAY,GAAY,GAAS;EAU7B,AARA,KAAK,aAAa,GAClB,KAAK,YAAY,MACjB,KAAK,UAAU,MACf,KAAK,UAAU,IACf,KAAK,gBAAgB,MACrB,KAAK,QAAc,EAAQ,SAAwC,GACnE,KAAK,QAAQ,EAAQ,UAAU,KAAQ,KAAA,IAAa,EAAQ,SAAS,SACrE,KAAK,QAAQ,EAAQ,OACrB,KAAK,WAAW;GAAC;GAAY;GAAW;GAAQ;EAAW,CAAC,CAAC,KAAI,MAAQ;GACrE,IAAI,KAAW,MAAM;IAAE,KAAK,EAAK,CAAC,CAAC;GAAG;GAEtC,OADA,EAAW,IAAI,iBAAiB,GAAM,CAAO,GACtC;IAAE;IAAM;GAAQ;EAC3B,CAAC;CACL;CACA,UAAU;EACN,KAAK,SAAS,SAAS,EAAE,SAAM,iBAAc,KAAK,WAAW,IAAI,oBAAoB,GAAM,CAAO,CAAC;CACvG;CACA,OAAO,GAAY,GAAW;EAC1B,IAAI,KAAK,aAAa,QAAQ,EAAU,OAAO,EAAW,MAAM,KAAK;GAGjE,IAAI,KAAK,eAAe;IACpB,IAAI,IAAS,KAAK,cAAc,KAAK,aAAa;IAClD,AAA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Y,GAAK,CAAK,IAC7C;EACN,IAAI,CAAC,KAAO,GACR,OAAO;EACX,IAAI,IAAS,EAAI;EACjB,IAAI,KAAK,WAAW,YAAY,KAAK,WAAW,SAAS,OAAO;GAC5D,IAAI,IAAQ,EAAU,KAAK,WAAW,MAAM,KAAK,GAAQ,KAAK,WAAW,SAAS,KAAK;GACvF,AAAI,KAAS,SACT,IAAS;EACjB;EACA,OAAO;CACX;CACA,SAAS,GAAO;EACZ,IAAI,CAAC,KAAK,WAAW,UACjB;EACJ,KAAK,gBAAgB;EACrB,IAAI,IAAS,KAAK,cAAc,CAAK;EACrC,AAAI,KAAU,SACV,KAAK,UAAU,CAAM,GACrB,KAAK,gBAAgB,GAAI;CAEjC;CACA,UAAU;EACN,KAAK,gBAAgB,EAAE;CAC3B;CACA,OAAO;EACH,KAAK,gBAAgB,EAAE;CAC3B;CACA,UAAU,GAAO;EACb,AAAK,KAAK,WAAW,IAAI,SAAS,EAAM,aAAa,KACjD,KAAK,UAAU,IAAI;CAC3B;AACJ"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["dropCursor","Plugin","DropCursorView","editorView","options","handler","name","prevState","target","pos","$pos","isBlock","rect","editorDOM","editorRect","scaleX","scaleY","before","after","node","nodeRect","top","halfWidth","coords","parent","parentLeft","parentTop","parentScaleX","parentScaleY","timeout","event","disableDropCursor","disabled","point","dropPoint"],"sources":["../../../../node_modules/prosemirror-dropcursor/dist/index.js"],"sourcesContent":["import { Plugin } from 'prosemirror-state';\nimport { dropPoint } from 'prosemirror-transform';\n\n/**\nCreate a plugin that, when added to a ProseMirror instance,\ncauses a decoration to show up at the drop position when something\nis dragged over the editor.\n\nNodes may add a `disableDropCursor` property to their spec to\ncontrol the showing of a drop cursor inside them. This may be a\nboolean or a function, which will be called with a view and a\nposition, and should return a boolean.\n*/\nfunction dropCursor(options = {}) {\n return new Plugin({\n view(editorView) { return new DropCursorView(editorView, options); }\n });\n}\nclass DropCursorView {\n constructor(editorView, options) {\n var _a;\n this.editorView = editorView;\n this.cursorPos = null;\n this.element = null;\n this.timeout = -1;\n this.lastDragEvent = null;\n this.width = (_a = options.width) !== null && _a !== void 0 ? _a : 1;\n this.color = options.color === false ? undefined : (options.color || \"black\");\n this.class = options.class;\n this.handlers = [\"dragover\", \"dragend\", \"drop\", \"dragleave\"].map(name => {\n let handler = (e) => { this[name](e); };\n editorView.dom.addEventListener(name, handler);\n return { name, handler };\n });\n }\n destroy() {\n this.handlers.forEach(({ name, handler }) => this.editorView.dom.removeEventListener(name, handler));\n }\n update(editorView, prevState) {\n if (this.cursorPos != null && prevState.doc != editorView.state.doc) {\n // if we currently have an on-going drag event\n // we need to update the cursor position again and update the overlay\n if (this.lastDragEvent) {\n let target = this.computeTarget(this.lastDragEvent);\n if (target == this.cursorPos)\n this.updateOverlay();\n else\n this.setCursor(target);\n }\n else {\n this.updateOverlay();\n }\n }\n }\n setCursor(pos) {\n if (pos == this.cursorPos)\n return;\n this.cursorPos = pos;\n if (pos == null) {\n this.element.parentNode.removeChild(this.element);\n this.element = null;\n }\n else {\n this.updateOverlay();\n }\n }\n updateOverlay() {\n let $pos = this.editorView.state.doc.resolve(this.cursorPos);\n let isBlock = !$pos.parent.inlineContent, rect;\n let editorDOM = this.editorView.dom, editorRect = editorDOM.getBoundingClientRect();\n let scaleX = editorRect.width / editorDOM.offsetWidth, scaleY = editorRect.height / editorDOM.offsetHeight;\n if (isBlock) {\n let before = $pos.nodeBefore, after = $pos.nodeAfter;\n if (before || after) {\n let node = this.editorView.nodeDOM(this.cursorPos - (before ? before.nodeSize : 0));\n if (node) {\n let nodeRect = node.getBoundingClientRect();\n let top = before ? nodeRect.bottom : nodeRect.top;\n if (before && after)\n top = (top + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2;\n let halfWidth = (this.width / 2) * scaleY;\n rect = { left: nodeRect.left, right: nodeRect.right, top: top - halfWidth, bottom: top + halfWidth };\n }\n }\n }\n if (!rect) {\n let coords = this.editorView.coordsAtPos(this.cursorPos);\n let halfWidth = (this.width / 2) * scaleX;\n rect = { left: coords.left - halfWidth, right: coords.left + halfWidth, top: coords.top, bottom: coords.bottom };\n }\n let parent = this.editorView.dom.offsetParent;\n if (!this.element) {\n this.element = parent.appendChild(document.createElement(\"div\"));\n if (this.class)\n this.element.className = this.class;\n this.element.style.cssText = \"position: absolute; z-index: 50; pointer-events: none;\";\n if (this.color) {\n this.element.style.backgroundColor = this.color;\n }\n }\n this.element.classList.toggle(\"prosemirror-dropcursor-block\", isBlock);\n this.element.classList.toggle(\"prosemirror-dropcursor-inline\", !isBlock);\n let parentLeft, parentTop;\n if (!parent || parent == document.body && getComputedStyle(parent).position == \"static\") {\n parentLeft = -pageXOffset;\n parentTop = -pageYOffset;\n }\n else {\n let rect = parent.getBoundingClientRect();\n let parentScaleX = rect.width / parent.offsetWidth, parentScaleY = rect.height / parent.offsetHeight;\n parentLeft = rect.left - parent.scrollLeft * parentScaleX;\n parentTop = rect.top - parent.scrollTop * parentScaleY;\n }\n this.element.style.left = (rect.left - parentLeft) / scaleX + \"px\";\n this.element.style.top = (rect.top - parentTop) / scaleY + \"px\";\n this.element.style.width = (rect.right - rect.left) / scaleX + \"px\";\n this.element.style.height = (rect.bottom - rect.top) / scaleY + \"px\";\n }\n scheduleRemoval(timeout) {\n clearTimeout(this.timeout);\n this.timeout = setTimeout(() => this.setCursor(null), timeout);\n }\n computeTarget(event) {\n let pos = this.editorView.posAtCoords({ left: event.clientX, top: event.clientY });\n let node = pos && pos.inside >= 0 && this.editorView.state.doc.nodeAt(pos.inside);\n let disableDropCursor = node && node.type.spec.disableDropCursor;\n let disabled = typeof disableDropCursor == \"function\"\n ? disableDropCursor(this.editorView, pos, event)\n : disableDropCursor;\n if (!pos || disabled)\n return null;\n let target = pos.pos;\n if (this.editorView.dragging && this.editorView.dragging.slice) {\n let point = dropPoint(this.editorView.state.doc, target, this.editorView.dragging.slice);\n if (point != null)\n target = point;\n }\n return target;\n }\n dragover(event) {\n if (!this.editorView.editable)\n return;\n this.lastDragEvent = event;\n let target = this.computeTarget(event);\n if (target != null) {\n this.setCursor(target);\n this.scheduleRemoval(5000);\n }\n }\n dragend() {\n this.scheduleRemoval(20);\n }\n drop() {\n this.scheduleRemoval(20);\n }\n dragleave(event) {\n if (!this.editorView.dom.contains(event.relatedTarget))\n this.setCursor(null);\n }\n}\n\nexport { dropCursor };\n"],"ignoreList":[0],"mappings":";;;AAaA,SAASA,EAAW,IAAU,CAAC,GAAG;CAC9B,OAAO,IAAIC,EAAO,EACd,KAAK,GAAY;EAAE,OAAO,IAAIC,EAAeC,GAAYC,CAAO;CAAG,EACvE,CAAC;AACL;AACA,IAAMF,IAAN,MAAqB;CACjB,YAAY,GAAY,GAAS;EAU7B,AARA,KAAK,aAAaC,GAClB,KAAK,YAAY,MACjB,KAAK,UAAU,MACf,KAAK,UAAU,IACf,KAAK,gBAAgB,MACrB,KAAK,QAAcC,EAAQ,SAAwC,GACnE,KAAK,QAAQA,EAAQ,UAAU,KAAQ,KAAA,IAAaA,EAAQ,SAAS,SACrE,KAAK,QAAQA,EAAQ,OACrB,KAAK,WAAW;GAAC;GAAY;GAAW;GAAQ;EAAW,CAAC,CAAC,KAAI,MAAQ;GACrE,IAAIC,KAAW,MAAM;IAAE,KAAKC,EAAK,CAAC,CAAC;GAAG;GAEtC,OADAH,EAAW,IAAI,iBAAiBG,GAAMD,CAAO,GACtC;IAAE;IAAM;GAAQ;EAC3B,CAAC;CACL;CACA,UAAU;EACN,KAAK,SAAS,SAAS,EAAE,SAAM,iBAAc,KAAK,WAAW,IAAI,oBAAoBC,GAAMD,CAAO,CAAC;CACvG;CACA,OAAO,GAAY,GAAW;EAC1B,IAAI,KAAK,aAAa,QAAQE,EAAU,OAAOJ,EAAW,MAAM,KAAK;GAGjE,IAAI,KAAK,eAAe;IACpB,IAAIK,IAAS,KAAK,cAAc,KAAK,aAAa;IAClD,AAAIA,KAAU,KAAK,YACf,KAAK,cAAc,IAEnB,KAAK,UAAUA,CAAM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AAK,mBAC3Ca,IAAW,OAAOD,KAAqB,aACrCA,EAAkB,KAAK,YAAYtB,GAAKqB,CAAK,IAC7CC;EACN,IAAI,CAACtB,KAAOuB,GACR,OAAO;EACX,IAAIxB,IAASC,EAAI;EACjB,IAAI,KAAK,WAAW,YAAY,KAAK,WAAW,SAAS,OAAO;GAC5D,IAAIwB,IAAQC,EAAU,KAAK,WAAW,MAAM,KAAK1B,GAAQ,KAAK,WAAW,SAAS,KAAK;GACvF,AAAIyB,KAAS,SACT,IAASA;EACjB;EACA,OAAOzB;CACX;CACA,SAAS,GAAO;EACZ,IAAI,CAAC,KAAK,WAAW,UACjB;EACJ,KAAK,gBAAgBsB;EACrB,IAAItB,IAAS,KAAK,cAAcsB,CAAK;EACrC,AAAItB,KAAU,SACV,KAAK,UAAUA,CAAM,GACrB,KAAK,gBAAgB,GAAI;CAEjC;CACA,UAAU;EACN,KAAK,gBAAgB,EAAE;CAC3B;CACA,OAAO;EACH,KAAK,gBAAgB,EAAE;CAC3B;CACA,UAAU,GAAO;EACb,AAAK,KAAK,WAAW,IAAI,SAASsB,EAAM,aAAa,KACjD,KAAK,UAAU,IAAI;CAC3B;AACJ"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NodeSelection as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
var l = class e extends
|
|
1
|
+
import { keydownHandler as e } from "../../prosemirror-keymap/dist/index.js";
|
|
2
|
+
import { NodeSelection as t, Plugin as n, Selection as r, TextSelection as i } from "../../prosemirror-state/dist/index.js";
|
|
3
|
+
import { Fragment as a, Slice as o } from "../../prosemirror-model/dist/index.js";
|
|
4
|
+
import { Decoration as s, DecorationSet as c } from "../../prosemirror-view/dist/index.js";
|
|
5
|
+
// node_modules/prosemirror-gapcursor/dist/index.js
|
|
6
|
+
var l = class e extends r {
|
|
7
7
|
constructor(e) {
|
|
8
8
|
super(e, e);
|
|
9
9
|
}
|
|
10
10
|
map(t, n) {
|
|
11
|
-
let
|
|
12
|
-
return e.valid(
|
|
11
|
+
let i = t.resolve(n.map(this.head));
|
|
12
|
+
return e.valid(i) ? new e(i) : r.near(i);
|
|
13
13
|
}
|
|
14
14
|
content() {
|
|
15
|
-
return
|
|
15
|
+
return o.empty;
|
|
16
16
|
}
|
|
17
17
|
eq(t) {
|
|
18
18
|
return t instanceof e && t.head == this.head;
|
|
@@ -38,39 +38,39 @@ var l = class e extends i {
|
|
|
38
38
|
let r = t.contentMatchAt(e.index()).defaultType;
|
|
39
39
|
return r && r.isTextblock;
|
|
40
40
|
}
|
|
41
|
-
static findGapCursorFrom(
|
|
41
|
+
static findGapCursorFrom(n, r, i = !1) {
|
|
42
42
|
search: for (;;) {
|
|
43
|
-
if (!i && e.valid(
|
|
44
|
-
let a =
|
|
45
|
-
for (let
|
|
46
|
-
let i =
|
|
47
|
-
if (r > 0 ?
|
|
48
|
-
o = i.child(r > 0 ?
|
|
43
|
+
if (!i && e.valid(n)) return n;
|
|
44
|
+
let a = n.pos, o = null;
|
|
45
|
+
for (let t = n.depth;; t--) {
|
|
46
|
+
let i = n.node(t);
|
|
47
|
+
if (r > 0 ? n.indexAfter(t) < i.childCount : n.index(t) > 0) {
|
|
48
|
+
o = i.child(r > 0 ? n.indexAfter(t) : n.index(t) - 1);
|
|
49
49
|
break;
|
|
50
50
|
}
|
|
51
|
-
if (
|
|
51
|
+
if (t == 0) return null;
|
|
52
52
|
a += r;
|
|
53
|
-
let s =
|
|
53
|
+
let s = n.doc.resolve(a);
|
|
54
54
|
if (e.valid(s)) return s;
|
|
55
55
|
}
|
|
56
56
|
for (;;) {
|
|
57
57
|
let s = r > 0 ? o.firstChild : o.lastChild;
|
|
58
58
|
if (!s) {
|
|
59
|
-
if (o.isAtom && !o.isText && !
|
|
60
|
-
|
|
59
|
+
if (o.isAtom && !o.isText && !t.isSelectable(o)) {
|
|
60
|
+
n = n.doc.resolve(a + o.nodeSize * r), i = !1;
|
|
61
61
|
continue search;
|
|
62
62
|
}
|
|
63
63
|
break;
|
|
64
64
|
}
|
|
65
65
|
o = s, a += r;
|
|
66
|
-
let c =
|
|
66
|
+
let c = n.doc.resolve(a);
|
|
67
67
|
if (e.valid(c)) return c;
|
|
68
68
|
}
|
|
69
69
|
return null;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
-
l.prototype.visible = !1, l.findFrom = l.findGapCursorFrom,
|
|
73
|
+
l.prototype.visible = !1, l.findFrom = l.findGapCursorFrom, r.jsonID("gapcursor", l);
|
|
74
74
|
var u = class e {
|
|
75
75
|
constructor(e) {
|
|
76
76
|
this.pos = e;
|
|
@@ -80,7 +80,7 @@ var u = class e {
|
|
|
80
80
|
}
|
|
81
81
|
resolve(e) {
|
|
82
82
|
let t = e.resolve(this.pos);
|
|
83
|
-
return l.valid(t) ? new l(t) :
|
|
83
|
+
return l.valid(t) ? new l(t) : r.near(t);
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
86
|
function d(e) {
|
|
@@ -91,9 +91,7 @@ function f(e) {
|
|
|
91
91
|
let n = e.index(t), r = e.node(t);
|
|
92
92
|
if (n == 0) {
|
|
93
93
|
if (r.type.spec.isolating) return !0;
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
for (let e = r.child(n - 1);; e = e.lastChild) {
|
|
94
|
+
} else for (let e = r.child(n - 1);; e = e.lastChild) {
|
|
97
95
|
if (e.childCount == 0 && !e.inlineContent || d(e.type)) return !0;
|
|
98
96
|
if (e.inlineContent) return !1;
|
|
99
97
|
}
|
|
@@ -105,9 +103,7 @@ function p(e) {
|
|
|
105
103
|
let n = e.indexAfter(t), r = e.node(t);
|
|
106
104
|
if (n == r.childCount) {
|
|
107
105
|
if (r.type.spec.isolating) return !0;
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
for (let e = r.child(n);; e = e.firstChild) {
|
|
106
|
+
} else for (let e = r.child(n);; e = e.firstChild) {
|
|
111
107
|
if (e.childCount == 0 && !e.inlineContent || d(e.type)) return !0;
|
|
112
108
|
if (e.inlineContent) return !1;
|
|
113
109
|
}
|
|
@@ -115,7 +111,7 @@ function p(e) {
|
|
|
115
111
|
return !0;
|
|
116
112
|
}
|
|
117
113
|
function m() {
|
|
118
|
-
return new
|
|
114
|
+
return new n({ props: {
|
|
119
115
|
decorations: y,
|
|
120
116
|
createSelectionBetween(e, t, n) {
|
|
121
117
|
return t.pos == n.pos && l.valid(n) ? new l(n) : null;
|
|
@@ -125,7 +121,7 @@ function m() {
|
|
|
125
121
|
handleDOMEvents: { beforeinput: v }
|
|
126
122
|
} });
|
|
127
123
|
}
|
|
128
|
-
var h =
|
|
124
|
+
var h = e({
|
|
129
125
|
ArrowLeft: g("horiz", -1),
|
|
130
126
|
ArrowRight: g("horiz", 1),
|
|
131
127
|
ArrowUp: g("vert", -1),
|
|
@@ -133,41 +129,40 @@ var h = c({
|
|
|
133
129
|
});
|
|
134
130
|
function g(e, t) {
|
|
135
131
|
let n = e == "vert" ? t > 0 ? "down" : "up" : t > 0 ? "right" : "left";
|
|
136
|
-
return function(e, r,
|
|
132
|
+
return function(e, r, a) {
|
|
137
133
|
let o = e.selection, s = t > 0 ? o.$to : o.$from, c = o.empty;
|
|
138
|
-
if (o instanceof
|
|
139
|
-
if (!
|
|
134
|
+
if (o instanceof i) {
|
|
135
|
+
if (!a.endOfTextblock(n) || s.depth == 0) return !1;
|
|
140
136
|
c = !1, s = e.doc.resolve(t > 0 ? s.after() : s.before());
|
|
141
137
|
}
|
|
142
138
|
let u = l.findGapCursorFrom(s, t, c);
|
|
143
139
|
return u ? (r && r(e.tr.setSelection(new l(u))), !0) : !1;
|
|
144
140
|
};
|
|
145
141
|
}
|
|
146
|
-
function _(e,
|
|
142
|
+
function _(e, n, r) {
|
|
147
143
|
if (!e || !e.editable) return !1;
|
|
148
|
-
let i = e.state.doc.resolve(
|
|
144
|
+
let i = e.state.doc.resolve(n);
|
|
149
145
|
if (!l.valid(i)) return !1;
|
|
150
146
|
let a = e.posAtCoords({
|
|
151
147
|
left: r.clientX,
|
|
152
148
|
top: r.clientY
|
|
153
149
|
});
|
|
154
|
-
return a && a.inside > -1 &&
|
|
150
|
+
return a && a.inside > -1 && t.isSelectable(e.state.doc.nodeAt(a.inside)) ? !1 : (e.dispatch(e.state.tr.setSelection(new l(i))), !0);
|
|
155
151
|
}
|
|
156
|
-
function v(
|
|
157
|
-
if (
|
|
158
|
-
let { $from:
|
|
159
|
-
if (!
|
|
160
|
-
let s =
|
|
161
|
-
for (let
|
|
162
|
-
let c =
|
|
163
|
-
return c.setSelection(
|
|
152
|
+
function v(e, t) {
|
|
153
|
+
if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof l)) return !1;
|
|
154
|
+
let { $from: n } = e.state.selection, r = n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);
|
|
155
|
+
if (!r) return !1;
|
|
156
|
+
let s = a.empty;
|
|
157
|
+
for (let e = r.length - 1; e >= 0; e--) s = a.from(r[e].createAndFill(null, s));
|
|
158
|
+
let c = e.state.tr.replace(n.pos, n.pos, new o(s, 0, 0));
|
|
159
|
+
return c.setSelection(i.near(c.doc.resolve(n.pos + 1))), e.dispatch(c), !1;
|
|
164
160
|
}
|
|
165
161
|
function y(e) {
|
|
166
162
|
if (!(e.selection instanceof l)) return null;
|
|
167
163
|
let t = document.createElement("div");
|
|
168
|
-
return t.className = "ProseMirror-gapcursor",
|
|
164
|
+
return t.className = "ProseMirror-gapcursor", c.create(e.doc, [s.widget(e.selection.head, t, { key: "gapcursor" })]);
|
|
169
165
|
}
|
|
170
|
-
//#endregion
|
|
171
166
|
export { l as GapCursor, m as gapCursor };
|
|
172
167
|
|
|
173
168
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../node_modules/prosemirror-gapcursor/dist/index.js"],"sourcesContent":["import { keydownHandler } from 'prosemirror-keymap';\nimport { Selection, NodeSelection, TextSelection, Plugin } from 'prosemirror-state';\nimport { Slice, Fragment } from 'prosemirror-model';\nimport { DecorationSet, Decoration } from 'prosemirror-view';\n\n/**\nGap cursor selections are represented using this class. Its\n`$anchor` and `$head` properties both point at the cursor position.\n*/\nclass GapCursor extends Selection {\n /**\n Create a gap cursor.\n */\n constructor($pos) {\n super($pos, $pos);\n }\n map(doc, mapping) {\n let $pos = doc.resolve(mapping.map(this.head));\n return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos);\n }\n content() { return Slice.empty; }\n eq(other) {\n return other instanceof GapCursor && other.head == this.head;\n }\n toJSON() {\n return { type: \"gapcursor\", pos: this.head };\n }\n /**\n @internal\n */\n static fromJSON(doc, json) {\n if (typeof json.pos != \"number\")\n throw new RangeError(\"Invalid input for GapCursor.fromJSON\");\n return new GapCursor(doc.resolve(json.pos));\n }\n /**\n @internal\n */\n getBookmark() { return new GapBookmark(this.anchor); }\n /**\n @internal\n */\n static valid($pos) {\n let parent = $pos.parent;\n if (parent.inlineContent || !closedBefore($pos) || !closedAfter($pos))\n return false;\n let override = parent.type.spec.allowGapCursor;\n if (override != null)\n return override;\n let deflt = parent.contentMatchAt($pos.index()).defaultType;\n return deflt && deflt.isTextblock;\n }\n /**\n @internal\n */\n static findGapCursorFrom($pos, dir, mustMove = false) {\n search: for (;;) {\n if (!mustMove && GapCursor.valid($pos))\n return $pos;\n let pos = $pos.pos, next = null;\n // Scan up from this position\n for (let d = $pos.depth;; d--) {\n let parent = $pos.node(d);\n if (dir > 0 ? $pos.indexAfter(d) < parent.childCount : $pos.index(d) > 0) {\n next = parent.child(dir > 0 ? $pos.indexAfter(d) : $pos.index(d) - 1);\n break;\n }\n else if (d == 0) {\n return null;\n }\n pos += dir;\n let $cur = $pos.doc.resolve(pos);\n if (GapCursor.valid($cur))\n return $cur;\n }\n // And then down into the next node\n for (;;) {\n let inside = dir > 0 ? next.firstChild : next.lastChild;\n if (!inside) {\n if (next.isAtom && !next.isText && !NodeSelection.isSelectable(next)) {\n $pos = $pos.doc.resolve(pos + next.nodeSize * dir);\n mustMove = false;\n continue search;\n }\n break;\n }\n next = inside;\n pos += dir;\n let $cur = $pos.doc.resolve(pos);\n if (GapCursor.valid($cur))\n return $cur;\n }\n return null;\n }\n }\n}\nGapCursor.prototype.visible = false;\nGapCursor.findFrom = GapCursor.findGapCursorFrom;\nSelection.jsonID(\"gapcursor\", GapCursor);\nclass GapBookmark {\n constructor(pos) {\n this.pos = pos;\n }\n map(mapping) {\n return new GapBookmark(mapping.map(this.pos));\n }\n resolve(doc) {\n let $pos = doc.resolve(this.pos);\n return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos);\n }\n}\nfunction needsGap(type) {\n return type.isAtom || type.spec.isolating || type.spec.createGapCursor;\n}\nfunction closedBefore($pos) {\n for (let d = $pos.depth; d >= 0; d--) {\n let index = $pos.index(d), parent = $pos.node(d);\n // At the start of this parent, look at next one\n if (index == 0) {\n if (parent.type.spec.isolating)\n return true;\n continue;\n }\n // See if the node before (or its first ancestor) is closed\n for (let before = parent.child(index - 1);; before = before.lastChild) {\n if ((before.childCount == 0 && !before.inlineContent) || needsGap(before.type))\n return true;\n if (before.inlineContent)\n return false;\n }\n }\n // Hit start of document\n return true;\n}\nfunction closedAfter($pos) {\n for (let d = $pos.depth; d >= 0; d--) {\n let index = $pos.indexAfter(d), parent = $pos.node(d);\n if (index == parent.childCount) {\n if (parent.type.spec.isolating)\n return true;\n continue;\n }\n for (let after = parent.child(index);; after = after.firstChild) {\n if ((after.childCount == 0 && !after.inlineContent) || needsGap(after.type))\n return true;\n if (after.inlineContent)\n return false;\n }\n }\n return true;\n}\n\n/**\nCreate a gap cursor plugin. When enabled, this will capture clicks\nnear and arrow-key-motion past places that don't have a normally\nselectable position nearby, and create a gap cursor selection for\nthem. The cursor is drawn as an element with class\n`ProseMirror-gapcursor`. You can either include\n`style/gapcursor.css` from the package's directory or add your own\nstyles to make it visible.\n*/\nfunction gapCursor() {\n return new Plugin({\n props: {\n decorations: drawGapCursor,\n createSelectionBetween(_view, $anchor, $head) {\n return $anchor.pos == $head.pos && GapCursor.valid($head) ? new GapCursor($head) : null;\n },\n handleClick,\n handleKeyDown,\n handleDOMEvents: { beforeinput: beforeinput }\n }\n });\n}\nconst handleKeyDown = keydownHandler({\n \"ArrowLeft\": arrow(\"horiz\", -1),\n \"ArrowRight\": arrow(\"horiz\", 1),\n \"ArrowUp\": arrow(\"vert\", -1),\n \"ArrowDown\": arrow(\"vert\", 1)\n});\nfunction arrow(axis, dir) {\n const dirStr = axis == \"vert\" ? (dir > 0 ? \"down\" : \"up\") : (dir > 0 ? \"right\" : \"left\");\n return function (state, dispatch, view) {\n let sel = state.selection;\n let $start = dir > 0 ? sel.$to : sel.$from, mustMove = sel.empty;\n if (sel instanceof TextSelection) {\n if (!view.endOfTextblock(dirStr) || $start.depth == 0)\n return false;\n mustMove = false;\n $start = state.doc.resolve(dir > 0 ? $start.after() : $start.before());\n }\n let $found = GapCursor.findGapCursorFrom($start, dir, mustMove);\n if (!$found)\n return false;\n if (dispatch)\n dispatch(state.tr.setSelection(new GapCursor($found)));\n return true;\n };\n}\nfunction handleClick(view, pos, event) {\n if (!view || !view.editable)\n return false;\n let $pos = view.state.doc.resolve(pos);\n if (!GapCursor.valid($pos))\n return false;\n let clickPos = view.posAtCoords({ left: event.clientX, top: event.clientY });\n if (clickPos && clickPos.inside > -1 && NodeSelection.isSelectable(view.state.doc.nodeAt(clickPos.inside)))\n return false;\n view.dispatch(view.state.tr.setSelection(new GapCursor($pos)));\n return true;\n}\n// This is a hack that, when a composition starts while a gap cursor\n// is active, quickly creates an inline context for the composition to\n// happen in, to avoid it being aborted by the DOM selection being\n// moved into a valid position.\nfunction beforeinput(view, event) {\n if (event.inputType != \"insertCompositionText\" || !(view.state.selection instanceof GapCursor))\n return false;\n let { $from } = view.state.selection;\n let insert = $from.parent.contentMatchAt($from.index()).findWrapping(view.state.schema.nodes.text);\n if (!insert)\n return false;\n let frag = Fragment.empty;\n for (let i = insert.length - 1; i >= 0; i--)\n frag = Fragment.from(insert[i].createAndFill(null, frag));\n let tr = view.state.tr.replace($from.pos, $from.pos, new Slice(frag, 0, 0));\n tr.setSelection(TextSelection.near(tr.doc.resolve($from.pos + 1)));\n view.dispatch(tr);\n return false;\n}\nfunction drawGapCursor(state) {\n if (!(state.selection instanceof GapCursor))\n return null;\n let node = document.createElement(\"div\");\n node.className = \"ProseMirror-gapcursor\";\n return DecorationSet.create(state.doc, [Decoration.widget(state.selection.head, node, { key: \"gapcursor\" })]);\n}\n\nexport { GapCursor, gapCursor };\n"],"x_google_ignoreList":[0],"mappings":";;;;;AASA,IAAM,IAAN,MAAM,UAAkB,EAAU;CAI9B,YAAY,GAAM;EACd,MAAM,GAAM,CAAI;CACpB;CACA,IAAI,GAAK,GAAS;EACd,IAAI,IAAO,EAAI,QAAQ,EAAQ,IAAI,KAAK,IAAI,CAAC;EAC7C,OAAO,EAAU,MAAM,CAAI,IAAI,IAAI,EAAU,CAAI,IAAI,EAAU,KAAK,CAAI;CAC5E;CACA,UAAU;EAAE,OAAO,EAAM;CAAO;CAChC,GAAG,GAAO;EACN,OAAO,aAAiB,KAAa,EAAM,QAAQ,KAAK;CAC5D;CACA,SAAS;EACL,OAAO;GAAE,MAAM;GAAa,KAAK,KAAK;EAAK;CAC/C;CAIA,OAAO,SAAS,GAAK,GAAM;EACvB,IAAI,OAAO,EAAK,OAAO,UACnB,MAAU,WAAW,sCAAsC;EAC/D,OAAO,IAAI,EAAU,EAAI,QAAQ,EAAK,GAAG,CAAC;CAC9C;CAIA,cAAc;EAAE,OAAO,IAAI,EAAY,KAAK,MAAM;CAAG;CAIrD,OAAO,MAAM,GAAM;EACf,IAAI,IAAS,EAAK;EAClB,IAAI,EAAO,iBAAiB,CAAC,EAAa,CAAI,KAAK,CAAC,EAAY,CAAI,GAChE,OAAO;EACX,IAAI,IAAW,EAAO,KAAK,KAAK;EAChC,IAAI,KAAY,MACZ,OAAO;EACX,IAAI,IA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ACX,EAAK,SAAS,EAAK,MAAM,GAAG,aAAa,IAAI,EAAU,CAAI,CAAC,CAAC,GACtD;AACX;AAKA,SAAS,EAAY,GAAM,GAAO;CAC9B,IAAI,EAAM,aAAa,2BAA2B,EAAE,EAAK,MAAM,qBAAqB,IAChF,OAAO;CACX,IAAI,EAAE,aAAU,EAAK,MAAM,WACvB,IAAS,EAAM,OAAO,eAAe,EAAM,MAAM,CAAC,CAAC,CAAC,aAAa,EAAK,MAAM,OAAO,MAAM,IAAI;CACjG,IAAI,CAAC,GACD,OAAO;CACX,IAAI,IAAO,EAAS;CACpB,KAAK,IAAI,IAAI,EAAO,SAAS,GAAG,KAAK,GAAG,KACpC,IAAO,EAAS,KAAK,EAAO,EAAE,CAAC,cAAc,MAAM,CAAI,CAAC;CAC5D,IAAI,IAAK,EAAK,MAAM,GAAG,QAAQ,EAAM,KAAK,EAAM,KAAK,IAAI,EAAM,GAAM,GAAG,CAAC,CAAC;CAG1E,OAFA,EAAG,aAAa,EAAc,KAAK,EAAG,IAAI,QAAQ,EAAM,MAAM,CAAC,CAAC,CAAC,GACjE,EAAK,SAAS,CAAE,GACT;AACX;AACA,SAAS,EAAc,GAAO;CAC1B,IAAI,EAAE,EAAM,qBAAqB,IAC7B,OAAO;CACX,IAAI,IAAO,SAAS,cAAc,KAAK;CAEvC,OADA,EAAK,YAAY,yBACV,EAAc,OAAO,EAAM,KAAK,CAAC,EAAW,OAAO,EAAM,UAAU,MAAM,GAAM,EAAE,KAAK,YAAY,CAAC,CAAC,CAAC;AAChH"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["GapCursor","Selection","$pos","doc","mapping","Slice","other","json","GapBookmark","parent","closedBefore","closedAfter","override","deflt","mustMove","pos","next","d","dir","$cur","inside","NodeSelection","needsGap","type","index","before","after","gapCursor","Plugin","drawGapCursor","$anchor","$head","handleKeyDown","keydownHandler","\"ArrowLeft\"","arrow","\"ArrowRight\"","\"ArrowUp\"","\"ArrowDown\"","dirStr","axis","sel","state","$start","TextSelection","view","$found","dispatch","handleClick","clickPos","event","beforeinput","insert","$from","frag","Fragment","i","tr","node","DecorationSet","Decoration"],"sources":["../../../../node_modules/prosemirror-gapcursor/dist/index.js"],"sourcesContent":["import { keydownHandler } from 'prosemirror-keymap';\nimport { Selection, NodeSelection, TextSelection, Plugin } from 'prosemirror-state';\nimport { Slice, Fragment } from 'prosemirror-model';\nimport { DecorationSet, Decoration } from 'prosemirror-view';\n\n/**\nGap cursor selections are represented using this class. Its\n`$anchor` and `$head` properties both point at the cursor position.\n*/\nclass GapCursor extends Selection {\n /**\n Create a gap cursor.\n */\n constructor($pos) {\n super($pos, $pos);\n }\n map(doc, mapping) {\n let $pos = doc.resolve(mapping.map(this.head));\n return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos);\n }\n content() { return Slice.empty; }\n eq(other) {\n return other instanceof GapCursor && other.head == this.head;\n }\n toJSON() {\n return { type: \"gapcursor\", pos: this.head };\n }\n /**\n @internal\n */\n static fromJSON(doc, json) {\n if (typeof json.pos != \"number\")\n throw new RangeError(\"Invalid input for GapCursor.fromJSON\");\n return new GapCursor(doc.resolve(json.pos));\n }\n /**\n @internal\n */\n getBookmark() { return new GapBookmark(this.anchor); }\n /**\n @internal\n */\n static valid($pos) {\n let parent = $pos.parent;\n if (parent.inlineContent || !closedBefore($pos) || !closedAfter($pos))\n return false;\n let override = parent.type.spec.allowGapCursor;\n if (override != null)\n return override;\n let deflt = parent.contentMatchAt($pos.index()).defaultType;\n return deflt && deflt.isTextblock;\n }\n /**\n @internal\n */\n static findGapCursorFrom($pos, dir, mustMove = false) {\n search: for (;;) {\n if (!mustMove && GapCursor.valid($pos))\n return $pos;\n let pos = $pos.pos, next = null;\n // Scan up from this position\n for (let d = $pos.depth;; d--) {\n let parent = $pos.node(d);\n if (dir > 0 ? $pos.indexAfter(d) < parent.childCount : $pos.index(d) > 0) {\n next = parent.child(dir > 0 ? $pos.indexAfter(d) : $pos.index(d) - 1);\n break;\n }\n else if (d == 0) {\n return null;\n }\n pos += dir;\n let $cur = $pos.doc.resolve(pos);\n if (GapCursor.valid($cur))\n return $cur;\n }\n // And then down into the next node\n for (;;) {\n let inside = dir > 0 ? next.firstChild : next.lastChild;\n if (!inside) {\n if (next.isAtom && !next.isText && !NodeSelection.isSelectable(next)) {\n $pos = $pos.doc.resolve(pos + next.nodeSize * dir);\n mustMove = false;\n continue search;\n }\n break;\n }\n next = inside;\n pos += dir;\n let $cur = $pos.doc.resolve(pos);\n if (GapCursor.valid($cur))\n return $cur;\n }\n return null;\n }\n }\n}\nGapCursor.prototype.visible = false;\nGapCursor.findFrom = GapCursor.findGapCursorFrom;\nSelection.jsonID(\"gapcursor\", GapCursor);\nclass GapBookmark {\n constructor(pos) {\n this.pos = pos;\n }\n map(mapping) {\n return new GapBookmark(mapping.map(this.pos));\n }\n resolve(doc) {\n let $pos = doc.resolve(this.pos);\n return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos);\n }\n}\nfunction needsGap(type) {\n return type.isAtom || type.spec.isolating || type.spec.createGapCursor;\n}\nfunction closedBefore($pos) {\n for (let d = $pos.depth; d >= 0; d--) {\n let index = $pos.index(d), parent = $pos.node(d);\n // At the start of this parent, look at next one\n if (index == 0) {\n if (parent.type.spec.isolating)\n return true;\n continue;\n }\n // See if the node before (or its first ancestor) is closed\n for (let before = parent.child(index - 1);; before = before.lastChild) {\n if ((before.childCount == 0 && !before.inlineContent) || needsGap(before.type))\n return true;\n if (before.inlineContent)\n return false;\n }\n }\n // Hit start of document\n return true;\n}\nfunction closedAfter($pos) {\n for (let d = $pos.depth; d >= 0; d--) {\n let index = $pos.indexAfter(d), parent = $pos.node(d);\n if (index == parent.childCount) {\n if (parent.type.spec.isolating)\n return true;\n continue;\n }\n for (let after = parent.child(index);; after = after.firstChild) {\n if ((after.childCount == 0 && !after.inlineContent) || needsGap(after.type))\n return true;\n if (after.inlineContent)\n return false;\n }\n }\n return true;\n}\n\n/**\nCreate a gap cursor plugin. When enabled, this will capture clicks\nnear and arrow-key-motion past places that don't have a normally\nselectable position nearby, and create a gap cursor selection for\nthem. The cursor is drawn as an element with class\n`ProseMirror-gapcursor`. You can either include\n`style/gapcursor.css` from the package's directory or add your own\nstyles to make it visible.\n*/\nfunction gapCursor() {\n return new Plugin({\n props: {\n decorations: drawGapCursor,\n createSelectionBetween(_view, $anchor, $head) {\n return $anchor.pos == $head.pos && GapCursor.valid($head) ? new GapCursor($head) : null;\n },\n handleClick,\n handleKeyDown,\n handleDOMEvents: { beforeinput: beforeinput }\n }\n });\n}\nconst handleKeyDown = keydownHandler({\n \"ArrowLeft\": arrow(\"horiz\", -1),\n \"ArrowRight\": arrow(\"horiz\", 1),\n \"ArrowUp\": arrow(\"vert\", -1),\n \"ArrowDown\": arrow(\"vert\", 1)\n});\nfunction arrow(axis, dir) {\n const dirStr = axis == \"vert\" ? (dir > 0 ? \"down\" : \"up\") : (dir > 0 ? \"right\" : \"left\");\n return function (state, dispatch, view) {\n let sel = state.selection;\n let $start = dir > 0 ? sel.$to : sel.$from, mustMove = sel.empty;\n if (sel instanceof TextSelection) {\n if (!view.endOfTextblock(dirStr) || $start.depth == 0)\n return false;\n mustMove = false;\n $start = state.doc.resolve(dir > 0 ? $start.after() : $start.before());\n }\n let $found = GapCursor.findGapCursorFrom($start, dir, mustMove);\n if (!$found)\n return false;\n if (dispatch)\n dispatch(state.tr.setSelection(new GapCursor($found)));\n return true;\n };\n}\nfunction handleClick(view, pos, event) {\n if (!view || !view.editable)\n return false;\n let $pos = view.state.doc.resolve(pos);\n if (!GapCursor.valid($pos))\n return false;\n let clickPos = view.posAtCoords({ left: event.clientX, top: event.clientY });\n if (clickPos && clickPos.inside > -1 && NodeSelection.isSelectable(view.state.doc.nodeAt(clickPos.inside)))\n return false;\n view.dispatch(view.state.tr.setSelection(new GapCursor($pos)));\n return true;\n}\n// This is a hack that, when a composition starts while a gap cursor\n// is active, quickly creates an inline context for the composition to\n// happen in, to avoid it being aborted by the DOM selection being\n// moved into a valid position.\nfunction beforeinput(view, event) {\n if (event.inputType != \"insertCompositionText\" || !(view.state.selection instanceof GapCursor))\n return false;\n let { $from } = view.state.selection;\n let insert = $from.parent.contentMatchAt($from.index()).findWrapping(view.state.schema.nodes.text);\n if (!insert)\n return false;\n let frag = Fragment.empty;\n for (let i = insert.length - 1; i >= 0; i--)\n frag = Fragment.from(insert[i].createAndFill(null, frag));\n let tr = view.state.tr.replace($from.pos, $from.pos, new Slice(frag, 0, 0));\n tr.setSelection(TextSelection.near(tr.doc.resolve($from.pos + 1)));\n view.dispatch(tr);\n return false;\n}\nfunction drawGapCursor(state) {\n if (!(state.selection instanceof GapCursor))\n return null;\n let node = document.createElement(\"div\");\n node.className = \"ProseMirror-gapcursor\";\n return DecorationSet.create(state.doc, [Decoration.widget(state.selection.head, node, { key: \"gapcursor\" })]);\n}\n\nexport { GapCursor, gapCursor };\n"],"ignoreList":[0],"mappings":";;;;;AASA,IAAMA,IAAN,MAAMA,UAAkBC,EAAU;CAI9B,YAAY,GAAM;EACd,MAAMC,GAAMA,CAAI;CACpB;CACA,IAAI,GAAK,GAAS;EACd,IAAIA,IAAOC,EAAI,QAAQC,EAAQ,IAAI,KAAK,IAAI,CAAC;EAC7C,OAAOJ,EAAU,MAAME,CAAI,IAAI,IAAIF,EAAUE,CAAI,IAAID,EAAU,KAAKC,CAAI;CAC5E;CACA,UAAU;EAAE,OAAOG,EAAM;CAAO;CAChC,GAAG,GAAO;EACN,OAAOC,aAAiBN,KAAaM,EAAM,QAAQ,KAAK;CAC5D;CACA,SAAS;EACL,OAAO;GAAE,MAAM;GAAa,KAAK,KAAK;EAAK;CAC/C;CAIA,OAAO,SAAS,GAAK,GAAM;EACvB,IAAI,OAAOC,EAAK,OAAO,UACnB,MAAU,WAAW,sCAAsC;EAC/D,OAAO,IAAIP,EAAUG,EAAI,QAAQI,EAAK,GAAG,CAAC;CAC9C;CAIA,cAAc;EAAE,OAAO,IAAIC,EAAY,KAAK,MAAM;CAAG;CAI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,IAC7B,OAAO;CACX,IAAI0D,IAAO,SAAS,cAAc,KAAK;CAEvC,OADA,EAAK,YAAY,yBACVC,EAAc,OAAOjB,EAAM,KAAK,CAACkB,EAAW,OAAOlB,EAAM,UAAU,MAAMgB,GAAM,EAAE,KAAK,YAAY,CAAC,CAAC,CAAC;AAChH"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import r from "../../
|
|
4
|
-
|
|
5
|
-
var i = 500, a = class
|
|
1
|
+
import e from "../../rope-sequence/dist/index.js";
|
|
2
|
+
import { Mapping as t } from "../../prosemirror-transform/dist/index.js";
|
|
3
|
+
import { Plugin as n, PluginKey as r } from "../../prosemirror-state/dist/index.js";
|
|
4
|
+
// node_modules/prosemirror-history/dist/index.js
|
|
5
|
+
var i = 500, a = class n {
|
|
6
6
|
constructor(e, t) {
|
|
7
7
|
this.items = e, this.eventCount = t;
|
|
8
8
|
}
|
|
9
|
-
popEvent(e,
|
|
9
|
+
popEvent(e, t) {
|
|
10
10
|
if (this.eventCount == 0) return null;
|
|
11
11
|
let r = this.items.length;
|
|
12
12
|
for (;; r--) if (this.items.get(r - 1).selection) {
|
|
@@ -14,51 +14,50 @@ var i = 500, a = class t {
|
|
|
14
14
|
break;
|
|
15
15
|
}
|
|
16
16
|
let i, a;
|
|
17
|
-
|
|
17
|
+
t && (i = this.remapping(r, this.items.length), a = i.maps.length);
|
|
18
18
|
let o = e.tr, c, l, u = [], d = [];
|
|
19
|
-
return this.items.forEach((e,
|
|
20
|
-
if (!e.step)
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
return this.items.forEach((e, t) => {
|
|
20
|
+
if (!e.step) i || (i = this.remapping(r, t + 1), a = i.maps.length), a--, d.push(e);
|
|
21
|
+
else {
|
|
22
|
+
if (i) {
|
|
23
|
+
d.push(new s(e.map));
|
|
24
|
+
let t = e.step.map(i.slice(a)), n;
|
|
25
|
+
t && o.maybeStep(t).doc && (n = o.mapping.maps[o.mapping.maps.length - 1], u.push(new s(n, void 0, void 0, u.length + d.length))), a--, n && i.appendMap(n, a);
|
|
26
|
+
} else o.maybeStep(e.step);
|
|
27
|
+
if (e.selection) return c = i ? e.selection.map(i.slice(a)) : e.selection, l = new n(this.items.slice(0, r).append(d.reverse().concat(u)), this.eventCount - 1), !1;
|
|
23
28
|
}
|
|
24
|
-
if (i) {
|
|
25
|
-
d.push(new s(e.map));
|
|
26
|
-
let t = e.step.map(i.slice(a)), n;
|
|
27
|
-
t && o.maybeStep(t).doc && (n = o.mapping.maps[o.mapping.maps.length - 1], u.push(new s(n, void 0, void 0, u.length + d.length))), a--, n && i.appendMap(n, a);
|
|
28
|
-
} else o.maybeStep(e.step);
|
|
29
|
-
if (e.selection) return c = i ? e.selection.map(i.slice(a)) : e.selection, l = new t(this.items.slice(0, r).append(d.reverse().concat(u)), this.eventCount - 1), !1;
|
|
30
29
|
}, this.items.length, 0), {
|
|
31
30
|
remaining: l,
|
|
32
31
|
transform: o,
|
|
33
32
|
selection: c
|
|
34
33
|
};
|
|
35
34
|
}
|
|
36
|
-
addTransform(e,
|
|
35
|
+
addTransform(e, t, r, i) {
|
|
37
36
|
let a = [], c = this.eventCount, u = this.items, d = !i && u.length ? u.get(u.length - 1) : null;
|
|
38
|
-
for (let
|
|
39
|
-
let r = e.steps[
|
|
40
|
-
(l = d && d.merge(o)) && (o = l,
|
|
37
|
+
for (let n = 0; n < e.steps.length; n++) {
|
|
38
|
+
let r = e.steps[n].invert(e.docs[n]), o = new s(e.mapping.maps[n], r, t), l;
|
|
39
|
+
(l = d && d.merge(o)) && (o = l, n ? a.pop() : u = u.slice(0, u.length - 1)), a.push(o), t &&= (c++, void 0), i || (d = o);
|
|
41
40
|
}
|
|
42
41
|
let f = c - r.depth;
|
|
43
|
-
return f > l && (u = o(u, f), c -= f), new
|
|
42
|
+
return f > l && (u = o(u, f), c -= f), new n(u.append(a), c);
|
|
44
43
|
}
|
|
45
|
-
remapping(
|
|
46
|
-
let r = new
|
|
47
|
-
return this.items.forEach((
|
|
48
|
-
let i =
|
|
49
|
-
r.appendMap(
|
|
50
|
-
},
|
|
44
|
+
remapping(e, n) {
|
|
45
|
+
let r = new t();
|
|
46
|
+
return this.items.forEach((t, n) => {
|
|
47
|
+
let i = t.mirrorOffset != null && n - t.mirrorOffset >= e ? r.maps.length - t.mirrorOffset : void 0;
|
|
48
|
+
r.appendMap(t.map, i);
|
|
49
|
+
}, e, n), r;
|
|
51
50
|
}
|
|
52
51
|
addMaps(e) {
|
|
53
|
-
return this.eventCount == 0 ? this : new
|
|
52
|
+
return this.eventCount == 0 ? this : new n(this.items.append(e.map((e) => new s(e))), this.eventCount);
|
|
54
53
|
}
|
|
55
|
-
rebased(e,
|
|
54
|
+
rebased(e, t) {
|
|
56
55
|
if (!this.eventCount) return this;
|
|
57
|
-
let r = [], a = Math.max(0, this.items.length -
|
|
56
|
+
let r = [], a = Math.max(0, this.items.length - t), o = e.mapping, c = e.steps.length, l = this.eventCount;
|
|
58
57
|
this.items.forEach((e) => {
|
|
59
58
|
e.selection && l--;
|
|
60
59
|
}, a);
|
|
61
|
-
let u =
|
|
60
|
+
let u = t;
|
|
62
61
|
this.items.forEach((t) => {
|
|
63
62
|
let n = o.getMirror(--u);
|
|
64
63
|
if (n == null) return;
|
|
@@ -70,8 +69,8 @@ var i = 500, a = class t {
|
|
|
70
69
|
} else r.push(new s(i));
|
|
71
70
|
}, a);
|
|
72
71
|
let d = [];
|
|
73
|
-
for (let e =
|
|
74
|
-
let f = this.items.slice(0, a).append(d).append(r), p = new
|
|
72
|
+
for (let e = t; e < c; e++) d.push(new s(o.maps[e]));
|
|
73
|
+
let f = this.items.slice(0, a).append(d).append(r), p = new n(f, l);
|
|
75
74
|
return p.emptyItemCount() > i && (p = p.compress(this.items.length - r.length)), p;
|
|
76
75
|
}
|
|
77
76
|
emptyItemCount() {
|
|
@@ -80,23 +79,23 @@ var i = 500, a = class t {
|
|
|
80
79
|
t.step || e++;
|
|
81
80
|
}), e;
|
|
82
81
|
}
|
|
83
|
-
compress(
|
|
84
|
-
let
|
|
85
|
-
return this.items.forEach((
|
|
86
|
-
if (
|
|
87
|
-
else if (
|
|
88
|
-
let
|
|
89
|
-
if (i--,
|
|
90
|
-
let c =
|
|
82
|
+
compress(t = this.items.length) {
|
|
83
|
+
let r = this.remapping(0, t), i = r.maps.length, a = [], o = 0;
|
|
84
|
+
return this.items.forEach((e, n) => {
|
|
85
|
+
if (n >= t) a.push(e), e.selection && o++;
|
|
86
|
+
else if (e.step) {
|
|
87
|
+
let t = e.step.map(r.slice(i)), n = t && t.getMap();
|
|
88
|
+
if (i--, n && r.appendMap(n, i), t) {
|
|
89
|
+
let c = e.selection && e.selection.map(r.slice(i));
|
|
91
90
|
c && o++;
|
|
92
|
-
let l = new s(
|
|
91
|
+
let l = new s(n.invert(), t, c), u, d = a.length - 1;
|
|
93
92
|
(u = a.length && a[d].merge(l)) ? a[d] = u : a.push(l);
|
|
94
93
|
}
|
|
95
|
-
} else
|
|
96
|
-
}, this.items.length, 0), new
|
|
94
|
+
} else e.map && i--;
|
|
95
|
+
}, this.items.length, 0), new n(e.from(a.reverse()), o);
|
|
97
96
|
}
|
|
98
97
|
};
|
|
99
|
-
a.empty = new a(
|
|
98
|
+
a.empty = new a(e.empty, 0);
|
|
100
99
|
function o(e, t) {
|
|
101
100
|
let n;
|
|
102
101
|
return e.forEach((e, r) => {
|
|
@@ -174,12 +173,12 @@ function _(e) {
|
|
|
174
173
|
}
|
|
175
174
|
return h;
|
|
176
175
|
}
|
|
177
|
-
var v = new
|
|
176
|
+
var v = new r("history"), y = new r("closeHistory");
|
|
178
177
|
function b(e = {}) {
|
|
179
178
|
return e = {
|
|
180
179
|
depth: e.depth || 100,
|
|
181
180
|
newGroupDelay: e.newGroupDelay || 500
|
|
182
|
-
}, new
|
|
181
|
+
}, new n({
|
|
183
182
|
key: v,
|
|
184
183
|
state: {
|
|
185
184
|
init() {
|
|
@@ -208,7 +207,6 @@ function x(e, t) {
|
|
|
208
207
|
};
|
|
209
208
|
}
|
|
210
209
|
var S = x(!1, !0), C = x(!0, !0);
|
|
211
|
-
//#endregion
|
|
212
210
|
export { b as history, C as redo, S as undo };
|
|
213
211
|
|
|
214
212
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../node_modules/prosemirror-history/dist/index.js"],"sourcesContent":["import RopeSequence from 'rope-sequence';\nimport { Mapping } from 'prosemirror-transform';\nimport { PluginKey, Plugin } from 'prosemirror-state';\n\n// ProseMirror's history isn't simply a way to roll back to a previous\n// state, because ProseMirror supports applying changes without adding\n// them to the history (for example during collaboration).\n//\n// To this end, each 'Branch' (one for the undo history and one for\n// the redo history) keeps an array of 'Items', which can optionally\n// hold a step (an actual undoable change), and always hold a position\n// map (which is needed to move changes below them to apply to the\n// current document).\n//\n// An item that has both a step and a selection bookmark is the start\n// of an 'event' — a group of changes that will be undone or redone at\n// once. (It stores only the bookmark, since that way we don't have to\n// provide a document until the selection is actually applied, which\n// is useful when compressing.)\n// Used to schedule history compression\nconst max_empty_items = 500;\nclass Branch {\n constructor(items, eventCount) {\n this.items = items;\n this.eventCount = eventCount;\n }\n // Pop the latest event off the branch's history and apply it\n // to a document transform.\n popEvent(state, preserveItems) {\n if (this.eventCount == 0)\n return null;\n let end = this.items.length;\n for (;; end--) {\n let next = this.items.get(end - 1);\n if (next.selection) {\n --end;\n break;\n }\n }\n let remap, mapFrom;\n if (preserveItems) {\n remap = this.remapping(end, this.items.length);\n mapFrom = remap.maps.length;\n }\n let transform = state.tr;\n let selection, remaining;\n let addAfter = [], addBefore = [];\n this.items.forEach((item, i) => {\n if (!item.step) {\n if (!remap) {\n remap = this.remapping(end, i + 1);\n mapFrom = remap.maps.length;\n }\n mapFrom--;\n addBefore.push(item);\n return;\n }\n if (remap) {\n addBefore.push(new Item(item.map));\n let step = item.step.map(remap.slice(mapFrom)), map;\n if (step && transform.maybeStep(step).doc) {\n map = transform.mapping.maps[transform.mapping.maps.length - 1];\n addAfter.push(new Item(map, undefined, undefined, addAfter.length + addBefore.length));\n }\n mapFrom--;\n if (map)\n remap.appendMap(map, mapFrom);\n }\n else {\n transform.maybeStep(item.step);\n }\n if (item.selection) {\n selection = remap ? item.selection.map(remap.slice(mapFrom)) : item.selection;\n remaining = new Branch(this.items.slice(0, end).append(addBefore.reverse().concat(addAfter)), this.eventCount - 1);\n return false;\n }\n }, this.items.length, 0);\n return { remaining: remaining, transform, selection: selection };\n }\n // Create a new branch with the given transform added.\n addTransform(transform, selection, histOptions, preserveItems) {\n let newItems = [], eventCount = this.eventCount;\n let oldItems = this.items, lastItem = !preserveItems && oldItems.length ? oldItems.get(oldItems.length - 1) : null;\n for (let i = 0; i < transform.steps.length; i++) {\n let step = transform.steps[i].invert(transform.docs[i]);\n let item = new Item(transform.mapping.maps[i], step, selection), merged;\n if (merged = lastItem && lastItem.merge(item)) {\n item = merged;\n if (i)\n newItems.pop();\n else\n oldItems = oldItems.slice(0, oldItems.length - 1);\n }\n newItems.push(item);\n if (selection) {\n eventCount++;\n selection = undefined;\n }\n if (!preserveItems)\n lastItem = item;\n }\n let overflow = eventCount - histOptions.depth;\n if (overflow > DEPTH_OVERFLOW) {\n oldItems = cutOffEvents(oldItems, overflow);\n eventCount -= overflow;\n }\n return new Branch(oldItems.append(newItems), eventCount);\n }\n remapping(from, to) {\n let maps = new Mapping;\n this.items.forEach((item, i) => {\n let mirrorPos = item.mirrorOffset != null && i - item.mirrorOffset >= from\n ? maps.maps.length - item.mirrorOffset : undefined;\n maps.appendMap(item.map, mirrorPos);\n }, from, to);\n return maps;\n }\n addMaps(array) {\n if (this.eventCount == 0)\n return this;\n return new Branch(this.items.append(array.map(map => new Item(map))), this.eventCount);\n }\n // When the collab module receives remote changes, the history has\n // to know about those, so that it can adjust the steps that were\n // rebased on top of the remote changes, and include the position\n // maps for the remote changes in its array of items.\n rebased(rebasedTransform, rebasedCount) {\n if (!this.eventCount)\n return this;\n let rebasedItems = [], start = Math.max(0, this.items.length - rebasedCount);\n let mapping = rebasedTransform.mapping;\n let newUntil = rebasedTransform.steps.length;\n let eventCount = this.eventCount;\n this.items.forEach(item => { if (item.selection)\n eventCount--; }, start);\n let iRebased = rebasedCount;\n this.items.forEach(item => {\n let pos = mapping.getMirror(--iRebased);\n if (pos == null)\n return;\n newUntil = Math.min(newUntil, pos);\n let map = mapping.maps[pos];\n if (item.step) {\n let step = rebasedTransform.steps[pos].invert(rebasedTransform.docs[pos]);\n let selection = item.selection && item.selection.map(mapping.slice(iRebased + 1, pos));\n if (selection)\n eventCount++;\n rebasedItems.push(new Item(map, step, selection));\n }\n else {\n rebasedItems.push(new Item(map));\n }\n }, start);\n let newMaps = [];\n for (let i = rebasedCount; i < newUntil; i++)\n newMaps.push(new Item(mapping.maps[i]));\n let items = this.items.slice(0, start).append(newMaps).append(rebasedItems);\n let branch = new Branch(items, eventCount);\n if (branch.emptyItemCount() > max_empty_items)\n branch = branch.compress(this.items.length - rebasedItems.length);\n return branch;\n }\n emptyItemCount() {\n let count = 0;\n this.items.forEach(item => { if (!item.step)\n count++; });\n return count;\n }\n // Compressing a branch means rewriting it to push the air (map-only\n // items) out. During collaboration, these naturally accumulate\n // because each remote change adds one. The `upto` argument is used\n // to ensure that only the items below a given level are compressed,\n // because `rebased` relies on a clean, untouched set of items in\n // order to associate old items with rebased steps.\n compress(upto = this.items.length) {\n let remap = this.remapping(0, upto), mapFrom = remap.maps.length;\n let items = [], events = 0;\n this.items.forEach((item, i) => {\n if (i >= upto) {\n items.push(item);\n if (item.selection)\n events++;\n }\n else if (item.step) {\n let step = item.step.map(remap.slice(mapFrom)), map = step && step.getMap();\n mapFrom--;\n if (map)\n remap.appendMap(map, mapFrom);\n if (step) {\n let selection = item.selection && item.selection.map(remap.slice(mapFrom));\n if (selection)\n events++;\n let newItem = new Item(map.invert(), step, selection), merged, last = items.length - 1;\n if (merged = items.length && items[last].merge(newItem))\n items[last] = merged;\n else\n items.push(newItem);\n }\n }\n else if (item.map) {\n mapFrom--;\n }\n }, this.items.length, 0);\n return new Branch(RopeSequence.from(items.reverse()), events);\n }\n}\nBranch.empty = new Branch(RopeSequence.empty, 0);\nfunction cutOffEvents(items, n) {\n let cutPoint;\n items.forEach((item, i) => {\n if (item.selection && (n-- == 0)) {\n cutPoint = i;\n return false;\n }\n });\n return items.slice(cutPoint);\n}\nclass Item {\n constructor(\n // The (forward) step map for this item.\n map, \n // The inverted step\n step, \n // If this is non-null, this item is the start of a group, and\n // this selection is the starting selection for the group (the one\n // that was active before the first step was applied)\n selection, \n // If this item is the inverse of a previous mapping on the stack,\n // this points at the inverse's offset\n mirrorOffset) {\n this.map = map;\n this.step = step;\n this.selection = selection;\n this.mirrorOffset = mirrorOffset;\n }\n merge(other) {\n if (this.step && other.step && !other.selection) {\n let step = other.step.merge(this.step);\n if (step)\n return new Item(step.getMap().invert(), step, this.selection);\n }\n }\n}\n// The value of the state field that tracks undo/redo history for that\n// state. Will be stored in the plugin state when the history plugin\n// is active.\nclass HistoryState {\n constructor(done, undone, prevRanges, prevTime, prevComposition) {\n this.done = done;\n this.undone = undone;\n this.prevRanges = prevRanges;\n this.prevTime = prevTime;\n this.prevComposition = prevComposition;\n }\n}\nconst DEPTH_OVERFLOW = 20;\n// Record a transformation in undo history.\nfunction applyTransaction(history, state, tr, options) {\n let historyTr = tr.getMeta(historyKey), rebased;\n if (historyTr)\n return historyTr.historyState;\n if (tr.getMeta(closeHistoryKey))\n history = new HistoryState(history.done, history.undone, null, 0, -1);\n let appended = tr.getMeta(\"appendedTransaction\");\n if (tr.steps.length == 0) {\n return history;\n }\n else if (appended && appended.getMeta(historyKey)) {\n if (appended.getMeta(historyKey).redo)\n return new HistoryState(history.done.addTransform(tr, undefined, options, mustPreserveItems(state)), history.undone, rangesFor(tr.mapping.maps), history.prevTime, history.prevComposition);\n else\n return new HistoryState(history.done, history.undone.addTransform(tr, undefined, options, mustPreserveItems(state)), null, history.prevTime, history.prevComposition);\n }\n else if (tr.getMeta(\"addToHistory\") !== false && !(appended && appended.getMeta(\"addToHistory\") === false)) {\n // Group transforms that occur in quick succession into one event.\n let composition = tr.getMeta(\"composition\");\n let newGroup = history.prevTime == 0 ||\n (!appended && history.prevComposition != composition &&\n (history.prevTime < (tr.time || 0) - options.newGroupDelay || !isAdjacentTo(tr, history.prevRanges)));\n let prevRanges = appended ? mapRanges(history.prevRanges, tr.mapping) : rangesFor(tr.mapping.maps);\n return new HistoryState(history.done.addTransform(tr, newGroup ? state.selection.getBookmark() : undefined, options, mustPreserveItems(state)), Branch.empty, prevRanges, tr.time, composition == null ? history.prevComposition : composition);\n }\n else if (rebased = tr.getMeta(\"rebased\")) {\n // Used by the collab module to tell the history that some of its\n // content has been rebased.\n return new HistoryState(history.done.rebased(tr, rebased), history.undone.rebased(tr, rebased), mapRanges(history.prevRanges, tr.mapping), history.prevTime, history.prevComposition);\n }\n else {\n return new HistoryState(history.done.addMaps(tr.mapping.maps), history.undone.addMaps(tr.mapping.maps), mapRanges(history.prevRanges, tr.mapping), history.prevTime, history.prevComposition);\n }\n}\nfunction isAdjacentTo(transform, prevRanges) {\n if (!prevRanges)\n return false;\n if (!transform.docChanged)\n return true;\n let adjacent = false;\n transform.mapping.maps[0].forEach((start, end) => {\n for (let i = 0; i < prevRanges.length; i += 2)\n if (start <= prevRanges[i + 1] && end >= prevRanges[i])\n adjacent = true;\n });\n return adjacent;\n}\nfunction rangesFor(maps) {\n let result = [];\n for (let i = maps.length - 1; i >= 0 && result.length == 0; i--)\n maps[i].forEach((_from, _to, from, to) => result.push(from, to));\n return result;\n}\nfunction mapRanges(ranges, mapping) {\n if (!ranges)\n return null;\n let result = [];\n for (let i = 0; i < ranges.length; i += 2) {\n let from = mapping.map(ranges[i], 1), to = mapping.map(ranges[i + 1], -1);\n if (from <= to)\n result.push(from, to);\n }\n return result;\n}\n// Apply the latest event from one branch to the document and shift the event\n// onto the other branch.\nfunction histTransaction(history, state, redo) {\n let preserveItems = mustPreserveItems(state);\n let histOptions = historyKey.get(state).spec.config;\n let pop = (redo ? history.undone : history.done).popEvent(state, preserveItems);\n if (!pop)\n return null;\n let selection = pop.selection.resolve(pop.transform.doc);\n let added = (redo ? history.done : history.undone).addTransform(pop.transform, state.selection.getBookmark(), histOptions, preserveItems);\n let newHist = new HistoryState(redo ? added : pop.remaining, redo ? pop.remaining : added, null, 0, -1);\n return pop.transform.setSelection(selection).setMeta(historyKey, { redo, historyState: newHist });\n}\nlet cachedPreserveItems = false, cachedPreserveItemsPlugins = null;\n// Check whether any plugin in the given state has a\n// `historyPreserveItems` property in its spec, in which case we must\n// preserve steps exactly as they came in, so that they can be\n// rebased.\nfunction mustPreserveItems(state) {\n let plugins = state.plugins;\n if (cachedPreserveItemsPlugins != plugins) {\n cachedPreserveItems = false;\n cachedPreserveItemsPlugins = plugins;\n for (let i = 0; i < plugins.length; i++)\n if (plugins[i].spec.historyPreserveItems) {\n cachedPreserveItems = true;\n break;\n }\n }\n return cachedPreserveItems;\n}\n/**\nSet a flag on the given transaction that will prevent further steps\nfrom being appended to an existing history event (so that they\nrequire a separate undo command to undo).\n*/\nfunction closeHistory(tr) {\n return tr.setMeta(closeHistoryKey, true);\n}\nconst historyKey = new PluginKey(\"history\");\nconst closeHistoryKey = new PluginKey(\"closeHistory\");\n/**\nReturns a plugin that enables the undo history for an editor. The\nplugin will track undo and redo stacks, which can be used with the\n[`undo`](https://prosemirror.net/docs/ref/#history.undo) and [`redo`](https://prosemirror.net/docs/ref/#history.redo) commands.\n\nYou can set an `\"addToHistory\"` [metadata\nproperty](https://prosemirror.net/docs/ref/#state.Transaction.setMeta) of `false` on a transaction\nto prevent it from being rolled back by undo.\n*/\nfunction history(config = {}) {\n config = { depth: config.depth || 100,\n newGroupDelay: config.newGroupDelay || 500 };\n return new Plugin({\n key: historyKey,\n state: {\n init() {\n return new HistoryState(Branch.empty, Branch.empty, null, 0, -1);\n },\n apply(tr, hist, state) {\n return applyTransaction(hist, state, tr, config);\n }\n },\n config,\n props: {\n handleDOMEvents: {\n beforeinput(view, e) {\n let inputType = e.inputType;\n let command = inputType == \"historyUndo\" ? undo : inputType == \"historyRedo\" ? redo : null;\n if (!command || !view.editable)\n return false;\n e.preventDefault();\n return command(view.state, view.dispatch);\n }\n }\n }\n });\n}\nfunction buildCommand(redo, scroll) {\n return (state, dispatch) => {\n let hist = historyKey.getState(state);\n if (!hist || (redo ? hist.undone : hist.done).eventCount == 0)\n return false;\n if (dispatch) {\n let tr = histTransaction(hist, state, redo);\n if (tr)\n dispatch(scroll ? tr.scrollIntoView() : tr);\n }\n return true;\n };\n}\n/**\nA command function that undoes the last change, if any.\n*/\nconst undo = buildCommand(false, true);\n/**\nA command function that redoes the last undone change, if any.\n*/\nconst redo = buildCommand(true, true);\n/**\nA command function that undoes the last change. Don't scroll the\nselection into view.\n*/\nconst undoNoScroll = buildCommand(false, false);\n/**\nA command function that redoes the last undone change. Don't\nscroll the selection into view.\n*/\nconst redoNoScroll = buildCommand(true, false);\n/**\nThe amount of undoable events available in a given state.\n*/\nfunction undoDepth(state) {\n let hist = historyKey.getState(state);\n return hist ? hist.done.eventCount : 0;\n}\n/**\nThe amount of redoable events available in a given editor state.\n*/\nfunction redoDepth(state) {\n let hist = historyKey.getState(state);\n return hist ? hist.undone.eventCount : 0;\n}\n/**\nReturns true if the given transaction was generated by the history\nplugin.\n*/\nfunction isHistoryTransaction(tr) {\n return tr.getMeta(historyKey) != null;\n}\n\nexport { closeHistory, history, isHistoryTransaction, redo, redoDepth, redoNoScroll, undo, undoDepth, undoNoScroll };\n"],"x_google_ignoreList":[0],"mappings":";;;;AAoBA,IAAM,IAAkB,KAClB,IAAN,MAAM,EAAO;CACT,YAAY,GAAO,GAAY;EAE3B,AADA,KAAK,QAAQ,GACb,KAAK,aAAa;CACtB;CAGA,SAAS,GAAO,GAAe;EAC3B,IAAI,KAAK,cAAc,GACnB,OAAO;EACX,IAAI,IAAM,KAAK,MAAM;EACrB,QAAQ,KA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AS;EAC9B,eAAe,EAAO,iBAAiB;CAAI,GACxC,IAAI,EAAO;EACd,KAAK;EACL,OAAO;GACH,OAAO;IACH,OAAO,IAAI,EAAa,EAAO,OAAO,EAAO,OAAO,MAAM,GAAG,EAAE;GACnE;GACA,MAAM,GAAI,GAAM,GAAO;IACnB,OAAO,EAAiB,GAAM,GAAO,GAAI,CAAM;GACnD;EACJ;EACA;EACA,OAAO,EACH,iBAAiB,EACb,YAAY,GAAM,GAAG;GACjB,IAAI,IAAY,EAAE,WACd,IAAU,KAAa,gBAAgB,IAAO,KAAa,gBAAgB,IAAO;GAItF,OAHI,CAAC,KAAW,CAAC,EAAK,WACX,MACX,EAAE,eAAe,GACV,EAAQ,EAAK,OAAO,EAAK,QAAQ;EAC5C,EACJ,EACJ;CACJ,CAAC;AACL;AACA,SAAS,EAAa,GAAM,GAAQ;CAChC,QAAQ,GAAO,MAAa;EACxB,IAAI,IAAO,EAAW,SAAS,CAAK;EACpC,IAAI,CAAC,MAAS,IAAO,EAAK,SAAS,EAAK,KAAA,CAAM,cAAc,GACxD,OAAO;EACX,IAAI,GAAU;GACV,IAAI,IAAK,EAAgB,GAAM,GAAO,CAAI;GAC1C,AAAI,KACA,EAAS,IAAS,EAAG,eAAe,IAAI,CAAE;EAClD;EACA,OAAO;CACX;AACJ;AAIA,IAAM,IAAO,EAAa,IAAO,EAAI,GAI/B,IAAO,EAAa,IAAM,EAAI"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["RopeSequence","max_empty_items","Branch","items","eventCount","end","remap","mapFrom","preserveItems","transform","state","selection","remaining","addAfter","addBefore","item","i","Item","step","map","newItems","oldItems","lastItem","merged","overflow","histOptions","DEPTH_OVERFLOW","cutOffEvents","maps","Mapping","mirrorPos","from","to","array","rebasedItems","start","rebasedCount","mapping","rebasedTransform","newUntil","iRebased","pos","newMaps","branch","count","upto","events","newItem","last","cutPoint","mirrorOffset","other","HistoryState","done","undone","prevRanges","prevTime","prevComposition","applyTransaction","historyTr","tr","historyKey","rebased","closeHistoryKey","history","appended","options","mustPreserveItems","rangesFor","composition","newGroup","isAdjacentTo","mapRanges","adjacent","result","ranges","histTransaction","pop","redo","added","newHist","cachedPreserveItems","cachedPreserveItemsPlugins","plugins","PluginKey","config","Plugin","hist","inputType","e","command","undo","view","buildCommand","dispatch","scroll"],"sources":["../../../../node_modules/prosemirror-history/dist/index.js"],"sourcesContent":["import RopeSequence from 'rope-sequence';\nimport { Mapping } from 'prosemirror-transform';\nimport { PluginKey, Plugin } from 'prosemirror-state';\n\n// ProseMirror's history isn't simply a way to roll back to a previous\n// state, because ProseMirror supports applying changes without adding\n// them to the history (for example during collaboration).\n//\n// To this end, each 'Branch' (one for the undo history and one for\n// the redo history) keeps an array of 'Items', which can optionally\n// hold a step (an actual undoable change), and always hold a position\n// map (which is needed to move changes below them to apply to the\n// current document).\n//\n// An item that has both a step and a selection bookmark is the start\n// of an 'event' — a group of changes that will be undone or redone at\n// once. (It stores only the bookmark, since that way we don't have to\n// provide a document until the selection is actually applied, which\n// is useful when compressing.)\n// Used to schedule history compression\nconst max_empty_items = 500;\nclass Branch {\n constructor(items, eventCount) {\n this.items = items;\n this.eventCount = eventCount;\n }\n // Pop the latest event off the branch's history and apply it\n // to a document transform.\n popEvent(state, preserveItems) {\n if (this.eventCount == 0)\n return null;\n let end = this.items.length;\n for (;; end--) {\n let next = this.items.get(end - 1);\n if (next.selection) {\n --end;\n break;\n }\n }\n let remap, mapFrom;\n if (preserveItems) {\n remap = this.remapping(end, this.items.length);\n mapFrom = remap.maps.length;\n }\n let transform = state.tr;\n let selection, remaining;\n let addAfter = [], addBefore = [];\n this.items.forEach((item, i) => {\n if (!item.step) {\n if (!remap) {\n remap = this.remapping(end, i + 1);\n mapFrom = remap.maps.length;\n }\n mapFrom--;\n addBefore.push(item);\n return;\n }\n if (remap) {\n addBefore.push(new Item(item.map));\n let step = item.step.map(remap.slice(mapFrom)), map;\n if (step && transform.maybeStep(step).doc) {\n map = transform.mapping.maps[transform.mapping.maps.length - 1];\n addAfter.push(new Item(map, undefined, undefined, addAfter.length + addBefore.length));\n }\n mapFrom--;\n if (map)\n remap.appendMap(map, mapFrom);\n }\n else {\n transform.maybeStep(item.step);\n }\n if (item.selection) {\n selection = remap ? item.selection.map(remap.slice(mapFrom)) : item.selection;\n remaining = new Branch(this.items.slice(0, end).append(addBefore.reverse().concat(addAfter)), this.eventCount - 1);\n return false;\n }\n }, this.items.length, 0);\n return { remaining: remaining, transform, selection: selection };\n }\n // Create a new branch with the given transform added.\n addTransform(transform, selection, histOptions, preserveItems) {\n let newItems = [], eventCount = this.eventCount;\n let oldItems = this.items, lastItem = !preserveItems && oldItems.length ? oldItems.get(oldItems.length - 1) : null;\n for (let i = 0; i < transform.steps.length; i++) {\n let step = transform.steps[i].invert(transform.docs[i]);\n let item = new Item(transform.mapping.maps[i], step, selection), merged;\n if (merged = lastItem && lastItem.merge(item)) {\n item = merged;\n if (i)\n newItems.pop();\n else\n oldItems = oldItems.slice(0, oldItems.length - 1);\n }\n newItems.push(item);\n if (selection) {\n eventCount++;\n selection = undefined;\n }\n if (!preserveItems)\n lastItem = item;\n }\n let overflow = eventCount - histOptions.depth;\n if (overflow > DEPTH_OVERFLOW) {\n oldItems = cutOffEvents(oldItems, overflow);\n eventCount -= overflow;\n }\n return new Branch(oldItems.append(newItems), eventCount);\n }\n remapping(from, to) {\n let maps = new Mapping;\n this.items.forEach((item, i) => {\n let mirrorPos = item.mirrorOffset != null && i - item.mirrorOffset >= from\n ? maps.maps.length - item.mirrorOffset : undefined;\n maps.appendMap(item.map, mirrorPos);\n }, from, to);\n return maps;\n }\n addMaps(array) {\n if (this.eventCount == 0)\n return this;\n return new Branch(this.items.append(array.map(map => new Item(map))), this.eventCount);\n }\n // When the collab module receives remote changes, the history has\n // to know about those, so that it can adjust the steps that were\n // rebased on top of the remote changes, and include the position\n // maps for the remote changes in its array of items.\n rebased(rebasedTransform, rebasedCount) {\n if (!this.eventCount)\n return this;\n let rebasedItems = [], start = Math.max(0, this.items.length - rebasedCount);\n let mapping = rebasedTransform.mapping;\n let newUntil = rebasedTransform.steps.length;\n let eventCount = this.eventCount;\n this.items.forEach(item => { if (item.selection)\n eventCount--; }, start);\n let iRebased = rebasedCount;\n this.items.forEach(item => {\n let pos = mapping.getMirror(--iRebased);\n if (pos == null)\n return;\n newUntil = Math.min(newUntil, pos);\n let map = mapping.maps[pos];\n if (item.step) {\n let step = rebasedTransform.steps[pos].invert(rebasedTransform.docs[pos]);\n let selection = item.selection && item.selection.map(mapping.slice(iRebased + 1, pos));\n if (selection)\n eventCount++;\n rebasedItems.push(new Item(map, step, selection));\n }\n else {\n rebasedItems.push(new Item(map));\n }\n }, start);\n let newMaps = [];\n for (let i = rebasedCount; i < newUntil; i++)\n newMaps.push(new Item(mapping.maps[i]));\n let items = this.items.slice(0, start).append(newMaps).append(rebasedItems);\n let branch = new Branch(items, eventCount);\n if (branch.emptyItemCount() > max_empty_items)\n branch = branch.compress(this.items.length - rebasedItems.length);\n return branch;\n }\n emptyItemCount() {\n let count = 0;\n this.items.forEach(item => { if (!item.step)\n count++; });\n return count;\n }\n // Compressing a branch means rewriting it to push the air (map-only\n // items) out. During collaboration, these naturally accumulate\n // because each remote change adds one. The `upto` argument is used\n // to ensure that only the items below a given level are compressed,\n // because `rebased` relies on a clean, untouched set of items in\n // order to associate old items with rebased steps.\n compress(upto = this.items.length) {\n let remap = this.remapping(0, upto), mapFrom = remap.maps.length;\n let items = [], events = 0;\n this.items.forEach((item, i) => {\n if (i >= upto) {\n items.push(item);\n if (item.selection)\n events++;\n }\n else if (item.step) {\n let step = item.step.map(remap.slice(mapFrom)), map = step && step.getMap();\n mapFrom--;\n if (map)\n remap.appendMap(map, mapFrom);\n if (step) {\n let selection = item.selection && item.selection.map(remap.slice(mapFrom));\n if (selection)\n events++;\n let newItem = new Item(map.invert(), step, selection), merged, last = items.length - 1;\n if (merged = items.length && items[last].merge(newItem))\n items[last] = merged;\n else\n items.push(newItem);\n }\n }\n else if (item.map) {\n mapFrom--;\n }\n }, this.items.length, 0);\n return new Branch(RopeSequence.from(items.reverse()), events);\n }\n}\nBranch.empty = new Branch(RopeSequence.empty, 0);\nfunction cutOffEvents(items, n) {\n let cutPoint;\n items.forEach((item, i) => {\n if (item.selection && (n-- == 0)) {\n cutPoint = i;\n return false;\n }\n });\n return items.slice(cutPoint);\n}\nclass Item {\n constructor(\n // The (forward) step map for this item.\n map, \n // The inverted step\n step, \n // If this is non-null, this item is the start of a group, and\n // this selection is the starting selection for the group (the one\n // that was active before the first step was applied)\n selection, \n // If this item is the inverse of a previous mapping on the stack,\n // this points at the inverse's offset\n mirrorOffset) {\n this.map = map;\n this.step = step;\n this.selection = selection;\n this.mirrorOffset = mirrorOffset;\n }\n merge(other) {\n if (this.step && other.step && !other.selection) {\n let step = other.step.merge(this.step);\n if (step)\n return new Item(step.getMap().invert(), step, this.selection);\n }\n }\n}\n// The value of the state field that tracks undo/redo history for that\n// state. Will be stored in the plugin state when the history plugin\n// is active.\nclass HistoryState {\n constructor(done, undone, prevRanges, prevTime, prevComposition) {\n this.done = done;\n this.undone = undone;\n this.prevRanges = prevRanges;\n this.prevTime = prevTime;\n this.prevComposition = prevComposition;\n }\n}\nconst DEPTH_OVERFLOW = 20;\n// Record a transformation in undo history.\nfunction applyTransaction(history, state, tr, options) {\n let historyTr = tr.getMeta(historyKey), rebased;\n if (historyTr)\n return historyTr.historyState;\n if (tr.getMeta(closeHistoryKey))\n history = new HistoryState(history.done, history.undone, null, 0, -1);\n let appended = tr.getMeta(\"appendedTransaction\");\n if (tr.steps.length == 0) {\n return history;\n }\n else if (appended && appended.getMeta(historyKey)) {\n if (appended.getMeta(historyKey).redo)\n return new HistoryState(history.done.addTransform(tr, undefined, options, mustPreserveItems(state)), history.undone, rangesFor(tr.mapping.maps), history.prevTime, history.prevComposition);\n else\n return new HistoryState(history.done, history.undone.addTransform(tr, undefined, options, mustPreserveItems(state)), null, history.prevTime, history.prevComposition);\n }\n else if (tr.getMeta(\"addToHistory\") !== false && !(appended && appended.getMeta(\"addToHistory\") === false)) {\n // Group transforms that occur in quick succession into one event.\n let composition = tr.getMeta(\"composition\");\n let newGroup = history.prevTime == 0 ||\n (!appended && history.prevComposition != composition &&\n (history.prevTime < (tr.time || 0) - options.newGroupDelay || !isAdjacentTo(tr, history.prevRanges)));\n let prevRanges = appended ? mapRanges(history.prevRanges, tr.mapping) : rangesFor(tr.mapping.maps);\n return new HistoryState(history.done.addTransform(tr, newGroup ? state.selection.getBookmark() : undefined, options, mustPreserveItems(state)), Branch.empty, prevRanges, tr.time, composition == null ? history.prevComposition : composition);\n }\n else if (rebased = tr.getMeta(\"rebased\")) {\n // Used by the collab module to tell the history that some of its\n // content has been rebased.\n return new HistoryState(history.done.rebased(tr, rebased), history.undone.rebased(tr, rebased), mapRanges(history.prevRanges, tr.mapping), history.prevTime, history.prevComposition);\n }\n else {\n return new HistoryState(history.done.addMaps(tr.mapping.maps), history.undone.addMaps(tr.mapping.maps), mapRanges(history.prevRanges, tr.mapping), history.prevTime, history.prevComposition);\n }\n}\nfunction isAdjacentTo(transform, prevRanges) {\n if (!prevRanges)\n return false;\n if (!transform.docChanged)\n return true;\n let adjacent = false;\n transform.mapping.maps[0].forEach((start, end) => {\n for (let i = 0; i < prevRanges.length; i += 2)\n if (start <= prevRanges[i + 1] && end >= prevRanges[i])\n adjacent = true;\n });\n return adjacent;\n}\nfunction rangesFor(maps) {\n let result = [];\n for (let i = maps.length - 1; i >= 0 && result.length == 0; i--)\n maps[i].forEach((_from, _to, from, to) => result.push(from, to));\n return result;\n}\nfunction mapRanges(ranges, mapping) {\n if (!ranges)\n return null;\n let result = [];\n for (let i = 0; i < ranges.length; i += 2) {\n let from = mapping.map(ranges[i], 1), to = mapping.map(ranges[i + 1], -1);\n if (from <= to)\n result.push(from, to);\n }\n return result;\n}\n// Apply the latest event from one branch to the document and shift the event\n// onto the other branch.\nfunction histTransaction(history, state, redo) {\n let preserveItems = mustPreserveItems(state);\n let histOptions = historyKey.get(state).spec.config;\n let pop = (redo ? history.undone : history.done).popEvent(state, preserveItems);\n if (!pop)\n return null;\n let selection = pop.selection.resolve(pop.transform.doc);\n let added = (redo ? history.done : history.undone).addTransform(pop.transform, state.selection.getBookmark(), histOptions, preserveItems);\n let newHist = new HistoryState(redo ? added : pop.remaining, redo ? pop.remaining : added, null, 0, -1);\n return pop.transform.setSelection(selection).setMeta(historyKey, { redo, historyState: newHist });\n}\nlet cachedPreserveItems = false, cachedPreserveItemsPlugins = null;\n// Check whether any plugin in the given state has a\n// `historyPreserveItems` property in its spec, in which case we must\n// preserve steps exactly as they came in, so that they can be\n// rebased.\nfunction mustPreserveItems(state) {\n let plugins = state.plugins;\n if (cachedPreserveItemsPlugins != plugins) {\n cachedPreserveItems = false;\n cachedPreserveItemsPlugins = plugins;\n for (let i = 0; i < plugins.length; i++)\n if (plugins[i].spec.historyPreserveItems) {\n cachedPreserveItems = true;\n break;\n }\n }\n return cachedPreserveItems;\n}\n/**\nSet a flag on the given transaction that will prevent further steps\nfrom being appended to an existing history event (so that they\nrequire a separate undo command to undo).\n*/\nfunction closeHistory(tr) {\n return tr.setMeta(closeHistoryKey, true);\n}\nconst historyKey = new PluginKey(\"history\");\nconst closeHistoryKey = new PluginKey(\"closeHistory\");\n/**\nReturns a plugin that enables the undo history for an editor. The\nplugin will track undo and redo stacks, which can be used with the\n[`undo`](https://prosemirror.net/docs/ref/#history.undo) and [`redo`](https://prosemirror.net/docs/ref/#history.redo) commands.\n\nYou can set an `\"addToHistory\"` [metadata\nproperty](https://prosemirror.net/docs/ref/#state.Transaction.setMeta) of `false` on a transaction\nto prevent it from being rolled back by undo.\n*/\nfunction history(config = {}) {\n config = { depth: config.depth || 100,\n newGroupDelay: config.newGroupDelay || 500 };\n return new Plugin({\n key: historyKey,\n state: {\n init() {\n return new HistoryState(Branch.empty, Branch.empty, null, 0, -1);\n },\n apply(tr, hist, state) {\n return applyTransaction(hist, state, tr, config);\n }\n },\n config,\n props: {\n handleDOMEvents: {\n beforeinput(view, e) {\n let inputType = e.inputType;\n let command = inputType == \"historyUndo\" ? undo : inputType == \"historyRedo\" ? redo : null;\n if (!command || !view.editable)\n return false;\n e.preventDefault();\n return command(view.state, view.dispatch);\n }\n }\n }\n });\n}\nfunction buildCommand(redo, scroll) {\n return (state, dispatch) => {\n let hist = historyKey.getState(state);\n if (!hist || (redo ? hist.undone : hist.done).eventCount == 0)\n return false;\n if (dispatch) {\n let tr = histTransaction(hist, state, redo);\n if (tr)\n dispatch(scroll ? tr.scrollIntoView() : tr);\n }\n return true;\n };\n}\n/**\nA command function that undoes the last change, if any.\n*/\nconst undo = buildCommand(false, true);\n/**\nA command function that redoes the last undone change, if any.\n*/\nconst redo = buildCommand(true, true);\n/**\nA command function that undoes the last change. Don't scroll the\nselection into view.\n*/\nconst undoNoScroll = buildCommand(false, false);\n/**\nA command function that redoes the last undone change. Don't\nscroll the selection into view.\n*/\nconst redoNoScroll = buildCommand(true, false);\n/**\nThe amount of undoable events available in a given state.\n*/\nfunction undoDepth(state) {\n let hist = historyKey.getState(state);\n return hist ? hist.done.eventCount : 0;\n}\n/**\nThe amount of redoable events available in a given editor state.\n*/\nfunction redoDepth(state) {\n let hist = historyKey.getState(state);\n return hist ? hist.undone.eventCount : 0;\n}\n/**\nReturns true if the given transaction was generated by the history\nplugin.\n*/\nfunction isHistoryTransaction(tr) {\n return tr.getMeta(historyKey) != null;\n}\n\nexport { closeHistory, history, isHistoryTransaction, redo, redoDepth, redoNoScroll, undo, undoDepth, undoNoScroll };\n"],"ignoreList":[0],"mappings":";;;;AAoBA,IAAMC,IAAkB,KAClBC,IAAN,MAAMA,EAAO;CACT,YAAY,GAAO,GAAY;EAE3B,AADA,KAAK,QAAQC,GACb,KAAK,aAAaC;CACtB;CAGA,SAAS,GAAO,GAAe;EAC3B,IAAI,KAAK,cAAc,GACnB,OAAO;EACX,IAAIC,IAAM,KAAK,MAAM;EACrB,QAAQ,KAEJ,IADW,KAAK,MAAM,IAA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