fix: duplicate element id
This commit is contained in:
@@ -3,6 +3,7 @@ import { PureComponent } from '@/components/Abstract/PureComponent';
|
|||||||
import { WebApplication } from '@/ui_models/application';
|
import { WebApplication } from '@/ui_models/application';
|
||||||
import { MultipleSelectedNotes } from '@/components/MultipleSelectedNotes';
|
import { MultipleSelectedNotes } from '@/components/MultipleSelectedNotes';
|
||||||
import { NoteView } from '@/components/NoteView/NoteView';
|
import { NoteView } from '@/components/NoteView/NoteView';
|
||||||
|
import { ElementIds } from '@/element_ids';
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
showMultipleSelectedNotes: boolean;
|
showMultipleSelectedNotes: boolean;
|
||||||
@@ -40,7 +41,10 @@ export class NoteGroupView extends PureComponent<Props, State> {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
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 && (
|
{this.state.showMultipleSelectedNotes && (
|
||||||
<MultipleSelectedNotes
|
<MultipleSelectedNotes
|
||||||
application={this.application}
|
application={this.application}
|
||||||
|
|||||||
@@ -37,16 +37,11 @@ import { ActionsMenu } from '../ActionsMenu';
|
|||||||
import { HistoryMenu } from '../HistoryMenu';
|
import { HistoryMenu } from '../HistoryMenu';
|
||||||
import { ComponentView } from '../ComponentView';
|
import { ComponentView } from '../ComponentView';
|
||||||
import { PanelSide, PanelResizer, PanelResizeType } from '../PanelResizer';
|
import { PanelSide, PanelResizer, PanelResizeType } from '../PanelResizer';
|
||||||
|
import { ElementIds } from '@/element_ids';
|
||||||
|
|
||||||
const MINIMUM_STATUS_DURATION = 400;
|
const MINIMUM_STATUS_DURATION = 400;
|
||||||
const TEXTAREA_DEBOUNCE = 100;
|
const TEXTAREA_DEBOUNCE = 100;
|
||||||
|
|
||||||
const ElementIds = {
|
|
||||||
NoteTextEditor: 'note-text-editor',
|
|
||||||
NoteTitleEditor: 'note-title-editor',
|
|
||||||
EditorContent: 'editor-content',
|
|
||||||
};
|
|
||||||
|
|
||||||
type NoteStatus = {
|
type NoteStatus = {
|
||||||
message?: string;
|
message?: string;
|
||||||
desc?: string;
|
desc?: string;
|
||||||
@@ -982,11 +977,7 @@ export class NoteView extends PureComponent<Props, State> {
|
|||||||
render() {
|
render() {
|
||||||
if (this.state.showProtectedWarning) {
|
if (this.state.showProtectedWarning) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div aria-label="Note" className="section editor sn-component">
|
||||||
id="editor-column"
|
|
||||||
aria-label="Note"
|
|
||||||
className="section editor sn-component"
|
|
||||||
>
|
|
||||||
{this.state.showProtectedWarning && (
|
{this.state.showProtectedWarning && (
|
||||||
<div className="h-full flex justify-center items-center">
|
<div className="h-full flex justify-center items-center">
|
||||||
<ProtectedNoteOverlay
|
<ProtectedNoteOverlay
|
||||||
@@ -1001,11 +992,7 @@ export class NoteView extends PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div aria-label="Note" className="section editor sn-component">
|
||||||
id="editor-column"
|
|
||||||
aria-label="Note"
|
|
||||||
className="section editor sn-component"
|
|
||||||
>
|
|
||||||
<div className="flex-grow flex flex-col">
|
<div className="flex-grow flex flex-col">
|
||||||
<div className="sn-component">
|
<div className="sn-component">
|
||||||
{this.state.noteLocked && (
|
{this.state.noteLocked && (
|
||||||
|
|||||||
6
app/assets/javascripts/element_ids.ts
Normal file
6
app/assets/javascripts/element_ids.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export const ElementIds = {
|
||||||
|
NoteTextEditor: 'note-text-editor',
|
||||||
|
NoteTitleEditor: 'note-title-editor',
|
||||||
|
EditorContent: 'editor-content',
|
||||||
|
EditorColumn: 'editor-column',
|
||||||
|
};
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { ElementIds } from '@/element_ids';
|
||||||
import { ContentType, SNNote, SNTag, UuidString } from '@standardnotes/snjs';
|
import { ContentType, SNNote, SNTag, UuidString } from '@standardnotes/snjs';
|
||||||
import { action, computed, makeObservable, observable } from 'mobx';
|
import { action, computed, makeObservable, observable } from 'mobx';
|
||||||
import { WebApplication } from '../application';
|
import { WebApplication } from '../application';
|
||||||
@@ -167,8 +168,9 @@ export class NoteTagsState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
reloadTagsContainerMaxWidth(): void {
|
reloadTagsContainerMaxWidth(): void {
|
||||||
const EDITOR_ELEMENT_ID = 'editor-column';
|
const editorWidth = document.getElementById(
|
||||||
const editorWidth = document.getElementById(EDITOR_ELEMENT_ID)?.clientWidth;
|
ElementIds.EditorColumn
|
||||||
|
)?.clientWidth;
|
||||||
if (editorWidth) {
|
if (editorWidth) {
|
||||||
this.setTagsContainerMaxWidth(editorWidth);
|
this.setTagsContainerMaxWidth(editorWidth);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user