mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
bug fixes
This commit is contained in:
11 files changed
+45
-19
No files matched your search
@@ -1,3 +1,10 @@
|
||||
.decoration-hide
|
||||
color: grey !important
|
||||
background-color: grey !important
|
||||
|
||||
.md-editor-preview code
|
||||
background-color: unset !important
|
||||
color: unset !important
|
||||
|
||||
.md-editor-scrn pre.syntax-hl code
|
||||
padding-left: unset !important
|
||||
@@ -1,4 +1,5 @@
|
||||
import $ from 'jquery';
|
||||
import { debounce } from 'lodash';
|
||||
import { nanoid } from 'nanoid';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
@@ -156,8 +157,12 @@ export default class Editor extends DOMAttachedObject {
|
||||
const { onChange } = this.options;
|
||||
const { MdEditor } = await import('./mdeditor');
|
||||
|
||||
const debouncedTrigger = debounce(() => {
|
||||
$(document.querySelector('.md-editor-preview')).trigger('vjContentNew');
|
||||
}, 500, { trailing: true });
|
||||
const renderCallback = (ref) => {
|
||||
this.markdownEditor = ref;
|
||||
setTimeout(debouncedTrigger, 200);
|
||||
};
|
||||
|
||||
function EditorComponent() {
|
||||
@@ -169,10 +174,12 @@ export default class Editor extends DOMAttachedObject {
|
||||
codeTheme='github'
|
||||
codeStyleReverse={false}
|
||||
ref={renderCallback}
|
||||
modelValue={val}
|
||||
value={val}
|
||||
theme={getTheme()}
|
||||
noMermaid
|
||||
noPrettier
|
||||
noKatex
|
||||
noHighlight
|
||||
autoDetectCode
|
||||
toolbarsExclude={[
|
||||
// 'bold',
|
||||
@@ -214,6 +221,7 @@ export default class Editor extends DOMAttachedObject {
|
||||
$dom.val(v);
|
||||
$dom.text(v);
|
||||
onChange?.(v);
|
||||
setTimeout(debouncedTrigger, 100);
|
||||
}}
|
||||
onUploadImg={async (files, callback) => {
|
||||
let ext: string;
|
||||
|
||||
@@ -7,6 +7,7 @@ import MergeCells from 'markdown-it-merge-cells';
|
||||
import TOC from 'markdown-it-table-of-contents';
|
||||
import { config, MdEditor } from 'md-editor-rt';
|
||||
import Imsize from '../../backendlib/markdown-it-imsize';
|
||||
import katex from '../../backendlib/markdown-it-katex';
|
||||
import { Media } from '../../backendlib/markdown-it-media';
|
||||
import { xssProtector } from '../../backendlib/markdown-it-xss';
|
||||
|
||||
@@ -28,6 +29,7 @@ config({
|
||||
mdit.use(TOC);
|
||||
mdit.use(MergeCells);
|
||||
mdit.use(xssProtector);
|
||||
mdit.use(katex);
|
||||
if (isProblemPage) {
|
||||
mdit.core.ruler.before('normalize', 'xss', (state) => {
|
||||
state.src = state.src.replace(/file:\/\//g, pagename === 'problem_create' ? `/file/${UserContext._id}/` : './file/');
|
||||
|
||||
Reference in new issue
Block a user