Socket
Socket
Sign inDemoInstall

vue-trumbowyg

Package Overview
Dependencies
23
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vue-trumbowyg

Vue.js component for trumbowyg WYSIWYG editor


Version published
Weekly downloads
3.4K
increased by5.68%
Maintainers
1
Install size
2.05 MB
Created
Weekly downloads
 

Changelog

Source

4.0.0

  • Add support for Vue v3.x

Readme

Source

Vue Trumbowyg

downloads npm-version github-tag build license

Vue.js component for Trumbowyg WYSIWYG editor

Demo or JSFiddle

Version matrix

Vue.js versionPackage versionBranch
2.x3.x3.x
3.x4.xmaster

Installation

# yarn
yarn add vue-trumbowyg

# npm
npm install vue-trumbowyg 

Features

  • Reactive v-model value
    • You can change editor value programmatically
  • Emits all possible events
  • Supports most plugins
  • Works with validation libraries like - vee-validate

Requirements

  • jQuery >=1.8
  • Vue v3.x

Usage

<template>
  <div>
    <trumbowyg v-model="content" :config="config" class="form-control" name="content"></trumbowyg>
  </div>
</template>

<script>  
  // Import this component
  import Trumbowyg from 'vue-trumbowyg';
  
  // Import editor css
  import 'trumbowyg/dist/ui/trumbowyg.css';
   
  export default {    
    data () {
      return {
        content: null,
        config: {
          // Get options from 
          // https://alex-d.github.io/Trumbowyg/documentation
        }       
      }
    },
    components: {
      Trumbowyg
    }
  }
</script>
As plugin
  import Vue from 'vue';
  import VueTrumbowyg from 'vue-trumbowyg';
  import 'trumbowyg/dist/ui/trumbowyg.css';
  app.use(VueTrumbowyg);

This will register a global component <trumbowyg>

Events

  • You can listen to various events like this
 <trumbowyg v-model="body" @tbw-blur="yourMethod"></trumbowyg>
  • :bulb: Events names are prefixed with tbw and separated with a dash, for example: tbw-focus

Available props

The component accepts these props:

AttributeTypeDefaultDescription
v-modelString / nullnullSet or Get editor value (required)
disabledBooleanfalseEnable/disable editor
configObject{}Editor configuration options
svg-pathString, Booleanimport 'trumbowyg/dist/ui/icons.svg'Set custom svg icon file URL

Install in non-module environments (without webpack)

<!-- Editor dependencies-->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5"></script>

<!-- Editor itself -->
<script src="https://cdn.jsdelivr.net/npm/trumbowyg@2"></script>
<link href="https://cdn.jsdelivr.net/npm/trumbowyg@2/dist/ui/trumbowyg.min.css" rel="stylesheet">

<!-- Vue js -->
<script src="https://cdn.jsdelivr.net/npm/vue@3"></script>
<!-- Lastly add this package -->
<script src="https://cdn.jsdelivr.net/npm/vue-trumbowyg@4"></script><
<script>
  // Initialize as global component
  yourAppInstance.component('Trumbowyg', VueTrumbowyg.default);
</script>

Troubleshoot

Run examples on your localhost

  • Clone this repo
  • Make sure you have node-js >=10.13 and yarn >=1.x pre-installed
  • Install dependencies - yarn install
  • Run webpack dev server - yarn start
  • This should open the demo page at http://localhost:9000 in your default web browser

Changelog

Please see CHANGELOG for more information what has changed recently.

License

MIT License

Keywords

FAQs

Last updated on 31 Oct 2020

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc