Skip to content

Commit

Permalink
Поправил выпадающий список
Browse files Browse the repository at this point in the history
  • Loading branch information
YarikMix committed May 31, 2024
1 parent fa0cc90 commit 5a66378
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
4 changes: 0 additions & 4 deletions public/src/components/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {ScReact} from '@veglem/screact';
import './Dropdown.sass';
import {Img} from '../Image/Image';
import {AppDispatcher} from '../../modules/dispatcher';
import {AppNoteStore, NoteStoreActions} from '../../modules/stores/NoteStore';
import {AppNotesStore, NotesActions} from '../../modules/stores/NotesStore';
import {MAX_ATTACH_SIZE} from '../../utils/consts';
import {AppToasts} from '../../modules/toasts';
Expand Down Expand Up @@ -47,9 +46,6 @@ export class Dropdown extends ScReact.Component<any, any> {
};

handleOnClick = (id:string) => {
let tag = id;
let attr = null;
let content = [];

if (id === "h1") {
insertBlockPlugin('header', 'h1')
Expand Down
17 changes: 8 additions & 9 deletions public/src/components/NoteEditor/NoteEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,6 @@ export class NoteEditor extends ScReact.Component<NoteEditorProps, NoteEditorTyp
}))
}

closeInviteUserModal = () => {
this.setState(state => ({
...state,
inviteUserModalOpen: false
}))
}

openParentNote = () => {
AppDispatcher.dispatch(NotesActions.OPEN_NOTE, this.state.selectedNote.parent)
}
Expand Down Expand Up @@ -230,16 +223,22 @@ export class NoteEditor extends ScReact.Component<NoteEditorProps, NoteEditorTyp
}

openDropdown = (elem: HTMLElement) => {
console.log("openDropdown")
const editor = this.editorWrapperRef
console.log("editor.clientHeight: ", editor.clientHeight)
console.log("elem.getBoundingClientRect().top: ", elem.getBoundingClientRect().top)
const offsetBottom = editor.clientHeight - elem.getBoundingClientRect().top
const dropdownOffsetTop = offsetBottom < 205 ? -225 : 40
console.log("offsetBottom: ", offsetBottom)
const dropdownOffsetTop = offsetBottom < 205 ? -420 : -145
console.log("dropdownOffsetTop: ", dropdownOffsetTop)
console.log("elem.offsetTop: ", elem.offsetTop)

this.setState(state => ({
...state,
dropdownOpen: true,
dropdownPos: {
left: elem.offsetLeft + 20,
top: elem.offsetTop + dropdownOffsetTop
top: elem.getBoundingClientRect().top + dropdownOffsetTop
}
}))
}
Expand Down

0 comments on commit 5a66378

Please sign in to comment.