Closed Bug 1839553 Opened 1 year ago Closed 1 year ago

`EditorBase::IsInPlaintextMode` is confusing name

Categories

(Core :: DOM: Editor, task)

task

Tracking

()

RESOLVED FIXED
116 Branch
Tracking Status
firefox116 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

nsIEditor.eEditorPlaintextMask is always set to TextEditor, and if the editor is for plaintext email of Thunderbird, it's also set to HTMLEditor. It's unclear that whether we can share the behavior with Thunderbird and contenteditable="plaintext-only". Therefore, I think that we should rename it like IsTextEditorOrPlaintextModeHTMLEditor.

Assignee: nobody → masayuki
Status: NEW → ASSIGNED

Now, most users of EditorBase::IsInPlaintextMode() are HTMLEditor itself.

There are some exceptions:

EditorBase::GetDesiredSpellCheckState() uses it to consider whether the root
(<body> if HTMLEditor) element's specllcheck attribute should be referred
or document's editing state. I think that this should just check
IsHTMLEditor(), but I think it must be okay to keep this as-is for now.

EditorEventListener::KeyUp() uses it to consider whether Ctrl + left/right
Shift switches the text direction of the editing host if and only if user
installed both LTR/RTL keyboard layouts and running in Windows. I think that
this should keep working in plaintext mail composer because nobody can control
the direction in plaintext editor. Therefore, this needs to check either
IsTextEditor() or IsPlaintextMailComposer() returning true.

EditorEventListener::DragEventHasSupportingData() uses it to consider
whether the editor accepts styled text and files. Therefore, it needs to check
either IsTextEditor() or IsPlaintextMailComposer() returning false.

Finally, we can stop setting nsIEditor::eEditorPlaintextMask to TextEditor.

Depends on D181836

Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/96ddc24e289a Move `EditorBase::IsInPlaintextMode()` to `HTMLEditor` with renaming to `IsPlaintextMailComposer()` r=m_kato
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 116 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: