Milkdown / milkdown

🍼 Plugin driven WYSIWYG markdown editor framework.
https://milkdown.dev
MIT License
8.93k stars 401 forks source link

Timer "e" not found, do you forget to record it? #634

Closed cruvie closed 2 years ago

cruvie commented 2 years ago

Describe the bug Just a nomal demo of milkdown run with vue3.0

To Reproduce Steps to reproduce the behavior:

  1. create a vue project with vite
  2. import file MilkdownEditor.vue in app.vue
  3. run the app
  4. See error

Expected behavior no errors

Screenshots image

Milkdown version 6.3.1

Desktop (please complete the following information):

Additional context code MilkdownEditor.vue


<template>
  <VueEditor :editor="editor"/>
</template>

<script lang="ts" setup>
import {defaultValueCtx, Editor, editorViewOptionsCtx, rootCtx} from '@milkdown/core';
import {clipboard} from '@milkdown/plugin-clipboard';
import {cursor} from '@milkdown/plugin-cursor';
import {diagram} from '@milkdown/plugin-diagram';
import {emoji} from '@milkdown/plugin-emoji';
import {history} from '@milkdown/plugin-history';
import {indent} from '@milkdown/plugin-indent';
import {listener, listenerCtx} from '@milkdown/plugin-listener';
import {math} from '@milkdown/plugin-math';
import {menu} from '@milkdown/plugin-menu';
import {prism} from '@milkdown/plugin-prism';
import {slash} from '@milkdown/plugin-slash';
import {tooltip} from '@milkdown/plugin-tooltip';
import {upload} from '@milkdown/plugin-upload';
import {gfm} from '@milkdown/preset-gfm';
import {nord} from '@milkdown/theme-nord';
import {useEditor, VueEditor} from "@milkdown/vue";
import {trailing} from "@milkdown/plugin-trailing";
import {commonmark} from "@milkdown/preset-commonmark";

const defaultValue = '# Hello milkdown';
let jsonOutput;
// const defaultValue = {
//   type: 'json',
//   value: jsonOutput,
// };

let output = '';

//只读模式
let readonly = false;
const editable = () => !readonly;

const editor = useEditor(() =>
    Editor.make().config((ctx) => {
      ctx.set(rootCtx, document.querySelector('#editor'));
      ctx.set(defaultValueCtx, defaultValue);
      ctx.get(listenerCtx).markdownUpdated((ctx, markdown, prevMarkdown) => {
        output = markdown;
        //监听markdown
        console.log(output);
      });
      ctx.get(listenerCtx).updated((ctx, doc, prevDoc) => {
        jsonOutput = doc.toJSON();
        console.log(jsonOutput);
      });
      //只读模式
      ctx.set(editorViewOptionsCtx, { editable });
    })
        .use(nord)
        .use(commonmark)
        //撤销,重做ctrl+z/y
        .use(history)
        .use(listener)
        //显示顶部菜单
        .use(menu)

);

</script>

App.vue

<template>
  <main>
    <div style="margin-right: auto; margin-left: auto; width: 80%">
      <h1>Milkdown Sample</h1>

      <MilkdownEditor v-model="content"/>

    </div>
  </main>
</template>

<script setup lang="ts">
import {ref} from "vue";
import MilkdownEditor from "./components/MilkdownEditor.vue";

const content = ref<string>("Milkdown");
</script>
<style>

@import "./assets/font.css";
@import "./assets/material-design-icons.css";
</style>
Saul-Mirone commented 2 years ago

Please provide the version and follow the issue template.

Saul-Mirone commented 2 years ago

Can not reproduce on my side, can you provide a demo project?

Saul-Mirone commented 2 years ago

https://stackblitz.com/edit/vue-dg5ek3?file=src%2FApp.vue,src%2Fcomponents%2FMilkdown.vue This demo seems doesn't have any issue.

cruvie commented 2 years ago

https://stackblitz.com/edit/vue-dg5ek3?file=src%2FApp.vue,src%2Fcomponents%2FMilkdown.vue This demo seems doesn't have any issue.

thanks you , yes it looks fine ,but the error shows in the browser's console image

Saul-Mirone commented 2 years ago

I can't see this error in the demo I provided. How can I see it?

cruvie commented 2 years ago

I can't see this error in the demo I provided. How can I see it?

here is the project,thank u! https://github.com/gkdgo/markdown_dome

Saul-Mirone commented 2 years ago
Screen Shot 2022-07-25 at 14 06 18

Everything looks fine on my side.

Saul-Mirone commented 2 years ago

Maybe it's related to some of your browser extension.

cruvie commented 2 years ago

Maybe it's related to some of your browser extension.

thank u,I fix it by delete 'node_modules',and rerun pnpm install,the error desappeared!