Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/build/config/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function createProxyItem(item: App.Service.ServiceConfigItem) {
proxy[item.proxyPattern] = {
changeOrigin: true,
rewrite: path =>
path.replace(new RegExp(`^${item.proxyPattern}`), item.key?.startsWith('/') ? item.proxyPattern : ''),
path?.replace(new RegExp(`^${item.proxyPattern}`), item.key?.startsWith('/') ? item.proxyPattern : ''),
target: item.baseURL
};

Expand Down
2 changes: 1 addition & 1 deletion web/widgets/searchbox/src/DocSearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const DocSearch = (props) => {
const currentHotkeys = useMemo(() => {
let formatHotKey = settings?.hotkey;
if (!isAppleDevice() && formatHotKey?.includes('meta')) {
formatHotKey = formatHotKey.replace('meta', 'ctrl');
formatHotKey = formatHotKey?.replace('meta', 'ctrl');
}
return formatHotKey ? [formatHotKey] : hotKeys;
}, [hotKeys, settings?.hotkey]);
Expand Down
6 changes: 3 additions & 3 deletions web/widgets/searchbox/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function renameKeysWithLevels<T extends Record<any, any>>(object: T, pref
return Object.keys(object).reduce((acc, key) => {
const result: any = acc;
if (key.startsWith(prefix)) {
const newKey = key.replace(prefix, '');
const newKey = key?.replace(prefix, '');
result[newKey] = object[key];
} else {
result[key] = object[key];
Expand Down Expand Up @@ -146,8 +146,8 @@ export function getHighlightedValue<T extends Record<any, any>>(object: T, prope
**/
export function replaceHtmlTagsToHighlight(str: string) {
return str
.replace(/<em>/g, '<span class="infini__searchbox-modal-search-hits-item--highlight">')
.replace(/<\/em>/g, '</span>');
?.replace(/<em>/g, '<span class="infini__searchbox-modal-search-hits-item--highlight">')
?.replace(/<\/em>/g, '</span>');
}

/*
Expand Down
6 changes: 3 additions & 3 deletions web/widgets/ui-search/src/ChatMessage/Markdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ const CustomCode = forwardRef((props, ref) => {
function escapeBrackets(text) {
const pattern =
/(```[\s\S]*?```|`.*?`)|\\\[([\s\S]*?[^\\])\\\]|\\\((.*?)\\\)/g;
return text.replace(
return text?.replace(
pattern,
(match, codeBlock, squareBracket, roundBracket) => {
if (codeBlock) {
Expand All @@ -206,13 +206,13 @@ function escapeBrackets(text) {
function tryWrapHtmlCode(text) {
// try add wrap html code (fixed: html codeblock include 2 newline)
return text
.replace(
?.replace(
/([`]*?)(\w*?)([\n\r]*?)(<!DOCTYPE html>)/g,
(match, quoteStart, doctype) => {
return !quoteStart ? "\n```html\n" + doctype : match;
}
)
.replace(
?.replace(
/(<\/body>)([\r\n\s]*?)(<\/html>)([\n\r]*)([`]*)([\n\r]*?)/g,
(match, bodyEnd, space, htmlEnd, quoteEnd) => {
return !quoteEnd ? bodyEnd + space + htmlEnd + "\n```\n" : match;
Expand Down
Loading