https://htmx.org logo
Join Discord
Powered by
# htmx-general
  • s

    some-airline-73512

    02/15/2023, 4:37 PM
    Does it require extra markup being in the original page?
  • r

    ripe-action-67367

    02/15/2023, 4:38 PM
    yes, oob elements should be rendered at the top level, near the primary markup
  • s

    some-airline-73512

    02/15/2023, 5:03 PM
    Thanks
  • b

    brainy-magician-58066

    02/16/2023, 12:48 AM
    Hey all, I'm trying to catch an error from my server and, instead of the normal swap on a successful request, have it replace the content area of the page with the server's response. I'm listening for
    htmx:beforeSwap
    because that seems to be the only event that lets me set
    ev.detail.shouldSwap
    to true, since it defaults to
    false
    in an error. That's fine, and I'm changing that and setting
    ev.detail.target
    to the right thing. Problem is, there's no way to override the
    hx-select
    . If it succeeds, I clip out a small bit of the response with
    hx-select="#foo"
    but in the error case, #foo doesn't exist!
  • b

    brainy-magician-58066

    02/16/2023, 12:50 AM
    It feels like I'm just Doing It Wrong and there's a different path that the author(s) use instead, but I haven't stumbled onto it. Maybe a
    HX-Trigger
    header with some JSON in the value that I then parse locally and pop an error dialog? Feels more... javascript-y than I was hoping for.
  • l

    limited-journalist-45462

    02/16/2023, 1:59 AM
    What exactly is hyperscript?
  • l

    limited-journalist-45462

    02/16/2023, 1:59 AM
    Landed here after reading some SolidJS docs
  • d

    dazzling-refrigerator-62542

    02/16/2023, 2:22 AM
    You probably want https://github.com/hyperhype/hyperscript if you come from solidjs land.
  • d

    dazzling-refrigerator-62542

    02/16/2023, 2:24 AM
    Having said that, gg grug brains, y’all seo the heck outta htmx/hyperscript. Which is dope.
  • m

    mysterious-toddler-20573

    02/16/2023, 3:14 AM
    OK, not perfect, but you can modify
    detail.serverResponse
    . You'd need to parse the response and then select out the content your want. Sorry.
  • b

    brainy-magician-58066

    02/16/2023, 3:16 AM
    Ahh right. Yeah cheers that would work. I think I'm better off just running down the path of
    HX-Trigger
    kicking off a separate request to get the persisted error message from another endpoint rather than parsing the DOM of the response myself. The thing I was reaching for, that still feels like it would be useful, is an
    HX-Reselect
    header to sit alongside
    HX-Retarget
  • m

    mysterious-toddler-20573

    02/16/2023, 3:21 AM
    reasonable
  • l

    limited-journalist-45462

    02/16/2023, 4:14 AM
    Thanks
  • h

    happy-knife-63802

    02/16/2023, 9:32 AM
    Anyone know if it’s possible for hx-push-url to be triggered without making a request, for example by intersection? I want the browser to update the current url with a page #location which changes as the user scrolls through
  • r

    ripe-action-67367

    02/16/2023, 9:48 AM
    Sound like something, better done with _hyperscript/JS
  • h

    happy-knife-63802

    02/16/2023, 9:50 AM
    You’re probably right
  • h

    happy-knife-63802

    02/16/2023, 9:51 AM
    On a related note, does issuing hx-get include window.hash?
  • h

    happy-knife-63802

    02/16/2023, 9:52 AM
    *Location hash
  • r

    ripe-action-67367

    02/16/2023, 9:54 AM
    I think, it's removed at XHR level, so no
  • h

    happy-knife-63802

    02/16/2023, 9:54 AM
    Hmm
  • h

    happy-knife-63802

    02/16/2023, 9:55 AM
    So probably best way is to use vals with js
  • g

    gray-dinner-25100

    02/16/2023, 10:36 AM
    Is there a way to add htmx debug tool(?) (bottom of example pages) to my own page? or is it just for example page?
  • g

    gray-dinner-25100

    02/16/2023, 10:40 AM
    I mean this:
  • a

    astonishing-barista-36240

    02/16/2023, 11:57 AM
    hey gnat.. blast from the past here.. what did you decide regarding markdown/wysiwyg editors for use with htmx? did you find a good solution?
  • r

    refined-waiter-90422

    02/16/2023, 12:47 PM
    Ended up building my own, looks similar in concept to the github editor + preview button, so more of an explicit WYSIWYG. Previously I had a heavily stripped down version of Toast editor, which was okay, but 500+ kb IIRC even stripped down.
  • r

    refined-waiter-90422

    02/16/2023, 12:48 PM
    But it was overall the most complete non-react.js editor.
  • r

    refined-waiter-90422

    02/16/2023, 12:50 PM
    its unfortunate but many WYSIWYG editors have people loading multiple megabytes.
  • r

    refined-waiter-90422

    02/16/2023, 12:51 PM
    Also I'm building a games industry product, and wanted to keep markdown close to whatever people use in Discord. So a simpler editor was I think a good compromise.
  • r

    refined-waiter-90422

    02/16/2023, 12:52 PM
    a lot of gamers seem to know discord markdown just fine
  • r

    refined-waiter-90422

    02/16/2023, 12:54 PM
    But yeah technically still very open to trying others, especially htmx-based ones, but these probably do not exist yet.
1...102110221023...1146Latest