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

vue-simple-html-editor

v1.2.0

Published

An opinionated vue html editor

Downloads

11

Readme

vue-simple-html-editor

A simple html rich-text editor based on Vue3 and Typescript.

Install

npm install vue-simple-html-editor --save

Usage

  1. local usage
import { VueSimpleHtmlEditor, version } from 'vue-simple-html-editor'
import "vue-simple-html-editor/style.css"

export default {
   components: {
      VueSimpleHtmlEditor
   }
}
  1. regiter globally
import { createApp } from 'vue'
import App from './App.vue'
import VueSimpleHtmlEditorPlugin from 'vue-simple-html-editor'
import "vue-simple-html-editor/style.css"

createApp(App).use(VueSimpleHtmlEditorPlugin).mount('#app')
<script setup lang="ts">
import { ref } from 'vue'

const articleCode = ref(`
  <h2 style="font-size: 20px;">this is a title block</h2>
  <p>
    click to enter 
    <a href="https://www.baidu.com">baidu</a>
    website
  </p>
  <section>
    <p style="text-indent: 2em;">this is a paragraph block</p>
    <section style="margin: 0 auto;">
        <caption>image caption</caption>
        <img src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" width="400" />
    </section>
    <section style="margin: 0 auto;">
        <caption>image caption(with link)</caption>
        <a href="https://baidu.com" target="_blank">
          <img src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" width="400" />
        </a>
    </section>
    </section>
`)
function uploadFunction() {
  return Promise.resolve({
    url: "https://csimg.91xiaojia.com/UpFiles/xj/1000059/2022/000101/01/2022041209560591533120.jpg"
  })
}
function syncArticleCode(code: string) {
  console.info("changed with code: ", code)
}
</script>

<template>
  <div>
    <vue-simple-html-editor :value="articleCode" @change="syncArticleCode" :upload-function="uploadFunction"/>
  </div>
</template>

<style scoped>
</style>

Props

| name | description | type | default value | | --- | --- | --- | --- | | value | rich-text, v-modal is not supported | string | - | | upload-function | image upload function | (file: File) => Promise<{ url: string }> | - | | editorClass | class name for editor wrapper | string | - | | style | style for editor wrapper | CSSProperties | - | | linkActionModalProps | props for link modal | Object | - | | imageActionModalProps | props for image modal | Object | - | | sourceCodeModalProps | props for source code modal | Object | - | | prettifyCodeWhenPreview | should prettify code or not when openning source code preview | true | - |

v-modal is not supported, please use :value and @change instead, and make sure Not to sync the value prop in the @change handler, otherwise it will cause the editor caret reset to editor start point.

Events

| name | description | callback | | --- | --- | --- | | change | triggered whenever value changes | (value: string) => void |

License

MIT