merge origin/master

This commit is contained in:
undefined committed 2022-03-28 01:30:38 +08:00
commit 0e20de9200
2 files changed
+4 -3

No files matched your search

+2 -2
View File
@@ -49,7 +49,7 @@ global.Hydro.lib.problemSearch = async (domainId, q, opts) => {
post_filter: { post_filter: {
bool: { bool: {
minimum_should_match: 1, minimum_should_match: 1,
should: domainIds.map((i) => ({ term: { domainId: i } })), should: domainIds.map((i) => ({ match: { domainId: i } })),
}, },
}, },
}); });
@@ -64,7 +64,7 @@ export const description = 'Elastic problem search re-index';
export async function run({ domainId }, report) { export async function run({ domainId }, report) {
try { try {
if (domainId) await client.deleteByQuery({ index: 'problem', query: { term: { domainId } } }); if (domainId) await client.deleteByQuery({ index: 'problem', query: { match: { domainId } } });
else await client.deleteByQuery({ index: 'problem', query: { match_all: {} } }); else await client.deleteByQuery({ index: 'problem', query: { match_all: {} } });
} catch (e) { } catch (e) {
if (!e.message.includes('index_not_found_exception')) throw e; if (!e.message.includes('index_not_found_exception')) throw e;
@@ -162,6 +162,7 @@ export default class Editor extends DOMAttachedObject {
async initVditor() { async initVditor() {
const pagename = document.documentElement.getAttribute('data-page'); const pagename = document.documentElement.getAttribute('data-page');
const isProblemPage = ['problem_create', 'problem_edit'].includes(pagename);
const isProblemEdit = pagename === 'problem_edit'; const isProblemEdit = pagename === 'problem_edit';
const { default: Vditor } = await import('vditor'); const { default: Vditor } = await import('vditor');
const { $dom } = this; const { $dom } = this;
@@ -209,7 +210,7 @@ export default class Editor extends DOMAttachedObject {
}, },
}) })
.then(() => { .then(() => {
this.vditor.insertValue(`${wrapper.join(`file://${filename}`)} `); this.vditor.insertValue(`${wrapper.join(`${isProblemPage ? 'file://' : `/file/${UserContext._id}/`}${filename}`)} `);
this.vditor.vditor.tip.hide(); this.vditor.vditor.tip.hide();
}) })
.catch((e: { message: string; }) => { .catch((e: { message: string; }) => {