浏览代码

Support clipboard copy/paste on web

pull/2352/head
Ray 3 年前
父节点
当前提交
6e9ec253c8
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. +7
    -2
      src/rcore.c

+ 7
- 2
src/rcore.c 查看文件

@ -1903,9 +1903,11 @@ const char *GetClipboardText(void)
{
#if defined(PLATFORM_DESKTOP)
return glfwGetClipboardString(CORE.Window.handle);
#else
return NULL;
#endif
#if defined(PLATFORM_WEB)
return emscripten_run_script_string("navigator.clipboard.readText()");
#endif
return NULL;
}
// Set clipboard text content
@ -1914,6 +1916,9 @@ void SetClipboardText(const char *text)
#if defined(PLATFORM_DESKTOP)
glfwSetClipboardString(CORE.Window.handle, text);
#endif
#if defined(PLATFORM_WEB)
emscripten_run_script(TextFormat("navigator.clipboard.writeText('%s')", text));
#endif
}
// Show mouse cursor

正在加载...
取消
保存