cherry-markdown
cherry-markdown copied to clipboard
[Feature Request] 新增目录开关的API实现
Prerequisites
- [ ] There isn't an existing issue that requests the same feature, to avoid duplicates.
Clear and concise description of the problem
Suggested solution
cherry.toolbar.toolbarHandlers.toggleToc();
感谢🙏
你指的是在开启toc模式下,控制toc的展开和折叠?
你指的是在开启toc模式下,控制toc的展开和折叠?
是的,开启了toc,想用接口方式调用展开和折叠
目前没有开放出来api,不过可以通过下面的方式控制,欢迎尝试哈:
// 展开
cherry.toc.$switchModel('full')
cherry.toc.setModelToLocalStorage('full')
// 收起
cherry.toc.$switchModel('pure')
cherry.toc.setModelToLocalStorage('pure')
目前没有开放出来api,不过可以通过下面的方式控制,欢迎尝试哈:
// 展开 cherry.toc.$switchModel('full') cherry.toc.setModelToLocalStorage('full') // 收起 cherry.toc.$switchModel('pure') cherry.toc.setModelToLocalStorage('pure')
好的呢~我试试
cherryObj.toggleToc(); // 切换状态
cherryObj.toggleToc('full'); // 强制切换到全屏状态
cherryObj.toggleToc('pure'); // 强制切换到极简状态
已新增api,可以参考api文档:https://tencent.github.io/cherry-markdown/examples/api.html