Feature Request: Add an [CC=email] similar to [TO=email]

未关闭
#545 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
55/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript
领域
desktop

调研方向

The change belongs in quicktextParser.mjs: add 'CC' to allowedTags, mirror the existing process_to and get_to pair with process_cc and get_cc, and add a case 'cc': to the tag switch in parse. Check how the TO handling reads this.mData and getDetails() first, because the reporter's snippet may not match the current code. Done means a template containing [[CC=email]] renders the CC addresses as [[TO=email]] does.

由索引模型根据 Issue 内容生成。

描述

enhancement

Greetings.
Sorry for my bad english.
I suggest adding an [CC=email] field similar to [TO=email].

Template for insert in mail body looks like:
To: [[TO=email]]
CC: [[CC=email]]

Now I have to manually edit quicktextParser.mjs inside .xpi every time after addon's auto-update:

  1. Add to const allowedTags:
    ... , 'CC', ...

  2. After process_to and get_to blocks and before async parse(aStr) { block add:
    (I add in a simpler format - without asking for full name - I only need to extract the addresses themselves, separated by commas):

async process_cc(aVariables) {
if (this.mData['CC'] && this.mData['CC'].checked)
return this.mData['CC'].data;
this.mData['CC'] = {};
this.mData['CC'].checked = true;
this.mData['CC'].data = { email: [] };
let details = await this.getDetails();
let emailAddresses = Array.isArray(details.cc) ? details.cc : (details.cc ? [details.cc] : []);
for (let i = 0; i < emailAddresses.length; i++) {
let contactData = await utils.parseDisplayName(emailAddresses[i]);
this.mData['CC'].data.email.push(contactData.email.toLowerCase());
}
return this.mData['CC'].data;
}

async get_cc(aVariables) {
let data = await this.process_cc(aVariables);
if (typeof data[aVariables[0]] != 'undefined') {
let mainSep = (aVariables.length > 1) ? aVariables[1].replace(/\n/g, "\n").replace(/\t/g, "\t") : ", ";
let lastSep = (aVariables.length > 2) ? aVariables[2].replace(/\n/g, "\n").replace(/\t/g, "\t") : mainSep;
let entries = data[aVariables[0]].slice(0);
let last = entries.pop();
let all = [];
if (entries.length > 0) all.push(entries.join(mainSep));
if (last) all.push(last);
return all.join(lastSep);
}
return "";
}

  1. Add to switch (tags[i].tagName.toLowerCase()) { :
    case 'cc':

Thanks for the great addon - it really helps in my work.

主要语言
JavaScript
星标
283
派生
62
平均合并
1 分钟
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

jobisoft/quicktext 的其他 Issue

查看 jobisoft/quicktext 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。