Merge pull request #20081 from calixteman/signature_description
Add the l10n parameter when pasting a Signature annotation
This commit is contained in:
commit
e853a8f41a
@ -192,6 +192,11 @@ class SignatureEditor extends DrawingEditor {
|
||||
this.div.hidden = true;
|
||||
this._uiManager.getSignature(this);
|
||||
}
|
||||
} else {
|
||||
this.div.setAttribute(
|
||||
"data-l10n-args",
|
||||
JSON.stringify({ description: this.#description || "" })
|
||||
);
|
||||
}
|
||||
|
||||
if (_isCopy) {
|
||||
@ -217,6 +222,10 @@ class SignatureEditor extends DrawingEditor {
|
||||
|
||||
set description(description) {
|
||||
this.#description = description;
|
||||
if (!this.div) {
|
||||
return;
|
||||
}
|
||||
this.div.setAttribute("data-l10n-args", JSON.stringify({ description }));
|
||||
super.addEditToolbar().then(toolbar => {
|
||||
toolbar?.updateEditSignatureButton(description);
|
||||
});
|
||||
@ -256,7 +265,6 @@ class SignatureEditor extends DrawingEditor {
|
||||
const { outline } = (this.#signatureData = data);
|
||||
this.#isExtracted = outline instanceof ContourDrawOutline;
|
||||
this.description = description;
|
||||
this.div.setAttribute("data-l10n-args", JSON.stringify({ description }));
|
||||
let drawingOptions;
|
||||
if (this.#isExtracted) {
|
||||
drawingOptions = SignatureEditor.getDefaultDrawingOptions();
|
||||
@ -428,7 +436,7 @@ class SignatureEditor extends DrawingEditor {
|
||||
static async deserialize(data, parent, uiManager) {
|
||||
const editor = await super.deserialize(data, parent, uiManager);
|
||||
editor.#isExtracted = data.areContours;
|
||||
editor.#description = data.accessibilityData?.alt || "";
|
||||
editor.description = data.accessibilityData?.alt || "";
|
||||
editor.#signatureUUID = data.uuid;
|
||||
return editor;
|
||||
}
|
||||
|
||||
@ -365,6 +365,9 @@ describe("Signature Editor", () => {
|
||||
`${editorSelector} .altText.editDescription`,
|
||||
el => el.title
|
||||
);
|
||||
const originalL10nParameter = await page.$eval(editorSelector, el =>
|
||||
el.getAttribute("data-l10n-args")
|
||||
);
|
||||
|
||||
await copy(page);
|
||||
await paste(page);
|
||||
@ -376,6 +379,9 @@ describe("Signature Editor", () => {
|
||||
`${pastedEditorSelector} .altText.editDescription`,
|
||||
el => el.title
|
||||
);
|
||||
const pastedL10nParameter = await page.$eval(pastedEditorSelector, el =>
|
||||
el.getAttribute("data-l10n-args")
|
||||
);
|
||||
|
||||
expect(pastedRect)
|
||||
.withContext(`In ${browserName}`)
|
||||
@ -383,6 +389,9 @@ describe("Signature Editor", () => {
|
||||
expect(pastedDescription)
|
||||
.withContext(`In ${browserName}`)
|
||||
.toEqual(originalDescription);
|
||||
expect(pastedL10nParameter)
|
||||
.withContext(`In ${browserName}`)
|
||||
.toEqual(originalL10nParameter);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user