Gathering detailed insights and metrics for froala-wysiwyg-vue3
Gathering detailed insights and metrics for froala-wysiwyg-vue3
Gathering detailed insights and metrics for froala-wysiwyg-vue3
Gathering detailed insights and metrics for froala-wysiwyg-vue3
Vue3 component for Froala WYSIWYG HTML Rich Text Editor.
npm install froala-wysiwyg-vue3
Typescript
Module System
Min. Node Version
Node Version
NPM Version
56.2
Supply Chain
88.3
Quality
74.9
Maintenance
100
Vulnerability
98.7
License
JavaScript (80.29%)
Vue (19.05%)
HTML (0.66%)
Total Downloads
3,590
Last Day
1
Last Week
10
Last Month
82
Last Year
1,687
4 Stars
130 Commits
1 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
4.0.15
Package Id
froala-wysiwyg-vue3@4.0.15
Unpacked Size
1.38 MB
Size
376.54 kB
File Count
12
NPM Version
8.15.0
Node Version
16.17.0
Cumulative downloads
Total Downloads
Last day
-66.7%
1
Compared to previous day
Last week
-47.4%
10
Compared to previous week
Last month
-39.7%
82
Compared to previous month
Last year
-1.2%
1,687
Compared to previous year
4
42
Install froala-wysiwyg-vue3
from npm
1npm install froala-wysiwyg-vue3 --save
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 'froala-wysiwyg-vue3'; 13 14const app = createApp({ 15 render: () => h(App) 16}); 17app.use(VueFroala); 18app.mount('#app'); 19
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 'froala-wysiwyg-vue3'; 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>
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}
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.
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:
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: (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.
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"/>
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.
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.
1config: { 2 vueIgnoreAttrs: ['class', 'id'] 3}
You can pass the custom buttons to the editor by following way:
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
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:
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>
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.
If you want to contribute to vue-froala-wyswiyg, you will first need to install the required tools to get the project going.
$ npm install
$ npm run build
$ npm run dev
No vulnerabilities found.
No security vulnerabilities found.