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