Files
baserow/web-frontend/modules/core/editor/richTextMenuPosition.js
Davide Silvestri 3a4a57246d fix: use the official TipTap Markdown extension and fix newlines disappearing (#5721)
* fix: use TipTap Markdown for rich text fields

* fix: escape markdown at line starts only and skip saves without edits

* perf: skip the preview markdown round-trip when no empty paragraphs are possible

* fix: address feedback; add docs

* fix: copilot feedback

* fix: copy one cell, paste in edit mode in another one
2026-07-22 12:02:53 +02:00

23 lines
660 B
JavaScript

import { posToDOMRect } from '@tiptap/core'
export const isRichTextSelectionVisible = (editor, scrollTargets) => {
if (!editor || !scrollTargets) {
return true
}
const { from, to } = editor.state.selection
const selectionRect = posToDOMRect(editor.view, from, to)
const targets = Array.isArray(scrollTargets) ? scrollTargets : [scrollTargets]
return targets.every((target) => {
const containerRect =
target === window
? { top: 0, bottom: window.innerHeight }
: target.getBoundingClientRect()
return (
selectionRect.bottom > containerRect.top &&
selectionRect.top < containerRect.bottom
)
})
}