The position of the cursor when the page is opened

Is there any way to keep the cursor at the end of the page automatically when opening the page? Now it seems to always be at the beginning of the page

I have a browser bookmark. After clicking it, I can quickly get the title and link of the current page to the pasteboard, and then automatically open my daily diary page (I set the daily diary page as the homepage). And it can also be used on mobile devices

This way of recording is very convenient for me, I just need to record my thoughts and press the paste shortcut key.

If the cursor can automatically be at the end of the page, I can save a click and directly enter.

Here’s the code for my browser bookmark (from ChatGPT):

javascript: (function() {
     const title = document.title;
     const url = location.href;
     const markdown = `[${title}](${url})`;
    
     navigator.clipboard.writeText(markdown)
         .then(() => {
             window.open('https://xxxxx.com', '_blank');
         })
         .catch(err => {
             console.error('error', err);
         });
})();

1 Like

You can get a link with a title in a simpler way:

  1. Paste the https://xxxxx.com adress into SilverBullet from bookmark
  2. With your cursor touching this address (including at the end after pasting), run the Link: Unfurl command
    a. Search for “link” in the Command Palette
    b. Or directly with Ctrl+Shift+U
  3. Confirm the “Extract title” option

ezgif-4-70ac9b7683

Needlessly complex solution to actually move the cursor

I don’t know of a built-in way to do it, but I made this Space Script which I believe does what you just described:

```space-script
silverbullet.registerEventListener({name: "editor:pageLoaded"}, async (event) => {
  // this part allows you to only move cursor on some pages
  const title = await syscall("editor.getCurrentPage");
  if (!title.startsWith("Diary")) {
    return;
  }

  // this part actually moves the cursor
  const text = await syscall("editor.getText");
  await syscall("editor.moveCursor", text.length);

  // this part is here just to force the view to show where cursor is
  await syscall("editor.insertAtCursor", "someTextToMoveView"); // bit of a nasty trick
  await syscall("editor.undo"); // remove the text inserted in previous line
});
```
1 Like

Thank you for your detailed explanation and solutions!

I successfully used your script, and it genuinely helped me. It seems that the editor.undo command does not work in my version. I deleted the someTextToMoveView text and commented out await syscall("editor.undo"); and it still seems to run well, positioning the cursor at the very end of the page each time it’s opened.

I like to capture fleeting thoughts in list form on my journal page:

After jotting down a thought, I press Enter to leave an empty list item, allowing me to immediately start recording the next time I open the page.

When browsing and finding useful information, my process is:

  1. Click the browser bookmark.
  2. Record the thought.
  3. Press the paste shortcut, then Enter.

This few-step process is intuitive for me.
Thanks again for providing me with the solution ! :sob: