diff --git a/packages/fps-importer/index.ts b/packages/fps-importer/index.ts index 4be9d6ff..40a877bd 100644 --- a/packages/fps-importer/index.ts +++ b/packages/fps-importer/index.ts @@ -59,7 +59,7 @@ class FpsProblemImportHandler extends Handler { memory: p.memory_limit[0]._ + p.memory_limit[0].$.unit, }; const title = decodeHTML(p.title.join(' ')); - const tags = _.filter(p.source, (i: string) => i.trim()); + const tags = _.filter(p.source, (i: string) => i.trim()).flatMap((i) => i.split(' ')).filter((i) => i); const pid = await ProblemModel.add(domainId, null, title, buildContent(content, 'html'), this.user._id, tags); const tasks = [ ProblemModel.edit(domainId, pid, { html: true }), diff --git a/packages/ui-default/backendlib/markdown-it-xss.ts b/packages/ui-default/backendlib/markdown-it-xss.ts index 185ce0ee..0153ec6d 100644 --- a/packages/ui-default/backendlib/markdown-it-xss.ts +++ b/packages/ui-default/backendlib/markdown-it-xss.ts @@ -75,12 +75,12 @@ export const xss = new Xss.FilterXSS({ li: [], mark: [], ol: [], - p: [], + p: ['align', 'style'], pre: [], s: [], section: [], small: [], - span: ['class'], + span: ['class', 'style'], sub: [], summary: [], sup: [], @@ -98,6 +98,16 @@ export const xss = new Xss.FilterXSS({ var: [], video: ['autoplay', 'controls', 'loop', 'preload', 'src', 'height', 'width'], }, + css: { + whiteList: { + 'font-size': true, + 'font-family': true, + 'text-align': true, + 'text-indent': true, + 'margin-left': true, + color: true, + }, + }, allowCommentTag: false, stripIgnoreTagBody: ['script'], safeAttrValue(tag, name, value) {