All Projects → froala → Angular Froala Wysiwyg

froala / Angular Froala Wysiwyg

Angular 4, 5, 6, 7, 8 and 9 plugin for Froala WYSIWYG HTML Rich Text Editor.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Angular Froala Wysiwyg

AuthGuard
Example repo for guarding routes post
Stars: ✭ 42 (-93.97%)
Mutual labels:  angular2, angular4, angular5, angular6
am-editor
A rich text collaborative editor framework that can use React and Vue custom plug-ins. 一个富文本实时协同编辑器框架,可以使用React和Vue自定义插件。
Stars: ✭ 542 (-22.13%)
Mutual labels:  wysiwyg, text-editor, rich-text-editor, wysiwyg-editor
bangle.dev
Collection of higher level rich text editing tools. It powers the local only note taking app https://bangle.io
Stars: ✭ 541 (-22.27%)
Mutual labels:  wysiwyg, text-editor, rich-text-editor, wysiwyg-editor
Ng Select
⭐ Native angular select component
Stars: ✭ 2,781 (+299.57%)
Mutual labels:  angular2, angular4, angular5, angular6
Wysiwyg.js
wysiwyg contenteditable editor (minified+compression: 6kb)
Stars: ✭ 520 (-25.29%)
Mutual labels:  text-editor, rich-text-editor, wysiwyg, wysiwyg-editor
Pell
📝 the simplest and smallest WYSIWYG text editor for web, with no dependencies
Stars: ✭ 11,653 (+1574.28%)
Mutual labels:  text-editor, rich-text-editor, wysiwyg, wysiwyg-editor
Angular Material App
基于最新Angular 9框架与Material 2技术的web中后台前端应用框架。
Stars: ✭ 509 (-26.87%)
Mutual labels:  angular2, angular4, angular5, angular6
Ng Simple Slideshow
A simple, responsive slideshow for Angular 4+.
Stars: ✭ 119 (-82.9%)
Mutual labels:  angular2, angular4, angular5, angular6
typester
✒️ A WYSIWYG that gives you predictable and clean HTML
Stars: ✭ 29 (-95.83%)
Mutual labels:  wysiwyg, text-editor, rich-text-editor, wysiwyg-editor
angular-rollbar-source-maps
Angular 2+ implementation to upload sourcemaps to Rollbar
Stars: ✭ 17 (-97.56%)
Mutual labels:  angular2, angular4, angular5, angular6
Angular5 Seed
Angular5 Seed for Application
Stars: ✭ 222 (-68.1%)
Mutual labels:  angular2, angular4, angular5, angular6
Ngx Smart Modal
Modal/Dialog component crafted for Angular
Stars: ✭ 256 (-63.22%)
Mutual labels:  angular2, angular4, angular5, angular6
Ngx Daterangepicker Material
Pure Angular 2+ date range picker with material design theme, a demo here:
Stars: ✭ 169 (-75.72%)
Mutual labels:  angular2, angular4, angular5, angular6
Ng Http Loader
🍡 Smart angular HTTP interceptor - Intercepts automagically HTTP requests and shows a spinkit spinner / loader / progress bar
Stars: ✭ 327 (-53.02%)
Mutual labels:  angular2, angular4, angular5, angular6
Ng2 Pdfjs Viewer
An angular 8 component for PDFJS and ViewerJS (Supports angular 2/4/5/6/7)
Stars: ✭ 150 (-78.45%)
Mutual labels:  angular2, angular4, angular5, angular6
spring-websocket-angular6
Example for using Spring Websocket and Angular with Stomp Messaging
Stars: ✭ 18 (-97.41%)
Mutual labels:  angular2, angular4, angular5, angular6
Angular File Uploader
Angular file uploader is an Angular 2/4/5/6/7/8/9/10 + file uploader module with Real-Time Progress Bar, Responsive design, Angular Universal Compatibility, localization and multiple themes which includes Drag and Drop and much more.
Stars: ✭ 92 (-86.78%)
Mutual labels:  angular2, angular4, angular5, angular6
Aspnetcore Angular Universal
ASP.NET Core & Angular Universal advanced starter - PWA w/ server-side rendering for SEO, Bootstrap, i18n internationalization, TypeScript, unit testing, WebAPI REST setup, SignalR, Swagger docs, and more! By @TrilonIO
Stars: ✭ 1,455 (+109.05%)
Mutual labels:  angular2, angular4, angular5, angular6
ng-toggle
Bootstrap-styled Angular Toggle Component
Stars: ✭ 14 (-97.99%)
Mutual labels:  angular2, angular4, angular5, angular6
angular-progress-bar
This component allow you to easy incorporate progress-bar to angular/ionic project, providing binding and color options
Stars: ✭ 26 (-96.26%)
Mutual labels:  angular2, angular4, angular5, angular6

Angular Froala WYSIWYG Editor - Demo

npm npm npm

Angular 4 to Angular 9 bindings for Froala WYSIWYG Editor.

WYSIWYG HTML Editor

Table of contents

  1. Installation instructions
  2. Update editor instructions
  3. Integration
  4. Usage
  5. Manual Initialization
  6. Displaying HTML
  7. License
  8. Development environment setup

Installation instructions

Install angular-froala-wysiwyg from npm

npm install angular-froala-wysiwyg

You will need CSS styles

<!-- index.html -->
<link href="node_modules/froala-editor/css/froala_editor.pkgd.min.css" rel="stylesheet">

Update editor instructions

npm update froala-editor --save

Integration

Use with Angular CLI

Installing @angular/cli

Note: you can skip this part if you already have application generated.

npm install -g @angular/cli
ng new my-app
cd my-app

Add angular-froala-wysiwyg

  • install angular-froala-wysiwyg
npm install angular-froala-wysiwyg --save
  • open src/app/app.module.ts and add
// Import all Froala Editor plugins.
// import 'froala-editor/js/plugins.pkgd.min.js';

// Import a single Froala Editor plugin.
// import 'froala-editor/js/plugins/align.min.js';

// Import a Froala Editor language file.
// import 'froala-editor/js/languages/de.js';

// Import a third-party plugin.
// import 'froala-editor/js/third_party/font_awesome.min';
// import 'froala-editor/js/third_party/image_tui.min';
// import 'froala-editor/js/third_party/spell_checker.min';
// import 'froala-editor/js/third_party/embedly.min';

// Import Angular plugin.
import { FroalaEditorModule, FroalaViewModule } from 'angular-froala-wysiwyg';
...

@NgModule({
   ...
   imports: [FroalaEditorModule.forRoot(), FroalaViewModule.forRoot() ... ],
   ...
})
  • open angular.json file and insert a new entry into the styles array
"styles": [
  "styles.css",
  "./node_modules/froala-editor/css/froala_editor.pkgd.min.css",
  "./node_modules/froala-editor/css/froala_style.min.css",
]
  • open src/app/app.component.html and add
<div [froalaEditor]>Hello, Froala!</div>

Run angular-cli

ng serve

Use with ionic v2 or v3

Create Ionic app

Note: you can skip this part if you already have application generated.

npm install -g cordova ionic
ionic start sample blank
cd sample

Add angular-froala-wysiwyg

For v3 make sure that you use the latest version of ionic and also the latest version of angular.

Installing Froala Wysiwyg Editor in Ionic is fairly easy, it can be done using npm:

npm install angular-froala-wysiwyg --save
  • Inside src/app/app.component.html add
<ion-app>
<ion-router-outlet></ion-router-outlet>
<div [froalaEditor]>Hello, Froala!</div>
</ion-app>
  • open src/app/app.module.ts and add
// Import all Froala Editor plugins.
// import 'froala-editor/js/plugins.pkgd.min.js';

// Import a single Froala Editor plugin.
// import 'froala-editor/js/plugins/align.min.js';

// Import a Froala Editor language file.
// import 'froala-editor/js/languages/de.js';

// Import a third-party plugin.
// import 'froala-editor/js/third_party/font_awesome.min';
// import 'froala-editor/js/third_party/image_tui.min';
// import 'froala-editor/js/third_party/spell_checker.min';
// import 'froala-editor/js/third_party/embedly.min';

// Import Angular2 plugin.
import { FroalaEditorModule, FroalaViewModule } from 'angular-froala-wysiwyg';
...

Replace

imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule]

with

imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule,FroalaEditorModule.forRoot(), FroalaViewModule.forRoot()]
  • Inside src/app/app-routing.module.ts remove the line
{ path: '', redirectTo: 'home', pathMatch: 'full' }  
  • Inside src/index.html
<link rel="stylesheet" href="assets/css/font-awesome.min.css">  
<link rel="stylesheet" href="assets/css/froala_editor.pkgd.min.css">
<link rel="stylesheet" href="assets/css/froala_style.min.css">
  • In angular.json change outpath of build to "outputPath": "src/assets" and insert following inside assetsarray of build:
"assets":[
 ...,
 
  {
    "glob": "**/*",
    "input": "node_modules/froala-editor/css",
    "output": "css"
  },
  {
    "glob": "**/*",
    "input": "node_modules/font-awesome/css",
    "output": "css"
  },
  {
    "glob": "**/*",
    "input": "node_modules/font-awesome/fonts",
    "output": "fonts"
  },
  {
    "glob": "**/*",
    "input": "node_modules/froala-editor/js",
    "output": "js"
  }
 ]

Run your App

ionic build
ionic serve

Use with webpack/starter

Create webpack app

Note: you can skip this part if you already have application generated.

git clone --depth 1 https://github.com/AngularClass/angular-starter.git
cd angular-starter
npm install
npm install [email protected] --save
npm install @types/[email protected]

Add angular-froala-wysiwyg

  • install angular-froala-wysiwyg
npm install angular-froala-wysiwyg --save
  • open src/app/app.module.ts and add
// Import all Froala Editor plugins.
// import 'froala-editor/js/plugins.pkgd.min.js';

// Import a single Froala Editor plugin.
// import 'froala-editor/js/plugins/align.min.js';

// Import a Froala Editor language file.
// import 'froala-editor/js/languages/de.js';

// Import a third-party plugin.
// import 'froala-editor/js/third_party/font_awesome.min';
// import 'froala-editor/js/third_party/image_tui.min';
// import 'froala-editor/js/third_party/spell_checker.min';
// import 'froala-editor/js/third_party/embedly.min';

// Import Angular plugin.
import { FroalaEditorModule, FroalaViewModule } from 'angular-froala-wysiwyg';
...

@NgModule({
   ...
   imports: [FroalaEditorModule.forRoot(), FroalaViewModule.forRoot(), ... ],
   ...
})
  • open src/app/app.component.ts and add to the template
<div [froalaEditor]>Hello, Froala!</div>
  • open config/webpack.common.js
var webpack = require('webpack');
  • open config/webpack.common.js and add the following to CopyWebpackPlugin
{
  from: 'node_modules/froala-editor/css/',
  to: 'assets/froala-editor/css/',
},
  • open config/head-config.common.js and add a new entry to link
{ rel: 'stylesheet', href: '/assets/froala-editor/css/froala_editor.pkgd.min.css' },
{ rel: 'stylesheet', href: '/assets/froala-editor/css/froala_style.min.css' }

Run webpack app

npm run start

Use with system.js and JIT

Create Angular app

Note: you can skip this part if you already have application generated.

git clone https://github.com/froala/angular-froala-systemjs-demo
cd angular-froala-systemjs-demo
npm install

Add angular-froala-wysiwyg

  • install angular-froala-wysiwyg
npm install angular-froala-wysiwyg --save
  • open src/index.html and add
<link rel="stylesheet" href="node_modules/froala-editor/css/froala_editor.pkgd.min.css">
<link rel="stylesheet" href="node_modules/froala-editor/css/froala_style.min.css">
  • open src/app/app.module.ts and add
// Import all Froala Editor plugins.
// import 'froala-editor/js/plugins.pkgd.min.js';

// Import a single Froala Editor plugin.
// import 'froala-editor/js/plugins/align.min.js';

// Import a Froala Editor language file.
// import 'froala-editor/js/languages/de.js';

// Import a third-party plugin.
// import 'froala-editor/js/third_party/font_awesome.min';
// import 'froala-editor/js/third_party/image_tui.min';
// import 'froala-editor/js/third_party/spell_checker.min';
// import 'froala-editor/js/third_party/embedly.min';

// Import Angular2 plugin.
import { FroalaEditorModule, FroalaViewModule } from 'angular-froala-wysiwyg';
...

@NgModule({
   ...
   imports: [FroalaEditorModule.forRoot(), FroalaViewModule.forRoot(), ... ],
   ...
})
  • open src/app/app.component.ts file and add to the template
<div [froalaEditor]>Hello, Froala!</div>

Run app

npm run start

Use with aot

Create Angular app

  1. ng new froala-aot
{
  "glob": "**/*",
  "input": "./node_modules/froala-editor",
  "output": "assets/froala-editor/"
},
{
  "glob": "**/*",
  "input": "./node_modules/font-awesome",
  "output": "assets/font-awesome/"
},
{
  "glob": "**/*",
  "input": "./node_modules/jquery",
  "output": "assets/jquery/"
}
  • Go to package.json and update scripts.build to ng build --aot and scripts.start to ng serve --aot

Add angular-froala-wysiwyg

  • install angular-froala-wysiwyg

In case you want to use font-awesome icons , you can use them by installing it.

  • Run npm install font-awesome and add in app.module.ts
import 'froala-editor/js/third_party/font_awesome.min';
  • Go to angular.json and change architect.build.options.outputPath to src/dist and add following json to architect.build.options.assets array
npm install angular-froala-wysiwyg --save
  • open src/index.html and add
<link rel="stylesheet" href="assets/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="assets/froala-editor/css/froala_editor.pkgd.min.css">
  • open src/app/app.module.ts and add
// Import all Froala Editor plugins.
// import 'froala-editor/js/plugins.pkgd.min.js';

// Import a single Froala Editor plugin.
// import 'froala-editor/js/plugins/align.min.js';

// Import a Froala Editor language file.
// import 'froala-editor/js/languages/de.js';

// Import a third-party plugin.
// import 'froala-editor/js/third_party/image_tui.min';
// import 'froala-editor/js/third_party/spell_checker.min';
// import 'froala-editor/js/third_party/embedly.min';

// Import Angular2 plugin.
import { FroalaEditorModule, FroalaViewModule } from 'angular-froala-wysiwyg';
...

@NgModule({
   ...
   imports: [FroalaEditorModule.forRoot(), FroalaViewModule.forRoot(), ... ],
   ...
})
  • open src/app/app.component.ts file and add to the template
<div [froalaEditor]>Hello, Froala!</div>

Run app

npm run build
npm run start

Usage

Options

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:

  • immediateAngularModelUpdate: (default: false) This option synchronizes the angular 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.

public options: Object = {
  placeholder: "Edit Me",
  events : {
    '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.

Model

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"/>
<input [(ngModel)]="editorContent"/> <!-- For two way binding -->

Other two way binding example:

<div [froalaEditor] [(froalaModel)]="editorContent"></div>
<div [froalaEditor] [(froalaModel)]="editorContent"></div>

Use it with reactive forms:

<form [formGroup]="form" (ngSubmit)="onSubmit()">
  <textarea [froalaEditor] formControlName="formModel"></textarea>
  <button type="submit">Submit</button>
</form>

If you want to use two-way binding to display the form model in other places you must include [(froalaModel)]:

<form [formGroup]="form" (ngSubmit)="onSubmit()">
  <textarea [froalaEditor] formControlName="formModel" [(froalaModel)]="form.formModel"></textarea>
  <div [froalaView]="form.formModel"></div>
  <button type="submit">Submit</button>
</form>

If you want to wrap froalaEditor directive into a component that supports reactive forms please see froala.component.ts from demo.

Extend functionality

You can extend the functionality by adding a custom button like bellow:

// Import Froala Editor.
import FroalaEditor from 'froala-editor';

// We will make usage of the Init hook and make the implementation there.
import { Component, OnInit  } from '@angular/core';

@Component({
  selector: 'app-demo',
  template: `<div class="sample">
               <h2>Sample 11: Add Custom Button</h2>
               <div [froalaEditor]="options" [(froalaModel)]="content" ></div>
             </div>`,


export class AppComponent implements OnInit{

  ngOnInit () {
    FroalaEditor.DefineIcon('alert', {NAME: 'info'});
    FroalaEditor.RegisterCommand('alert', {
      title: 'Hello',
      focus: false,
      undo: false,
      refreshAfterCallback: false,

      callback: () => {
        alert('Hello!', this);
      }
    });
  }

  public options: Object = {
    charCounterCount: true,
    toolbarButtons: ['bold', 'italic', 'underline', 'paragraphFormat','alert'],
    toolbarButtonsXS: ['bold', 'italic', 'underline', 'paragraphFormat','alert'],
    toolbarButtonsSM: ['bold', 'italic', 'underline', 'paragraphFormat','alert'],
    toolbarButtonsMD: ['bold', 'italic', 'underline', 'paragraphFormat','alert'],
  };
}

Special tags

Note: In order to use special tags in app.module.ts add

// Import all Froala Editor plugins.
 import 'froala-editor/js/plugins.pkgd.min.js';

You may also use the editor on img, button, input and a tags:

<img [froalaEditor] [(froalaModel)]="imgObj"/>

The model must be an object containing the attributes for your special tags. Example:

public imgObj: Object = {
  src: 'path/to/image.jpg'
};

The froalaModel will change as the attributes change during usage.

  • froalaModel 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:
public buttonModel: Object = {
  innerHTML: 'Click Me'
};

As the button text is modified by the editor, the innerHTML attribute from buttonModel model will be modified too.

Specific option for special tags

  • angularIgnoreAttrs: (default: null) This option is an array of attributes that you want to ignore when the editor updates the froalaModel:
public inputOptions: Object = {
  angularIgnoreAttrs: ['class', 'id']
};

Manual Initialization

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:

  • 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 directive.

[froalaView]="editorContent"

<div [froalaEditor] [(froalaModel)]="editorContent"></div>
<div [froalaView]="editorContent"></div>

License

The angular-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 angular-froala-wyswiyg, you will first need to install the required tools to get the project going.

Prerequisites

Install dependencies

$ npm install

Build

$ npm run demo.build

Run Demo

$ npm run start
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].