Only show popups when they've some contents to display
Chrome, Edge and Acrobat do that.
This commit is contained in:
parent
5653458b51
commit
96216de410
@ -185,8 +185,8 @@ class AnnotationElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static _hasPopupData({ titleObj, contentsObj, richText }) {
|
static _hasPopupData({ contentsObj, richText }) {
|
||||||
return !!(titleObj?.str || contentsObj?.str || richText?.str);
|
return !!(contentsObj?.str || richText?.str);
|
||||||
}
|
}
|
||||||
|
|
||||||
get _isEditable() {
|
get _isEditable() {
|
||||||
|
|||||||
@ -664,7 +664,7 @@ describe("ResetForm action", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("Rotated annotation and its clickable area", () => {
|
describe("Rotated annotation and its clickable area", () => {
|
||||||
describe("issue14438.pdf", () => {
|
describe("rotated_ink.pdf", () => {
|
||||||
let pages;
|
let pages;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
|||||||
@ -27,7 +27,6 @@ import {
|
|||||||
getFirstSerialized,
|
getFirstSerialized,
|
||||||
getRect,
|
getRect,
|
||||||
getSerialized,
|
getSerialized,
|
||||||
hover,
|
|
||||||
isCanvasMonochrome,
|
isCanvasMonochrome,
|
||||||
kbBigMoveDown,
|
kbBigMoveDown,
|
||||||
kbBigMoveLeft,
|
kbBigMoveLeft,
|
||||||
@ -1166,16 +1165,6 @@ describe("FreeText Editor", () => {
|
|||||||
await Promise.all(
|
await Promise.all(
|
||||||
pages.map(async ([browserName, page]) => {
|
pages.map(async ([browserName, page]) => {
|
||||||
await page.waitForSelector("[data-annotation-id='23R']");
|
await page.waitForSelector("[data-annotation-id='23R']");
|
||||||
// Cannot use page.hover with Firefox on Mac because of a bug.
|
|
||||||
// TODO: remove this when we switch to BiDi.
|
|
||||||
await hover(page, "[data-annotation-id='23R']");
|
|
||||||
|
|
||||||
// Wait for the popup to be displayed.
|
|
||||||
await page.waitForFunction(
|
|
||||||
() =>
|
|
||||||
document.querySelector("[data-annotation-id='popup_23R']")
|
|
||||||
.hidden === false
|
|
||||||
);
|
|
||||||
|
|
||||||
// Enter in editing mode.
|
// Enter in editing mode.
|
||||||
await switchToFreeText(page);
|
await switchToFreeText(page);
|
||||||
@ -1183,15 +1172,7 @@ describe("FreeText Editor", () => {
|
|||||||
// Disable editing mode.
|
// Disable editing mode.
|
||||||
await switchToFreeText(page, /* disable = */ true);
|
await switchToFreeText(page, /* disable = */ true);
|
||||||
|
|
||||||
// TODO: remove this when we switch to BiDi.
|
await page.waitForSelector("[data-annotation-id='23R']");
|
||||||
await hover(page, "[data-annotation-id='23R']");
|
|
||||||
|
|
||||||
// Wait for the popup to be displayed.
|
|
||||||
await page.waitForFunction(
|
|
||||||
() =>
|
|
||||||
document.querySelector("[data-annotation-id='popup_23R']")
|
|
||||||
.hidden === false
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -623,11 +623,6 @@ async function firstPageOnTop(page) {
|
|||||||
return awaitPromise(handle);
|
return awaitPromise(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function hover(page, selector) {
|
|
||||||
const rect = await getRect(page, selector);
|
|
||||||
await page.mouse.move(rect.x + rect.width / 2, rect.y + rect.height / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function setCaretAt(page, pageNumber, text, position) {
|
async function setCaretAt(page, pageNumber, text, position) {
|
||||||
await page.evaluate(
|
await page.evaluate(
|
||||||
(pageN, string, pos) => {
|
(pageN, string, pos) => {
|
||||||
@ -912,7 +907,6 @@ export {
|
|||||||
getSerialized,
|
getSerialized,
|
||||||
getSpanRectFromText,
|
getSpanRectFromText,
|
||||||
getXY,
|
getXY,
|
||||||
hover,
|
|
||||||
isCanvasMonochrome,
|
isCanvasMonochrome,
|
||||||
kbBigMoveDown,
|
kbBigMoveDown,
|
||||||
kbBigMoveLeft,
|
kbBigMoveLeft,
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user