mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 16:15:10 +00:00

This patch updates the Page::keydown_event event handler to implement crude Unicode support. It implements new method in EditEventHandler to more easily handle deleting a single character after the cursor. Furthermore, it makes use of the previously implemented methods to increment and decrement the cursor position, which take into account that Unicode codepoint may be multiple bytes wide. This means it is now possible to mostly edit Unicode in editable DOM nodes without any crashes. :^)
31 lines
562 B
C++
31 lines
562 B
C++
/*
|
|
* Copyright (c) 2020-2021, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Types.h>
|
|
#include <LibWeb/Forward.h>
|
|
|
|
namespace Web {
|
|
|
|
class EditEventHandler {
|
|
public:
|
|
explicit EditEventHandler(Frame& frame)
|
|
: m_frame(frame)
|
|
{
|
|
}
|
|
|
|
virtual ~EditEventHandler() = default;
|
|
|
|
virtual void handle_delete_character_after(const DOM::Position&);
|
|
virtual void handle_delete(DOM::Range&);
|
|
virtual void handle_insert(DOM::Position, u32 code_point);
|
|
|
|
private:
|
|
Frame& m_frame;
|
|
};
|
|
|
|
}
|