跪拜 Guibai
← Back to the summary

Tencent Open-Sources tmagic-editor: Drag-and-Drop Visual Page Builder for H5, PC, and TV

A Freelancer's Dream Tool: Tencent's Low-Code Platform is Now Open Source, Build by Drag-and-Drop~

Table of Contents


Tencent's tmagic-editor is a WYSIWYG page visual editor that implements zero-code/low-code page generation, quickly building a visual page production platform, allowing non-technical personnel to self-service generate H5 pages, PC pages, TV pages through drag-and-drop and configuration, greatly reducing page production costs.

The following is a schematic diagram of the visual page-building platform built by Tencent Video VIP business based on tmagic-editor. tmagic-editor has been used in more than a dozen Tencent businesses, such as Tencent Video VIP, Love Playing Games, Cloud Audio Video Aurora, Tencent Meeting, etc., producing and publishing hundreds of pages every month.

Schematic of Tencent Video VIP Visual Page Building Platform

Schematic diagram of Tencent Video VIP visual page building platform

Page production process based on visual editor

  1. Component development mainly refers to business components, such as image components, lottery components, login plug-ins, etc. tmagic-editor itself does not provide business components; business components are developed by businesses using tmagic-editor according to their own business needs. A business component is developed once and reused across multiple pages. Business components should provide some configuration options to ensure flexibility and meet customization needs when different pages use the component. Business components can be implemented with different front-end frameworks, such as vue2, vue3, react.

  2. Arrangement refers to completing page editing by dragging and configuring components, mainly done by non-technical personnel.

  3. Save and publish. Technically, this stage is divided into generating DSL, building, and deploying. Generating DSL: the editor and the generated page are decoupled through DSL. The product of configuring a page in the editor is a serialized JS object page description file. This object is described using a JS schema, describing the basic information of the page, the component information it contains, and the logic between components. Build: the build module packages and builds components based on runtime code to generate html, js, and css files. The runtime used in the build can be chosen from different front-end frameworks according to business needs. tmagic-editor provides three runtimes by default: vue2, vue3, and react. Deploy: the html, js, css, and js schema description files generated in the previous steps are deployed to the business's own servers.

What tmagic-editor provides

Visual editor

tmagic-editor visual editor interface

tmagic-editor visual editor interface

As shown above, this is the tmagic-editor visual editor, which is implemented based on vue3. It includes a left sidebar, component list display, the component tree of selected components, the central page drag-and-drop canvas area (also called the simulator), the right form configuration area, the canvas control area at the top center (zoom in/out, grid line visibility), preview, save, view source code (the JS object described by the JS schema), and page add/delete in the bottom area. The editor has extension capabilities; businesses can add version management, publishing, and other features to the sidebar and top bar as needed.

runtime

The runtime concept is important for understanding how tmagic-editor pages run. A runtime is the execution environment that hosts tmagic-editor pages. Visual pages need to be built and rendered in the tmagic-editor editor, achieving WYSIWYG through the simulator. After building, save the configuration and publish, then render into the real page users access. Two different runtimes are involved: the simulator in the editor and the real page opened on the terminal.

Because the simulator in the tmagic-editor editor is rendered via iframe, it can be framework-decoupled from the tmagic-editor platform itself, so runtimes can also be developed with different frameworks. Currently tmagic-editor provides runtimes for vue2/vue3 and react.

Each runtime serves not only as the rendering environment in different scenarios, but also as the packaging and building carrier for different environments. In the tmagic-editor sample code, packaging is based on the runtime.

Admin demo

The editor can edit, configure, and publish a page, but we also need an admin panel to manage the page list. We provide an admin demo to help businesses quickly build a complete visual building platform. The admin panel provides the following capabilities:

What businesses using tmagic-editor need to do

Develop business components

tmagic-editor does not provide business components; businesses need to develop corresponding business components based on their own business scenarios, such as lottery components, video player components, etc. tmagic-editor's universal design allows businesses to develop components using different front-end frameworks. tmagic-editor officially provides vue2/vue3 and react runtimes, meaning businesses can directly use these frameworks to develop components. If a business wants to use another framework, it needs to develop the corresponding runtime.

Develop business plugins (optional)

Plugins supplement page logic and behavior. They generally do not render specific content in the simulator (unless a plugin generates components and inserts them into the page). Usually we use plugins to implement functions like login, page environment detection, request interceptors, etc. Like components, they can be implemented with different front-end frameworks.

Deploy the visual building service

tmagic-editor provides open-source code, not a SaaS service, so businesses need to deploy the visual building platform service themselves.

Build and publish pages

Businesses need to manage their own component library. During the publishing phase, based on the obtained page JS schema description file, they package and build using the runtime, and deploy the build artifacts to their own servers/CDN.

Other customization needs

If there are extension needs for the editor, the editor already reserves extension capabilities, and businesses can develop corresponding extensions. tmagic-editor provides vue2/vue3 and react runtimes; businesses can modify the runtime or develop runtimes for other front-end frameworks.

tmagic-editor capabilities

tmagic-editor capabilities

tmagic-editor capabilities

How to learn about tmagic-editor

Open source address: github.com/Tencent/tmagic-editor Online documentation: tencent.github.io/tmagic-editor/docs/ Online experience: tencent.github.io/tmagic-editor/playground/index.html