mtasa-blue icon indicating copy to clipboard operation
mtasa-blue copied to clipboard

Copying text from CEF Browser shows Chinese characters in console

Open Xenius97 opened this issue 1 year ago • 1 comments

Describe the bug

https://github.com/user-attachments/assets/9bbcfe8e-f12c-42eb-a402-87ad302884e3

(if you paste it normally to somewhere else, it works fine)

Steps to reproduce

Start this resource cefbug.zip

Version

Multi Theft Auto v1.6-release-22684

Security Policy

  • [X] I have read and understood the Security Policy and this issue is not security related.

Xenius97 avatar Sep 14 '24 13:09 Xenius97

Old bug yes

Fernando-A-Rocha avatar Sep 14 '24 15:09 Fernando-A-Rocha

use this

JS :

document.addEventListener("copy", function (event) {
    event.preventDefault();
    
    let selectedText = window.getSelection().toString();
    
    if (selectedText) {
        mta.triggerEvent("Copy", selectedText);
    }
});

LUA (C-SIDE) :

addEvent("Copy",true)
addEventHandler("Copy",root,fucntion(text)
  setClipboard(text)
end)

AliiiAm avatar Mar 01 '25 05:03 AliiiAm