-
Notifications
You must be signed in to change notification settings - Fork 538
编辑器回复和撤销和编辑问题 #1572
Replies: 1 comment · 4 replies
-
|
额,看描述看不出来是什么问题,可以尝试在每次打开弹窗时调用 |
Beta Was this translation helpful? Give feedback.
All reactions
-
Beta Was this translation helpful? Give feedback.
All reactions
-
|
有可能出现这些“异常”是因为用了代理的原因,可以参考这个issue,因为cherry引用的codemirror V5 对代理的情况支持的不好,所以会有各种奇怪的现象,可以通过去掉代理方式再试试哈 |
Beta Was this translation helpful? Give feedback.
All reactions
-
编辑器打开时,出现多个问题: `
Markdown视图
编辑
预览
import Cherry from 'cherry-markdown'; import { useCdnUrl } from '@/hooks/useCdnUrl'; interface Props { interface Emits { defineOptions({ const props = withDefaults(defineProps(), { const emit = defineEmits(); // 生成唯一编辑器ID,避免多个实例冲突 // 编辑模式:preview - 预览,edit - 源码 // 使用CDN URL处理 // 初始化Cherry编辑器 if (!markdownEditorRef.value) return; // 清理编辑器容器,确保每次初始化都是干净的 try { } catch (error) { // 切换模式 // 监听内容变化 // 销毁Cherry实例 } // 切换编辑模式 editMode.value = mode; // 直接使用switchModel切换模式,避免销毁重建实例导致的内容丢失 // 保存Markdown,返回Promise以便外部调用 // 调用父组件提供的保存回调函数,等待其完成并获取返回结果 // 保存成功后,更新保存生成的路径和重置isDirty状态 return result; // 下载Markdown源文件 // 如果内容未修改,直接下载,不需要弹框 } // 内容已修改,显示弹框询问 }); // 监听initialContent变化,更新编辑器内容 }, // 组件挂载时初始化编辑器 // 组件卸载时销毁编辑器实例
|
Beta Was this translation helpful? Give feedback.
All reactions
-
|
抱歉,提供的代码有点杂不太好分析原因。建议将ref去掉试试,或者在有问题的步骤里主动调用 |
Beta Was this translation helpful? Give feedback.



Uh oh!
There was an error while loading. Please reload this page.
-
将编辑器卸载弹框里,关闭再打开,关闭再打开,重复时会出现
Beta Was this translation helpful? Give feedback.
All reactions