Embed URL
By inheriting this plugin, you can embed a specific URL to realize the preview function.
$ yarn add @aomao/plugin-embed
Add to engine
import Engine, {EngineInterface} from'@aomao/engine';import Embed, {EmbedComponent} from'@aomao/plugin-embed';new Engine(...,{ plugins:[ Embed], cards:[ EmbedComponent ]})
Embed
optional//Use configurationnew Engine(...,{config:{[Embed.pluginName]:{//...Related configuration}}})
renderBefore
: return some information before rendering
renderBefore?:(url: string) => {url?: stringheight?: numbercollapsed?: booleanico?: stringtitle?: stringisResize?: boolean}
If you need to extend the returned information more, you can inherit the EmbedComponent
class, and then override the handleSubmit
method
Parameter 1: The url to be loaded, optional, the current input url interface will be displayed by default Parameter 2: icon, the default is a web icon Parameter 3: Title, default is url Parameter 4: Whether to collapse, the default is false Parameter 5: Whether the size can be changed, the default is true
engine.command.execute(Math.pluginName,'https://editor.aomao.com', // optional'ico icon','Display title',false,true,);