Installations
npm install @timcharper/vue-froala-wysiwyg
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=6.9.0
Node Version
14.15.4
NPM Version
6.14.10
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (54.78%)
Shell (29.43%)
Vue (13.97%)
Dockerfile (1.35%)
HTML (0.47%)
Developer
Download Statistics
Total Downloads
549
Last Day
1
Last Week
2
Last Month
4
Last Year
93
GitHub Statistics
634 Stars
142 Commits
86 Forks
14 Watching
23 Branches
19 Contributors
Package Meta Information
Latest Version
2.9.8-2
Package Id
@timcharper/vue-froala-wysiwyg@2.9.8-2
Unpacked Size
64.54 kB
Size
25.23 kB
File Count
12
NPM Version
6.14.10
Node Version
14.15.4
Publised On
06 Mar 2023
Total Downloads
Cumulative downloads
Total Downloads
549
Last day
0%
1
Compared to previous day
Last week
0%
2
Compared to previous week
Last month
33.3%
4
Compared to previous month
Last year
-79.6%
93
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
4
Dev Dependencies
42
Vue JS Froala WYSIWYG Editor
vue-froala-wyswiyg provides Vue bindings to the Froala WYSIWYG editor VERSION 3.
Compatibility
- v1 later
@legacy
- Vue.js 1.x
- v2 later
- Vue.js 2.x
Installation
Install vue-froala-wysiwyg
from npm
1npm install vue-froala-wysiwyg --save
Integration
1. Require and use Froala Editor component inside your application.
main.js file:
1//Import Froala Editor 2import 'froala-editor/js/plugins.pkgd.min.js'; 3//Import third party plugins 4import 'froala-editor/js/third_party/embedly.min'; 5import 'froala-editor/js/third_party/font_awesome.min'; 6import 'froala-editor/js/third_party/spell_checker.min'; 7import 'froala-editor/js/third_party/image_tui.min'; 8// Import Froala Editor css files. 9import 'froala-editor/css/froala_editor.pkgd.min.css'; 10 11// Import and use Vue Froala lib. 12import VueFroala from 'vue-froala-wysiwyg' 13Vue.use(VueFroala) 14Vue.config.productionTip = false 15 16new Vue({ 17 render: h => h(App), 18 19}).$mount('#app') 20
App.vue file:
1<template> 2 <div id="app"> 3 <froala id="edit" :tag="'textarea'" :config="config" v-model="model"></froala> 4 </div> 5</template> 6 7<script> 8import VueFroala from 'vue-froala-wysiwyg'; 9 10export default { 11 name: 'app', 12 data () { 13 return { 14 config: { 15 events: { 16 initialized: function () { 17 console.log('initialized') 18 } 19 } 20 }, 21 model: 'Edit Your Content Here!' 22 } 23 } 24} 25</script>
2. Make sure you have the right Webpack settings for loading the CSS files.
1var webpack = require('webpack') 2var path = require('path') 3 4module.exports = { 5 module: { 6 loaders: [ 7 8 // ... 9 10 // Css loader. 11 { 12 test: /\.css$/, 13 loader: 'vue-style-loader!css-loader' 14 } 15 16 ] 17 }, 18 vue: { 19 loaders: { 20 21 // ... 22 23 // Css loader for Webpack 1.x . 24 css: 'vue-style-loader!css-loader' 25 } 26 } 27})
Usage
Initialize
1// If model is initialized, 'Init text' text child will be overwritten. 2<froala :tag="'textarea'" :config="config" v-model="model">Init text</froala>
:tag attr is used to tell on which tag the editor is initialized.
There are special tags: a, button, img, input.
Options
You can pass editor options as component attribute (optional).
:config="config"
You can pass any existing Froala option. Consult the Froala documentation to view the list of all the available options:
1config: { 2 placeholderText: 'Edit Your Content Here!', 3 charCounterCount: false 4}
Aditional option is used:
- immediateVueModelUpdate: (default: false) This option updates the Vue model as soon as a key is released in the editor. Note that it may affect performances.
Events and Methods
Events can be passed in with the options, with a key events and object where the key is the event name and the value is the callback function.
1config: { 2 placeholder: "Edit Me", 3 events : { 4 focus : function(e, editor) { 5 console.log(editor.selection.get()); 6 } 7 } 8}
Using the editor instance from the arguments of the callback you can call editor methods as described in the method docs.
Froala events are described in the events docs.
Model
The WYSIWYG HTML editor content model. Two way binding is suported.
v-model="model"
Use the content in other places:
1<input v-model="model"/>
Special tags
You can also use the editor on img, button, input and a tags:
1<froala :tag="img" v-model="imgModel"></froala>
The model must be an object containing the attributes for your special tags. Example:
1imgModel: { 2 src: require('./image.jpg') 3}
The model will change as the attributes change during usage.
- The model can contain a special attribute named innerHTML which inserts innerHTML in the element: If you are using 'button' tag, you can specify the button text like this:
1buttonModel: { 2 innerHTML: 'Click Me' 3}
As the button text is modified by the editor, the innerHTML attribute from buttonModel model will be modified too.
Specific option for special tags
- vueIgnoreAttrs: (default: null) This option is an array of attributes that you want to ignore when the editor updates the v-model:
1config: { 2 vueIgnoreAttrs: ['class', 'id'] 3}
Custom Buttons
You can pass the custom buttons to the editor by following way:
App.vue file:
1<script> 2import FroalaEditor from 'froala-editor'; 3 4FroalaEditor.DefineIcon('alert', {NAME: 'info', SVG_KEY: 'help'}); 5 FroalaEditor.RegisterCommand('alert', { 6 title: 'Hello', 7 focus: false, 8 undo: false, 9 refreshAfterCallback: false, 10 callback: function () { 11 alert('Hello!'); 12 } 13 }); 14 15 FroalaEditor.DefineIcon('clear', {NAME: 'remove', SVG_KEY: 'remove'}); 16 FroalaEditor.RegisterCommand('clear', { 17 title: 'Clear HTML', 18 focus: false, 19 undo: true, 20 refreshAfterCallback: true, 21 callback: function () { 22 this.html.set(''); 23 this.events.focus(); 24 } 25 }); 26 27 FroalaEditor.DefineIcon('insert', {NAME: 'plus', SVG_KEY: 'add'}); 28 FroalaEditor.RegisterCommand('insert', { 29 title: 'Insert HTML', 30 focus: true, 31 undo: true, 32 refreshAfterCallback: true, 33 callback: function () { 34 this.html.insert('My New HTML'); 35 } 36 }); 37 </script> 38
Now you can use these buttons in options:
1toolbarButtons: [['undo', 'redo' , 'bold'], ['alert', 'clear', 'insert']], 2
Manual Instantiation
Gets the functionality to operate on the editor: create, destroy and get editor instance. Use it if you want to manually initialize the editor.
:onManualControllerReady="initialize"
1initialize: function(initControls) { 2 this.initControls = initControls; 3 this.deleteAll = () => { 4 this.initControls.getEditor().html.set(''); 5 this.initControls.getEditor().undo.reset(); 6 this.initControls.getEditor().undo.saveStep(); 7 }; 8}
The object received by the function will contain the following methods:
- initialize: Call this method to initialize the Froala Editor
- destroy: Call this method to destroy the Froala Editor
- getEditor: Call this method to retrieve the editor that was created. This method will return null if the editor was not yet created
Displaying HTML
To display content created with the froala editor use the froalaView
component.
1<froala v-model="content"></froala> 2 3<froalaView v-model="content"></froalaView>
License
The vue-froala-wyswiyg
project is under MIT license. However, in order to use Froala WYSIWYG HTML Editor plugin you should purchase a license for it.
Froala Editor has 3 different licenses for commercial use. For details please see License Agreement.
Development environment setup
If you want to contribute to vue-froala-wyswiyg, you will first need to install the required tools to get the project going.
Prerequisites
- Node Package Manager (NPM)
- Git
Install dependencies
$ npm install
Build
$ npm run build
Run Demo
$ npm run dev
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1
Reason
Found 1/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: containerImage not pinned by hash: Dockerfile:1: pin your Docker image by updating node:14.17.3 to node:14.17.3@sha256:976c9107158a1c85ab0702aec5b1d56bbb85de493ca50794e545a0271421e028
- Warn: npmCommand not pinned by hash: Dockerfile:12
- Info: 0 out of 1 containerImage dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 2 are checked with a SAST tool
Reason
37 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw
- Warn: Project is vulnerable to: GHSA-wxhq-pm8v-cw75
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-ghr5-ch3p-vcr6
- Warn: Project is vulnerable to: GHSA-434g-2637-qmqr
- Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m
- Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw
- Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p
- Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747
- Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc
- Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp
- Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5
- Warn: Project is vulnerable to: GHSA-pfq8-rq6v-vf5m
- Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-cf4h-3jhx-xvhq
- Warn: Project is vulnerable to: GHSA-g3ch-rx76-35fx
- Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
1.3
/10
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More