pixiebrix / pixiebrix-extension

PixieBrix browser extension
https://www.pixiebrix.com
GNU Affero General Public License v3.0
83 stars 22 forks source link

Add support for more input types in form-fill and forms/set bricks #1751

Closed twschiller closed 2 years ago

twschiller commented 2 years ago

Copied from https://github.com/pixiebrix/pixiebrix-extension/pull/1726#issue-764721859

fregante commented 2 years ago
  • Not all input fields are currently supported

A few years ago used the "deserialize" part of dom-form-serializer to replace the custom "field set" operation and support more field types:

However I think some/most of its logic is in this file: https://github.com/jefersondaniel/dom-form-serializer/blob/master/lib/InputWriters.js

  • Text editors like CodeMirrors are not supported

This is a little complex as it needs to inject a reader into the unsafe context and set the value via CodeMirror’s API instead. I wrote this code before:

twschiller commented 2 years ago

This is a little complex as it needs to inject a reader into the unsafe context

Yes, I've taken a similar approach in a private extension that calls the API for Tiny MCE, another popular rich text editor component (via tinyMCE.activeEditor.setContent). We'll probably just need to create some definitions of common editor components: 1) how to detect them, 2) how to read the content, 3) how to set the content

I would vote we hold off on supporting these editors though until we get interest for them