mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
Merge pull request #31924 from overleaf/ds-removing-useIsNewEditorEnabled-4
[Part 4] Removing the usage of `useIsNewEditorEnabled` for editor tear down GitOrigin-RevId: 4c1194bb011630f83ecf7334f9ad0deb6ab52580
This commit is contained in:
@@ -1147,7 +1147,6 @@
|
|||||||
"n_more_updates_below_plural": "",
|
"n_more_updates_below_plural": "",
|
||||||
"name": "",
|
"name": "",
|
||||||
"name_usage_explanation": "",
|
"name_usage_explanation": "",
|
||||||
"navigate_log_source": "",
|
|
||||||
"navigation": "",
|
"navigation": "",
|
||||||
"need_anything_contact_us_at": "",
|
"need_anything_contact_us_at": "",
|
||||||
"need_contact_group_admin_to_make_changes": "",
|
"need_contact_group_admin_to_make_changes": "",
|
||||||
|
|||||||
@@ -1,18 +1,13 @@
|
|||||||
import { memo } from 'react'
|
import { memo } from 'react'
|
||||||
import PreviewLogEntryHeader from '../../preview/components/preview-log-entry-header'
|
|
||||||
import PdfLogEntryContent from './pdf-log-entry-content'
|
|
||||||
import HumanReadableLogsHints from '../../../ide/human-readable-logs/HumanReadableLogsHints'
|
import HumanReadableLogsHints from '../../../ide/human-readable-logs/HumanReadableLogsHints'
|
||||||
import getMeta from '@/utils/meta'
|
|
||||||
import { ErrorLevel, LogEntry, SourceLocation } from '../util/types'
|
import { ErrorLevel, LogEntry, SourceLocation } from '../util/types'
|
||||||
import NewLogEntry from '@/features/pdf-preview/components/log-entry'
|
import NewLogEntry from '@/features/pdf-preview/components/log-entry'
|
||||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
|
||||||
import useHandleLogEntryClick from '../hooks/use-handle-log-entry-click'
|
import useHandleLogEntryClick from '../hooks/use-handle-log-entry-click'
|
||||||
|
|
||||||
function PdfLogEntry({
|
function PdfLogEntry({
|
||||||
autoExpand,
|
autoExpand,
|
||||||
ruleId,
|
ruleId,
|
||||||
headerTitle,
|
headerTitle,
|
||||||
headerIcon,
|
|
||||||
rawContent,
|
rawContent,
|
||||||
logType,
|
logType,
|
||||||
formattedContent,
|
formattedContent,
|
||||||
@@ -31,7 +26,6 @@ function PdfLogEntry({
|
|||||||
level: ErrorLevel
|
level: ErrorLevel
|
||||||
autoExpand?: boolean
|
autoExpand?: boolean
|
||||||
ruleId?: string
|
ruleId?: string
|
||||||
headerIcon?: React.ReactElement
|
|
||||||
rawContent?: string
|
rawContent?: string
|
||||||
logType?: string
|
logType?: string
|
||||||
formattedContent?: React.ReactNode
|
formattedContent?: React.ReactNode
|
||||||
@@ -45,8 +39,6 @@ function PdfLogEntry({
|
|||||||
logEntry?: LogEntry
|
logEntry?: LogEntry
|
||||||
id?: string
|
id?: string
|
||||||
}) {
|
}) {
|
||||||
const showAiErrorAssistant = getMeta('ol-showAiFeatures')
|
|
||||||
|
|
||||||
if (ruleId && HumanReadableLogsHints[ruleId]) {
|
if (ruleId && HumanReadableLogsHints[ruleId]) {
|
||||||
const hint = HumanReadableLogsHints[ruleId]
|
const hint = HumanReadableLogsHints[ruleId]
|
||||||
formattedContent = hint.formattedContent(contentDetails)
|
formattedContent = hint.formattedContent(contentDetails)
|
||||||
@@ -60,58 +52,25 @@ function PdfLogEntry({
|
|||||||
onSourceLocationClick,
|
onSourceLocationClick,
|
||||||
})
|
})
|
||||||
|
|
||||||
const newEditor = useIsNewEditorEnabled()
|
|
||||||
|
|
||||||
if (newEditor) {
|
|
||||||
return (
|
|
||||||
<NewLogEntry
|
|
||||||
autoExpand={autoExpand}
|
|
||||||
index={index}
|
|
||||||
id={id}
|
|
||||||
logEntry={logEntry}
|
|
||||||
ruleId={ruleId}
|
|
||||||
headerTitle={headerTitle}
|
|
||||||
formattedContent={formattedContent}
|
|
||||||
rawContent={rawContent}
|
|
||||||
logType={logType}
|
|
||||||
level={level}
|
|
||||||
contentDetails={contentDetails}
|
|
||||||
entryAriaLabel={entryAriaLabel}
|
|
||||||
sourceLocation={sourceLocation}
|
|
||||||
onSourceLocationClick={handleLogEntryLinkClick}
|
|
||||||
showSourceLocationLink={showSourceLocationLink}
|
|
||||||
extraInfoURL={extraInfoURL}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<NewLogEntry
|
||||||
className="log-entry"
|
autoExpand={autoExpand}
|
||||||
aria-label={entryAriaLabel}
|
index={index}
|
||||||
data-ruleid={ruleId}
|
id={id}
|
||||||
data-log-entry-id={id}
|
logEntry={logEntry}
|
||||||
>
|
ruleId={ruleId}
|
||||||
<PreviewLogEntryHeader
|
headerTitle={headerTitle}
|
||||||
level={level}
|
formattedContent={formattedContent}
|
||||||
sourceLocation={sourceLocation}
|
rawContent={rawContent}
|
||||||
headerTitle={headerTitle}
|
logType={logType}
|
||||||
headerIcon={headerIcon}
|
level={level}
|
||||||
logType={logType}
|
contentDetails={contentDetails}
|
||||||
showSourceLocationLink={showSourceLocationLink}
|
entryAriaLabel={entryAriaLabel}
|
||||||
onSourceLocationClick={handleLogEntryLinkClick}
|
sourceLocation={sourceLocation}
|
||||||
/>
|
onSourceLocationClick={handleLogEntryLinkClick}
|
||||||
|
showSourceLocationLink={showSourceLocationLink}
|
||||||
{(rawContent || formattedContent || showAiErrorAssistant) && (
|
extraInfoURL={extraInfoURL}
|
||||||
<PdfLogEntryContent
|
/>
|
||||||
rawContent={rawContent}
|
|
||||||
formattedContent={formattedContent}
|
|
||||||
extraInfoURL={extraInfoURL}
|
|
||||||
index={index}
|
|
||||||
logEntry={logEntry}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -256,12 +256,10 @@ export default memo(PdfPreviewError)
|
|||||||
function ErrorLogEntry({
|
function ErrorLogEntry({
|
||||||
autoExpand = true,
|
autoExpand = true,
|
||||||
title,
|
title,
|
||||||
headerIcon,
|
|
||||||
children,
|
children,
|
||||||
}: {
|
}: {
|
||||||
autoExpand?: boolean
|
autoExpand?: boolean
|
||||||
title: string
|
title: string
|
||||||
headerIcon?: React.ReactElement
|
|
||||||
children: React.ReactNode
|
children: React.ReactNode
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
@@ -270,7 +268,6 @@ function ErrorLogEntry({
|
|||||||
<PdfLogEntry
|
<PdfLogEntry
|
||||||
autoExpand={autoExpand}
|
autoExpand={autoExpand}
|
||||||
headerTitle={title}
|
headerTitle={title}
|
||||||
headerIcon={headerIcon}
|
|
||||||
formattedContent={children}
|
formattedContent={children}
|
||||||
entryAriaLabel={t('compile_error_entry_description')}
|
entryAriaLabel={t('compile_error_entry_description')}
|
||||||
level="error"
|
level="error"
|
||||||
|
|||||||
@@ -1,123 +0,0 @@
|
|||||||
import classNames from 'classnames'
|
|
||||||
import { useState, useRef, MouseEventHandler } from 'react'
|
|
||||||
import { useTranslation } from 'react-i18next'
|
|
||||||
import useResizeObserver from '../hooks/use-resize-observer'
|
|
||||||
import OLTooltip from '@/shared/components/ol/ol-tooltip'
|
|
||||||
import OLButton from '@/shared/components/ol/ol-button'
|
|
||||||
import MaterialIcon from '@/shared/components/material-icon'
|
|
||||||
import { ErrorLevel, SourceLocation } from '@/features/pdf-preview/util/types'
|
|
||||||
|
|
||||||
function PreviewLogEntryHeader({
|
|
||||||
sourceLocation,
|
|
||||||
level,
|
|
||||||
headerTitle,
|
|
||||||
headerIcon,
|
|
||||||
logType,
|
|
||||||
showSourceLocationLink = true,
|
|
||||||
onSourceLocationClick,
|
|
||||||
}: {
|
|
||||||
headerTitle: string | React.ReactNode
|
|
||||||
level: ErrorLevel
|
|
||||||
headerIcon?: React.ReactElement
|
|
||||||
logType?: string
|
|
||||||
sourceLocation?: SourceLocation
|
|
||||||
showSourceLocationLink?: boolean
|
|
||||||
onSourceLocationClick?: MouseEventHandler<HTMLButtonElement>
|
|
||||||
}) {
|
|
||||||
const { t } = useTranslation()
|
|
||||||
const logLocationSpanRef = useRef<HTMLSpanElement>(null)
|
|
||||||
const [locationSpanOverflown, setLocationSpanOverflown] = useState(false)
|
|
||||||
|
|
||||||
useResizeObserver(
|
|
||||||
logLocationSpanRef,
|
|
||||||
locationSpanOverflown,
|
|
||||||
checkLocationSpanOverflow
|
|
||||||
)
|
|
||||||
|
|
||||||
const file = sourceLocation ? sourceLocation.file : null
|
|
||||||
const line = sourceLocation ? sourceLocation.line : null
|
|
||||||
const logEntryHeaderClasses = classNames('log-entry-header', {
|
|
||||||
'log-entry-header-error': level === 'error',
|
|
||||||
'log-entry-header-warning': level === 'warning',
|
|
||||||
'log-entry-header-info': level === 'info',
|
|
||||||
'log-entry-header-typesetting': level === 'typesetting',
|
|
||||||
'log-entry-header-raw': level === 'raw',
|
|
||||||
'log-entry-header-success': level === 'success',
|
|
||||||
})
|
|
||||||
const logEntryLocationBtnClasses = classNames('log-entry-header-link', {
|
|
||||||
'log-entry-header-link-error': level === 'error',
|
|
||||||
'log-entry-header-link-warning': level === 'warning',
|
|
||||||
'log-entry-header-link-typesetting': level === 'typesetting',
|
|
||||||
'log-entry-header-link-raw': level === 'raw',
|
|
||||||
'log-entry-header-link-info': level === 'info',
|
|
||||||
'log-entry-header-link-success': level === 'success',
|
|
||||||
})
|
|
||||||
const headerLogLocationTitle = t('navigate_log_source', {
|
|
||||||
location: file + (line ? `, ${line}` : ''),
|
|
||||||
})
|
|
||||||
|
|
||||||
function checkLocationSpanOverflow(observedElement: ResizeObserverEntry) {
|
|
||||||
const spanEl = observedElement.target
|
|
||||||
const isOverflowing = spanEl.scrollWidth > spanEl.clientWidth
|
|
||||||
setLocationSpanOverflown(isOverflowing)
|
|
||||||
}
|
|
||||||
|
|
||||||
const locationLinkText =
|
|
||||||
showSourceLocationLink && file ? `${file}${line ? `, ${line}` : ''}` : null
|
|
||||||
|
|
||||||
// Because we want an ellipsis on the left-hand side (e.g. "...longfilename.tex"), the
|
|
||||||
// `log-entry-header-link-location` class has text laid out from right-to-left using the CSS
|
|
||||||
// rule `direction: rtl;`.
|
|
||||||
// This works most of the times, except when the first character of the filename is considered
|
|
||||||
// a punctuation mark, like `/` (e.g. `/foo/bar/baz.sty`). In this case, because of
|
|
||||||
// right-to-left writing rules, the punctuation mark is moved to the right-side of the string,
|
|
||||||
// resulting in `...bar/baz.sty/` instead of `...bar/baz.sty`.
|
|
||||||
// To avoid this edge-case, we wrap the `logLocationLinkText` in two directional formatting
|
|
||||||
// characters:
|
|
||||||
// * \u202A LEFT-TO-RIGHT EMBEDDING Treat the following text as embedded left-to-right.
|
|
||||||
// * \u202C POP DIRECTIONAL FORMATTING End the scope of the last LRE, RLE, RLO, or LRO.
|
|
||||||
// This essentially tells the browser that, althought the text is laid out from right-to-left,
|
|
||||||
// the wrapped portion of text should follow left-to-right writing rules.
|
|
||||||
const locationLink = locationLinkText ? (
|
|
||||||
<OLButton
|
|
||||||
variant="ghost"
|
|
||||||
className={logEntryLocationBtnClasses}
|
|
||||||
aria-label={headerLogLocationTitle}
|
|
||||||
onClick={onSourceLocationClick}
|
|
||||||
>
|
|
||||||
<MaterialIcon type="link" />
|
|
||||||
<span
|
|
||||||
ref={logLocationSpanRef}
|
|
||||||
className="log-entry-header-link-location"
|
|
||||||
translate="no"
|
|
||||||
>
|
|
||||||
{`\u202A${locationLinkText}\u202C`}
|
|
||||||
</span>
|
|
||||||
</OLButton>
|
|
||||||
) : null
|
|
||||||
|
|
||||||
const headerTitleText = logType ? `${logType} ${headerTitle}` : headerTitle
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={logEntryHeaderClasses}>
|
|
||||||
{headerIcon ? (
|
|
||||||
<div className="log-entry-header-icon-container">{headerIcon}</div>
|
|
||||||
) : null}
|
|
||||||
<h3 className="log-entry-header-title">{headerTitleText}</h3>
|
|
||||||
{locationSpanOverflown && locationLinkText && locationLink ? (
|
|
||||||
<OLTooltip
|
|
||||||
id={locationLinkText}
|
|
||||||
description={locationLinkText}
|
|
||||||
overlayProps={{ placement: 'left' }}
|
|
||||||
tooltipProps={{ className: 'log-location-tooltip', translate: 'no' }}
|
|
||||||
>
|
|
||||||
{locationLink}
|
|
||||||
</OLTooltip>
|
|
||||||
) : (
|
|
||||||
locationLink
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default PreviewLogEntryHeader
|
|
||||||
+2
-5
@@ -33,7 +33,6 @@ import ReviewPanelMoreCommentsButton from './review-panel-more-comments-button'
|
|||||||
import useMoreCommments from '../hooks/use-more-comments'
|
import useMoreCommments from '../hooks/use-more-comments'
|
||||||
import { Decoration } from '@codemirror/view'
|
import { Decoration } from '@codemirror/view'
|
||||||
import { debounce } from 'lodash'
|
import { debounce } from 'lodash'
|
||||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
|
||||||
|
|
||||||
type AggregatedRanges = {
|
type AggregatedRanges = {
|
||||||
changes: Change<EditOperation>[]
|
changes: Change<EditOperation>[]
|
||||||
@@ -47,7 +46,6 @@ const ReviewPanelCurrentFile: FC = () => {
|
|||||||
const threads = useThreadsContext()
|
const threads = useThreadsContext()
|
||||||
const state = useCodeMirrorStateContext()
|
const state = useCodeMirrorStateContext()
|
||||||
const [hoveredEntry, setHoveredEntry] = useState<string | null>(null)
|
const [hoveredEntry, setHoveredEntry] = useState<string | null>(null)
|
||||||
const newEditor = useIsNewEditorEnabled()
|
|
||||||
|
|
||||||
const hoverTimeout = useRef<number>(0)
|
const hoverTimeout = useRef<number>(0)
|
||||||
const handleEntryEnter = useCallback((id: string) => {
|
const handleEntryEnter = useCallback((id: string) => {
|
||||||
@@ -248,8 +246,7 @@ const ReviewPanelCurrentFile: FC = () => {
|
|||||||
const positioningRes = positionItems(
|
const positioningRes = positionItems(
|
||||||
containerRef.current,
|
containerRef.current,
|
||||||
previousFocusedItem.current.get(docId),
|
previousFocusedItem.current.get(docId),
|
||||||
docId,
|
docId
|
||||||
newEditor
|
|
||||||
)
|
)
|
||||||
|
|
||||||
onEntriesPositioned()
|
onEntriesPositioned()
|
||||||
@@ -261,7 +258,7 @@ const ReviewPanelCurrentFile: FC = () => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [ranges?.docId, onEntriesPositioned, newEditor])
|
}, [ranges?.docId, onEntriesPositioned])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const timer = window.setTimeout(() => {
|
const timer = window.setTimeout(() => {
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
import { FC, memo, useMemo } from 'react'
|
import { FC, memo, useMemo } from 'react'
|
||||||
import ReviewPanelTabs from './review-panel-tabs'
|
import ReviewPanelTabs from './review-panel-tabs'
|
||||||
import ReviewPanelHeader from './review-panel-header'
|
|
||||||
import ReviewPanelCurrentFile from './review-panel-current-file'
|
import ReviewPanelCurrentFile from './review-panel-current-file'
|
||||||
import { ReviewPanelOverview } from './review-panel-overview'
|
import { ReviewPanelOverview } from './review-panel-overview'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import { useReviewPanelStyles } from '@/features/review-panel/hooks/use-review-panel-styles'
|
import { useReviewPanelStyles } from '@/features/review-panel/hooks/use-review-panel-styles'
|
||||||
import { useReviewPanelViewContext } from '../context/review-panel-view-context'
|
import { useReviewPanelViewContext } from '../context/review-panel-view-context'
|
||||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
|
||||||
|
|
||||||
const ReviewPanel: FC<{ mini?: boolean }> = ({ mini = false }) => {
|
const ReviewPanel: FC<{ mini?: boolean }> = ({ mini = false }) => {
|
||||||
const choosenSubView = useReviewPanelViewContext()
|
const choosenSubView = useReviewPanelViewContext()
|
||||||
const newEditor = useIsNewEditorEnabled()
|
|
||||||
|
|
||||||
const activeSubView = useMemo(
|
const activeSubView = useMemo(
|
||||||
() => (mini ? 'cur_file' : choosenSubView),
|
() => (mini ? 'cur_file' : choosenSubView),
|
||||||
@@ -27,8 +24,6 @@ const ReviewPanel: FC<{ mini?: boolean }> = ({ mini = false }) => {
|
|||||||
return (
|
return (
|
||||||
<div className={className} style={style} data-testid="review-panel">
|
<div className={className} style={style} data-testid="review-panel">
|
||||||
<div id="review-panel-inner" className="review-panel-inner">
|
<div id="review-panel-inner" className="review-panel-inner">
|
||||||
{!newEditor && !mini && <ReviewPanelHeader />}
|
|
||||||
|
|
||||||
{activeSubView === 'cur_file' && <ReviewPanelCurrentFile />}
|
{activeSubView === 'cur_file' && <ReviewPanelCurrentFile />}
|
||||||
{activeSubView === 'overview' && <ReviewPanelOverview />}
|
{activeSubView === 'overview' && <ReviewPanelOverview />}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import { useLayoutContext } from '@/shared/context/layout-context'
|
|
||||||
import { useRangesContext } from '../context/ranges-context'
|
import { useRangesContext } from '../context/ranges-context'
|
||||||
import { useThreadsContext } from '@/features/review-panel/context/threads-context'
|
import { useThreadsContext } from '@/features/review-panel/context/threads-context'
|
||||||
import { hasActiveRange } from '@/features/review-panel/utils/has-active-range'
|
import { hasActiveRange } from '@/features/review-panel/utils/has-active-range'
|
||||||
import { useRailContext } from '@/features/ide-react/context/rail-context'
|
import { useRailContext } from '@/features/ide-react/context/rail-context'
|
||||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
|
||||||
import { useCallback } from 'react'
|
import { useCallback } from 'react'
|
||||||
|
|
||||||
export default function useReviewPanelLayout(): {
|
export default function useReviewPanelLayout(): {
|
||||||
@@ -21,30 +19,16 @@ export default function useReviewPanelLayout(): {
|
|||||||
openTab: openRailTab,
|
openTab: openRailTab,
|
||||||
setIsOpen: setRailIsOpen,
|
setIsOpen: setRailIsOpen,
|
||||||
} = useRailContext()
|
} = useRailContext()
|
||||||
const { reviewPanelOpen: reviewPanelOpenOldEditor, setReviewPanelOpen } =
|
|
||||||
useLayoutContext()
|
|
||||||
|
|
||||||
const newEditor = useIsNewEditorEnabled()
|
const reviewPanelOpen = selectedRailTab === 'review-panel' && railIsOpen
|
||||||
|
|
||||||
const reviewPanelOpen = newEditor
|
|
||||||
? selectedRailTab === 'review-panel' && railIsOpen
|
|
||||||
: reviewPanelOpenOldEditor
|
|
||||||
|
|
||||||
const openReviewPanel = useCallback(() => {
|
const openReviewPanel = useCallback(() => {
|
||||||
if (newEditor) {
|
openRailTab('review-panel')
|
||||||
openRailTab('review-panel')
|
}, [openRailTab])
|
||||||
} else {
|
|
||||||
setReviewPanelOpen(true)
|
|
||||||
}
|
|
||||||
}, [newEditor, setReviewPanelOpen, openRailTab])
|
|
||||||
|
|
||||||
const closeReviewPanel = useCallback(() => {
|
const closeReviewPanel = useCallback(() => {
|
||||||
if (newEditor) {
|
setRailIsOpen(false)
|
||||||
setRailIsOpen(false)
|
}, [setRailIsOpen])
|
||||||
} else {
|
|
||||||
setReviewPanelOpen(false)
|
|
||||||
}
|
|
||||||
}, [newEditor, setReviewPanelOpen, setRailIsOpen])
|
|
||||||
|
|
||||||
const hasCommentOrChange = hasActiveRange(ranges, threads)
|
const hasCommentOrChange = hasActiveRange(ranges, threads)
|
||||||
const showPanel = reviewPanelOpen || !!hasCommentOrChange
|
const showPanel = reviewPanelOpen || !!hasCommentOrChange
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
import { debounce } from 'lodash'
|
import { debounce } from 'lodash'
|
||||||
|
|
||||||
export const OFFSET_FOR_ENTRIES_ABOVE = 70
|
export const OFFSET_FOR_ENTRIES_ABOVE = 70
|
||||||
const COLLAPSED_HEADER_HEIGHT = 42
|
|
||||||
const GAP_BETWEEN_ENTRIES = 4
|
const GAP_BETWEEN_ENTRIES = 4
|
||||||
|
|
||||||
export const positionItems = debounce(
|
export const positionItems = debounce(
|
||||||
(
|
(
|
||||||
element: HTMLDivElement,
|
element: HTMLDivElement,
|
||||||
previousFocusedItemIndex: number | undefined,
|
previousFocusedItemIndex: number | undefined,
|
||||||
docId: string,
|
docId: string
|
||||||
newEditor: boolean
|
|
||||||
) => {
|
) => {
|
||||||
const items = Array.from(
|
const items = Array.from(
|
||||||
element.querySelectorAll<HTMLDivElement>('.review-panel-entry')
|
element.querySelectorAll<HTMLDivElement>('.review-panel-entry')
|
||||||
@@ -42,11 +40,7 @@ export const positionItems = debounce(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const activeItemTop = getTopPosition(
|
const activeItemTop = getTopPosition(activeItem, activeItemIndex === 0)
|
||||||
activeItem,
|
|
||||||
activeItemIndex === 0,
|
|
||||||
newEditor
|
|
||||||
)
|
|
||||||
|
|
||||||
const positions: [HTMLElement, number][] = []
|
const positions: [HTMLElement, number][] = []
|
||||||
positions.push([activeItem, activeItemTop])
|
positions.push([activeItem, activeItemTop])
|
||||||
@@ -56,7 +50,7 @@ export const positionItems = debounce(
|
|||||||
for (let i = activeItemIndex - 1; i >= 0; i--) {
|
for (let i = activeItemIndex - 1; i >= 0; i--) {
|
||||||
const item = items[i]
|
const item = items[i]
|
||||||
const height = item.offsetHeight
|
const height = item.offsetHeight
|
||||||
let top = getTopPosition(item, i === 0, newEditor)
|
let top = getTopPosition(item, i === 0)
|
||||||
const bottom = top + height
|
const bottom = top + height
|
||||||
if (bottom > topLimit) {
|
if (bottom > topLimit) {
|
||||||
top = topLimit - height - GAP_BETWEEN_ENTRIES
|
top = topLimit - height - GAP_BETWEEN_ENTRIES
|
||||||
@@ -70,7 +64,7 @@ export const positionItems = debounce(
|
|||||||
for (let i = activeItemIndex + 1; i < items.length; i++) {
|
for (let i = activeItemIndex + 1; i < items.length; i++) {
|
||||||
const item = items[i]
|
const item = items[i]
|
||||||
const height = item.offsetHeight
|
const height = item.offsetHeight
|
||||||
let top = getTopPosition(item, false, newEditor)
|
let top = getTopPosition(item, false)
|
||||||
if (top < bottomLimit) {
|
if (top < bottomLimit) {
|
||||||
top = bottomLimit + GAP_BETWEEN_ENTRIES
|
top = bottomLimit + GAP_BETWEEN_ENTRIES
|
||||||
}
|
}
|
||||||
@@ -92,16 +86,8 @@ export const positionItems = debounce(
|
|||||||
{ leading: false, trailing: true, maxWait: 1000 }
|
{ leading: false, trailing: true, maxWait: 1000 }
|
||||||
)
|
)
|
||||||
|
|
||||||
function getTopPosition(
|
function getTopPosition(item: HTMLDivElement, isFirstEntry: boolean) {
|
||||||
item: HTMLDivElement,
|
|
||||||
isFirstEntry: boolean,
|
|
||||||
newEditor: boolean
|
|
||||||
) {
|
|
||||||
const offset = isFirstEntry ? 0 : OFFSET_FOR_ENTRIES_ABOVE
|
const offset = isFirstEntry ? 0 : OFFSET_FOR_ENTRIES_ABOVE
|
||||||
|
|
||||||
if (newEditor) {
|
return Math.max(offset, Number(item.dataset.top))
|
||||||
return Math.max(offset, Number(item.dataset.top))
|
|
||||||
}
|
|
||||||
|
|
||||||
return Math.max(COLLAPSED_HEADER_HEIGHT + offset, Number(item.dataset.top))
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -253,77 +253,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.log-entry-header-error {
|
|
||||||
background-color: var(--content-danger);
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-entry-header-link-error {
|
|
||||||
@include ol-button-variant(
|
|
||||||
$color: var(--content-primary-dark),
|
|
||||||
$background: var(--bg-danger-02),
|
|
||||||
$hover-background: var(--red-70)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-entry-header-warning {
|
|
||||||
background-color: var(--content-warning-dark);
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-entry-header-link-warning {
|
|
||||||
@include ol-button-variant(
|
|
||||||
$color: var(--content-primary-dark),
|
|
||||||
$background: var(--bg-warning-01),
|
|
||||||
$hover-background: var(--bg-warning-02)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-entry-header-typesetting {
|
|
||||||
background-color: var(--blue-50);
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-entry-header-link-typesetting {
|
|
||||||
@include ol-button-variant(
|
|
||||||
$color: var(--content-primary-dark),
|
|
||||||
$background: var(--blue-60),
|
|
||||||
$hover-background: var(--blue-70)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-entry-header-raw,
|
|
||||||
.log-entry-header-info {
|
|
||||||
background-color: var(--bg-dark-tertiary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-entry-header-link-raw,
|
|
||||||
.log-entry-header-link-info {
|
|
||||||
@include ol-button-variant(
|
|
||||||
$color: var(--content-primary-dark),
|
|
||||||
$background: var(--bg-dark-secondary),
|
|
||||||
$hover-background: var(--bg-dark-primary)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-entry-header-success {
|
|
||||||
background-color: var(--green-50);
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-entry-header-link-success {
|
|
||||||
@include ol-button-variant(
|
|
||||||
$color: var(--content-primary-dark),
|
|
||||||
$background: var(--green-60),
|
|
||||||
$hover-background: var(--green-70)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-entry-header-title {
|
|
||||||
@include body-base;
|
|
||||||
|
|
||||||
flex-grow: 1;
|
|
||||||
font-weight: bold;
|
|
||||||
margin: 0;
|
|
||||||
color: var(--content-primary-dark);
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-entry-header-link {
|
.log-entry-header-link {
|
||||||
color: var(--content-primary-dark);
|
color: var(--content-primary-dark);
|
||||||
border-width: 0;
|
border-width: 0;
|
||||||
@@ -470,19 +399,4 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
.log-entry-header-error {
|
|
||||||
background-color: var(--red-10);
|
|
||||||
|
|
||||||
.log-entry-header-title {
|
|
||||||
@include heading-sm;
|
|
||||||
|
|
||||||
color: var(--red-50);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.log-entry-header-raw {
|
|
||||||
background-color: var(--neutral-60);
|
|
||||||
padding: var(--spacing-04) var(--spacing-06);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1477,7 +1477,6 @@
|
|||||||
"name": "Name",
|
"name": "Name",
|
||||||
"name_usage_explanation": "Your name will be displayed to your collaborators (so they know who they’re working with).",
|
"name_usage_explanation": "Your name will be displayed to your collaborators (so they know who they’re working with).",
|
||||||
"native": "Native",
|
"native": "Native",
|
||||||
"navigate_log_source": "Navigate to log position in source code: __location__",
|
|
||||||
"navigation": "Navigation",
|
"navigation": "Navigation",
|
||||||
"nearly_activated": "You’re one step away from activating your __appName__ account!",
|
"nearly_activated": "You’re one step away from activating your __appName__ account!",
|
||||||
"need_20_plus_users_discount": "20+ users? <0>Contact sales</0> to get the best discounts.",
|
"need_20_plus_users_discount": "20+ users? <0>Contact sales</0> to get the best discounts.",
|
||||||
|
|||||||
Reference in New Issue
Block a user