Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

代码块工具插槽 #771

Closed
Roywhite opened this issue Feb 14, 2025 · 14 comments
Closed

代码块工具插槽 #771

Roywhite opened this issue Feb 14, 2025 · 14 comments

Comments

@Roywhite
Copy link

一个很棒的想法

Image
这一块能支持插槽吗,允许自己定义一些工具,参数传入值是代码块的代码

@imzbf
Copy link
Owner

imzbf commented Feb 16, 2025

这里做不了插槽,仅能通过语言设置改变文字

@Roywhite
Copy link
Author

能否和代码块折叠一样,新增一个属性传入一个数组,里面是配置项(展示的文字、点击回调(传参是代码块的代码和语言类型))。md-editor-v3用来渲染流式输出时,如果涉及到流程图整个界面就会抽搐,所以打算默认不渲染流程图,点击后在侧边栏渲染。

@imzbf
Copy link
Owner

imzbf commented Feb 17, 2025

我尝试了一下,可以在后面预留位置供开发时嵌入额外的功能点,大概的情况是这样

  1. 只能是文本类型的html
  2. 需要考虑通用,内部不会主动去注册事件,因为不知道开发者会放置多少个功能(html元素),而是提供一个内容重新挂载的事件,在该事件中,去获取开发者嵌入的额外功能的节点,手动添加事件

@Roywhite
Copy link
Author

好的,感谢大佬😄期待该功能点

imzbf added a commit that referenced this issue Feb 19, 2025
@imzbf
Copy link
Owner

imzbf commented Feb 20, 2025

在5.3.0中尝试,参考:https://github.com/imzbf/md-editor-v3/releases/tag/v5.3.0

@imzbf imzbf closed this as completed Feb 20, 2025
@Roywhite
Copy link
Author

Roywhite commented Feb 21, 2025

在5.3.0中尝试,参考:https://github.com/imzbf/md-editor-v3/releases/tag/v5.3.0

onRemount事件什么时候会触发呢,照着参考例子,config里加了extraTools,但界面没有显示出来,

Image
然后onRemount也没有触发打印

Image

@imzbf
Copy link
Owner

imzbf commented Feb 21, 2025

你在编辑器添加onRemount事件了吗,另外,请参考demo提到的示例获取代码内容及类型,因为工具节点是字符型的,组件默认不对它做修改

@Roywhite
Copy link
Author

添加了这个事件,但是没有触发打印

Image

@imzbf
Copy link
Owner

imzbf commented Feb 21, 2025

注意名称是onRemount

@Roywhite
Copy link
Author

Image
改成@onRemount也没有触发打印
Image

@Roywhite
Copy link
Author

onHtmlChanged事件可以触发,但onRemount没触发

Image

Image

Image

@imzbf
Copy link
Owner

imzbf commented Feb 21, 2025

先通过:onRemount="onRemount"使用,预览组件好像忘记添加事件的代码了

@Roywhite
Copy link
Author

先通过:onRemount="onRemount"使用,预览组件好像忘记添加事件的代码了

😭貌似还是没有打印

Image

@imzbf
Copy link
Owner

imzbf commented Feb 21, 2025

我不清楚你上面的v-if是不是正确,重新安装最新版本,然后使用@onRemount的方式,如果还是不能触发,提供一份出现这个问题的基础项目给我看看

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants