Skip to content

Commit 9874901

Browse files
author
zhepama
committed
no message
1 parent a202d0d commit 9874901

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/functions/functions.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ class Semaphore {
3030
let semaphore = new Semaphore(100);
3131

3232
Office.onReady(() => {
33-
semaphore.count = parseInt(window.semaphoreCount);
33+
if (window.semaphoreCount) {
34+
semaphore.count = parseInt(window.semaphoreCount);
35+
}
3436
});
3537

3638
/**
@@ -397,13 +399,15 @@ async function fillOffsetCell(fillOffset, result, invocation) {
397399
const invocationCell = context.workbook.worksheets.getItem(sheetId).getRange(cellId);
398400
const fillOffsetCell = invocationCell.getOffsetRange(0, fillOffset);
399401
let filteredText = result;
400-
const filterPattern = window.filterPattern;
402+
let filterPattern = window.filterPattern;
401403
// 如果过滤模式不为空,则执行正则替换
402404
if (filterPattern) {
405+
// 转义正则表达式中的特殊字符
406+
filterPattern = filterPattern.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& 表示整个匹配到的字符串
403407
// 创建正则表达式,'g'标志表示全局匹配
404408
const re = new RegExp(filterPattern, "g");
405409
// 替换匹配到的字符为""
406-
filteredText = textToFilter.replace(re, "");
410+
filteredText = filteredText.replace(re, "");
407411
}
408412
fillOffsetCell.values = [[filteredText]];
409413
fillOffsetCell.format.autofitColumns();

src/taskpane/taskpane.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function initializeInputs(inputs) {
8383
Object.keys(inputs).forEach((inputId) => {
8484
const element = document.getElementById(inputId);
8585
if (element) {
86-
element.value = getLocalStorage(inputs[inputId]);
86+
element.value = getLocalStorage(inputs[inputId],element.value);
8787
}
8888
});
8989
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy