mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
merge origin/master
This commit is contained in:
commit
0e20de9200
2 files changed
+4
-3
No files matched your search
@@ -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; }) => {
|
||||||
|
|||||||
Reference in new issue
Block a user