Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
angular2-froala-wyswiyg
Advanced tools
Angular2 bindings for Froala WYSIWYG HTML rich text editor
angular2-froala-wyswiyg provides Angular2 bindings to the froala WYSIWYG editor VERSION 2.
Clone this repo or download the zip.
Run bower install
or Download the editor from https://www.froala.com/wysiwyg-editor/ and jQuery
Load Froala WYSIWYG editor (and all desired plugins), jQuery and the angular2 directives file into your project.
NB: You must ensure jQuery is included before angular2.
1. Import froala directives:
import { FroalaEditorDirective, FroalaViewDirective } from 'path/to/froala.directives';
2. Use them in your component:
@Component({
selector: 'app',
template: `
<div [froalaEditor]="options" [(froalaModel)]="content"></div>
`,
directives: [FroalaEditorDirective]
})
You can check src/app.component.ts file for a more detailed usage example.
'src' directory contains a working example that will need a server to run. To run them: npm start
.
'demo' directory contains a minified working example that can run without a server. To build demo/app.js in case you've modified the sources(src dir): npm run build
. To run: open demo/index.html directly into browser.
You can pass editor options as Input (optional).
[froalaEditor]='options'
You can pass any existing Froala option. Consult the Froala documentation to view the list of all the available options:
public options: Object = {
placeholderText: 'Edit Your Content Here!',
charCounterCount: false
}
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.
public options: Object = {
placeholder: "Edit Me",
events : {
'froalaEditor.focus' : function(e, editor) {
console.log(editor.selection.get());
}
}
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.
[(froalaModel)]="editorContent"
Pass initial content:
public editorContent: string = 'My Document\'s Title'
Use the content in other places:
<input [ngModel]="editorContent"/>
Gets the functionality to operate on the editor: create, destroy and get editor instance. Use it if you want to manually initialize the editor.
(froalaInit)="initialize($event)"
Where initialize
is the name of a function in your component which will receive an object with different methods to control the editor initialization process.
public initialize(initControls) {
this.initControls = initControls;
this.deleteAll = function() {
this.initControls.getEditor()('html.set', '');
};
}
The object received by the function will contain the following methods:
To display content created with the froala editor use the froalaView directive.
[froalaView]="editorContent"
<div [froalaEditor] [(froalaModel)]="editorContent"></div>
<div [froalaView]="editorContent"></div>
The angular2-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 angular2-froala-wyswiyg, you will first need to install the required tools to get the project going.
$ npm install -g grunt-cli bower
$ npm install
$ bower install
$ npm start
FAQs
Angular2 bindings for Froala WYSIWYG HTML rich text editor
We found that angular2-froala-wyswiyg demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.