diff --git a/public/src/components/Editor/Editor.ts b/public/src/components/Editor/Editor.ts index 167ad20e..a1ad03af 100644 --- a/public/src/components/Editor/Editor.ts +++ b/public/src/components/Editor/Editor.ts @@ -25,8 +25,7 @@ export class Editor { dropdown: {open: (elem: HTMLElement) => void, close: () => void }, onChange: (schema: PluginProps[]) => void, tippy: {open: (elem: HTMLElement) => void, close: () => void}, - open: boolean, - toast) { + open: boolean) { // TODO: при наборе символов в поисковую строку фокусится редактор заметки (отключить) @@ -41,10 +40,7 @@ export class Editor { this.editable.contentEditable = "true"; this.dropdownObserver = new MutationObserver((records) => { - records.forEach(record => { - - switch (record.type) { case "childList": if (record.addedNodes.length > 0) { @@ -72,8 +68,6 @@ export class Editor { parent.append(this.editable); - - const selectionCallback = () => { const isInEditor = (node: Node) => { if (node.nodeType === Node.ELEMENT_NODE && (node as HTMLElement).contentEditable === 'true' && !(node as HTMLElement).classList.contains("note-title")) { @@ -189,7 +183,6 @@ export class Editor { }); - toast(this.open.toString()) if (this.open) { this.editable.focus() this.editable.click() diff --git a/public/src/components/Editor/EditorWrapper.tsx b/public/src/components/Editor/EditorWrapper.tsx index 18810e67..3b1eea76 100644 --- a/public/src/components/Editor/EditorWrapper.tsx +++ b/public/src/components/Editor/EditorWrapper.tsx @@ -75,8 +75,7 @@ export class EditorWrapper extends Component { {open: this.openDropdown, close: this.closeDropdown}, this.props.onChangeContent, {open: this.openTippy, close: this.closeTippy}, - this.props.open, - (value) => AppToasts.info(value) + this.props.open ); } } diff --git a/public/src/components/NoteEditor/NoteEditor.tsx b/public/src/components/NoteEditor/NoteEditor.tsx index aee5f2af..83347af5 100644 --- a/public/src/components/NoteEditor/NoteEditor.tsx +++ b/public/src/components/NoteEditor/NoteEditor.tsx @@ -76,13 +76,6 @@ export class NoteEditor extends ScReact.Component { selectedNote: store.selectedNote, fullScreen: store.fullScreen })); - - if (this.state.selectedNote) { - AppDispatcher.dispatch(NoteStoreActions.SET_NOTE, { - title: this.state.selectedNote.data.title, - blocks: this.state.selectedNote.data.content - }) - } }; openDeleteNoteModal = () => { diff --git a/public/src/modules/stores/NoteStore.ts b/public/src/modules/stores/NoteStore.ts index bc4ca8be..615f52cb 100644 --- a/public/src/modules/stores/NoteStore.ts +++ b/public/src/modules/stores/NoteStore.ts @@ -92,6 +92,7 @@ class NoteStore extends BaseStore { }; private setNote = (note: any) => { + console.log("setNote") this.SetState(state => ({ ...state, note: note @@ -99,22 +100,26 @@ class NoteStore extends BaseStore { }; private changeTitle = (title: string) => { + console.log("changeTitle") this.state.note.title = title; this.onNoteChanged() }; private changeContent = (content: any) => { + console.log("changeContent") this.state.note.blocks = content this.onNoteChanged() } private onNoteChanged = () => { + console.log("onNoteChanged") if (AppNotesStore.state.selectedNote) { this.saveNote({id: AppNotesStore.state.selectedNote.id, parent: AppNotesStore.state.selectedNote.parent, note: this.state.note}); } } private clearNote = () => { + console.log("clearNote") this.SetState(state => ({ ...state, note: { diff --git a/public/src/modules/stores/NotesStore.ts b/public/src/modules/stores/NotesStore.ts index 982cc49b..4b6381b0 100644 --- a/public/src/modules/stores/NotesStore.ts +++ b/public/src/modules/stores/NotesStore.ts @@ -235,6 +235,11 @@ class NotesStore extends BaseStore { selectedNoteCollaborators: [] })); + AppDispatcher.dispatch(NoteStoreActions.SET_NOTE, { + title: this.state.selectedNote.data.title, + blocks: this.state.selectedNote.data.content + }) + this.ws = new WebSocketConnection(`note/${note.id}/subscribe_on_updates`) this.ws.onOpen(() => {