Is there a "Navigate: To Page" command in v2?

I just moved to v2 after a lot of thoughts and I try to migrate my old pages, configs and everything and tbh it’s been a pain in the a$$. Nothing works anymore: templates, space-scripts etc.
I will try to move those after I got the main things running.

But my real question ist where did the “Navigate: To Page” command disappeared?

I have a lot of these Shortcuts/Links/Buttons throughout my “old” v1 space:

{[Navigate: To Page|📬]("Library/Core/Quick Notes")} {[Navigate: To Page|✅]("Tasks")} {[Navigate: To Page|🕓]("ChangeLog")} {[Navigate: To Page|🔗]("Bookmark Collection")}

and can’t seem to find something similar in v2 which will display a button and the button sends you to a certain page.

before (v1)

after (v2)

And also how to make an action button which will open a certain page?

something like this, but this doesnt work

 {
      icon = "settings",
      description = "Settings",
      priority = 2,
      run = function()
        editor.invokeCommand("Navigato: To Page /CONFIG")
      end
  }

someone any ideas? Please? Thanks!

This works for me for creating buttons:

${widgets.button("Space Overview", function()
editor.navigate("Library/Core/Page/Space Overview")
end)}

image
This is the relevant part of the migration guide

1 Like

Thanks, I found the widget button in the migration instructions, but I still can’t find the old:
“Navigate: To Page” - command.

Thanks :folded_hands: this did the trick :

editor.navigate(“CONFIG”)

How can I make multiple buttons?

function multiButtonWidget()
  -- Create individual widgets for the items
  local item1 = widgets.button("All1", function()
      editor.navigate("Journals")
    end)
  local item2 = widgets.button("All2", function()
      editor.navigate("Journals2")
    end)

  -- how do I combine 2 buttons into 1 widget???
  -- google AI gave `widget.hstack`, but it doesn't work
  -- below is just my intuitive attemp, but doesn't work as well
  return widget.new {
     html = item1 
  }
end
 
event.listen {
  name = "hooks:renderTopWidgets",
  run = function(e)
    -- doesn't work    
    return multiButtonWidget()
  end
}

spent over an hour tearing my hair out… none of the examples help.. only simple basics and nothing more Widget

apprecaite any help thanks

Try this with: html = dom.div {item1, item2}

thanks it’s working now

Is there a way to get rid of the bottom margin?

Easiest would be to use display = "inline" instead of the default “block”. This will get rid of that extra padding in your widget block.

return widget.new {
     html = dom.div {item1, item2},
     display = "inline"
  }

It looks like this now, but margin still there

  return widget.new {
    html = dom.div {
        item1, item2
    },
    display = "inline"
  }

try dom.span instead of dom.div, (without the line: display = “inline”)

1 Like

Thanks! That worked

And I realized, the padding isn’t the problem.
The unbalanced top and bottom padding + the border was…

Yours looks great, can share your CSS styling? Though I will be using div/block

i have a lot’s of space-style`s doing different things.

here i shared you some of my space-styles:

some of them are “disabled”

i think the one you’re after are the:

  • Disable widget border
  • SB Markdown Widget Border
  • Button Styles (Default & LibraryManager)

but feel free to test any of them. I can recommend you import them all in your space, disable them by deleting the space-style tag from each of the codeblocks, and enable them one by one, to see the change, and if you want to keep it or not.

indeed dom.span works even beter because dom.div implicitly is handled as block:

here is the result:

1 Like