about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/composer/textarea/index.js
diff options
context:
space:
mode:
authorkibigo! <marrus-sh@users.noreply.github.com>2018-01-03 12:36:21 -0800
committerkibigo! <marrus-sh@users.noreply.github.com>2018-01-04 18:33:13 -0800
commit42f50049ff29ccdc484c22f8a5a19cda2dd03a5b (patch)
tree5e04c0bc0106f634316202eb8dc2f8c356d1b556 /app/javascript/flavours/glitch/features/composer/textarea/index.js
parentb4a3792201ccc01713b536e50428e027bd094d2b (diff)
WIP <Compose> Refactor; 1000 tiny edits
Diffstat (limited to 'app/javascript/flavours/glitch/features/composer/textarea/index.js')
-rw-r--r--app/javascript/flavours/glitch/features/composer/textarea/index.js42
1 files changed, 21 insertions, 21 deletions
diff --git a/app/javascript/flavours/glitch/features/composer/textarea/index.js b/app/javascript/flavours/glitch/features/composer/textarea/index.js
index 2299757df..1b6f79bba 100644
--- a/app/javascript/flavours/glitch/features/composer/textarea/index.js
+++ b/app/javascript/flavours/glitch/features/composer/textarea/index.js
@@ -31,14 +31,14 @@ const messages = defineMessages({
 const handlers = {
 
   //  When blurring the textarea, suggestions are hidden.
-  blur () {
+  handleBlur () {
     this.setState({ suggestionsHidden: true });
   },
 
   //  When the contents of the textarea change, we have to pull up new
   //  autosuggest suggestions if applicable, and also change the value
   //  of the textarea in our store.
-  change ({
+  handleChange ({
     target: {
       selectionStart,
       value,
@@ -91,7 +91,7 @@ const handlers = {
   },
 
   //  Handles a click on an autosuggestion.
-  clickSuggestion (index) {
+  handleClickSuggestion (index) {
     const { textarea } = this;
     const {
       onSuggestionSelected,
@@ -107,7 +107,7 @@ const handlers = {
 
   //  Handles a keypress.  If the autosuggestions are visible, we need
   //  to allow keypresses to navigate and sleect them.
-  keyDown (e) {
+  handleKeyDown (e) {
     const {
       disabled,
       onSubmit,
@@ -165,7 +165,7 @@ const handlers = {
 
   //  When the escape key is released, we either close the suggestions
   //  window or focus the UI.
-  keyUp ({ key }) {
+  handleKeyUp ({ key }) {
     const { suggestionsHidden } = this.state;
     if (key === 'Escape') {
       if (!suggestionsHidden) {
@@ -177,7 +177,7 @@ const handlers = {
   },
 
   //  Handles the pasting of images into the composer.
-  paste (e) {
+  handlePaste (e) {
     const { onPaste } = this.props;
     let d;
     if (onPaste && (d = e.clipboardData) && (d = d.files).length === 1) {
@@ -187,7 +187,7 @@ const handlers = {
   },
 
   //  Saves a reference to the textarea.
-  refTextarea (textarea) {
+  handleRefTextarea (textarea) {
     this.textarea = textarea;
   },
 };
@@ -223,13 +223,13 @@ export default class ComposerTextarea extends React.Component {
   //  Rendering.
   render () {
     const {
-      blur,
-      change,
-      clickSuggestion,
-      keyDown,
-      keyUp,
-      paste,
-      refTextarea,
+      handleBlur,
+      handleChange,
+      handleClickSuggestion,
+      handleKeyDown,
+      handleKeyUp,
+      handlePaste,
+      handleRefTextarea,
     } = this.handlers;
     const {
       autoFocus,
@@ -254,12 +254,12 @@ export default class ComposerTextarea extends React.Component {
             autoFocus={autoFocus}
             className='textarea'
             disabled={disabled}
-            inputRef={refTextarea}
-            onBlur={blur}
-            onChange={change}
-            onKeyDown={keyDown}
-            onKeyUp={keyUp}
-            onPaste={paste}
+            inputRef={handleRefTextarea}
+            onBlur={handleBlur}
+            onChange={handleChange}
+            onKeyDown={handleKeyDown}
+            onKeyUp={handleKeyUp}
+            onPaste={handlePaste}
             placeholder={intl.formatMessage(messages.placeholder)}
             value={value}
             style={{ direction: isRtl(value) ? 'rtl' : 'ltr' }}
@@ -268,7 +268,7 @@ export default class ComposerTextarea extends React.Component {
         <EmojiPicker onPickEmoji={onPickEmoji} />
         <ComposerTextareaSuggestions
           hidden={suggestionsHidden}
-          onSuggestionClick={clickSuggestion}
+          onSuggestionClick={handleClickSuggestion}
           suggestions={suggestions}
           value={selectedSuggestion}
         />