The preview pane displays the wrong context menu inside code blocks
matippetts opened this issue · 1 comments
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
- Open a markdown file
- Create a code block or HTML <pre> element with some content
- Toggle Markdown-Preview
- 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: