Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support setting values of content editable div #1715

Closed
twschiller opened this issue Oct 22, 2021 · 4 comments · Fixed by #1726 or #1814
Closed

Support setting values of content editable div #1715

twschiller opened this issue Oct 22, 2021 · 4 comments · Fixed by #1726 or #1814
Assignees
Labels
brick enhancement New feature or request
Milestone

Comments

@twschiller
Copy link
Contributor

twschiller commented Oct 22, 2021

Context

  • As a user, I'd like to use @pixiebrix/form-fill and @pixiebrix/forms/set to set the value of a div that's content editable

Implementation Sketch

  • Modify the setValue method to detect if the element is a content editable div, and use the correct way of setting the value

Reference

Related

@fregante
Copy link
Collaborator

I don’t think this should be automatic based on contentEditable. If an element happens to be editable, it doesn't necessarily mean I want my HTML input to be parsed. For example the element could just be an editor like CodeMirror.

@twschiller
Copy link
Contributor Author

twschiller commented Oct 23, 2021

I don’t think this should be automatic based on contentEditable

I'm not sure I'm following -- what do you mean by "my HTML input". Are you asking whether or not the user is trying to automatically change the value of the div? Or how the value might automatically be transformed before its value is applied?

With the @pixiebrix/form-fill and @pixiebrix/forms/set bricks, the intent of the user is that they want to change the value of some "input-like" element on the page. With the bricks we're trying to automatically to the right thing based on what kind of element it is, so that users don't have to understand the quirks of HTML

The context behind this issue is that some sites use content editable divs in their chat widgets, for the message the user wants to send

@twschiller twschiller modified the milestones: 1.4.X, 1.4.4 Oct 23, 2021
@fregante
Copy link
Collaborator

fregante commented Oct 23, 2021

Oh, gotcha, the issue is that setValue uses .value = input whereas .textContent = input is needed. I assumed you were referring to innerHTML instead.

I'll work on this now, after I reproduce a bug I found today.

@twschiller twschiller modified the milestones: 1.4.4, 1.4.5 Oct 26, 2021
fregante added a commit that referenced this issue Oct 28, 2021
Co-authored-by: Todd Schiller <todd.schiller@gmail.com>
@twschiller
Copy link
Contributor Author

Re-opening since it's not working on LinkedIn (see Loom/Slack)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
brick enhancement New feature or request
Projects
None yet
2 participants