npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@marsgis/editor

v1.3.3

Published

Mars3D平台功能示例通用示例容器

Downloads

65

Readme

marsgis editor

介绍

marsgis-editor 是 margis 平台的,示例运行容器,内置了 mars3dmars2d 的运行环境,可以在各种技术栈中使用,如 vue react angular 等。或者也可以选择直接通过 script 标签加载的方式。

安装

npm install @marsgis/editor --save

vite 中使用

  1. 配置 vite-plugin-monaco-editor
npm install vite-plugin-monaco-editor -save-dev
import monacoEditorPlugin from "vite-plugin-monaco-editor"

// 在pligins数组中加入以下配置
plugins: [monacoEditorPlugin()]
  1. 引入 npm 包
import MarsgisEditor from "@marsgis/editor"
import "@marsgis/editor/dist/style.css"
  1. 初始化容器,并传入配置
const marsEditor = new MarsgisEditor({})

支持的配置如下

interface Config {
  configFetchType?: "online" | "local" // 是否始终加载在线的配置文件
  baseUrl?: string // 基础请求路径
  code?: string // 是否默认打开编辑器
  fullScreen?: string // 是否全屏
  packageName?: string // 运行基础库包名
  homepage?: string // 首页地址,用于快捷跳转
  configLibs?: any // lib公共依赖配置
  libPublicPath?: string // libs资源的公共路径,可用于配置cdn地址
  thumbnailPublicPath?: string // 缩略图的公共路径
  configSourceUrl?: string // 配置文件地址
  alwaysUseOrigin?: boolean // true 始终使用 src 的方式加载map.js
  resourcePublicPath?: string //
  expandBtnText?: string // 展开按钮文字
  collapseBtnText?: string // 收起按钮文字
  links?: {
    title: string
    url: string
    icon: string
    description: string
  }[] // 快捷跳转链接数组
  UIFile?: string | ((main: string) => string) // UI面板代码的url
  UIFileLanguage?: "html" | "javascript" | "typescript" // UI面板的代码语言
  fetchUICode?: (main: string) => string | Promise<string> // 返回UI面板代码,配置此项后 UIfile配置不再生效
}
  1. 初始化完成之后就可以加载容器了,完整代码如下
import MarsgisEditor from "@marsgis/editor"
import { configLibs } from "./includeLibs"

const marsEditor = new MarsgisEditor({
  configLibs,
  resourcePublicPath: "src/example",
  thumbnailPublicPath: "/config/",
  libPublicPath: "/lib/"
})

const componentId = "map/test"

let inited = false

marsEditor.on("loaded", () => {
  if (inited) {
    destoryUI()
  }
  initUI()
  inited = true
})

function initUI() {
  document.getElementById("mars-main-view").innerHTML = `<div class="test-pannel"></div>`
}
function destoryUI() {
  document.getElementById("mars-main-view").innerHTML = ""
}

marsEditor.render("app", componentId)

版权说明

  1. 该插件由火星科技自主研发,拥有所有权利。
  2. 任何个人或组织可以在遵守相关要求下可以免费无限制使用。