把Poe聊天框变成Monaco Editor

1.把Poe聊天框变成Monaco Editor; 2.可调整输入框高度; 3. 回车改为Ctrl + Enter

当前为 2023-05-05 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

作者
mercutiojohn
评分
0 0 0
版本
0.2.1
创建于
2023-05-05
更新于
2023-05-05
大小
5.2 KB
许可证
MIT
适用于

en

This UserScript replaces the chat box in Poe website with Monaco Editor and provides the following features:

  1. Allow adjusting the input box height by dragging a slider.
  2. Change the Enter event to Ctrl+Enter for sending messages more conveniently.

Specifically, the script will:

  • Load the scripts and modules of Monaco Editor.
  • Find the textarea element in the chat box and hide it.
  • Create a slider as a tool for adjusting the input box height and add it before the input box.
  • Create a div element as an editor container and add it before the textarea. Then, instantiate the editor.
  • Synchronize the value of textarea with that of the editor when the editor content changes.
  • Add a Ctrl+Enter shortcut for sending messages.
  • Monitor the changes of the input box and editor container sizes, and adjust the editor container size dynamically.
  • Add an event listener for the slider and adjust the input box height dynamically when the slider value changes.

zh

主要功能:

  • 将 Poe 网站的聊天框替换为 Monaco Editor

并提供以下功能:

  • 可以通过拖动滑动条调整输入框的高度;
  • 将 Enter 事件改为 Ctrl+Enter,以便更方便地发送消息。

具体来说,该脚本会:

  • 加载 Monaco Editor 的脚本和模块;
  • 查找聊天框中的 textarea 元素,并将其隐藏;
  • 创建一个拖动条作为输入框的高度调整工具,并将其添加到输入框前面;
  • 创建一个 div 元素作为编辑器容器,将其添加到 textarea 前面,并将编辑器实例化;
  • 当编辑器内容发生变化时,同步更新 textarea 中的值;
  • 添加一个 Ctrl+Enter 的快捷键,以便更方便地发送消息;
  • 监听输入框和编辑器容器大小的变化,并调整编辑器容器的大小以适应新的大小;
  • 监听拖动条的变化,并在拖动条值发生变化时动态调整输入框的高度。