Code Monkey home page Code Monkey logo

Comments (4)

obgnail avatar obgnail commented on August 13, 2024

@BrazilAmando

你好,1.4.2 版本已经完成此需求。

我为每个自定义图表(echarts、kanban、markmap)添加了一个 【INTERACTIVE_MODE】 配置。处于交互模式下,将无法编辑。

退出交互模式有两种方法:

  1. 点击 edit icon(默认开启)
  2. ctrl+click(默认关闭)

分别对应两个配置【CLICK_EDIT_BUTTON_TO_EXIT_INTERACTIVE_MODE】【CTRL_CLICK_TO_EXIST_INTERACTIVE_MODE】

注意:如果你使用了自定义图表(kanban、markmap、echarts),那么这两个配置请至少一个置为true,否则你将不能退出交互模式,修改fence(当然,你可以通过进入源码模式修改)

from typora_plugin.

BrazilAmando avatar BrazilAmando commented on August 13, 2024

尝试了新版,效果杠杠滴。新的需求又来啦,有时候想使得echarts图表全屏,一个方法是在toolbox中添加一个按钮,添加点击事件,使得全屏。在HTML中能知道DOM元素比较好设置,请教一下在typora中如何获取echarts图表的DOM元素呢?以及如何获取echarts图表示例在全屏后执行resize()呢?感谢!

from typora_plugin.

obgnail avatar obgnail commented on August 13, 2024

@BrazilAmando

  1. 获取 echarts 的 dom 元素:myChart._dom
  2. 获取预览图表的div: myChart._dom.closest(".md-diagram-panel-preview")
  3. 获取全屏div:document.querySelector("content")

所以 resize 的代码类似于

// 我没试过,可能还要修改previewer的其他CSS
myChart.on('click', params => {
    // 获取全屏的大小
    const {width, left, top, height} = document.querySelector("content").getBoundingClientRect();
    // 获取previewer
    const previewer = myChart._dom.closest(".md-diagram-panel-preview");
    previewer.style.width = width + "px";
    previewer.style.left = left + "px";
    previewer.style.top = top + "px";
    previewer.style.height = height + "px";
    myChart.resize();
});

你可以参考一下 markmap 的全屏功能
image

from typora_plugin.

obgnail avatar obgnail commented on August 13, 2024

@BrazilAmando

有两个 echarts 相关的 issue,不好管理,关闭这个。如有问题,请移步到 这个issue 继续讨论

from typora_plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.