mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:07:36 +00:00
LibWeb: Begin implementing the Clipboard API
https://w3c.github.io/clipboard-apis/ This implements enough for navigator.clipboard.writeText(String).
This commit is contained in:
parent
78d455e231
commit
4b94b0b561
14 changed files with 303 additions and 0 deletions
33
Userland/Libraries/LibWeb/Clipboard/Clipboard.h
Normal file
33
Userland/Libraries/LibWeb/Clipboard/Clipboard.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibJS/Heap/GCPtr.h>
|
||||
#include <LibWeb/DOM/EventTarget.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
|
||||
namespace Web::Clipboard {
|
||||
|
||||
class Clipboard final : public DOM::EventTarget {
|
||||
WEB_PLATFORM_OBJECT(Clipboard, DOM::EventTarget);
|
||||
|
||||
public:
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Clipboard>> construct_impl(JS::Realm&);
|
||||
virtual ~Clipboard() override;
|
||||
|
||||
JS::NonnullGCPtr<JS::Promise> write_text(String);
|
||||
|
||||
private:
|
||||
Clipboard(JS::Realm&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue