New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@aomao/plugin-embed

Package Overview
Dependencies
Maintainers
1
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aomao/plugin-embed

嵌入网址

latest
Source
npmnpm
Version
2.10.1
Version published
Maintainers
1
Created
Source

@aomao/plugin-embed

嵌入网址

通过继承此插件,可以实现嵌入特定网址实现预览功能。

安装

$ yarn add @aomao/plugin-embed

添加到引擎

import Engine, { EngineInterface } from '@aomao/engine';
import Embed , { EmbedComponent } from '@aomao/plugin-embed';

new Engine(...,{ plugins:[ Embed ] , cards:[ EmbedComponent ]})

Embed 可选项

//使用配置
new Engine(...,{
    config:{
        [Embed.pluginName]:{
            //...相关配置
        }
    }
 })

首次渲染前返回特定信息

renderBefore: 渲染前返回一些信息

renderBefore?:(url: string) => {url?: string
    height?: number
    collapsed?: boolean
    ico?: string
    title?: string
    isResize?: boolean}

如果需要对返回信息做更多扩展,可以继承 EmbedComponent 类,然后重写 handleSubmit 方法

命令

插入网址

参数 1:要加载的 url,可选,默认会展示当前输入 url 界面 参数 2: 图标,默认为一个网页图标 参数 3: 标题,默认为 url 参数 4: 是否折叠,默认为 false 参数 5: 是否可以改变大小,默认为 true

engine.command.execute(
	Math.pluginName,
	'https://editor.aomao.com', // 可选
	'ico 图标',
	'展示的标题',
	false,
	true,
);

FAQs

Package last updated on 25 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts