-
Notifications
You must be signed in to change notification settings - Fork 40
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
RFC: Contenteditable "indent"/"outdent" implementations are not aligned with popular editors #437
Comments
I would be cautious. Contenteditable/execCommand is seldom a good replacement for JS editors that may use contenteditable to move the selection and receive events, but don't depend on the default browser behavior for content changes. There are other and better technologies already shipping in browsers for this. Making small patches here and there to modernize the behavior of contenteditable will have the effect of luring some JavaScript developers into thinking they can create a working editor based on contenteditable and "just a few lines of code to work around bugs in implementations". A year or two working on their editor, they will realize that it takes a major team and many years effort to build an editor that is really water-tight. Better advice for them would be to try to do what some of the existing editor libraries are doing (have a separate model for the content, diffing dom nodes, etc. to match that behavior) - or to use one of those libraries and just configure them to behave in their custom way. It sounds like browsers are already in alignment with oneanother. So time spent on this may just be time wasted on the part of browser makers. That being said, if browser developers have the time and can agree on implementing this, I don't see anything wrong with doing it either. It sounds though as if browsers currently behave similarly. It would not be an advantage if a change in just one of the browsers changes this to where there is no alignment any longer. A spec where such behavior could be added would be the execCommand spec that @zcorpan is working on as the browser native behavior normally matches that of execCommand commands. |
TPAC 2023 |
Sounds great. Thanks!! As long as Simon is conducting research.... I just discovered something weird (IMHO) about user agent implementations of outdent with respect to list items: If you create an (un)ordered list in editors (I tried Google Docs and Microsoft 365 Word), indent nests the list item(s) and outdent reverses that, as expected. BUT at no point does outdent cause a list item to stop being a list item. In contrast, if you load: I personally think this is another instance where making the implementations match popular editors makes sense. EDIT/UPDATE: Issue #442 created for this aspect of the problem. |
(Another thing for Simon's research that falls under this umbrella) In popular editors, if you indent something and then immediately outdent it, the result is as if you made no changes. IMHO, that is the expected result, both for the popular editors and for native contenteditable elements. If you try anything but the simplest of cases, especially in Chromium and WebKit, the result is ... Well, try it out yourself. 😀 You can make it more visually obvious by using multiple levels of EDIT/UPDATE: Issue #443 created for this aspect of the problem. |
Hey, could you make separate issues for each of those points?
@zcorpan What will the research exactly entail? Will you check whether
changing the browser engine will break popular JavaScript editors? That
would be the main problem if any of this code is changed.
|
Done. I was erring on the side of caution (Does this working group really want a bunch of issues all for a feature that authors seem to be discouraged from using?). But now that I know this is your preference, I will do so going forward. I'll try not to file too many more. 😉 |
Hey, yes so to be clear: Simon will investigate some.And then that might
end up in sone spec text and a bug report for various browsers. But then
there is no guarantee that the bug report will be acted upon.
Contenteditable bug reports can at times sit around for 15+ years without
anything happening as it's mostly a legacy feature.
…On Thu, Sep 21, 2023, 14:40 joanmarie ***@***.***> wrote:
Hey, could you make separate issues for each of those points?
Done. I was erring on the side of caution (Does this working group really
want a bunch of issues all for a feature that authors seem to be
discouraged from using?). But now that I know this is your preference, I
will do so going forward. I'll try not to file too many more. 😉
—
Reply to this email directly, view it on GitHub
<#437 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAERMOC6FLRN2LS4XSYX53LX3QYVJANCNFSM6AAAAAA4HOREMU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Yes. Is there a good list of editors I should check? I've found https://github.com/JefMari/awesome-wysiwyg-editors but maybe it's missing some important editors. (BTW, my alias is @zcorpan, |
@zcorpan: Sounds good. Sorry, I answered by email and didn't know the user
tag would go through.
That list looks relatively complete. Some editors are there multiple times
as some are frameworks that other editors are based on (fx Tiptap is using
the Prosemirror framework).
Missing are editors for specific web systems (fx Gutenberg for Wordpress)
and special usage editors like CodeMirror or MathLive that also may contain
some contenteditable.
I can try to compile a more complete list next week some time.
|
@zcorpan Sorry, I noticed I never answered here. That list of contenteditable editors looks fine. Some of the editors have not been updated for a long time (fx Substance - 4 years ago). |
Summary: When a line break is inserted within a block, popular editors treat the text after the line break as part of the same block for the purposes of indentation/quoting. No user agent implementation of the "indent" command is doing this. Should they be?
Web App Editors
Test Case
N.B. This is for editors that support Shift+Enter as a way to create a newline without creating a new block, and have an indent or quote feature.
Results
Content Editable In User Agents
Test Case
data:text/html,<div contenteditable="true"></div><button onclick="document.execCommand('indent', false);">indent</button>
Results
<div contenteditable="true">New block 1<br>New line in block 1<div>New block 2</div></div>
<div contenteditable="true">New block 1<br>New line in block 1<div>New block 2</div></div>
<div contenteditable="true">New block 1<br><div>New line in block 1</div><div>New block 2<br></div></div>
Questions
The text was updated successfully, but these errors were encountered: