1.0.84 • Published 10 months ago

@ndflexcore/angular-editor v1.0.84

Weekly downloads
938
License
MIT
Repository
github
Last release
10 months ago

ND Flex Core AngularEditor

Fork of @kolkov/angular-editor modified for specific needs of our company. Please use the original repo at https://github.com/kolkov/angular-editor.

Important versions

Latest
This version introduces several breaking changes:

  • uses Ivy compiler
  • does not support projects with older CkFinder component for inserting images / files
  • requires at least Angular 14
  • this version is intended for projects based on Flex Core from 2023

1.0.81
From this version on, all inserted images are automatically inserted to <picture> element, thus webp images will be used, if possible on the target project.
If you do not plan using webp, use 1.0.80.

Getting Started

Installation

Install via npm package manager

npm install @ndflexcore/angular-editor --save

Usage

Import angular-editor module

import { HttpClientModule} from '@angular/common/http';
import { AngularEditorModule } from '@kolkov/angular-editor';

@NgModule({
  imports: [ HttpClientModule, AngularEditorModule ]
})

Then in HTML

<angular-editor [placeholder]="'Enter text here...'" [(ngModel)]="htmlContent" (ftpNeeded)="onFtpNeeded($event)" [ftpLink]="selectedFtpLink"></angular-editor>

or for usage with reactive forms

<angular-editor formControlName="htmlContent" [config]="editorConfig" (ftpNeeded)="onFtpNeeded($event)" [ftpLink]="selectedFtpLink"></angular-editor>

if you using more than one editor on same page set id property

<angular-editor id="editor1" formControlName="htmlContent1" [config]="editorConfig" (ftpNeeded)="onFtpNeeded($event)" [ftpLink]="selectedFtpLink"></angular-editor>
<angular-editor id="editor2" formControlName="htmlContent2" [config]="editorConfig" (ftpNeeded)="onFtpNeeded($event)" [ftpLink]="selectedFtpLink"></angular-editor>

where

import { AngularEditorConfig } from '@ndflexcore/angular-editor';


editorConfig: AngularEditorConfig = {
    editable: true,
      spellcheck: true,
      height: 'auto',
      minHeight: '0',
      maxHeight: 'auto',
      width: 'auto',
      minWidth: '0',
      translate: 'yes',
      enableToolbar: true,
      showToolbar: true,
      placeholder: 'Enter text here...',
      defaultParagraphSeparator: '',
      defaultFontName: '',
      defaultFontSize: '',
      fonts: [
        {class: 'arial', name: 'Arial'},
        {class: 'times-new-roman', name: 'Times New Roman'},
        {class: 'calibri', name: 'Calibri'},
        {class: 'comic-sans-ms', name: 'Comic Sans MS'}
      ],
      customClasses: [
      {
        name: 'quote',
        class: 'quote',
      },
      {
        name: 'redText',
        class: 'redText'
      },
      {
        name: 'titleText',
        class: 'titleText',
        tag: 'h1',
      },
    ],
    uploadUrl: 'v1/image',
    uploadWithCredentials: false,
    sanitize: true,
    toolbarPosition: 'top',
    language: 'cs',
    imageServerUrl: '',
    imageType: 'preview',
    presetWidth: 98,
    presetHeight: 98,
    toolbarHiddenButtons: [
      ['bold', 'italic'],
      ['fontSize']
    ]
};

For ngModel to work, you must import FormsModule from @angular/forms, or for formControlName, you must import ReactiveFormsModule from @angular/forms

API

Inputs

InputTypeDefaultRequiredDescription
idstring-noId property when multiple editor used on same page
configAngularEditorConfigdefault confignoconfig for the editor
placeholderstring-noSet custom placeholder for input area
tabIndexnumber-noSet Set tabindex on angular-editor
ftpLinkDirectoryChild-noThe ftpLink (either Image or Generic File) from external browser component

Outputs

OutputDescription
(html)Output html
(viewMode)Fired when switched visual and html source mode
(blur)Fired when editor blur
(focus)Fired when editor focus
(ftpNeeded)Fired when 'Insert Image/File from FTP' toolbar button is clicked

Methods

NameDescription
focusFocuses the editor element

Other

NameTypeDescription
AngularEditorConfigconfigurationConfiguration for the AngularEditor component.

Configuration

InputTypeDefaultRequiredDescription
editableboleantruenoSet editing enabled or not
spellcheckboleantruenoSet spellchecking enabled or not
translatestingyesnoSet translating enabled or not
sanitizeboleantruenoSet DOM sanitizing enabled or not
heightstringautonoSet height of the editor
minHeightstring0noSet minimum height of the editor
maxHeightstringautonoSet maximum height of the editor
widthstringautonoSet width of the editor
minWidthstring0noSet minimum width of the editor
enableToolbarboleantruenoSet toolbar enabled or not
showToolbarboleantruenoSet toolbar visible or not
toolbarPositionstringtopnoSet toolbar position top or bottom
placeholderstring-noSet placeholder text
defaultParagraphSeparatorstring-noSet default paragraph separator such as p
defaultFontNamestring-noSet default font such as Comic Sans MS
defaultFontSizestring-noSet default font size such as 1 - 7
uploadUrlstring-noSet image upload endpoint https://api.exapple.com/v1/image/upload
uploadWithCredentialsboleanfalsenoSet passing or not credentials in the image upload call
fontsFont[]-noSet array of available fonts [{name, class},...]
customClassesCustomClass[]-noSet array of available fonts [{name, class, tag},...]
outlineboleantruenoSet outline of the editor if in focus
toolbarHiddenButtonsstring[][]-noSet of the array of button names or elements to hide
language'cs' | 'en'|cs|yes` | The language of the editor tooltips
imageServerUrlstring-yesThe URL of the Image Server
imageTypestringpreviewyesThe Image Type
presetWidthnumber98yesThe preset width of the image, used when user does not enter one
presetHeightnumber98yesThe preset height of the image, used when user does not enter one
toolbarHiddenButtons: [
  [
    'undo',
    'redo',
    'bold',
    'italic',
    'underline',
    'strikeThrough',
    'subscript',
    'superscript',
    'justifyLeft',
    'justifyCenter',
    'justifyRight',
    'justifyFull',
    'indent',
    'outdent',
    'insertUnorderedList',
    'insertOrderedList',
    'heading',
    'fontName'
  ],
  [
    'fontSize',
    'textColor',
    'backgroundColor',
    'customClasses',
    'link',
    'unlink',
    'insertImage',
    'insertVideo',
    'insertHorizontalRule',
    'removeFormat',
    'toggleEditorMode'
  ]
]

What's included

Within the download you'll find the following directories and files. You'll see something like this:

angular-editor/
└── projects/
    ├── angular-editor/
    └── angular-editor-app/

angular-editor/ - library

angular-editor-app/ - demo application

Creators

Andrey Kolkov

The Author of the original repo. Thank you Andrey and Long Life to Russia!

Petr Humplík on behalf of NetDirect s.r.o.

Author of the specifically modified version (this repo).

License

MIT

1.0.84

10 months ago

1.0.83

2 years ago

1.0.82

2 years ago

1.0.79

3 years ago

1.0.80

3 years ago

1.0.81

3 years ago

1.0.77

3 years ago

1.0.76

3 years ago

1.0.75

4 years ago

1.0.74

4 years ago

1.0.78

3 years ago

1.0.73

4 years ago

1.0.72

4 years ago

1.0.71

4 years ago

1.0.70

4 years ago

1.0.69

4 years ago

1.0.68

4 years ago

1.0.67

4 years ago

1.0.66

4 years ago

1.0.65

4 years ago

1.0.64

4 years ago

1.0.63

4 years ago

1.0.62

4 years ago

1.0.61

4 years ago

1.0.60

4 years ago

1.0.59

4 years ago

1.0.58

4 years ago

1.0.57

4 years ago

1.0.56

4 years ago

1.0.55

4 years ago

1.0.54

4 years ago

1.0.53

4 years ago

1.0.52

5 years ago

1.0.51

5 years ago

1.0.50

5 years ago

1.0.39

5 years ago

1.0.38

5 years ago

1.0.40

5 years ago

1.0.41

5 years ago

1.0.48

5 years ago

1.0.47

5 years ago

1.0.46

5 years ago

1.0.45

5 years ago

1.0.37

5 years ago

1.0.36

5 years ago

1.0.35

5 years ago

1.0.32

5 years ago

1.0.31

5 years ago

1.0.30

5 years ago

1.0.29

5 years ago

1.0.28

5 years ago

1.0.26

5 years ago

1.0.25

5 years ago

1.0.27

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.23

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago