mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 06:33:55 +01:00
Merge pull request #36408 from overleaf/mj-context-menu-flag-teardown
[web] Tear down editor-context-menu flag GitOrigin-RevId: 80cc2ebaf62ec1bd6064b0f96b884d159a9d4b5f
This commit is contained in:
committed by
Copybot
parent
38eb3ddfa6
commit
e8ee19d17d
@@ -396,8 +396,8 @@ const contextMenuKeymap = (): Extension =>
|
||||
])
|
||||
)
|
||||
|
||||
export const contextMenu = (enabled: boolean): Extension =>
|
||||
enabled && !isMobile
|
||||
export const contextMenu = (): Extension =>
|
||||
!isMobile
|
||||
? [
|
||||
contextMenuContainerTheme,
|
||||
contextMenuStateField,
|
||||
|
||||
@@ -159,11 +159,8 @@ export const createExtensions = (options: Record<string, any>): Extension[] => [
|
||||
trackDetachedComments(options.currentDoc),
|
||||
visual(options.docName, options.visual),
|
||||
mathPreview(options.settings.mathPreview),
|
||||
reviewTooltip(
|
||||
options.settings.floatingMenu,
|
||||
options.editorContextMenuEnabled
|
||||
),
|
||||
contextMenu(options.editorContextMenuEnabled),
|
||||
reviewTooltip(options.settings.floatingMenu),
|
||||
contextMenu(),
|
||||
toolbarPanel(),
|
||||
breadcrumbPanel(),
|
||||
verticalOverflow(),
|
||||
|
||||
@@ -32,28 +32,20 @@ const mouseDownStateField = StateField.define<boolean>({
|
||||
|
||||
const reviewTooltipCompartment = new Compartment()
|
||||
|
||||
export const reviewTooltip = (
|
||||
enabled: boolean,
|
||||
editorContextMenuEnabled: boolean = false
|
||||
): Extension => {
|
||||
export const reviewTooltip = (enabled: boolean): Extension => {
|
||||
return [
|
||||
addCommentRangesField,
|
||||
reviewTooltipCompartment.of(
|
||||
enabled ? reviewTooltipMenu(editorContextMenuEnabled) : []
|
||||
),
|
||||
reviewTooltipCompartment.of(enabled ? reviewTooltipMenu() : []),
|
||||
]
|
||||
}
|
||||
|
||||
export const setReviewTooltip = (
|
||||
enabled: boolean,
|
||||
editorContextMenuEnabled: boolean
|
||||
): TransactionSpec => ({
|
||||
export const setReviewTooltip = (enabled: boolean): TransactionSpec => ({
|
||||
effects: reviewTooltipCompartment.reconfigure(
|
||||
enabled ? reviewTooltipMenu(editorContextMenuEnabled) : []
|
||||
enabled ? reviewTooltipMenu() : []
|
||||
),
|
||||
})
|
||||
|
||||
const reviewTooltipMenu = (editorContextMenuEnabled: boolean): Extension => {
|
||||
const reviewTooltipMenu = (): Extension => {
|
||||
let mouseUpListener: null | (() => void) = null
|
||||
const disableMouseUpListener = () => {
|
||||
if (mouseUpListener) {
|
||||
@@ -68,7 +60,7 @@ const reviewTooltipMenu = (editorContextMenuEnabled: boolean): Extension => {
|
||||
EditorView.domEventHandlers({
|
||||
mousedown: (event, view) => {
|
||||
// Hide tooltip when opening the context menu
|
||||
if (editorContextMenuEnabled && isContextMenuMouseEvent(event)) {
|
||||
if (isContextMenuMouseEvent(event)) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user