comment out more draft stuff

This commit is contained in:
Matthew Hodgson 2018-05-05 23:25:04 +01:00
parent 02947063d3
commit e62e43def6
3 changed files with 20 additions and 20 deletions

View file

@ -17,7 +17,7 @@ limitations under the License.
import { Value } from 'slate'; import { Value } from 'slate';
import Html from 'slate-html-serializer'; import Html from 'slate-html-serializer';
import Markdown as Md from 'slate-md-serializer'; import { Markdown as Md } from 'slate-md-serializer';
import Plain from 'slate-plain-serializer'; import Plain from 'slate-plain-serializer';
import * as RichText from './RichText'; import * as RichText from './RichText';
import Markdown from './Markdown'; import Markdown from './Markdown';

View file

@ -177,7 +177,7 @@ module.exports = React.createClass({
render: function() { render: function() {
const BaseAvatar = sdk.getComponent("avatars.BaseAvatar"); const BaseAvatar = sdk.getComponent("avatars.BaseAvatar");
const {room, oobData, ...otherProps} = this.props; const {room, oobData, viewAvatarOnClick, ...otherProps} = this.props;
const roomName = room ? room.name : oobData.name; const roomName = room ? room.name : oobData.name;

View file

@ -22,7 +22,7 @@ import { Editor } from 'slate-react';
import { Value } from 'slate'; import { Value } from 'slate';
import Html from 'slate-html-serializer'; import Html from 'slate-html-serializer';
import Markdown as Md from 'slate-md-serializer'; import { Markdown as Md } from 'slate-md-serializer';
import Plain from 'slate-plain-serializer'; import Plain from 'slate-plain-serializer';
// import {Editor, EditorState, RichUtils, CompositeDecorator, Modifier, // import {Editor, EditorState, RichUtils, CompositeDecorator, Modifier,
@ -1103,6 +1103,10 @@ export default class MessageComposerInput extends React.Component {
/* returns inline style and block type of current SelectionState so MessageComposer can render formatting /* returns inline style and block type of current SelectionState so MessageComposer can render formatting
buttons. */ buttons. */
getSelectionInfo(editorState: EditorState) { getSelectionInfo(editorState: EditorState) {
return {
[], null
};
/*
const styleName = { const styleName = {
BOLD: _td('bold'), BOLD: _td('bold'),
ITALIC: _td('italic'), ITALIC: _td('italic'),
@ -1130,13 +1134,17 @@ export default class MessageComposerInput extends React.Component {
style, style,
blockType, blockType,
}; };
*/
} }
getAutocompleteQuery(contentState: ContentState) { getAutocompleteQuery(contentState: ContentState) {
return [];
// Don't send markdown links to the autocompleter // Don't send markdown links to the autocompleter
return this.removeMDLinks(contentState, ['@', '#']); // return this.removeMDLinks(contentState, ['@', '#']);
} }
/*
removeMDLinks(contentState: ContentState, prefixes: string[]) { removeMDLinks(contentState: ContentState, prefixes: string[]) {
const plaintext = contentState.getPlainText(); const plaintext = contentState.getPlainText();
if (!plaintext) return ''; if (!plaintext) return '';
@ -1169,7 +1177,7 @@ export default class MessageComposerInput extends React.Component {
} }
}); });
} }
*/
onMarkdownToggleClicked = (e) => { onMarkdownToggleClicked = (e) => {
e.preventDefault(); // don't steal focus from the editor! e.preventDefault(); // don't steal focus from the editor!
this.handleKeyCommand('toggle-mode'); this.handleKeyCommand('toggle-mode');
@ -1178,25 +1186,14 @@ export default class MessageComposerInput extends React.Component {
render() { render() {
const activeEditorState = this.state.originalEditorState || this.state.editorState; const activeEditorState = this.state.originalEditorState || this.state.editorState;
// From https://github.com/facebook/draft-js/blob/master/examples/rich/rich.html#L92
// If the user changes block type before entering any text, we can
// either style the placeholder or hide it.
let hidePlaceholder = false;
const contentState = activeEditorState.getCurrentContent();
if (!contentState.hasText()) {
if (contentState.getBlockMap().first().getType() !== 'unstyled') {
hidePlaceholder = true;
}
}
const className = classNames('mx_MessageComposer_input', { const className = classNames('mx_MessageComposer_input', {
mx_MessageComposer_input_empty: hidePlaceholder, mx_MessageComposer_input_empty: hidePlaceholder,
mx_MessageComposer_input_error: this.state.someCompletions === false, mx_MessageComposer_input_error: this.state.someCompletions === false,
}); });
const content = activeEditorState.getCurrentContent(); // const content = activeEditorState.getCurrentContent();
const selection = RichText.selectionStateToTextOffsets(activeEditorState.getSelection(), // const selection = RichText.selectionStateToTextOffsets(activeEditorState.getSelection(),
activeEditorState.getCurrentContent().getBlocksAsArray()); // activeEditorState.getCurrentContent().getBlocksAsArray());
return ( return (
<div className="mx_MessageComposer_input_wrapper"> <div className="mx_MessageComposer_input_wrapper">
@ -1219,6 +1216,7 @@ export default class MessageComposerInput extends React.Component {
<Editor ref="editor" <Editor ref="editor"
dir="auto" dir="auto"
placeholder={this.props.placeholder} placeholder={this.props.placeholder}
/*
editorState={this.state.editorState} editorState={this.state.editorState}
onChange={this.onEditorContentChanged} onChange={this.onEditorContentChanged}
blockStyleFn={MessageComposerInput.getBlockStyle} blockStyleFn={MessageComposerInput.getBlockStyle}
@ -1232,7 +1230,9 @@ export default class MessageComposerInput extends React.Component {
onUpArrow={this.onUpArrow} onUpArrow={this.onUpArrow}
onDownArrow={this.onDownArrow} onDownArrow={this.onDownArrow}
onEscape={this.onEscape} onEscape={this.onEscape}
spellCheck={true} /> spellCheck={true}
*/
/>
</div> </div>
</div> </div>
); );