https://www.dendron.so/ logo
Join DiscordCommunities
Powered by
# dev
  • k

    kfischer_okarin

    05/05/2022, 2:46 AM
    Of course a fundamental change like the framework itself is not always easily isolated like that
  • k

    kfischer_okarin

    05/05/2022, 2:47 AM
    The struggle is real 😅
  • a

    aleksey

    05/05/2022, 2:47 AM
    I hear you. If you make your code framework-agnostic, you in essence just wrote your own framework...
  • k

    kevins8

    05/05/2022, 2:55 AM
    yeah, this happens to me too 😅
  • a

    alexis<3

    05/07/2022, 9:04 PM
    is there a good unofficial way to look at what the api can do? if not, is the api capable of modifying frontmatter?
  • s

    SeriousBug

    05/07/2022, 9:08 PM
    You can use
    note/write
    to update a note, or create a new note: https://github.com/dendronhq/dendron/blob/master/packages/common-all/src/api.ts#L468 You can look up an existing note with
    note/query
    I think: https://github.com/dendronhq/dendron/blob/master/packages/common-all/src/api.ts#L475 There are no docs for the API yet unfortunately, but this file lists everything and has the type definitions for the arguements and responses. If you have some time to dig you should be able to find what you need to send to the API, let us know if you need more details.
  • a

    alexis<3

    05/07/2022, 9:09 PM
    thanks! so frontmatter isn't abstracted direclty i can get the contents of a note but i would need to extract front matter, modify it, then write the new body back
  • s

    SeriousBug

    05/07/2022, 9:14 PM
    No, the engine parses the frontmatter and gives you the properties. So when you query the note, you should get the properties inside the frontmatter. And when you write it back, the engine will serialize the frontmatter and write it in.
  • a

    alexis<3

    05/07/2022, 9:15 PM
    ah thats awesome perfect
  • s

    SeriousBug

    05/07/2022, 9:18 PM
    Yup, here's an example:
    Copy code
    json
    $ curl 'http://localhost:37437/api/note/query?qs=root'
    
    {"error":null,"data":[{"id":"mLZTswhw1jIEVJaPjKoPq","title":"Bulgur Cloud","desc":"","updated":1648930214020,"created":1644786306412,"config":{"global":{"enablePrettyRefs":false}},"custom":{},"fname":"root","type":"note","vault":{"fsPath":"vault"},"contentHash":"e8a713b4ada5e33a5b03ba81136655e6","links":[{"type":"ref","from":{"fname":"root","id":"mLZTswhw1jIEVJaPjKoPq","vaultName":"vault"},"value":"design","position":{"start":{"line":13,"column":1,"offset":228},"end":{"line":13,"column":12,"offset":239},"indent":[]},"xvault":false,"to":{"fname":"design"}},{"type":"ref","from":{"fname":"root","id":"mLZTswhw1jIEVJaPjKoPq","vaultName":"vault"},"value":"security","position":{"start":{"line":17,"column":1,"offset":254},"end":{"line":17,"column":14,"offset":267},"indent":[]},"xvault":false,"to":{"fname":"security"}}],"anchors":{"features":{"type":"header","text":"Features","value":"features","line":14,"column":0,"depth":2},"getting-started":{"type":"header","text":"Getting Started","value":"getting-started","line":16,"column":0,"depth":2},"internal-design":{"type":"header","text":"Internal Design","value":"internal-design","line":20,"column":0,"depth":2},"security":{"type":"header","text":"Security","value":"security","line":24,"column":0,"depth":2}},"children":["ai0rrgkg3yqjnl39mlxpflf","2wji4295zgv0zbu6uerddgu","blfS4m5x4Y3WYoY9DpIjO","658io7uxt1rps9l82agplpp","3jghtc0rle05ca8ysvwossc"],"parent":null,"data":{},"body":"..."}]}
  • s

    SeriousBug

    05/07/2022, 9:18 PM
    You can get the port to use from the
    .dendron.port
    file inside the root of the workspace, Dendron creates the file once the engine has started
  • a

    alexis<3

    05/07/2022, 9:26 PM
    this looks easy enough to deal with. now i just have to learn typescript i haven't don JS since coffeescript was supposed to be the future :P i've been working in c mostly for the last many years so hopefully its not too bad
  • a

    alexis<3

    05/07/2022, 9:28 PM
    general typescript question - is there a good unit testing framework thats popular?
  • h

    hikchoi

    05/07/2022, 9:38 PM
    mocha is the one VSCode recommends for testing extensions. They have instructions here: https://code.visualstudio.com/api/working-with-extensions/testing-extension
  • a

    alexis<3

    05/07/2022, 9:45 PM
    thanks!
  • m

    Maxotronic

    05/09/2022, 2:35 AM
    I'm trying to make register a command to open a plugin view - PR #2490 (https://github.com/dendronhq/dendron/pull/2490) - but I get this error when I launch the command from the command bar:
    Copy code
    Command 'Dendron: Show Schema Validator' resulted in an error (command 'dendron.showSchemaValidator' not found)
    I can't find where that error is thrown - maybe it's internal? Been following [[Add an Editor View|pkg.dendron-plugin-views.tutorial.add-an-editor-view]] Do I have to make a factory and put it in
    _extension.ts
    ?
  • k

    kevins8

    05/09/2022, 2:48 AM
    see [Add New Command](https://docs.dendron.so/notes/ajxrv6ojg1hlx1y31ajrkte) specifically, make sure: - you run
    gen:config
    task - make sure command is added to
    src/commands/index.ts
  • n

    Nidoling

    05/12/2022, 9:51 PM
    @kevins8 Regarding
    NoteFNamesDict
    , what do you think of changing
    _internalMap
    to
    new ListMap<string, NoteProps>()
    . If we pass in a
    NotePropsDict
    to the constructor, the internal map will be fnames -> list of object references. This shouldn't increase memory footprint as we're not creating a new NotePropsDict and will make this dictionary easier to use since the user won't have to pass around 2 dictionaries (
    NoteFnamesDict
    and
    NotePropsDict
    ). Happy to talk online if it helps
  • s

    SeriousBug

    05/12/2022, 9:53 PM
    If you're trying to consolidate stuff, I'd actually recommend dropping the
    NotePropsDict
    and putting everything inside a single class. That class can then expose 2 interfaces, a
    getByName
    and a
    getById
    , both of which can be performed efficiently. That will also get rid of any risk of both maps becoming desynced if we don't update them together accidentally.
  • s

    SeriousBug

    05/12/2022, 9:54 PM
    The reason I didn't do that when implementing NoteFNamesDIct was becuase it would break a lot of existing code, but that should be less of a concern now that most of the code is migrated over to the new interfaces.
  • n

    Nidoling

    05/12/2022, 9:58 PM
    right, i have noticed that its easy to get out of sync between the two. I'll also need something that can play with redux well since it only likes primitive types. let me think on this some more. appreciate the suggestion!
  • h

    hikchoi

    05/16/2022, 3:06 PM
    Ran into a race condition in the tree view: https://github.com/dendronhq/dendron/pull/2923 basically when a new editor is open, it tries to reveal a tree item in the tree view, but the tree data provider can't keep up with the timing and fails to focus. My temp fix makes the handler wait for the tree view to be fully constructed (or time out), but this is not a great solution imo. If anyone has suggestions on this it would be great 🙏🏻
  • k

    kevins8

    05/16/2022, 3:17 PM
    left a comment 🙂
  • s

    SeriousBug

    05/24/2022, 5:27 AM
    Hey, does anyone have any pointers on how the note preview sets the theme? I found the
    useCurrentTheme
    hook which gets whether the current theme is supposed to be light or dark, but the value only seems to be passed into mermaid. There's also a function
    getThemeType
    , but it's not used anywhere. Also
    ThemeUtils.getTheme
    which is not used anywhere either.
  • j

    Joshi

    05/24/2022, 5:35 AM
    Maybe from here https://github.com/dendronhq/dendron/blob/master/packages/plugin-core/src/views/utils.ts#L205:L205
  • s

    SeriousBug

    05/24/2022, 5:38 AM
    Thanks! That info ends up in the
    ideSlice
    , but I can't find anywhere that uses the information from the selector to actually set the theme.
  • s

    SeriousBug

    05/24/2022, 5:39 AM
    Ah nevermind, found it! https://github.com/dendronhq/dendron/blob/555665ab533eaea564c1ca86be0479142e1b8e59/packages/dendron-next-server/pages/_app.tsx#L156 Thanks a lot!
  • j

    Joshi

    05/24/2022, 5:45 AM
    Hmm.. this is in
    dendron-next-server
    , for preview we now use
    dendron-plugin-views
    .
  • s

    SeriousBug

    05/24/2022, 5:45 AM
    Oops, I didn't check which folder it's in. I'm still looking for suggestions then! 😄
  • k

    kevins8

    05/24/2022, 4:58 PM
    @SeriousBug see here -> https://github.com/dendronhq/dendron/blob/enhance/better-publish-nav/packages/common-server/src/etc.ts#L79:L79
1...101102103...108Latest