-
Notifications
You must be signed in to change notification settings - Fork 176
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
Allow authors to customize whether a property is edited via a popup or not #695
Comments
I'm leaning towards the latter too. I like both the idea and the syntax.
One thought: So instead of And when we need to specify only properties, we can be explicit: In all other cases, we are dealing with a selector. |
We should have a consistent syntax across all key-value pair attributes though, the one parsed by |
Oh, OK. Got it. |
Another option would be a Or, better, the opposite: Any attributes to be set on the editor would be Actually, the more I think about this, the more I like this idea. |
I like that idea too. And indeed, it's not hard to learn. Moreover, if an author has some experience with Angular, they familiar with the similar syntax in it. Should we recommend plugin authors to sustain some naming conventions when adopting this scheme: concatenate multiple words, no camelCase, no hyphens, no underscores? |
I'm not sure, because they might be using it for a variety of things. E.g. I also want to support a |
A few thoughts.
|
Agreed, that's a documentation bug.
When you use that syntax, you're accepting that fluidity. Otherwise you'd just use
That seems clunky and doesn't work for every element due to content model limitations. Also, if you're worried that the practice is indicative of a leaky abstraction, any syntax for this is just as leaky.
Oh that might be workable and let's us save the dot notation for JS properties exclusively. @DmitrySharabin what do you think? |
What do you think of using |
Agreed it's intuitive, but then what does |
I believe in that case, authors can specify whether a property is editable via a popup or not with the help of We can even provide other values, like What do you think? |
I'm not a huge fan of the idea of using a microsyntax in For now, it will be an alias of And I'll add an @DmitrySharabin would you be able to edit the docs and demos accordingly once I push these changes? 🙏🏼 Edit: pushed |
So, for the popup, the syntax I'm thinking is an Bikeshedding for names:
What do you think? |
@LeaVerou Sure, Lea. Will do it now. Edit: And one more thing that fixes the behavior of the Should we fix this as well (add Line 942 in b9f3dac
|
Thank you so much Dmitry, fantastic job!! I merged all PRs, let me know if I forgot anything!
Yes, I think so. |
Do I understand correctly that you suggest using Why am I asking? I'm not quite sure whether it's difficult to implement or not, but what if we could hide experimental features we are working on behind the flag as modern browsers do? So we could have something like the <E mv-app mv-flags="editor-ui">
<!-- Later on -->
<time property="date" datetime="17:00" mv-edit="self">The five o’clock tea time</time> I believe that would let us perform migration and introduce breaking changes less painful. And we could already work with the new semantic of the |
No, I just don't think we should privilege I like the flags idea, but we don't have that many users right now to need this. It would be good for the future however! |
mv-edit-type seems reasonable. another option would be mv-edit-mode. or for the specific purpose you are using, mv-edit-container |
@DmitrySharabin we should probably add some documentation for this in the same page that mentions |
Sure, Lea. Will do it with pleasure. Edit: Done! |
Currently, the heuristic is that if the contents of a property are being edited, then the editor replaces the contents for the duration of editing, otherwise the property is being edited via a popup.
While the heuristic works for most cases, there are cases where it fails:
<span property="num" mv-edit-type="range">50</span>
results in the contents being replaced by a slider, which is never desirable<time property="date" datetime="15:00"></time>
results in the time being duplicated into a popup, which is disruptive<text>
element stores its value in its contents, but we can't easily edit it inline.We should probably adjust the defaults for these elements (we already disable popups for SVG
<text>
), although currently there is no way to set defaults based on the editor element. Should we also give authors control over this somehow?Options:
mv-popup
attribute (with valuesauto
,show
,none
?). What I don't like is that even though this is exclusively about editing, the name doesn't show this.mv-edit-popup
attribute. That does show that it's about editing, but it means authors can never use themv-edit-*
syntax to set apopup
attribute on the generated editor.mv-edit-popup
andmv-no-edit-popup
. It seems a bit "wrong" to set functionality via class names though.mv-edit
syntax, making it a key-value attribute. E.g. e.g.mv-edit="element: #foo, popup: show"
,mv-edit="element: #foo, popup: none"
. The singlemv-edit="<selector>"
syntax would still be supported, as a shortcut. This gives us an extension point for future metadata about editing, so I'm leaning towards that one for now. The problem is that in the general case it's quite hard to disambiguate if we have the options syntax, or a selector (e.g.foo:bar
could be a key-value pair or a pseudo-class,foo, bar
could be{foo: true, bar: true}
or afoo, bar
selector list). So we'll need to use a heuristic, which will likely be ok since nearly all usage ofmv-edit
currently is of the form#id
.The text was updated successfully, but these errors were encountered: