diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/util/UndoManager.ts | 2 | ||||
-rw-r--r-- | src/client/views/MainView.tsx | 2 | ||||
-rw-r--r-- | src/client/views/search/SearchBox.tsx | 5 |
3 files changed, 7 insertions, 2 deletions
diff --git a/src/client/util/UndoManager.ts b/src/client/util/UndoManager.ts index 0f7ad6d0a..569ad8ab4 100644 --- a/src/client/util/UndoManager.ts +++ b/src/client/util/UndoManager.ts @@ -76,7 +76,7 @@ export namespace UndoManager { export let undoStack: UndoBatch[] = observable([]); export let redoStack: UndoBatch[] = observable([]); let currentBatch: UndoBatch | undefined; - let batchCounter = 0; + export let batchCounter = 0; let undoing = false; let tempEvents: UndoEvent[] | undefined = undefined; diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index 69354020b..1730007a5 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -58,6 +58,7 @@ import { PropertiesView } from './PropertiesView'; import { SearchBox } from './search/SearchBox'; import { TraceMobx } from '../../fields/util'; import { SelectionManager } from '../util/SelectionManager'; +import { UndoManager } from '../util/UndoManager'; const _global = (window /* browser */ || global /* node */) as any; @observer @@ -174,6 +175,7 @@ export class MainView extends React.Component { initEventListeners = () => { window.addEventListener("drop", e => e.preventDefault(), false); // prevent default behavior of navigating to a new web page window.addEventListener("dragover", e => e.preventDefault(), false); + document.addEventListener("pointermove", action(e => SearchBox.Instance._undoBackground = UndoManager.batchCounter ? "#000000a8" : undefined)); document.addEventListener("pointerdown", this.globalPointerDown); document.addEventListener("click", (e: MouseEvent) => { if (!e.cancelBubble) { diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index 6cfd1f9d0..3adeb6133 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -25,6 +25,7 @@ import { FieldView, FieldViewProps } from '../nodes/FieldView'; import "./SearchBox.scss"; import { undoBatch } from "../../util/UndoManager"; import { DocServer } from "../../DocServer"; +import { MainView } from "../MainView"; export const searchSchema = createSchema({ Document: Doc }); @@ -53,6 +54,8 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc private newsearchstring = ""; private collectionRef = React.createRef<HTMLDivElement>(); + + @observable _undoBackground: string | undefined = ""; @observable _icons: string[] = this._allIcons; @observable _results: [Doc, string[], string[]][] = []; @observable _visibleElements: JSX.Element[] = []; @@ -498,7 +501,7 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc const myDashboards = DocListCast(CurrentUserUtils.MyDashboards.data); return ( <div style={{ pointerEvents: "all" }} className="searchBox-container"> - <div className="searchBox-bar"> + <div className="searchBox-bar" style={{ background: SearchBox.Instance._undoBackground }}> <div className="searchBox-lozenges" > <div className="searchBox-lozenge-user"> {`${Doc.CurrentUserEmail}`} |