发布: OpenWrt 路由器改纯 AP 模式记录(Cudy TR3000 + 中兴 F50)
This commit is contained in:
1 parent
097601a08f
commit
5cf6798e61
11 files changed
+152
No files matched your search
@@ -84,6 +84,26 @@ export default function PostEditor({ initialData, isEditing }: PostEditorProps)
|
||||
}
|
||||
};
|
||||
|
||||
const handlePaste = (e: React.ClipboardEvent<HTMLTextAreaElement>) => {
|
||||
const text = e.clipboardData.getData("text/plain");
|
||||
if (!text) return;
|
||||
|
||||
e.preventDefault();
|
||||
const el = e.currentTarget;
|
||||
const start = el.selectionStart;
|
||||
const end = el.selectionEnd;
|
||||
const nextContent = content.slice(0, start) + text + content.slice(end);
|
||||
const nextCursor = start + text.length;
|
||||
|
||||
setContent(nextContent);
|
||||
setSelectedText("");
|
||||
requestAnimationFrame(() => {
|
||||
el.focus();
|
||||
el.selectionStart = nextCursor;
|
||||
el.selectionEnd = nextCursor;
|
||||
});
|
||||
};
|
||||
|
||||
const handleImageUpload = async (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const file = e.target.files?.[0];
|
||||
if (!file) return;
|
||||
@@ -305,6 +325,7 @@ export default function PostEditor({ initialData, isEditing }: PostEditorProps)
|
||||
ref={textareaRef}
|
||||
value={content}
|
||||
onChange={(e) => setContent(e.target.value)}
|
||||
onPaste={handlePaste}
|
||||
onSelect={handleSelectionChange}
|
||||
onKeyUp={handleSelectionChange}
|
||||
onMouseUp={handleSelectionChange}
|
||||
|
||||
Reference in new issue
Block a user