6174 / 6174/pagedown

"Add heading" with no selected text doesn't add heading.

未關閉 適合新手
#79 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
auto-migrated Priority-Medium Type-Defect
主要語言
JavaScript
星號
0
分支
0
PR 合併指標
30 天內沒有已合併 PR

描述

```
What steps will reproduce the problem?
1. Type in "balpha is awesome at "
2. Hit Ctrl-H or "Add header"

What is the expected output? What do you see instead?

balpha is awesome at ## Heading ##

(as opposed to)

balpha is awesome at

## Heading ##

What version of the product are you using? On what operating system?

Repro'd on Discourse and SE.

Please provide any additional information below.

I _think_ it would be enough to change
https://code.google.com/p/pagedown/source/browse/Markdown.Editor.js#2182 so
that chunkStart and chunkEnd also add newlines, perhaps like so:

// If we clicked the button with no selected text, we just
// make a level 2 hash header around some default text.
if (!chunk.selection) {
chunk.startTag = "\n\n## ";
chunk.selection = this.getString("headingexample");
chunk.endTag = " ##\n\n";
return;
}

(Sorry, I don't have Mercurial or Node installed right now.)
```

Original issue reported on code.google.com by `badpazzword@gmail.com` on 22 Sep 2014 at 9:28

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

該 issue 指向 Markdown.Editor.js 的第 2182 行。首先在儲存庫中找到該檔案。這個 bug 是:未選取任何文字時,'Add heading' 按鈕應在新標題前後插入換行符號,但目前並未如此。報告者建議向 chunk.startTag 和 chunk.endTag 新增換行符號。檢查該行附近的目前實作,確認是否仍需要此修正,然後在瀏覽器中執行編輯器,驗證修改前後的行為。

由索引模型根據 Issue 內容生成。

評估

領域
frontend, tooling
Issue 類型
缺陷
難度
2/5
預估耗時
1-3 小時
活躍度
停滯
描述清晰度
描述清楚
新手友好度
75/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。