Skip to content

Commit

Permalink
Поправил стили
Browse files Browse the repository at this point in the history
  • Loading branch information
YarikMix committed May 14, 2024
1 parent 1f23abf commit 6d07761
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 17 deletions.
9 changes: 1 addition & 8 deletions public/src/components/Editor/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: при наборе символов в поисковую строку фокусится редактор заметки (отключить)

Expand All @@ -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) {
Expand Down Expand Up @@ -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")) {
Expand Down Expand Up @@ -189,7 +183,6 @@ export class Editor {
});


toast(this.open.toString())
if (this.open) {
this.editable.focus()
this.editable.click()
Expand Down
3 changes: 1 addition & 2 deletions public/src/components/Editor/EditorWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ export class EditorWrapper extends Component<any, EditorState> {
{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
);
}
}
Expand Down
7 changes: 0 additions & 7 deletions public/src/components/NoteEditor/NoteEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@ export class NoteEditor extends ScReact.Component<any, any> {
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 = () => {
Expand Down
5 changes: 5 additions & 0 deletions public/src/modules/stores/NoteStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,29 +92,34 @@ class NoteStore extends BaseStore<NoteStoreState> {
};

private setNote = (note: any) => {
console.log("setNote")
this.SetState(state => ({
...state,
note: note
}));
};

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: {
Expand Down
5 changes: 5 additions & 0 deletions public/src/modules/stores/NotesStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ class NotesStore extends BaseStore<NotesStoreState> {
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(() => {
Expand Down

0 comments on commit 6d07761

Please sign in to comment.