快速引用主题组件

:information_source: 摘要 简而言之:它改变了“回复帖子”按钮(非“回复主题”按钮)的行为,使其在单击时自动引用帖子。
:hammer_and_wrench: 仓库链接 GitHub - merefield/discourse-quick-quote: A Theme component to change the behaviour of the Post Reply buttons to quote a Post automatically in a single click. · GitHub
:open_book: 安装指南 Installing a theme or theme component
:heart: 赞助 请考虑根据您或您组织的资源和需求,成为我开源工作的持续 赞助商,以确保该组件获得应有的维护,并在未来继续为您的网站服务。

喜欢这个主题组件吗?请在 GitHub 上给它点一个 :star:

功能说明

简而言之:它改变了“回复帖子”按钮(非“回复主题”按钮)的行为,使其在单击时自动引用帖子。

有多种设置可以细化引用内容和时机。您甚至可以指定嵌套引用,以体验“老派”的感觉。

由于自动生成的引用会发送到编辑器,如果您愿意,可以在此处手动对其进行修改(但这在一定程度上违背了“快速”的初衷 :snail:)。

它不会改变底部“回复主题”按钮或引用工具的行为。

原因

  • 有些人认为在基础安装中执行引用操作需要点击太多次。这在触摸设备上尤其成问题。

  • “自动引用”在回复较靠前的帖子时特别有用。此插件会计算被引用帖子距离当前的位置,如果足够靠后,将自动插入引用。这有助于人们更快地理解上下文。

  • 它恢复了“嵌套引用”!(默认关闭)对于习惯某些“老派”论坛平台 :space_invader: 的用户来说,该组件可能特别有吸引力,这纯属个人喜好——如果您喜欢看到嵌套引用,现在可以实现,但请注意其对空间的占用!

您不需要它,如果

您对开箱即用的主题帖子回复行为完全满意。我是这样的,但拥有多种选择总是好的,对吧?

设置

quick_quote_post_location_threshold: “启用快速引用前需要回溯的帖子数量。”

控制帖子需要回溯多远才触发自动引用。避免对近期帖子进行不必要的引用。

quick_quote_remove_links: “从引用中移除所有链接(包括图片)”

清理内容并节省空间。

quick_quote_remove_prior_quotes: “移除所有先前的(嵌套)引用”

默认启用。清除此设置可获得终极的嵌套老派体验。(抱歉 Jeff!;))

quick_quote_remove_contiguous_new_lines: “移除不必要的换行符”

换行符被高估了。

quick_quote_character_limit: “引用字符限制(如果总长度超过限制,则使用最后 x 个字符)”

摘录功能比较基础 :slight_smile: 如果需要更精准的引用,请使用引用工具(该功能不会被此插件覆盖)。

已知限制

不支持编辑器的新富文本模式。 核心更新似乎已解决此问题?

该主题组件处理引用准备的方式相当简单。某些设置组合效果更佳,具体取决于管理员的选择。为了简化复杂性,例如存在一个可能会截断单词的摘录字符限制。格式化也被简化,因为移除了标签以避免因截断标签而导致损坏——这也是为了实现简洁。引用处理严重依赖正则表达式,并非所有表达式都完全万无一失,但“足够好用”。这些可能会随着该主题组件的生命周期进行优化。

这是最近从我的同名插件移植过来的,但在此过程中可能会引入一些错误。如果您遇到任何问题,请告诉我。

我的赞助者及该组件的灵感来源

感谢 @Merlls_Rizzini 赞助此项工作。该功能是我们两人的头脑风暴成果,并部分灵感 源自这篇帖子,由 @eesty 发布。

注意:这是基于我的“快速引用”插件,但已转换为主题组件格式,以便更多由第三方托管的网站管理员能够使用。@sam 建议将其转换为主题组件,因为该插件没有后端组件,而 @sully 在创建了他自己的主题版本后,最终推动了我进行这次转换。

欢迎所有反馈。

37 个赞

If I’d of not skip read that I’d of spent less time trying to figure out the value,

I like it :+1:

3 个赞

Would be cool if you could use this by category, would love to have it in our AMA category, but otherwise it would be kinda messy.

3 个赞

A recent Git commit to topic.js seems to have broken this theme component:

Quote.build() no longer exists; they seem to be importing and using the buildQuote() function instead. A quick substitution didn’t do the trick; will have to ponder this a bit more.

2 个赞

My bad! The quick quote plugin wasn’t on the all-the-plugins list so I missed it when looking for regressions. I’ll add it and I’ve opened a PR with a fix to the plugin:

(plus a small fix to settings: FIX: Setting descriptions were swapped by cvx · Pull Request #2 · merefield/discourse-quick-quote · GitHub)

5 个赞

Awesome, thanks Jarek (and thanks for reporting @sully!) , merged! (and thanks for the bug fix!)

1 个赞

I am running this theme, did the update yesterday and getting complaints today

upon creating a post to reply and explain I found if I’m replying to a post and I go up to another and
want to reply in whole I can not, the reply remains on the post I started with,

previously it would toggle, the quick quote still works though

For my full comprehension, would you mind breaking that down a bit more … can you explain it in finer steps and where you believe it goes wrong?

1 个赞

Yeah its being discussed now and the inability to hit reply any further up than 3 posts is likely going to be one of those haunting, need to explain over and over problems

Quick quote is great, but can the reply function be restored?

I’m still not following you. Can you please go into greater detail and more steps?

I’ve retested the Component locally and it seems to be behaving fine?

1 个赞

No problem, and maybe I’m misinterpreting function or some other oversight

but right now as it stands if I go up in a thread 4 posts in a thread the reply button is disabled,

this was only mentioned today and yesterday I did the update

So I believe its related, maybe there’s a setting involved?

Can you show me your Theme settings?

Can you also confirm you are on the latest discourse version and latest version of the Theme Component?

Also, can you please let me know if you see any Javascript errors on the console?

1 个赞

in a random thread

this site doesn’t show version like my self hosted

1 个赞

Thanks.

OK so I’ve set my settings the same and cannot replicate. The Reply button 4 posts back is working fine.

That’s highly suspicious though given your settings. (The ‘3’ jumps out!)

I’m on the latest version of Discourse and the TC. Make sure you are fully updated on both.

1 个赞

view source says Discourse 2.5.0.beta2

and TC is theme component?

image

changing 3 to 5 allows me to reply up to the 5th post

so do I do a 9999 and does that short any other function?

OK so I’ve replicated your issue on a Production site …

v2.5.0.beta2 +459

Those changes that Jarek submitted were very specfically targetting the latest version of Discourse.

Is it possible you are on a Discourse commit prior to his changes? If so, it will not work with the latest TC. You need to upgrade both or neither.

Moreover, I’ve just upgraded that site (to latest-release +495) and all is well again.

So yeah, you need to upgrade your Discourse past his commit.

1 个赞

Can you provide any css I can use to roll back?

then I’ll remove it after my site is updated?

Thank you :slightly_smiling_face:

or

@team is my site do for an update soon?

Ah, good idea, except I don’t think you can access the javascript folder contents from the UI (someone please correct me if I’m wrong!).

Unfortunately I don’t believe you can install a specific commit of a Theme Component either (ditto!).

So my suggestion is, yeah, change that 3 to 9999 and wait until your Discourse is more up-to-date.

1 个赞

Can do, no worries and thanks for the cooperation, its greatly appreciated :+1:

1 个赞

Hey all you Quick Quoting hip-shooting Discoursers … I’ve released a fix to make Quick Quote work again with latest Discourse.

I’m tracking tests-passed so do not update if you are not on that branch.

3 个赞