aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/formattedText/FormattedTextBox.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-02-28 14:47:27 -0500
committerbobzel <zzzman@gmail.com>2023-02-28 14:47:27 -0500
commitf1dea8f31886c1e5e3d8bb772434009803b8fb8a (patch)
tree241e43ba381b86e02a68817fcdb0c13dfce5cb5a /src/client/views/nodes/formattedText/FormattedTextBox.tsx
parent1161194527da1b185873098a9237d3d1e841b337 (diff)
added view spec capture options to complete link
Diffstat (limited to 'src/client/views/nodes/formattedText/FormattedTextBox.tsx')
-rw-r--r--src/client/views/nodes/formattedText/FormattedTextBox.tsx15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index 2226d10b4..123499647 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -63,6 +63,7 @@ import { schema } from './schema_rts';
import { SummaryView } from './SummaryView';
import applyDevTools = require('prosemirror-dev-tools');
import React = require('react');
+import { PinProps, PresBox } from '../trails';
const translateGoogleApi = require('translate-google-api');
export const GoogleRef = 'googleDocId';
@@ -229,7 +230,14 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FieldViewProps
}
}
- getAnchor = (addAsAnnotation: boolean) => this.makeLinkAnchor(undefined, OpenWhere.addRight, undefined, 'Anchored Selection', false, addAsAnnotation);
+ getAnchor = (addAsAnnotation: boolean, pinProps?: PinProps) => {
+ if (!pinProps) return this.rootDoc;
+ const anchor = Docs.Create.TextanchorDocument({ annotationOn: this.rootDoc, unrendered: true });
+ this.addDocument(anchor);
+ this.makeLinkAnchor(anchor, OpenWhere.addRight, undefined, 'Anchored Selection', false, addAsAnnotation);
+ PresBox.pinDocView(anchor, { pinDocLayout: pinProps?.pinDocLayout, pinData: { ...(pinProps?.pinData ?? {}), scrollable: true } }, this.rootDoc);
+ return anchor;
+ };
@action
setupAnchorMenu = () => {
@@ -988,8 +996,9 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FieldViewProps
setTimeout(() => clearStyleSheetRules(FormattedTextBox._highlightStyleSheet), Math.max(this._focusSpeed || 0, 3000));
}
}
-
- return this._didScroll ? this._focusSpeed : didToggle ? 1 : undefined; // if we actually scrolled, then return some focusSpeed
+ const finalFocusSpeed = this._didScroll ? this._focusSpeed : didToggle ? 1 : undefined;
+ PresBox.restoreTargetDocView(docView, textAnchor, finalFocusSpeed ?? 0);
+ return finalFocusSpeed; // if we actually scrolled, then return some focusSpeed
};
// if the scroll height has changed and we're in autoHeight mode, then we need to update the textHeight component of the doc.