[英]How to accomplish live preview feature in a web app?
Basically, we are using a headless CMS to edit content on Website A. We are building our own CMS UI based on the headless CMS API (call this Website CMS).基本上,我们使用无头 CMS 来编辑网站 A 上的内容。我们正在基于无头 CMS API(称为网站 CMS)构建自己的 CMS UI。
Now, we have this page in Website CMS wherein you can edit the content on the left panel and get a preview of Website A on the right panel (mobile view).现在,我们在网站 CMS 中有这个页面,您可以在其中编辑左侧面板上的内容并在右侧面板(移动视图)上预览网站 A。
I haven't done anything like this before and I am wondering what's the best way to accomplish this and if there any libraries that help with this functionality.我以前没有做过这样的事情,我想知道实现这一点的最佳方法是什么,以及是否有任何库可以帮助实现此功能。
Some ideas:一些想法:
Main framework we are using is ReactJs for this CMS UI.我们为此 CMS UI 使用的主要框架是 ReactJs。
Option 2 is what I would do and wouldn't necessarily be duplicative.选项 2 是我会做的,不一定是重复的。
You would want users to be able to preview changes without publishing them.您希望用户能够在不发布更改的情况下预览更改。 So porting the real website wouldn't be compatible with that goal.
因此,移植真实网站与该目标不兼容。
Code duplication would probably be minimal.代码重复可能是最小的。 It would share most of the same code and it would also propagate much faster.
它将共享大部分相同的代码,并且传播速度也会更快。
you can establish a communication link between CMS and website A to exchange data.您可以在 CMS 和网站 A 之间建立通信链接以交换数据。
Options选项
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.