diff --git a/app/javascript/gabsocial/actions/importer/normalizer.js b/app/javascript/gabsocial/actions/importer/normalizer.js index 1de5700f..f6306e41 100644 --- a/app/javascript/gabsocial/actions/importer/normalizer.js +++ b/app/javascript/gabsocial/actions/importer/normalizer.js @@ -85,22 +85,4 @@ export function normalizePoll(poll) { })); return normalPoll; -} - - -//

attention!

-//

#test @bob #nice https://bob.com http://techcrunch.com strike it

-//

https://twitter.com

-//

@bobitalic

-//

jonincode

- -// # attention! -// #test @bob #nice https://bob.com http://techcrunch.com ~~strike it~~ - -// ~~https://twitter.com~~ - -// _@bobitalic_ - -// ``` -// jonincode -// ``` \ No newline at end of file +} \ No newline at end of file diff --git a/app/javascript/gabsocial/components/autosuggest_textbox.js b/app/javascript/gabsocial/components/autosuggest_textbox.js index f4aff23f..636248f5 100644 --- a/app/javascript/gabsocial/components/autosuggest_textbox.js +++ b/app/javascript/gabsocial/components/autosuggest_textbox.js @@ -210,30 +210,6 @@ export default class AutosuggestTextbox extends ImmutablePureComponent { } = this.props const { suggestionsHidden } = this.state - const style = { - direction: isRtl(value) ? 'rtl' : 'ltr', - } - - const textareaClasses = CX({ - default: 1, - font: 1, - wrap: 1, - resizeNone: 1, - bgTransparent: 1, - outlineNone: 1, - lineHeight125: 1, - colorPrimary: 1, - width100PC: !small, - pt15: !small, - px15: !small, - px10: small, - pb10: !small, - fs16PX: !small, - fs14PX: small, - heightMax200PX: small, - heightMax80VH: !small, - heightMin80PX: !small, - }) const textareaContainerClasses = CX({ default: 1, @@ -254,7 +230,6 @@ export default class AutosuggestTextbox extends ImmutablePureComponent { inputRef={this.setTextbox} disabled={disabled} placeholder={placeholder} - autoFocus={autoFocus} value={value} valueMarkdown={valueMarkdown} onChange={this.onChange} diff --git a/app/javascript/gabsocial/components/composer.js b/app/javascript/gabsocial/components/composer.js index 05d5946c..2839589b 100644 --- a/app/javascript/gabsocial/components/composer.js +++ b/app/javascript/gabsocial/components/composer.js @@ -1,4 +1,5 @@ import { + getDefaultKeyBinding, Editor, EditorState, CompositeDecorator, @@ -86,7 +87,6 @@ export default class Composer extends PureComponent { valueMarkdown: PropTypes.string, onChange: PropTypes.func, onKeyDown: PropTypes.func, - onKeyUp: PropTypes.func, onFocus: PropTypes.func, onBlur: PropTypes.func, onPaste: PropTypes.func, @@ -94,6 +94,7 @@ export default class Composer extends PureComponent { } state = { + active: false, editorState: EditorState.createEmpty(compositeDecorator), plainText: this.props.value, } @@ -158,8 +159,34 @@ export default class Composer extends PureComponent { this.props.onChange(null, plainText, markdownString, selectionStart) } + handleOnFocus = () => { + document.addEventListener('paste', this.handleOnPaste) + this.setState({ active: true }) + this.props.onFocus() + } + + handleOnBlur = () => { + document.removeEventListener('paste', this.handleOnPaste, true) + this.setState({ active: false }) + this.props.onBlur() + } + focus = () => { - this.textbox.editor.focus() + this.textbox.focus() + } + + handleOnPaste = (e) => { + if (this.state.active) { + this.props.onPaste(e) + } + } + + keyBindingFn = (e) => { + if (e.type === 'keydown') { + this.props.onKeyDown(e) + } + + return getDefaultKeyBinding(e) } handleKeyCommand = (command) => { @@ -193,7 +220,6 @@ export default class Composer extends PureComponent { disabled, placeholder, onKeyDown, - onKeyUp, onFocus, onBlur, onPaste, @@ -231,7 +257,6 @@ export default class Composer extends PureComponent { >