aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/formattedText/FormattedTextBox.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-09-17 10:46:27 -0400
committerbobzel <zzzman@gmail.com>2020-09-17 10:46:27 -0400
commit80bbbb3842cb89949d2b949ce8f5a2ed3921b112 (patch)
tree0041374a63f80325060a47dc0a259c750e526792 /src/client/views/nodes/formattedText/FormattedTextBox.tsx
parent5dc5009da8018d79620a42b75833d5b4335e0f56 (diff)
fixed deleting text links to work when there are multiple links in the same linkAnchor mark. addressed problem with text getting a negative height when its resized to fit content in a preview window when its also displayed in freeform.
Diffstat (limited to 'src/client/views/nodes/formattedText/FormattedTextBox.tsx')
-rw-r--r--src/client/views/nodes/formattedText/FormattedTextBox.tsx16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index 188ed03da..83012bab5 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -1233,7 +1233,8 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp
FormattedTextBoxComment.textBox = this;
const pcords = editor.posAtCoords({ left: e.clientX, top: e.clientY });
!this.props.isSelected(true) && editor.dispatch(editor.state.tr.setSelection(new TextSelection(editor.state.doc.resolve(pcords?.pos || 0))));
- FormattedTextBoxComment.update(editor, undefined, (e.target as any)?.className === "prosemirror-dropdownlink" ? (e.target as any).href : "");
+ const target = (e.target as any).parentElement; // hrefs are store don the database of the <a> node that wraps the hyerlink <span>
+ FormattedTextBoxComment.update(editor, undefined, target?.dataset?.targethrefs);
}
(e.nativeEvent as any).formattedHandled = true;
@@ -1487,7 +1488,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp
@action
tryUpdateHeight(limitHeight?: number) {
let scrollHeight = this.ProseRef?.scrollHeight || 0;
- if (this.props.renderDepth && this.layoutDoc._autoHeight && !this.props.ignoreAutoHeight && scrollHeight) { // if top === 0, then the text box is growing upward (as the overlay caption) which doesn't contribute to the height computation
+ if (this.props.renderDepth && this.layoutDoc._autoHeight && !this.props.ignoreAutoHeight && scrollHeight && !this.props.dontRegisterView) { // if top === 0, then the text box is growing upward (as the overlay caption) which doesn't contribute to the height computation
scrollHeight = scrollHeight * NumCast(this.layoutDoc._viewScale, 1);
if (limitHeight && scrollHeight > limitHeight) {
scrollHeight = limitHeight;
@@ -1506,18 +1507,9 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp
}, 10);
} else {
try {
- // let ele = this._boxRef.current;
- // while (ele && ele.className !== "documentView-contentsView") ele = ele.parentElement as any;
- // if (ele) {
- // const docHeight = Number(getComputedStyle(ele).height.replace("px", ""));
- // const boxHeight = Number(getComputedStyle(this._boxRef.current!).height.replace("px", ""));
- // const outer = docHeight - boxHeight - (this.props.ChromeHeight ? this.props.ChromeHeight() : 0);
- // this.rootDoc._height = newHeight + outer;
- // this.layoutDoc._nativeHeight = nh ? scrollHeight : undefined;
- // }
const boxHeight = Number(getComputedStyle(this._boxRef.current!).height.replace("px", ""));
const outer = this.rootDoc[HeightSym]() - boxHeight - (this.props.ChromeHeight ? this.props.ChromeHeight() : 0);
- this.rootDoc._height = newHeight + outer;
+ this.rootDoc._height = newHeight + Math.max(0, outer);
this.layoutDoc._nativeHeight = nh ? scrollHeight : undefined;
} catch (e) { console.log("Error in tryUpdateHeight"); }
}