Skip to content

Commit

Permalink
fix: duplicate element id
Browse files Browse the repository at this point in the history
  • Loading branch information
moughxyz committed Feb 1, 2022
1 parent a477281 commit b1022cd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
6 changes: 5 additions & 1 deletion app/assets/javascripts/components/NoteGroupView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { PureComponent } from '@/components/Abstract/PureComponent';
import { WebApplication } from '@/ui_models/application';
import { MultipleSelectedNotes } from '@/components/MultipleSelectedNotes';
import { NoteView } from '@/components/NoteView/NoteView';
import { ElementIds } from '@/element_ids';

type State = {
showMultipleSelectedNotes: boolean;
Expand Down Expand Up @@ -40,7 +41,10 @@ export class NoteGroupView extends PureComponent<Props, State> {

render() {
return (
<div id="editor-column" className="h-full app-column app-column-third">
<div
id={ElementIds.EditorColumn}
className="h-full app-column app-column-third"
>
{this.state.showMultipleSelectedNotes && (
<MultipleSelectedNotes
application={this.application}
Expand Down
19 changes: 3 additions & 16 deletions app/assets/javascripts/components/NoteView/NoteView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,11 @@ import { ActionsMenu } from '../ActionsMenu';
import { HistoryMenu } from '../HistoryMenu';
import { ComponentView } from '../ComponentView';
import { PanelSide, PanelResizer, PanelResizeType } from '../PanelResizer';
import { ElementIds } from '@/element_ids';

const MINIMUM_STATUS_DURATION = 400;
const TEXTAREA_DEBOUNCE = 100;

const ElementIds = {
NoteTextEditor: 'note-text-editor',
NoteTitleEditor: 'note-title-editor',
EditorContent: 'editor-content',
};

type NoteStatus = {
message?: string;
desc?: string;
Expand Down Expand Up @@ -982,11 +977,7 @@ export class NoteView extends PureComponent<Props, State> {
render() {
if (this.state.showProtectedWarning) {
return (
<div
id="editor-column"
aria-label="Note"
className="section editor sn-component"
>
<div aria-label="Note" className="section editor sn-component">
{this.state.showProtectedWarning && (
<div className="h-full flex justify-center items-center">
<ProtectedNoteOverlay
Expand All @@ -1001,11 +992,7 @@ export class NoteView extends PureComponent<Props, State> {
}

return (
<div
id="editor-column"
aria-label="Note"
className="section editor sn-component"
>
<div aria-label="Note" className="section editor sn-component">
<div className="flex-grow flex flex-col">
<div className="sn-component">
{this.state.noteLocked && (
Expand Down
6 changes: 6 additions & 0 deletions app/assets/javascripts/element_ids.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const ElementIds = {
NoteTextEditor: 'note-text-editor',
NoteTitleEditor: 'note-title-editor',
EditorContent: 'editor-content',
EditorColumn: 'editor-column',
};
6 changes: 4 additions & 2 deletions app/assets/javascripts/ui_models/app_state/note_tags_state.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ElementIds } from '@/element_ids';
import { ContentType, SNNote, SNTag, UuidString } from '@standardnotes/snjs';
import { action, computed, makeObservable, observable } from 'mobx';
import { WebApplication } from '../application';
Expand Down Expand Up @@ -167,8 +168,9 @@ export class NoteTagsState {
}

reloadTagsContainerMaxWidth(): void {
const EDITOR_ELEMENT_ID = 'editor-column';
const editorWidth = document.getElementById(EDITOR_ELEMENT_ID)?.clientWidth;
const editorWidth = document.getElementById(
ElementIds.EditorColumn
)?.clientWidth;
if (editorWidth) {
this.setTagsContainerMaxWidth(editorWidth);
}
Expand Down

0 comments on commit b1022cd

Please sign in to comment.