This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
src/components/views/rooms/wysiwyg_composer Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -14,14 +14,14 @@ See the License for the specific language governing permissions and
1414limitations under the License.
1515*/
1616
17- import React , { MouseEventHandler } from "react" ;
17+ import React from "react" ;
1818
1919import { _t } from "../../../../../languageHandler" ;
20- import AccessibleButton from "../../../elements/AccessibleButton" ;
20+ import AccessibleButton , { ButtonEvent } from "../../../elements/AccessibleButton" ;
2121
2222interface EditionButtonsProps {
23- onCancelClick : MouseEventHandler < HTMLButtonElement > ;
24- onSaveClick : MouseEventHandler < HTMLButtonElement > ;
23+ onCancelClick : ( e : ButtonEvent ) => void ;
24+ onSaveClick : ( e : ButtonEvent ) => void ;
2525 isSaveDisabled ?: boolean ;
2626}
2727
Original file line number Diff line number Diff line change @@ -40,11 +40,14 @@ export function parseEditorStateTransfer(
4040) : string {
4141 const partCreator = new CommandPartCreator ( room , mxClient ) ;
4242
43- let parts : Part [ ] ;
43+ let parts : ( Part | undefined ) [ ] = [ ] ;
4444 if ( editorStateTransfer . hasEditorState ( ) ) {
4545 // if restoring state from a previous editor,
4646 // restore serialized parts from the state
47- parts = editorStateTransfer . getSerializedParts ( ) . map ( ( p ) => partCreator . deserializePart ( p ) ) ;
47+ const serializedParts = editorStateTransfer . getSerializedParts ( ) ;
48+ if ( serializedParts !== null ) {
49+ parts = serializedParts . map ( ( p ) => partCreator . deserializePart ( p ) ) ;
50+ }
4851 } else {
4952 // otherwise, either restore serialized parts from localStorage or parse the body of the event
5053 // TODO local storage
@@ -59,7 +62,7 @@ export function parseEditorStateTransfer(
5962 } ) ;
6063 }
6164
62- return parts . reduce ( ( content , part ) => content + part . text , "" ) ;
65+ return parts . reduce ( ( content , part ) => content + part ? .text , "" ) ;
6366 // Todo local storage
6467 // this.saveStoredEditorState();
6568}
You can’t perform that action at this time.
0 commit comments