mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
Merge branch 'master' into events
This commit is contained in:
57 files changed
+381
-229
No files matched your search
@@ -7,10 +7,10 @@ const highlighterPage = new AutoloadPage('highlighterPage', () => {
|
||||
function runHighlight($container) {
|
||||
$container.find('pre code').get().forEach((code) => {
|
||||
const language = ($(code).attr('class') || '').trim();
|
||||
if (language.includes('line-numbers')) $(code).parent().addClass('line-numbers');
|
||||
const m = language.match(/language-([a-z0-9]+)(\|[\d,-]+)/);
|
||||
if (m?.[2]) {
|
||||
$(code).parent().attr('data-line', m[2].substring(1));
|
||||
if (language.includes('line-numbers')) $(code).parent().addClass('line-numbers');
|
||||
$(code).attr('class', `language-${m[1]}`);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -64,10 +64,7 @@ let scratchpad: ScratchpadService;
|
||||
|
||||
export default function ScratchpadContainer() {
|
||||
const store = useStore();
|
||||
if (!scratchpad) {
|
||||
scratchpad = new ScratchpadService(store);
|
||||
ctx.provide('scratchpad', scratchpad);
|
||||
}
|
||||
scratchpad ||= new ScratchpadService(store);
|
||||
const [, updateState] = React.useState<any>();
|
||||
const forceUpdate = React.useCallback(() => updateState({}), []);
|
||||
React.useEffect(() => {
|
||||
|
||||
Reference in new issue
Block a user