Web Development

Demotivated, Again...

by Cory on November 3, 2019 10:02 PM (Edited November 29, 2019 12:42 PM)

It's Sunday and I feel like shit. I'm just sitting by myself in my room and I don't think i've talked to another human being outside of transaction store interactions in like 3 days.

I spent the last week trying to figure out how to get the forums site to work on the phone. Since I'm just fiddling around with divs using react, the Android soft keyboard isn't popping up on the phone. I'm still no closer to this and I don't really know where to find out more information. It's making me feel stupid and like a novice.

Also, while I was looking for stuff, I found this software package(s) called slatejs that is supposed to be this super ultra customizable web based text editor. It's really good too. I looked at the code and it's brilliant. Works on the phone. Looks like it was invented by some Silicon Valley whiz kid college dropout or something.

My own shit looks so stupid compared to this. What the hell. OTL

Anyway, I have to keep focused on the goal. The forum isn't about CS dick measuring, it's about "finding new ways to represent and foster long-form online communication". Or some shit. I'm still tossing it around in my head, but it's becoming more and more unconvincing the longer this takes.

=================

Now that all that whining is out of the way, note to self:

Let's try this. Make a text input html element in the react editor somewhere and set it to "display:hidden". Focus on it whenever someone clicks on the outer editor div and then set up all the keyboard interactions such that each keypress is routed to the old onKeyDown events. Hopefully this works?

Today's experiments also showed that doing this fucks up the cursor movement when click on the paragraph elements. I think this is because the cursor positioning looks at the global document selection ranges to find the cursor pixel coordinates and this is overwritten when the focus is brought to the hidden text input element. I probably will need to spend a bunch of time to write javascript to recreate the selection range after the focus and then call the old code.

Hope this makes sense in the morning.

EDIT:

1. https://github.com/nosir/cleave.js/issues/147

Fucking android screwing everything up. This is preventing text input via phone. So I'll need to figure this out at some point.

2. Thank fuck for this article:

https://marijnhaverbeke.nl/blog/browser-input-reading.html

Hide a textarea with a wrapped div to make it focusable but still hidden. Base the editor state off the textarea, instead of trying to manipulate the DOM elements directly like I'm doing right now.



This Thought is part of Web Development

General Web Development Thoughts and Odds and Ends

back to the

top