仅选择列表项或块引用的内容

您好,我注意到,当用户选择 Screenshot%20of%20Google%20Chrome%20(8-1-18%2C%202-12-07%20PM) 时,仅选中所强调文本的内容,以便用户可以立即开始输入。Screenshot%20of%20Google%20Chrome%20(8-1-18%2C%202-16-41%20PM)

对于强文本(strong text)也是如此。Screenshot%20of%20Google%20Chrome%20(8-1-18%2C%202-20-24%20PM)

然而,当用户决定创建有序列表、无序列表或引用块时,Markdown 键盘符号也会被选中,这意味着用户无法立即开始输入。

Screenshot%20of%20Google%20Chrome%20(8-1-18%2C%202-13-38%20PM) Screenshot%20of%20Google%20Chrome%20(8-1-18%2C%202-13-42%20PM) Screenshot%20of%20Google%20Chrome%20(8-1-18%2C%202-13-35%20PM)

这对熟悉 Markdown 的用户来说是一种困扰,因为我需要重新选择_仅_内容;而对于不熟悉 Markdown 的用户来说则完全令人沮丧,因为他们甚至可能不知道问题出在哪里。

能否更新此功能,使得仅选中列表或引用中的内容,而不选中键盘符号本身?

最后,本着帮助不熟悉 Markdown 的用户的初衷,是否可以将“强文本(strong text)”替换为“粗体文本(bold text)”,将“强调文本(emphasized text)”替换为“斜体文本(italicized text)”?

9 个赞

I like this suggestion, @codinghorror’s call on the wording here. I agree calling italics emphasised in the tooltip is somewhat confusing. Looking at Stack Exchange sites it uses “Emphasis” and “Strong” so there is precedent even in non tech sites. GitHub uses “Bold” and “Italic”.

Regarding making Italics/Bold smarter. There are quite a few edge cases… for example, when you highlight this block and hit “B” what do you expect?

- test
    -  text
-test
(3) test

4. test

[spoiler]
test
[/spoiler]

test [i]test
test[/i]

The ideal outcome has a LOT of magic rules, and we don’t want to have to write a full parser here.

- **test**
    -  **text**
**-test**
**(3) test**

4. **test**

[spoiler]
**test**
[/spoiler]

**test [i]test
test
[/i]**

I am sort of pr-welcome here, but we got to determine what a very simple set of rules that capture the 99% case first.

4 个赞

I see (1) highlighting text, then hitting “B” as different from (2) not having text and hitting “B”. The first case does have a lot of magic rules. Perhaps until there’s rich text editing (if that’s at all a priority), include a button that links to Markdown syntax? An you know, I think the second case already works very well for “B” and should be replicated for lists and blockquotes.

这是一个小问题,但有序列表和无序列表项仍然存在此问题:

我猜有一个 setSelectionRange 调用需要将其起始值偏移 Markdown 语法(“*”或“1.”)的长度加上空格字符的 1

我以前从未使用过这些工具按钮。我今天才注意到这个问题,因为我需要一个 Markdown 编辑器的示例来复制。我想知道这些按钮的实际使用量有多少?

1 个赞

这些按钮对不熟悉 markdown 的人很有用。在一个从 Discourse 迁移到 Discord 的社区中,成员们最初的反馈之一是缺少格式工具栏。但是,一旦我学会了格式设置技巧,我发现自己更喜欢输入格式命令,但在使用智能手机或平板电脑时除外。这是因为按钮放置在您手指附近,比手机键盘上的特殊字符更容易访问。这就是我使用它们的原因。

我还最近报告了 op 中提到的问题。

1 个赞

很高兴知道!这意味着我今天添加 Markdown 编辑器格式化按钮并没有白费。\n\n另外,我可以确认这就是作曲家工具栏的问题:\n\n[quote="simon, post:4, topic:93672"]\n我猜有一个 setSelectionRange 调用需要将其起始值偏移 Markdown 语法的长度\n[/quote]\n\n我相信有人可以很快解决这个问题,但如果能再等一会儿,我很乐意提交一个 PR。

1 个赞