diff options
| author | bobzel <zzzman@gmail.com> | 2024-09-18 20:46:38 -0400 | 
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2024-09-18 20:46:38 -0400 | 
| commit | d95730d904612640184ca6fdc00864b0c81b0c0c (patch) | |
| tree | 29176e9a4ea75fca8a146e8a49774fd1b1fb3fc9 /src/client/views/DocumentButtonBar.tsx | |
| parent | cf13604b06b8d8cf37f6e69f19a4092bf2c29d65 (diff) | |
lots of changes to fix dragging cards, integrate iconTags with other tags, sizing docs when selected to fit window,
Diffstat (limited to 'src/client/views/DocumentButtonBar.tsx')
| -rw-r--r-- | src/client/views/DocumentButtonBar.tsx | 44 | 
1 files changed, 13 insertions, 31 deletions
diff --git a/src/client/views/DocumentButtonBar.tsx b/src/client/views/DocumentButtonBar.tsx index 87dd5f45a..32bf67df1 100644 --- a/src/client/views/DocumentButtonBar.tsx +++ b/src/client/views/DocumentButtonBar.tsx @@ -9,7 +9,7 @@ import * as React from 'react';  import { FaEdit } from 'react-icons/fa';  import { returnFalse, returnTrue, setupMoveUpEvents, simulateMouseClick } from '../../ClientUtils';  import { emptyFunction } from '../../Utils'; -import { Doc } from '../../fields/Doc'; +import { Doc, DocListCast } from '../../fields/Doc';  import { Cast, DocCast } from '../../fields/Types';  import { DocUtils, IsFollowLinkScript } from '../documents/DocUtils';  import { CalendarManager } from '../util/CalendarManager'; @@ -28,7 +28,6 @@ import { DocumentLinksButton } from './nodes/DocumentLinksButton';  import { DocumentView } from './nodes/DocumentView';  import { OpenWhere } from './nodes/OpenWhere';  import { DashFieldView } from './nodes/formattedText/DashFieldView'; -import { DocData } from '../../fields/DocSymbols';  @observer  export class DocumentButtonBar extends ObservableReactComponent<{ views: () => (DocumentView | undefined)[]; stack?: unknown }> { @@ -287,44 +286,27 @@ export class DocumentButtonBar extends ObservableReactComponent<{ views: () => (      get keywordButton() {          const targetDoc = this.view0?.Document; -        const metaBtn = (name: string, icon: IconProp) => { -            const tooltip = `Toggle ${name}`; -            return ( -                <Tooltip title={<div className="dash-tooltip">{tooltip}</div>}> -                    <div className="documentButtonBar-pinIcon"> -                        <FontAwesomeIcon -                            className="documentdecorations-icon" -                            style={{ width: 20 }} -                            key={icon.toString()} -                            size="sm" -                            icon={icon} -                            onClick={() => { -                                if (name === 'tags') { -                                    targetDoc && (targetDoc[DocData].showIconTags = !targetDoc[DocData].showIconTags); -                                } else { -                                    targetDoc && (targetDoc[DocData].showLabels = !targetDoc[DocData].showLabels); -                                } -                            }} -                        /> -                    </div> -                </Tooltip> -            ); -        }; -          return !targetDoc ? null : (              <div className="documentButtonBar-icon"> -                <div className="documentButtonBar-pinTypes" style={{ width: '40px' }}> +                {/* <div className="documentButtonBar-pinTypes" style={{ width: '40px' }}>                      {metaBtn('tags', 'star')}                      {metaBtn('keywords', 'id-card')} -                </div> +                </div> */}                  <Tooltip title={<div className="dash-keyword-button">Open keyword menu</div>}>                      <div                          className="documentButtonBar-icon"                          style={{ color: 'white' }} -                        onClick={() => { -                            // targetDoc[DocData].showIconTags = !targetDoc[DocData].showIconTags; -                        }}> +                        onClick={undoable(e => { +                            const showing = DocumentView.Selected().some(dv => dv.showTags); +                            DocumentView.Selected().forEach(dv => { +                                dv.layoutDoc._layout_showTags = !showing; +                                if (e.shiftKey) +                                    DocListCast(dv.Document[Doc.LayoutFieldKey(dv.Document) + '_annotations']).forEach(doc => { +                                        if (doc.face) doc.hidden = showing; +                                    }); +                            }); +                        }, 'show Doc tags')}>                          <FontAwesomeIcon className="documentdecorations-icon" icon="tag" />                      </div>                  </Tooltip>  | 
