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

quill-swiper

v1.0.9

Published

swiper for quill

Downloads

3

Readme

Detail

swiper for quill

start

npm i quill-swiper swiper quill --save

// import css
import SwiperCss from 'swiper/dist/css/swiper.min.css'
import Snow from 'quill/dist/quill.snow.css'
import Snow from 'quill-swiper/dist/index.css'

// import js
import SwpierBlot from 'quill-swiper'
import { SwiperHandler } from 'quill-swiper'
Quill.register(SwpierBlot)

// new Quill
let quill = new Quill('#editor', {
  modules: { 
    toolbar: {
      container: '#toolbar',
      handlers: {
        swiper: SwiperHandler({ 
          upload: false
        }),
      }
    }
  },
  theme: 'snow'
})

tooltip swiper 图标

使用 option 配置

// options
  {
    modules: {
      toolbar: [
        ...
        ['image', 'swiper']
      ]
    }
  }

自定义

  <button class="ql-swiper">

两种方案都需引入 quill-swiper.css

添加上传地址

  // 默认是图片转换为 base64 格式
  // 如需上传图片
  new Quill('#editor', {
    modules: { 
      toolbar: {
        container: '#toolbar',
        handlers: {
          swiper: SwiperHandler({ 
            upload: true,
            url: '/upload', // 指定上传地址
            uploadResFormat: res => res
          }),
        }
      }
    }
  })

uploadResFormat为上传图片接口返回数据的格式化
需求返回的数据格式为

  [
    { url: 'http://www.xx.xx.jpg' },
    { url: 'http://www.xx.xx.jpg' },
    ...
  ]

run demo

git clone https://github.com/Bob2622/quill-swiper.git

npm i 

cd demo

npm i

npm run serve

功能

  • 双击轮播图可以调整 宽度 和 居中情况

TIP

  • .swiper-container 需要设置固定高度, 不然 swiper 无法正常运行, 但在 swiper 生成过程中会恢复为 auto
  • Error: [Parchment] Cannot insert swiper into scroll
  // app.vue 中 quill 和 siperblot 中 quill 的引用源不同引起的, ex
  // app.vue
  import Quill from 'quill'
  ...

  // swiperBlot.js 
  import Quill from '../../quill'
  ...

  // 如果 quill-swiper 的目录下也有安装的 node_modules 会引起引用源不同的情况
  // 此时删掉该目录下的 node_modules 
  // 会自动向上寻找 node_modules 引用项目下的 quill
  • 初始化时就有 swiper 时, editor dom节点必须显示, 不然会引起 swiper 初始化失败

feture

  • 宽度支持百分比和px切换