Code Monkey home page Code Monkey logo

Comments (4)

mxq-crystal avatar mxq-crystal commented on July 17, 2024 1

感谢你的回答。

jsMind非最新版,0.6+(6个月前的版本)
因业务需要,未安装依赖包,而是直接引入源代码文件

浏览器 chrome 117.0.5938.149(正式版本) (x86_64)
操作系统 macOS Big Sur 11.7.2

我已经通过笨办法解决了:在span上绑定节点id,然后addEventListener('click', this.handleClick)和this.jm.select_node(e.target.id)

from jsmind.

hizzgdev avatar hizzgdev commented on July 17, 2024

我这里并不能复现你说的这个现象。你要不在这个 demo 页修改一个节点的 topic 试试看。https://hizzgdev.github.io/jsmind/example/2_features.html

  • 如果仍然无法选中节点,那可能是浏览器的问题,或许可以换个电脑或换个浏览器试一下,另外麻烦提供一下你的浏览器及操作系统。
  • 如果在上面的页面中没有问题,那猜测可能有以下几种可能:
    • 不是最新版本
    • 页面上有其它脚本接管了 span 的 click 事件
    • 页面上有额外的样式影响到了对 span 的 click

@mxq-crystal

from jsmind.

mxq-crystal avatar mxq-crystal commented on July 17, 2024

我看到你对这个问题的解答:#293
我用了两种方式都有点小问题:

1.将 input type=text改成 input type=textarea
并未能实现节点换行,但title提示换行了

// 节点文字显示
node.topic = `<span>Q: ${item.question}\nC: ${item.contents}</span>`;
image
  1. 使用support_html属性 &
    标签
// 节点文字显示
node.topic = `<span>Q: ${item.question}<br/>C: ${item.contents}</span>`;

可以实现换行,但title显示如图
image

请问有什么办法可以解决吗, 或者如何让jmnode节点删除title属性,这样我就可以在标签上增加title属性是一样的效果
@hizzgdev

提出问题后突然想到一个笨办法:

const nodes = document.getElementsByTagName('jmnode');
for (let i = 0; i < nodes.length; i++) {
        const spans = nodes[i].getElementsByClassName('mind-qc-node');
        if (spans.length > 0) {
          nodes[i].setAttribute('title', spans[0].title || nodes[i].innerText); 
        }
      }

from jsmind.

hizzgdev avatar hizzgdev commented on July 17, 2024

并不是把 <input type="text"> 改成 <input type="textarea">, 而是改成 <textarea></textarea>,你再这样试试呢?

另外 jmnode 节点上并没有 title 属性啊。你用的是文档中的提到的 cdn 上的版本吗?

from jsmind.

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.