UNPKG

ngx-editor

Version:

WYSIWYG Editor for Angular Applications

466 lines (465 loc) 31.5 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc */ import { Component, Input, Output, ViewChild, EventEmitter, Renderer2, forwardRef } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; import { CommandExecutorService } from './common/services/command-executor.service'; import { MessageService } from './common/services/message.service'; import { ngxEditorConfig } from './common/ngx-editor.defaults'; import * as Utils from './common/utils/ngx-editor.utils'; var NgxEditorComponent = /** @class */ (function () { /** * @param _messageService service to send message to the editor message component * @param _commandExecutor executes command from the toolbar * @param _renderer access and manipulate the dom element */ function NgxEditorComponent(_messageService, _commandExecutor, _renderer) { this._messageService = _messageService; this._commandExecutor = _commandExecutor; this._renderer = _renderer; /** * The editor can be resized vertically. * * `basic` resizer enables the html5 reszier. Check here https://www.w3schools.com/cssref/css3_pr_resize.asp * * `stack` resizer enable a resizer that looks like as if in https://stackoverflow.com */ this.resizer = 'stack'; /** * The config property is a JSON object * * All avaibale inputs inputs can be provided in the configuration as JSON * inputs provided directly are considered as top priority */ this.config = ngxEditorConfig; /** * emits `blur` event when focused out from the textarea */ this.blur = new EventEmitter(); /** * emits `focus` event when focused in to the textarea */ this.focus = new EventEmitter(); this.Utils = Utils; } /** * events */ /** * events * @return {?} */ NgxEditorComponent.prototype.onTextAreaFocus = /** * events * @return {?} */ function () { this.focus.emit('focus'); }; /** focus the text area when the editor is focussed */ /** * focus the text area when the editor is focussed * @return {?} */ NgxEditorComponent.prototype.onEditorFocus = /** * focus the text area when the editor is focussed * @return {?} */ function () { this.textArea.nativeElement.focus(); }; /** * Executed from the contenteditable section while the input property changes * @param html html string from contenteditable */ /** * Executed from the contenteditable section while the input property changes * @param {?} innerHTML * @return {?} */ NgxEditorComponent.prototype.onContentChange = /** * Executed from the contenteditable section while the input property changes * @param {?} innerHTML * @return {?} */ function (innerHTML) { if (typeof this.onChange === 'function') { this.onChange(innerHTML); this.togglePlaceholder(innerHTML); } }; /** * @return {?} */ NgxEditorComponent.prototype.onTextAreaBlur = /** * @return {?} */ function () { /** save selection if focussed out */ this._commandExecutor.savedSelection = Utils.saveSelection(); if (typeof this.onTouched === 'function') { this.onTouched(); } this.blur.emit('blur'); }; /** * resizing text area * * @param offsetY vertical height of the eidtable portion of the editor */ /** * resizing text area * * @param {?} offsetY vertical height of the eidtable portion of the editor * @return {?} */ NgxEditorComponent.prototype.resizeTextArea = /** * resizing text area * * @param {?} offsetY vertical height of the eidtable portion of the editor * @return {?} */ function (offsetY) { /** @type {?} */ var newHeight = parseInt(this.height, 10); newHeight += offsetY; this.height = newHeight + 'px'; this.textArea.nativeElement.style.height = this.height; }; /** * editor actions, i.e., executes command from toolbar * * @param commandName name of the command to be executed */ /** * editor actions, i.e., executes command from toolbar * * @param {?} commandName name of the command to be executed * @return {?} */ NgxEditorComponent.prototype.executeCommand = /** * editor actions, i.e., executes command from toolbar * * @param {?} commandName name of the command to be executed * @return {?} */ function (commandName) { try { this._commandExecutor.execute(commandName); } catch (error) { this._messageService.sendMessage(error.message); } }; /** * Write a new value to the element. * * @param value value to be executed when there is a change in contenteditable */ /** * Write a new value to the element. * * @param {?} value value to be executed when there is a change in contenteditable * @return {?} */ NgxEditorComponent.prototype.writeValue = /** * Write a new value to the element. * * @param {?} value value to be executed when there is a change in contenteditable * @return {?} */ function (value) { this.togglePlaceholder(value); if (value === null || value === undefined || value === '' || value === '<br>') { value = null; } this.refreshView(value); }; /** * Set the function to be called * when the control receives a change event. * * @param fn a function */ /** * Set the function to be called * when the control receives a change event. * * @param {?} fn a function * @return {?} */ NgxEditorComponent.prototype.registerOnChange = /** * Set the function to be called * when the control receives a change event. * * @param {?} fn a function * @return {?} */ function (fn) { this.onChange = fn; }; /** * Set the function to be called * when the control receives a touch event. * * @param fn a function */ /** * Set the function to be called * when the control receives a touch event. * * @param {?} fn a function * @return {?} */ NgxEditorComponent.prototype.registerOnTouched = /** * Set the function to be called * when the control receives a touch event. * * @param {?} fn a function * @return {?} */ function (fn) { this.onTouched = fn; }; /** * refresh view/HTML of the editor * * @param value html string from the editor */ /** * refresh view/HTML of the editor * * @param {?} value html string from the editor * @return {?} */ NgxEditorComponent.prototype.refreshView = /** * refresh view/HTML of the editor * * @param {?} value html string from the editor * @return {?} */ function (value) { /** @type {?} */ var normalizedValue = value === null ? '' : value; this._renderer.setProperty(this.textArea.nativeElement, 'innerHTML', normalizedValue); }; /** * toggles placeholder based on input string * * @param value A HTML string from the editor */ /** * toggles placeholder based on input string * * @param {?} value A HTML string from the editor * @return {?} */ NgxEditorComponent.prototype.togglePlaceholder = /** * toggles placeholder based on input string * * @param {?} value A HTML string from the editor * @return {?} */ function (value) { if (!value || value === '<br>' || value === '') { this._renderer.addClass(this.ngxWrapper.nativeElement, 'show-placeholder'); } else { this._renderer.removeClass(this.ngxWrapper.nativeElement, 'show-placeholder'); } }; /** * returns a json containing input params */ /** * returns a json containing input params * @return {?} */ NgxEditorComponent.prototype.getCollectiveParams = /** * returns a json containing input params * @return {?} */ function () { return { editable: this.editable, spellcheck: this.spellcheck, placeholder: this.placeholder, translate: this.translate, height: this.height, minHeight: this.minHeight, width: this.width, minWidth: this.minWidth, enableToolbar: this.enableToolbar, showToolbar: this.showToolbar, imageEndPoint: this.imageEndPoint, toolbar: this.toolbar }; }; /** * @return {?} */ NgxEditorComponent.prototype.ngOnInit = /** * @return {?} */ function () { /** * set configuartion */ this.config = this.Utils.getEditorConfiguration(this.config, ngxEditorConfig, this.getCollectiveParams()); this.height = this.height || this.textArea.nativeElement.offsetHeight; this.executeCommand('enableObjectResizing'); }; NgxEditorComponent.decorators = [ { type: Component, args: [{ selector: 'app-ngx-editor', template: "<div class=\"ngx-editor\" id=\"ngxEditor\" [style.width]=\"config['width']\" [style.minWidth]=\"config['minWidth']\" tabindex=\"0\"\n (focus)=\"onEditorFocus()\">\n\n <app-ngx-editor-toolbar [config]=\"config\" (execute)=\"executeCommand($event)\"></app-ngx-editor-toolbar>\n\n <!-- text area -->\n <div class=\"ngx-wrapper\" #ngxWrapper>\n <div class=\"ngx-editor-textarea\" [attr.contenteditable]=\"config['editable']\" (input)=\"onContentChange($event.target.innerHTML)\"\n [attr.translate]=\"config['translate']\" [attr.spellcheck]=\"config['spellcheck']\" [style.height]=\"config['height']\"\n [style.minHeight]=\"config['minHeight']\" [style.resize]=\"Utils?.canResize(resizer)\" (focus)=\"onTextAreaFocus()\"\n (blur)=\"onTextAreaBlur()\" #ngxTextArea></div>\n\n <span class=\"ngx-editor-placeholder\">{{ placeholder || config['placeholder'] }}</span>\n </div>\n\n <app-ngx-editor-message></app-ngx-editor-message>\n <app-ngx-grippie *ngIf=\"resizer === 'stack'\"></app-ngx-grippie>\n\n</div>\n", providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(function () { return NgxEditorComponent; }), multi: true }], styles: [".ngx-editor{position:relative}.ngx-editor ::ng-deep [contenteditable=true]:empty:before{content:attr(placeholder);display:block;color:#868e96;opacity:1}.ngx-editor .ngx-wrapper{position:relative}.ngx-editor .ngx-wrapper .ngx-editor-textarea{min-height:5rem;padding:.5rem .8rem 1rem;border:1px solid #ddd;background-color:transparent;overflow-x:hidden;overflow-y:auto;z-index:2;position:relative}.ngx-editor .ngx-wrapper .ngx-editor-textarea.focus,.ngx-editor .ngx-wrapper .ngx-editor-textarea:focus{outline:0}.ngx-editor .ngx-wrapper .ngx-editor-textarea ::ng-deep blockquote{margin-left:1rem;border-left:.2em solid #dfe2e5;padding-left:.5rem}.ngx-editor .ngx-wrapper ::ng-deep p{margin-bottom:0}.ngx-editor .ngx-wrapper .ngx-editor-placeholder{display:none;position:absolute;top:0;padding:.5rem .8rem 1rem .9rem;z-index:1;color:#6c757d;opacity:1}.ngx-editor .ngx-wrapper.show-placeholder .ngx-editor-placeholder{display:block}"] }] } ]; /** @nocollapse */ NgxEditorComponent.ctorParameters = function () { return [ { type: MessageService }, { type: CommandExecutorService }, { type: Renderer2 } ]; }; NgxEditorComponent.propDecorators = { editable: [{ type: Input }], spellcheck: [{ type: Input }], placeholder: [{ type: Input }], translate: [{ type: Input }], height: [{ type: Input }], minHeight: [{ type: Input }], width: [{ type: Input }], minWidth: [{ type: Input }], toolbar: [{ type: Input }], resizer: [{ type: Input }], config: [{ type: Input }], showToolbar: [{ type: Input }], enableToolbar: [{ type: Input }], imageEndPoint: [{ type: Input }], blur: [{ type: Output }], focus: [{ type: Output }], textArea: [{ type: ViewChild, args: ['ngxTextArea',] }], ngxWrapper: [{ type: ViewChild, args: ['ngxWrapper',] }] }; return NgxEditorComponent; }()); export { NgxEditorComponent }; if (false) { /** * Specifies weather the textarea to be editable or not * @type {?} */ NgxEditorComponent.prototype.editable; /** * The spellcheck property specifies whether the element is to have its spelling and grammar checked or not. * @type {?} */ NgxEditorComponent.prototype.spellcheck; /** * Placeholder for the textArea * @type {?} */ NgxEditorComponent.prototype.placeholder; /** * The translate property specifies whether the content of an element should be translated or not. * * Check https://www.w3schools.com/tags/att_global_translate.asp for more information and browser support * @type {?} */ NgxEditorComponent.prototype.translate; /** * Sets height of the editor * @type {?} */ NgxEditorComponent.prototype.height; /** * Sets minimum height for the editor * @type {?} */ NgxEditorComponent.prototype.minHeight; /** * Sets Width of the editor * @type {?} */ NgxEditorComponent.prototype.width; /** * Sets minimum width of the editor * @type {?} */ NgxEditorComponent.prototype.minWidth; /** * Toolbar accepts an array which specifies the options to be enabled for the toolbar * * Check ngxEditorConfig for toolbar configuration * * Passing an empty array will enable all toolbar * @type {?} */ NgxEditorComponent.prototype.toolbar; /** * The editor can be resized vertically. * * `basic` resizer enables the html5 reszier. Check here https://www.w3schools.com/cssref/css3_pr_resize.asp * * `stack` resizer enable a resizer that looks like as if in https://stackoverflow.com * @type {?} */ NgxEditorComponent.prototype.resizer; /** * The config property is a JSON object * * All avaibale inputs inputs can be provided in the configuration as JSON * inputs provided directly are considered as top priority * @type {?} */ NgxEditorComponent.prototype.config; /** * Weather to show or hide toolbar * @type {?} */ NgxEditorComponent.prototype.showToolbar; /** * Weather to enable or disable the toolbar * @type {?} */ NgxEditorComponent.prototype.enableToolbar; /** * Endpoint for which the image to be uploaded * @type {?} */ NgxEditorComponent.prototype.imageEndPoint; /** * emits `blur` event when focused out from the textarea * @type {?} */ NgxEditorComponent.prototype.blur; /** * emits `focus` event when focused in to the textarea * @type {?} */ NgxEditorComponent.prototype.focus; /** @type {?} */ NgxEditorComponent.prototype.textArea; /** @type {?} */ NgxEditorComponent.prototype.ngxWrapper; /** @type {?} */ NgxEditorComponent.prototype.Utils; /** @type {?} */ NgxEditorComponent.prototype.onChange; /** @type {?} */ NgxEditorComponent.prototype.onTouched; /** @type {?} */ NgxEditorComponent.prototype._messageService; /** @type {?} */ NgxEditorComponent.prototype._commandExecutor; /** @type {?} */ NgxEditorComponent.prototype._renderer; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LWVkaXRvci5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9uZ3gtZWRpdG9yLyIsInNvdXJjZXMiOlsiYXBwL25neC1lZGl0b3Ivbmd4LWVkaXRvci5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFBLE9BQU8sRUFDTCxTQUFTLEVBQVUsS0FBSyxFQUFFLE1BQU0sRUFBRSxTQUFTLEVBQzNDLFlBQVksRUFBRSxTQUFTLEVBQUUsVUFBVSxFQUNwQyxNQUFNLGVBQWUsQ0FBQztBQUN2QixPQUFPLEVBQUUsaUJBQWlCLEVBQXdCLE1BQU0sZ0JBQWdCLENBQUM7QUFFekUsT0FBTyxFQUFFLHNCQUFzQixFQUFFLE1BQU0sNENBQTRDLENBQUM7QUFDcEYsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLG1DQUFtQyxDQUFDO0FBRW5FLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUMvRCxPQUFPLEtBQUssS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