Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

The preview pane displays the wrong context menu inside code blocks #555

Open
1 task done
matippetts opened this issue Jan 20, 2019 · 1 comment
Open
1 task done

Comments

@matippetts
Copy link

matippetts commented Jan 20, 2019

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following: ...

Description

The wrong context menu is sometimes displayed by the Markdown Preview pane. The function highlightCodeBlocks in renderer.coffee renders preformatted HTML blocks by creating instances of TextEditor and inserting them into the DOM. However, these TextEditor instances are not managed as Pane items. Instead, Workspace.getActivePaneItem() returns an instance of MarkdownPreviewView. Consequently, Workspace.getActiveTextEditor() returns undefined to the menu-item handlers.

Steps to Reproduce

  1. Open a markdown file
  2. Create a code block or HTML <pre> element with some content
  3. Toggle Markdown-Preview
  4. In the preview pane, right-click inside the code block

Expected behavior: The .markdown-preview context-menu should be displayed.

Actual behavior: The atom-text-editor context-menu is displayed.

Reproduces how often: Always

Versions

atom --version apm --version OS release
Atom : 1.34.0
Electron: 2.0.16
Chrome : 61.0.3163.100
Node : 8.9.3
apm 2.1.3
npm 6.2.0
node 8.9.3 x64
atom 1.34.0
python 2.7.12
git 2.7.4
Linux Mint 18.3

Additional Information

  • I believe this defect was introduced by pull #544,
    "Always use the text editor to highlight code blocks".

  • An example, showing edit commands enabled in the preview pane: Screenshot

@rsese
Copy link

rsese commented Jan 25, 2019

Thanks for the detailed report! Reproduce with 1.34.0 on macOS 10.12.6.

Context menu outside a code block:

menu-outside-code-block

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants