Skip to content

Commit

Permalink
chore: revert codemirror and lz-string workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Feb 27, 2024
1 parent 76ae95d commit 65a24a5
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/client/builtin/Monaco.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Learn more: https://sli.dev/guide/syntax.html#monaco-editor
import type * as monaco from 'monaco-editor'
import { computed, nextTick, onMounted, ref } from 'vue'
import { debounce } from '@antfu/utils'
import { lz } from '../utils'
import lz from 'lz-string'
import { makeId } from '../logic/utils'
const props = withDefaults(defineProps<{
Expand Down
2 changes: 1 addition & 1 deletion packages/client/builtin/ShikiMagicMove.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { ShikiMagicMovePrecompiled } from 'shiki-magic-move/vue'
import type { KeyedTokensInfo } from 'shiki-magic-move/types'
import { onMounted, onUnmounted, ref, watchEffect } from 'vue'
import { lz } from '../utils'
import lz from 'lz-string'
import { useSlideContext } from '../context'
import { makeId } from '../logic/utils'
Expand Down
2 changes: 1 addition & 1 deletion packages/client/modules/mermaid.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import mermaid from 'mermaid/dist/mermaid.esm.mjs'
import lz from 'lz-string'
import { clearUndefined } from '@antfu/utils'
import { lz } from '../utils'
import setupMermaid from '../setup/mermaid'
import { makeId } from '../logic/utils'

Expand Down
6 changes: 2 additions & 4 deletions packages/client/setup/codemirror.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Ref, WritableComputedRef } from 'vue'
import { onClickOutside } from '@vueuse/core'
import { watch } from 'vue'
import * as _CodeMirror from 'codemirror'
import { fromTextArea } from 'codemirror'
import 'codemirror/mode/javascript/javascript'
import 'codemirror/mode/css/css'
import 'codemirror/mode/markdown/markdown'
Expand All @@ -10,14 +10,12 @@ import 'codemirror/mode/htmlmixed/htmlmixed'
import 'codemirror/addon/display/placeholder'
import 'codemirror/lib/codemirror.css'

const CodeMirror = _CodeMirror.default ?? ('fromTextArea' in _CodeMirror ? _CodeMirror : globalThis.CodeMirror)

export async function useCodeMirror(
textarea: Ref<HTMLTextAreaElement | null | undefined>,
input: Ref<string> | WritableComputedRef<string>,
options: CodeMirror.EditorConfiguration = {},
) {
const cm = CodeMirror.fromTextArea(
const cm = fromTextArea(
textarea.value!,
{
theme: 'vars',
Expand Down
4 changes: 0 additions & 4 deletions packages/client/utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import type { RouteRecordRaw } from 'vue-router'
import * as _lz from 'lz-string'

// @ts-expect-error compat
export const lz: typeof _lz = _lz.default ?? ('compress' in _lz ? _lz : globalThis.LZString)

export function getSlideClass(route?: RouteRecordRaw, extra = '') {
const classes = ['slidev-page', extra]
Expand Down

0 comments on commit 65a24a5

Please sign in to comment.