mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
JS - Add support for display property
- in annotation_layer, move common properties treatment in a common method instead having duplicated code in each widget.
This commit is contained in:
parent
afb8c4fd25
commit
af125cd299
6 changed files with 197 additions and 141 deletions
|
@ -14,6 +14,13 @@
|
|||
*/
|
||||
|
||||
class ProxyHandler {
|
||||
constructor() {
|
||||
// Don't dispatch an event for those properties.
|
||||
// - delay: allow to delay field redraw until delay is set to false.
|
||||
// Likely it's useless to implement that stuff.
|
||||
this.nosend = new Set(["delay"]);
|
||||
}
|
||||
|
||||
get(obj, prop) {
|
||||
// script may add some properties to the object
|
||||
if (prop in obj._expandos) {
|
||||
|
@ -49,7 +56,12 @@ class ProxyHandler {
|
|||
if (typeof prop === "string" && !prop.startsWith("_") && prop in obj) {
|
||||
const old = obj[prop];
|
||||
obj[prop] = value;
|
||||
if (obj._send && obj._id !== null && typeof old !== "function") {
|
||||
if (
|
||||
!this.nosend.has(prop) &&
|
||||
obj._send &&
|
||||
obj._id !== null &&
|
||||
typeof old !== "function"
|
||||
) {
|
||||
const data = { id: obj._id };
|
||||
data[prop] = obj[prop];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue