question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: Node depth

See original GitHub issue

I see this being mostly useful for blocks, but for consistency I would add it to any node. A clear example where it’s useful:

type: unordered-list
    type: list-item
        type: text
        type: unordered-list
            type: list-item

Now imagine you’re working on a list plugin (I am) and you need to figure out how to handle a <TAB> keypress. You need to look at the depth of the current item and the parent item (or in this case parent of parent) to figure out if you can actually go one step “deeper” (i.e. wrap in another unordered-list.)

I would be happy to work on a PR, though I need a tiny bit of guidance, if you feel this is useful. I would add a depth<Number> to most of the models and at some point in the code figure out where to add this. Could be an extensive PR I guess. Happy to get pointers!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
mullcommented, Sep 9, 2016

I should be ashamed.

0reactions
ianstormtaylorcommented, Sep 8, 2016

Actually there is a getDepth(descendant) on Node already too 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature request: provide deep (recursive) fs.writeFile() #37733
Please describe alternative solutions or features you have considered. Checking if the directory exits recursively then writing the file if that ...
Read more >
"Is within..." alpha/depth | Vuo
I'm seeing a lot of touch-screen potential for the "is within" series of nodes. It would be great to be able to sample/select...
Read more >
Add Depth to Network Atlas Alert Indicators - Feature Requests ...
I use Visio to create the backgrounds for the maps and the tiered maps works great. Though the alert status only rolls up...
Read more >
Feature Requests - Node-RED Forum
Topic Replies Views Activity About the Feature Requests category 0 611 17 May 2018 Support for Matter Protocol 1 116 17 December 2022 Saving flow with...
Read more >
Selected note shown highlighted on the Local Graph
With Depth 1, I can see all nodes directly connected with it. ... I had a similar feature request at Give the center...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found