Facebook 之类的状态输入

发布于 2024-09-10 04:32:56 字数 380 浏览 2 评论 0原文

是否有现成的类似 Facebook 中状态输入的输入? 我的意思是,他们使用了一个 contenteditable div,并且他们把它包装得很好。他们可以调整它的大小(在焦点/模糊时),它会继续自动换行和扩展,当您在他们的输入中键入一个非常长的单词时,该单词无法换行,它会保留在 div 内并且不会与其他内容重叠它附近的元素..

请帮助我在 contenteditable div 上做这两件事,或者如果您知道现成的,请分享。

谢谢。

PS我确实尝试自己做,而不仅仅是懒惰。我几乎成功地阻止了重叠,但在调整高度大小后未能使 div 保持内容可编辑(自动换行、可扩展)。我也想过尝试了解 Facebook 自己是如何做到这一点的,但对于新手来说很难理解他们的代码,因为它们都是缩小的、压缩的等等。

Is there a ready similar input like the status input in Facebook?
I mean, they use a contenteditable div, and they've wrapped it all pretty good. They can resize it (on focus/blur), an it continues word-wrapping and expanding, and when you type a really long word in their input, which can't be wrapped, it stays inside the div and doesn't overlap other elements near it..

Please help me doing those two things on a contenteditable div, or if you know of a ready one, please share.

Thanks.

P.S. I did try doing it myself an not just being lazy. I almost succeeded in stopping the overlap, but didn't manage to make the div stay contenteditable(word-wrap, expandable) after a height resize. I also thought of trying to understand how Facebook do it by myself, but it's pretty hard for a newbie to understand their code as it's all minified and gzipped and whatnot.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

筑梦 2024-09-17 04:32:56

他们(Facebook)似乎正在使用这个 CSS

overflow-x: hidden;
overflow-y: auto;

They (Facebook) seem to be using this CSS

overflow-x: hidden;
overflow-y: auto;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文