Upgrade @codemirror/view and height fixes
This commit is contained in:
@@ -58,7 +58,7 @@ export class IFrameWidget extends WidgetType {
|
||||
|
||||
get estimatedHeight(): number {
|
||||
const cachedHeight = this.client.getCachedWidgetHeight(this.bodyText);
|
||||
// console.log("Calling estimated height", cachedHeight);
|
||||
console.log("Calling estimated height", this.bodyText, cachedHeight);
|
||||
return cachedHeight > 0 ? cachedHeight : 150;
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ export class MarkdownWidget extends WidgetType {
|
||||
setTimeout(() => {
|
||||
this.client.setWidgetCache(
|
||||
this.bodyText,
|
||||
{ height: div.clientHeight, html, buttons: widgetContent.buttons },
|
||||
{ height: div.offsetHeight, html, buttons: widgetContent.buttons },
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -185,7 +185,7 @@ export class MarkdownWidget extends WidgetType {
|
||||
|
||||
get estimatedHeight(): number {
|
||||
const cacheItem = this.client.getWidgetCache(this.bodyText);
|
||||
// console.log("Calling estimated height", cacheItem);
|
||||
console.log("Calling estimated height", this.bodyText, cacheItem);
|
||||
return cacheItem ? cacheItem.height : -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class TableViewWidget extends WidgetType {
|
||||
const height = this.client.getCachedWidgetHeight(
|
||||
`table:${this.tableBodyText}`,
|
||||
);
|
||||
console.log("Calling estimated height for table", height);
|
||||
// console.log("Calling estimated height for table", height);
|
||||
return height;
|
||||
}
|
||||
|
||||
|
||||
+17
-1
@@ -28,11 +28,27 @@ export class LinkWidget extends WidgetType {
|
||||
const anchor = document.createElement("a");
|
||||
anchor.className = this.options.cssClass;
|
||||
anchor.textContent = this.options.text;
|
||||
anchor.addEventListener("click", (e) => {
|
||||
|
||||
// Mouse handling
|
||||
anchor.addEventListener("mousedown", (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
this.options.callback(e);
|
||||
});
|
||||
|
||||
// Touch handling
|
||||
let touchCount = 0;
|
||||
anchor.addEventListener("touchmove", () => {
|
||||
touchCount++;
|
||||
});
|
||||
anchor.addEventListener("touchend", (e) => {
|
||||
if (touchCount === 0) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
this.options.callback(new MouseEvent("click", e));
|
||||
}
|
||||
touchCount = 0;
|
||||
});
|
||||
anchor.setAttribute("title", this.options.title);
|
||||
anchor.href = this.options.href || "#";
|
||||
return anchor;
|
||||
|
||||
Reference in New Issue
Block a user