Skip to content

Add Clipboard Interfaces to idlSources #639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ interface ClientQueryOptions {
type?: ClientTypes;
}

interface ClipboardEventInit extends EventInit {
clipboardData?: DataTransfer | null;
}

interface CloseEventInit extends EventInit {
code?: number;
reason?: string;
Expand Down Expand Up @@ -3260,21 +3264,26 @@ declare var ClientRectList: {
new(): ClientRectList;
};

interface Clipboard extends EventTarget {
readText(): Promise<string>;
writeText(data: string): Promise<void>;
}

declare var Clipboard: {
prototype: Clipboard;
new(): Clipboard;
};

/** The ClipboardEvent interface represents events providing information related to modification of the clipboard, that is cut, copy, and paste events. */
interface ClipboardEvent extends Event {
readonly clipboardData: DataTransfer;
readonly clipboardData: DataTransfer | null;
}

declare var ClipboardEvent: {
prototype: ClipboardEvent;
new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent;
};

interface ClipboardEventInit extends EventInit {
data?: string;
dataType?: string;
}

/** A CloseEvent is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute. */
interface CloseEvent extends Event {
readonly code: number;
Expand Down Expand Up @@ -10494,6 +10503,7 @@ declare var NavigationPreloadManager: {
interface Navigator extends NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, MSNavigatorDoNotTrack, MSFileSaver, NavigatorBeacon, NavigatorConcurrentHardware, NavigatorUserMedia, NavigatorLanguage, NavigatorStorage, NavigatorAutomationInformation {
readonly activeVRDisplays: ReadonlyArray<VRDisplay>;
readonly authentication: WebAuthentication;
readonly clipboard: Clipboard;
readonly cookieEnabled: boolean;
readonly doNotTrack: string | null;
gamepadInputEmulation: GamepadInputEmulationType;
Expand Down
20 changes: 0 additions & 20 deletions inputfiles/addedTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -832,26 +832,6 @@
}
}
},
"ClipboardEventInit": {
"exposed": "Window",
"name": "ClipboardEventInit",
"extends": "EventInit",
"properties": {
"property": {
"data": {
"name": "data",
"override-type": "string",
"required": 0
},
"dataType": {
"name": "dataType",
"override-type": "string",
"required": 0
}
}
},
"no-interface-object": "1"
},
"IDBArrayKey": {
"name": "IDBArrayKey",
"extends": "Array<IDBValidKey>",
Expand Down
23 changes: 23 additions & 0 deletions inputfiles/idl/Clipboard.widl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
dictionary ClipboardEventInit : EventInit {
DataTransfer? clipboardData = null;
};

[Constructor(DOMString type, optional ClipboardEventInit eventInitDict), Exposed=Window]
interface ClipboardEvent : Event {
readonly attribute DataTransfer? clipboardData;
};

partial interface Navigator {
[SecureContext, SameObject] readonly attribute Clipboard clipboard;
};

[SecureContext, Exposed=Window] interface Clipboard : EventTarget {
Promise<DataTransfer> read();
Promise<DOMString> readText();
Promise<void> write(DataTransfer data);
Promise<void> writeText(DOMString data);
};

dictionary ClipboardPermissionDescriptor : PermissionDescriptor {
boolean allowWithoutGesture = false;
};
4 changes: 4 additions & 0 deletions inputfiles/idlSources.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[
{
"url": "https://www.w3.org/TR/clipboard-apis/",
"title": "Clipboard"
},
{
"url": "https://compat.spec.whatwg.org/",
"title": "Compatibility",
Expand Down
8 changes: 0 additions & 8 deletions inputfiles/overridingTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -1342,14 +1342,6 @@
}
}
},
"ClipboardEvent": {
"name": "ClipboardEvent",
"constructor": {
"override-signatures": [
"new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent"
]
}
},
"Storage": {
"name": "Storage",
"methods": {
Expand Down
8 changes: 8 additions & 0 deletions inputfiles/removedTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
},
"interfaces": {
"interface": {
"Clipboard": {
"methods": {
"method": {
"read": null,
"write": null
}
}
},
"Console": {
"methods": {
"method": {
Expand Down