Skip to content

Instantly share code, notes, and snippets.

@KonnorRogers
Created September 29, 2024 04:55
Show Gist options
  • Save KonnorRogers/1568da1e22c6fb5f43593dd8eb031b87 to your computer and use it in GitHub Desktop.
Save KonnorRogers/1568da1e22c6fb5f43593dd8eb031b87 to your computer and use it in GitHub Desktop.
/**
* @param {InputEvent} e
*/
handleBeforeInput (e) {
// All level 2 input types: <https://w3c.github.io/input-events/#interface-InputEvent-Attributes>
switch (e.inputType) {
// insert typed plain text
case "insertText":
break;
// insert or replace existing text by means of a spell checker, auto-correct, writing suggestions or similar
case "insertReplacementText":
break;
// insert a line break
case "insertLineBreak":
break;
// insert a paragraph break
case "insertParagraph":
break;
// insert a numbered list
case "insertOrderedList":
break;
// insert a bulleted list
case "insertUnorderedList":
break;
// insert a horizontal rule
case "insertHorizontalRule":
break;
// replace the current selection with content stored in a kill buffer
case "insertFromYank":
break;
// insert content by means of drop
case "insertFromDrop":
break;
// paste content from clipboard or paste image from client provided image library
case "insertFromPaste":
break;
// paste content from the clipboard as a quotation
case "insertFromPasteAsQuotation":
break;
// transpose the last two grapheme cluster. that were entered
case "insertTranspose":
break;
// replace the current composition string
case "insertCompositionText":
break;
// insert a link
case "insertLink":
break;
// delete a word directly before the caret position
case "deleteWordBackward":
break;
// delete a word directly after the caret position
case "deleteWordForward":
break;
// delete from the caret to the nearest visual line break before the caret position
case "deleteSoftLineBackward":
break;
// delete from the caret to the nearest visual line break after the caret position
case "deleteSoftLineForward":
break;
// delete from the nearest visual line break before the caret position to the nearest visual line break after the caret position
case "deleteEntireSoftLine":
break;
// delete from the caret to the nearest beginning of a block element or br element before the caret position No Yes Collapsed
case "deleteHardLineBackward":
break;
// delete from the caret to the nearest end of a block element or br element after the caret position
case "deleteHardLineForward":
break;
// remove content from the DOM by means of drag
case "deleteByDrag":
break;
// remove the current selection as part of a cut
case "deleteByCut":
break;
// delete the selection without specifying the direction of the deletion and this intention is not covered by another inputType
case "deleteContent":
break;
// delete the content directly before the caret position and this intention is not covered by another inputType or delete the selection with the selection collapsing to its start after the deletion
case "deleteContentBackward":
break;
// delete the content directly after the caret position and this intention is not covered by another inputType or delete the selection with the selection collapsing to its end after the deletion
case "deleteContentForward":
break;
// undo the last editing action
case "historyUndo":
break;
// to redo the last undone editing action
case "historyRedo":
break;
// initiate bold text
case "formatBold":
break;
// initiate italic text
case "formatItalic":
break;
// initiate underline text
case "formatUnderline":
break;
// initiate stricken through text
case "formatStrikeThrough":
break;
// initiate superscript text
case "formatSuperscript":
break;
// initiate subscript text
case "formatSubscript":
break;
// make the current selection fully justified
case "formatJustifyFull":
break;
// center align the current selection
case "formatJustifyCenter":
break;
// right align the current selection
case "formatJustifyRight":
break;
// left align the current selection
case "formatJustifyLeft":
break;
// indent the current selection
case "formatIndent":
break;
// outdent the current selection
case "formatOutdent":
break;
// remove all formatting from the current selection
case "formatRemove":
break;
// set the text block direction
case "formatSetBlockTextDirection":
break;
// set the text inline direction
case "formatSetInlineTextDirection":
break;
// change the background color
case "formatBackColor":
break;
// change the font color
case "formatFontColor":
break;
// change the font name
case "formatFontName":
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment