mirror of https://github.com/vector-im/riot-web
stub out yet more
parent
05eba3fa32
commit
a2233a48c2
|
@ -84,6 +84,14 @@ limitations under the License.
|
||||||
margin-right: 6px;
|
margin-right: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_MessageComposer_editor {
|
||||||
|
width: 100%;
|
||||||
|
flex: 1;
|
||||||
|
max-height: 120px;
|
||||||
|
min-height: 21px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
@keyframes visualbell
|
@keyframes visualbell
|
||||||
{
|
{
|
||||||
from { background-color: #faa }
|
from { background-color: #faa }
|
||||||
|
|
|
@ -19,7 +19,7 @@ import PropTypes from 'prop-types';
|
||||||
import type SyntheticKeyboardEvent from 'react/lib/SyntheticKeyboardEvent';
|
import type SyntheticKeyboardEvent from 'react/lib/SyntheticKeyboardEvent';
|
||||||
|
|
||||||
import { Editor } from 'slate-react';
|
import { Editor } from 'slate-react';
|
||||||
import { Value } from 'slate';
|
import { Value, Document } 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';
|
||||||
|
@ -238,12 +238,17 @@ export default class MessageComposerInput extends React.Component {
|
||||||
return EditorState.moveFocusToEnd(editorState);
|
return EditorState.moveFocusToEnd(editorState);
|
||||||
*/
|
*/
|
||||||
if (value) {
|
if (value) {
|
||||||
// create with this value
|
// create from the existing value...
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
value = Value.create();
|
// ...or create a new one.
|
||||||
}
|
}
|
||||||
return value;
|
|
||||||
|
return Value.create({
|
||||||
|
document: Document.create({
|
||||||
|
nodes: [],
|
||||||
|
}),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
@ -394,6 +399,7 @@ export default class MessageComposerInput extends React.Component {
|
||||||
|
|
||||||
// Called by Draft to change editor contents
|
// Called by Draft to change editor contents
|
||||||
onEditorContentChanged = (editorState: EditorState) => {
|
onEditorContentChanged = (editorState: EditorState) => {
|
||||||
|
/*
|
||||||
editorState = RichText.attachImmutableEntitiesToEmoji(editorState);
|
editorState = RichText.attachImmutableEntitiesToEmoji(editorState);
|
||||||
|
|
||||||
const currentBlock = editorState.getSelection().getStartKey();
|
const currentBlock = editorState.getSelection().getStartKey();
|
||||||
|
@ -449,7 +455,7 @@ export default class MessageComposerInput extends React.Component {
|
||||||
editorState = EditorState.forceSelection(editorState, newContentState.getSelectionAfter());
|
editorState = EditorState.forceSelection(editorState, newContentState.getSelectionAfter());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/* Since a modification was made, set originalEditorState to null, since newState is now our original */
|
/* Since a modification was made, set originalEditorState to null, since newState is now our original */
|
||||||
this.setState({
|
this.setState({
|
||||||
editorState,
|
editorState,
|
||||||
|
@ -466,6 +472,7 @@ export default class MessageComposerInput extends React.Component {
|
||||||
* @param callback
|
* @param callback
|
||||||
*/
|
*/
|
||||||
setState(state, callback) {
|
setState(state, callback) {
|
||||||
|
/*
|
||||||
if (state.editorState != null) {
|
if (state.editorState != null) {
|
||||||
state.editorState = RichText.attachImmutableEntitiesToEmoji(
|
state.editorState = RichText.attachImmutableEntitiesToEmoji(
|
||||||
state.editorState);
|
state.editorState);
|
||||||
|
@ -501,12 +508,12 @@ export default class MessageComposerInput extends React.Component {
|
||||||
state.originalEditorState = null;
|
state.originalEditorState = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
super.setState(state, () => {
|
super.setState(state, () => {
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
const textContent = this.state.editorState.getCurrentContent().getPlainText();
|
const textContent = this.state.editorState.getCurrentContent().getPlainText();
|
||||||
const selection = RichText.selectionStateToTextOffsets(
|
const selection = RichText.selectionStateToTextOffsets(
|
||||||
this.state.editorState.getSelection(),
|
this.state.editorState.getSelection(),
|
||||||
|
@ -522,6 +529,7 @@ export default class MessageComposerInput extends React.Component {
|
||||||
let editorRoot = this.refs.editor.refs.editor.parentNode.parentNode;
|
let editorRoot = this.refs.editor.refs.editor.parentNode.parentNode;
|
||||||
editorRoot.scrollTop = editorRoot.scrollHeight;
|
editorRoot.scrollTop = editorRoot.scrollHeight;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1230,11 +1238,11 @@ export default class MessageComposerInput extends React.Component {
|
||||||
src={`img/button-md-${!this.state.isRichtextEnabled}.png`} />
|
src={`img/button-md-${!this.state.isRichtextEnabled}.png`} />
|
||||||
<Editor ref="editor"
|
<Editor ref="editor"
|
||||||
dir="auto"
|
dir="auto"
|
||||||
|
className="mx_MessageComposer_editor"
|
||||||
placeholder={this.props.placeholder}
|
placeholder={this.props.placeholder}
|
||||||
value={this.state.editorState}
|
value={this.state.editorState}
|
||||||
/*
|
|
||||||
editorState={this.state.editorState}
|
|
||||||
onChange={this.onEditorContentChanged}
|
onChange={this.onEditorContentChanged}
|
||||||
|
/*
|
||||||
blockStyleFn={MessageComposerInput.getBlockStyle}
|
blockStyleFn={MessageComposerInput.getBlockStyle}
|
||||||
keyBindingFn={MessageComposerInput.getKeyBinding}
|
keyBindingFn={MessageComposerInput.getKeyBinding}
|
||||||
handleKeyCommand={this.handleKeyCommand}
|
handleKeyCommand={this.handleKeyCommand}
|
||||||
|
|
Loading…
Reference in New Issue