diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2019-04-10 23:44:10 -0400 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2019-04-10 23:44:10 -0400 |
commit | a006717f7a847c1a230a334fa645b7382aa067d2 (patch) | |
tree | 6b2dd066fa966ef3ebdecb8aaa1757489e83a6b7 /src | |
parent | a04f690bf0f8104b48a8493905ee083f9b1504dc (diff) |
switched text proxy to appear on selection, not pointerdown
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/nodes/FormattedTextBox.tsx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx index 69086df42..17125a298 100644 --- a/src/client/views/nodes/FormattedTextBox.tsx +++ b/src/client/views/nodes/FormattedTextBox.tsx @@ -42,6 +42,7 @@ export class FormattedTextBox extends React.Component<FieldViewProps> { private _editorView: Opt<EditorView>; private _reactionDisposer: Opt<IReactionDisposer>; private _inputReactionDisposer: Opt<IReactionDisposer>; + private _proxyReactionDisposer: Opt<IReactionDisposer>; constructor(props: FieldViewProps) { super(props); @@ -92,6 +93,11 @@ export class FormattedTextBox extends React.Component<FieldViewProps> { this.setupEditor(config); } ); + } else { + this._proxyReactionDisposer = reaction(() => this.props.isSelected(), + () => + this.props.isSelected() && Main.Instance.SetTextDoc(this.props.Document, this._ref.current!, this.props.ScreenToLocalTransform()) + ); } this._reactionDisposer = reaction( @@ -141,6 +147,9 @@ export class FormattedTextBox extends React.Component<FieldViewProps> { if (this._inputReactionDisposer) { this._inputReactionDisposer(); } + if (this._proxyReactionDisposer) { + this._proxyReactionDisposer(); + } } shouldComponentUpdate() { @@ -154,7 +163,7 @@ export class FormattedTextBox extends React.Component<FieldViewProps> { // doc.SetData(fieldKey, e.target.value, RichTextField); } onPointerDown = (e: React.PointerEvent): void => { - if (e.buttons === 1 && this.props.isSelected() && !e.altKey && !e.ctrlKey && !e.metaKey) { + if (e.button === 1 && this.props.isSelected() && !e.altKey && !e.ctrlKey && !e.metaKey) { e.stopPropagation(); } } @@ -162,10 +171,6 @@ export class FormattedTextBox extends React.Component<FieldViewProps> { if (e.buttons === 1 && this.props.isSelected() && !e.altKey) { e.stopPropagation(); } - if (this.props.fieldKey !== KeyStore.Archives) { - e.preventDefault(); - Main.Instance.SetTextDoc(this.props.Document, this._ref.current!, this.props.ScreenToLocalTransform()); - } } onFocused = (e: React.FocusEvent): void => { |