UNPKG

@instechnologies/ng-rooster

Version:

ng-rooster is wrapper to roosterjs, an open source library created by Microsoft: https://github.com/Microsoft/roosterjs.

1,172 lines (1,156 loc) 49.3 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs/operators'), require('roosterjs'), require('rxjs'), require('util'), require('@angular/forms')) : typeof define === 'function' && define.amd ? define('@instechnologies/ng-rooster', ['exports', '@angular/core', 'rxjs/operators', 'roosterjs', 'rxjs', 'util', '@angular/forms'], factory) : (factory((global.instechnologies = global.instechnologies || {}, global.instechnologies['ng-rooster'] = {}),global.ng.core,global.rxjs.operators,global.RoosterJs,global.rxjs,global.util,global.ng.forms)); }(this, (function (exports,i0,operators,RoosterJs,rxjs,util,forms) { 'use strict'; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NgRoosterService = /** @class */ (function () { function NgRoosterService() { } NgRoosterService.decorators = [ { type: i0.Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ NgRoosterService.ctorParameters = function () { return []; }; /** @nocollapse */ NgRoosterService.ngInjectableDef = i0.defineInjectable({ factory: function NgRoosterService_Factory() { return new NgRoosterService(); }, token: NgRoosterService, providedIn: "root" }); return NgRoosterService; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NgRoosterComponent = /** @class */ (function () { function NgRoosterComponent() { } /** * @return {?} */ NgRoosterComponent.prototype.ngOnInit = /** * @return {?} */ function () { }; NgRoosterComponent.decorators = [ { type: i0.Component, args: [{ selector: 'lib-ng-rooster', template: "\n <p>\n ng-rooster works!\n </p>\n " }] } ]; /** @nocollapse */ NgRoosterComponent.ctorParameters = function () { return []; }; return NgRoosterComponent; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var EditorDirective = /** @class */ (function () { function EditorDirective(el) { this.el = el; } Object.defineProperty(EditorDirective.prototype, "editor", { get: /** * @return {?} */ function () { return this._editor; }, enumerable: true, configurable: true }); /** * @return {?} */ EditorDirective.prototype.ngOnInit = /** * @return {?} */ function () { /** @type {?} */ var nativeElement = this.el.nativeElement; this._editor = new RoosterJs.Editor(nativeElement, { plugins: this.plugins, defaultFormat: this.defaultFormat, initialContent: this.initialContent, disableRestoreSelectionOnFocus: this.disableRestoreSelectionOnFocus, omitContentEditableAttributeChanges: this.omitContentEditableAttributeChanges }); }; EditorDirective.decorators = [ { type: i0.Directive, args: [{ selector: '[rooster-editor]' },] } ]; /** @nocollapse */ EditorDirective.ctorParameters = function () { return [ { type: i0.ElementRef } ]; }; EditorDirective.propDecorators = { plugins: [{ type: i0.Input }], defaultFormat: [{ type: i0.Input }], initialContent: [{ type: i0.Input }], disableRestoreSelectionOnFocus: [{ type: i0.Input }], omitContentEditableAttributeChanges: [{ type: i0.Input }] }; return EditorDirective; }()); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var FormatStateObservable = /** @class */ (function (_super) { __extends(FormatStateObservable, _super); function FormatStateObservable() { var _this = _super.call(this, (( /** * @param {?} subscriber * @return {?} */function (subscriber) { _this._subject.subscribe(( /** * @param {?} value * @return {?} */function (value) { return subscriber.next(value); }), ( /** * @param {?} error * @return {?} */function (error) { return subscriber.error(error); }), ( /** * @return {?} */function () { return subscriber.complete(); })); }))) || this; _this._subject = new rxjs.Subject(); _this._contentChangeSubject = new rxjs.Subject(); return _this; } /** * @return {?} */ FormatStateObservable.prototype.getContentObservable = /** * @return {?} */ function () { return this._contentChangeSubject; }; /** * @param {?} editor * @return {?} */ FormatStateObservable.prototype.initialize = /** * @param {?} editor * @return {?} */ function (editor) { this.editor = editor; }; /** * @return {?} */ FormatStateObservable.prototype.getName = /** * @return {?} */ function () { return 'FormatStateObservable'; }; /** * @return {?} */ FormatStateObservable.prototype.dispose = /** * @return {?} */ function () { this._subject.complete(); this._contentChangeSubject.complete(); }; /** * @param {?} event * @return {?} */ FormatStateObservable.prototype.onPluginEvent = /** * @param {?} event * @return {?} */ function (event) { //console.log(event); switch (event.eventType) { case 4 /* MouseDown */: this.getFormatState(); break; case 0 /* KeyDown */: this.getFormatState(); break; case 6 /* ContentChanged */: this.getFormatState(); case 11 /* Input */: this.getContent(); break; } }; /** * @private * @return {?} */ FormatStateObservable.prototype.getContent = /** * @private * @return {?} */ function () { /** @type {?} */ var content = this.editor.getContent(true); this._contentChangeSubject.next(content); }; /** * @private * @return {?} */ FormatStateObservable.prototype.getFormatState = /** * @private * @return {?} */ function () { /** @type {?} */ var state = RoosterJs.getFormatState(this.editor); this._subject.next(state); }; return FormatStateObservable; }(rxjs.Observable)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} val * @return {?} */ function isNull(val) { if (val) return false; else if (util.isBoolean(val)) return false; else return true; } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var RoosterEditorComponent = /** @class */ (function () { function RoosterEditorComponent() { this.onChange = ( /** * @return {?} */function () { }); this.onTouched = ( /** * @return {?} */function () { }); this.editor$ = new rxjs.Subject(); this.formatStatePlugin$ = new FormatStateObservable(); this.aligment$ = new rxjs.Subject(); this.backgroundColor$ = new rxjs.Subject(); this.backgroundColorChange = new i0.EventEmitter(); this.direction$ = new rxjs.Subject(); this.fontName$ = new rxjs.Subject(); this.fontNameChange = new i0.EventEmitter(); this.fontSize$ = new rxjs.Subject(); this.fontSizeChange = new i0.EventEmitter(); this.indentation$ = new rxjs.Subject(); this.textColor$ = new rxjs.Subject(); this.textColorChange = new i0.EventEmitter(); this.toggleBlockQuote$$ = new rxjs.Subject(); this.isBlockQuoteChange = new i0.EventEmitter(); this.toggleBold$$ = new rxjs.Subject(); this.isBoldChange = new i0.EventEmitter(); this.toggleBullet$$ = new rxjs.Subject(); this.isBulletChange = new i0.EventEmitter(); this.toggleCodeBlock$$ = new rxjs.Subject(); this.toggleHeader$$ = new rxjs.Subject(); this.headerLevelChange = new i0.EventEmitter(); this.toggleItalic$$ = new rxjs.Subject(); this.isItalicChange = new i0.EventEmitter(); this.toggleNumbering$$ = new rxjs.Subject(); this.isNumberingChange = new i0.EventEmitter(); this.toggleStrikethrough$$ = new rxjs.Subject(); this.isStrikeThroughChange = new i0.EventEmitter(); this.toggleSubscript$$ = new rxjs.Subject(); this.isSubscriptChange = new i0.EventEmitter(); this.toggleSuperscript$$ = new rxjs.Subject(); this.isSuperscriptChange = new i0.EventEmitter(); this.toggleUnderline$$ = new rxjs.Subject(); this.isUnderlineChange = new i0.EventEmitter(); rxjs.combineLatest(this.aligment$, this.editor$).pipe(operators.filter(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; return !isNull(editor) && !isNull(value); }))).subscribe(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; RoosterJs.setAlignment(editor, value); })); rxjs.combineLatest(this.backgroundColor$, this.editor$).pipe(operators.filter(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; return !isNull(editor) && !isNull(value); }))).subscribe(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; RoosterJs.setBackgroundColor(editor, value); })); rxjs.combineLatest(this.direction$, this.editor$).pipe(operators.filter(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; return !isNull(editor) && !isNull(value); }))).subscribe(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; RoosterJs.setDirection(editor, value); })); rxjs.combineLatest(this.fontName$, this.editor$).pipe(operators.filter(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; return !isNull(editor) && !isNull(value); }))).subscribe(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; RoosterJs.setFontName(editor, value); })); rxjs.combineLatest(this.fontSize$, this.editor$).pipe(operators.filter(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; return !isNull(editor) && !isNull(value); }))).subscribe(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; RoosterJs.setFontSize(editor, value); })); rxjs.combineLatest(this.indentation$, this.editor$).pipe(operators.filter(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; return !isNull(editor) && !isNull(value); }))).subscribe(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; RoosterJs.setIndentation(editor, value); })); rxjs.combineLatest(this.textColor$, this.editor$).pipe(operators.filter(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; return !isNull(editor) && !isNull(value); }))).subscribe(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; RoosterJs.setTextColor(editor, value); })); /** @type {?} */ var toggleBlockQuoteSubscription = null; rxjs.combineLatest(this.toggleBlockQuote$$, this.editor$).pipe(operators.filter(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; return !isNull(editor) && !isNull(value); }))).subscribe(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; if (toggleBlockQuoteSubscription) toggleBlockQuoteSubscription.unsubscribe(); toggleBlockQuoteSubscription = value.subscribe(( /** * @param {?} val * @return {?} */function (val) { RoosterJs.toggleBlockQuote(editor, val); })); })); /** @type {?} */ var toggleBoldSubscription = null; rxjs.combineLatest(this.toggleBold$$, this.editor$).pipe(operators.filter(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; return !isNull(editor) && !isNull(value); }))).subscribe(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; if (toggleBoldSubscription) toggleBoldSubscription.unsubscribe(); toggleBoldSubscription = value.subscribe(( /** * @param {?} val * @return {?} */function (val) { RoosterJs.toggleBold(editor); })); })); /** @type {?} */ var toggleBulletSubscription = null; rxjs.combineLatest(this.toggleBullet$$, this.editor$).pipe(operators.filter(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; return !isNull(editor) && !isNull(value); }))).subscribe(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; if (toggleBulletSubscription) toggleBulletSubscription.unsubscribe(); toggleBulletSubscription = value.subscribe(( /** * @param {?} val * @return {?} */function (val) { RoosterJs.toggleBullet(editor); })); })); /** @type {?} */ var toggleCodeBlockSubscription = null; rxjs.combineLatest(this.toggleCodeBlock$$, this.editor$).pipe(operators.filter(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; return !isNull(editor) && !isNull(value); }))).subscribe(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; if (toggleCodeBlockSubscription) toggleCodeBlockSubscription.unsubscribe(); toggleCodeBlockSubscription = value.subscribe(( /** * @param {?} val * @return {?} */function (val) { RoosterJs.toggleCodeBlock(editor, val); })); })); /** @type {?} */ var toggleHeaderSubscription = null; rxjs.combineLatest(this.toggleHeader$$, this.editor$).pipe(operators.filter(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; return !isNull(editor) && !isNull(value); }))).subscribe(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; if (toggleHeaderSubscription) toggleHeaderSubscription.unsubscribe(); toggleHeaderSubscription = value.subscribe(( /** * @param {?} val * @return {?} */function (val) { RoosterJs.toggleHeader(editor, val); })); })); /** @type {?} */ var toggleItalicSubscription = null; rxjs.combineLatest(this.toggleItalic$$, this.editor$).pipe(operators.filter(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; return !isNull(editor) && !isNull(value); }))).subscribe(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; if (toggleItalicSubscription) toggleItalicSubscription.unsubscribe(); toggleItalicSubscription = value.subscribe(( /** * @param {?} val * @return {?} */function (val) { RoosterJs.toggleItalic(editor); })); })); /** @type {?} */ var toggleNumberingSubscription = null; rxjs.combineLatest(this.toggleNumbering$$, this.editor$).pipe(operators.filter(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; return !isNull(editor) && !isNull(value); }))).subscribe(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; if (toggleNumberingSubscription) toggleNumberingSubscription.unsubscribe(); toggleNumberingSubscription = value.subscribe(( /** * @param {?} val * @return {?} */function (val) { RoosterJs.toggleNumbering(editor); })); })); /** @type {?} */ var toggleStrikethroughSubscription = null; rxjs.combineLatest(this.toggleStrikethrough$$, this.editor$).pipe(operators.filter(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; return !isNull(editor) && !isNull(value); }))).subscribe(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; if (toggleStrikethroughSubscription) toggleStrikethroughSubscription.unsubscribe(); toggleStrikethroughSubscription = value.subscribe(( /** * @param {?} val * @return {?} */function (val) { RoosterJs.toggleStrikethrough(editor); })); })); /** @type {?} */ var toggleSubscriptSubscription = null; rxjs.combineLatest(this.toggleSubscript$$, this.editor$).pipe(operators.filter(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; return !isNull(editor) && !isNull(value); }))).subscribe(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; if (toggleSubscriptSubscription) toggleSubscriptSubscription.unsubscribe(); toggleSubscriptSubscription = value.subscribe(( /** * @param {?} val * @return {?} */function (val) { RoosterJs.toggleSubscript(editor); })); })); /** @type {?} */ var toggleSuperscriptSubscription = null; rxjs.combineLatest(this.toggleSuperscript$$, this.editor$).pipe(operators.filter(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; return !isNull(editor) && !isNull(value); }))).subscribe(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; if (toggleSuperscriptSubscription) toggleSuperscriptSubscription.unsubscribe(); toggleSuperscriptSubscription = value.subscribe(( /** * @param {?} val * @return {?} */function (val) { RoosterJs.toggleSuperscript(editor); })); })); /** @type {?} */ var toggleUnderlineSubscription = null; rxjs.combineLatest(this.toggleUnderline$$, this.editor$).pipe(operators.filter(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; return !isNull(editor) && !isNull(value); }))).subscribe(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), value = _b[0], editor = _b[1]; if (toggleUnderlineSubscription) toggleUnderlineSubscription.unsubscribe(); toggleUnderlineSubscription = value.subscribe(( /** * @param {?} val * @return {?} */function (val) { RoosterJs.toggleUnderline(editor); })); })); } Object.defineProperty(RoosterEditorComponent.prototype, "aligment", { set: /** * @param {?} v * @return {?} */ function (v) { this.aligment$.next(v); }, enumerable: true, configurable: true }); Object.defineProperty(RoosterEditorComponent.prototype, "backgroundColor", { set: /** * @param {?} v * @return {?} */ function (v) { this.backgroundColor$.next(v); }, enumerable: true, configurable: true }); Object.defineProperty(RoosterEditorComponent.prototype, "direction", { set: /** * @param {?} v * @return {?} */ function (v) { this.direction$.next(v); }, enumerable: true, configurable: true }); Object.defineProperty(RoosterEditorComponent.prototype, "fontName", { set: /** * @param {?} v * @return {?} */ function (v) { this.fontName$.next(v); }, enumerable: true, configurable: true }); Object.defineProperty(RoosterEditorComponent.prototype, "fontSize", { set: /** * @param {?} v * @return {?} */ function (v) { this.fontSize$.next(v); }, enumerable: true, configurable: true }); Object.defineProperty(RoosterEditorComponent.prototype, "indentation", { set: /** * @param {?} v * @return {?} */ function (v) { this.indentation$.next(v); }, enumerable: true, configurable: true }); Object.defineProperty(RoosterEditorComponent.prototype, "textColor", { set: /** * @param {?} v * @return {?} */ function (v) { this.textColor$.next(v); }, enumerable: true, configurable: true }); Object.defineProperty(RoosterEditorComponent.prototype, "toggleBlockQuote$", { set: /** * @param {?} v * @return {?} */ function (v) { this.toggleBlockQuote$$.next(v); }, enumerable: true, configurable: true }); Object.defineProperty(RoosterEditorComponent.prototype, "toggleBold$", { set: /** * @param {?} v * @return {?} */ function (v) { this.toggleBold$$.next(v); }, enumerable: true, configurable: true }); Object.defineProperty(RoosterEditorComponent.prototype, "toggleBullet$", { set: /** * @param {?} v * @return {?} */ function (v) { this.toggleBullet$$.next(v); }, enumerable: true, configurable: true }); Object.defineProperty(RoosterEditorComponent.prototype, "toggleCodeBlock$", { set: /** * @param {?} v * @return {?} */ function (v) { this.toggleCodeBlock$$.next(v); }, enumerable: true, configurable: true }); Object.defineProperty(RoosterEditorComponent.prototype, "toggleHeader$", { set: /** * @param {?} v * @return {?} */ function (v) { this.toggleHeader$$.next(v); }, enumerable: true, configurable: true }); Object.defineProperty(RoosterEditorComponent.prototype, "toggleItalic$", { set: /** * @param {?} v * @return {?} */ function (v) { this.toggleItalic$$.next(v); }, enumerable: true, configurable: true }); Object.defineProperty(RoosterEditorComponent.prototype, "toggleNumbering$", { set: /** * @param {?} v * @return {?} */ function (v) { this.toggleNumbering$$.next(v); }, enumerable: true, configurable: true }); Object.defineProperty(RoosterEditorComponent.prototype, "toggleStrikethrough$", { set: /** * @param {?} v * @return {?} */ function (v) { this.toggleStrikethrough$$.next(v); }, enumerable: true, configurable: true }); Object.defineProperty(RoosterEditorComponent.prototype, "toggleSubscript$", { set: /** * @param {?} v * @return {?} */ function (v) { this.toggleSubscript$$.next(v); }, enumerable: true, configurable: true }); Object.defineProperty(RoosterEditorComponent.prototype, "toggleSuperscript$", { set: /** * @param {?} v * @return {?} */ function (v) { this.toggleSuperscript$$.next(v); }, enumerable: true, configurable: true }); Object.defineProperty(RoosterEditorComponent.prototype, "toggleUnderline$", { set: /** * @param {?} v * @return {?} */ function (v) { this.toggleUnderline$$.next(v); }, enumerable: true, configurable: true }); /** * @return {?} */ RoosterEditorComponent.prototype.ngOnInit = /** * @return {?} */ function () { var _this = this; this.formatStatePlugin$.getContentObservable().subscribe(( /** * @param {?} v * @return {?} */function (v) { return _this.onChange(v); })); /** @type {?} */ var formatStateChange$ = this.formatStatePlugin$.pipe(operators.pairwise(), operators.map(( /** * @param {?} __0 * @return {?} */function (_a) { var _b = __read(_a, 2), previous = _b[0], current = _b[1]; /** @type {?} */ var result = {}; console.log(current); /** @type {?} */ var keys = Object.keys(current); for (var i = 0; i < keys.length; i++) { /** @type {?} */ var key = keys[i]; /** @type {?} */ var previousValue = previous[key]; /** @type {?} */ var currentValue = current[key]; if (currentValue !== previousValue) result[key] = currentValue; } return result; }))); formatStateChange$.pipe(operators.map(( /** * @param {?} s * @return {?} */function (s) { return s.fontName; })), operators.filter(( /** * @param {?} v * @return {?} */function (v) { return !isNull(v); }))).subscribe(( /** * @param {?} v * @return {?} */function (v) { return _this.fontNameChange.emit(v); })); formatStateChange$.pipe(operators.map(( /** * @param {?} s * @return {?} */function (s) { return s.fontSize; })), operators.filter(( /** * @param {?} v * @return {?} */function (v) { return !isNull(v); }))).subscribe(( /** * @param {?} v * @return {?} */function (v) { return _this.fontSizeChange.emit(v); })); formatStateChange$.pipe(operators.map(( /** * @param {?} s * @return {?} */function (s) { return s.isBold; })), operators.filter(( /** * @param {?} v * @return {?} */function (v) { return !isNull(v); }))).subscribe(( /** * @param {?} v * @return {?} */function (v) { return _this.isBoldChange.emit(v); })); formatStateChange$.pipe(operators.map(( /** * @param {?} s * @return {?} */function (s) { return s.isItalic; })), operators.filter(( /** * @param {?} v * @return {?} */function (v) { return !isNull(v); }))).subscribe(( /** * @param {?} v * @return {?} */function (v) { return _this.isItalicChange.emit(v); })); formatStateChange$.pipe(operators.map(( /** * @param {?} s * @return {?} */function (s) { return s.isUnderline; })), operators.filter(( /** * @param {?} v * @return {?} */function (v) { return !isNull(v); }))).subscribe(( /** * @param {?} v * @return {?} */function (v) { return _this.isUnderlineChange.emit(v); })); formatStateChange$.pipe(operators.map(( /** * @param {?} s * @return {?} */function (s) { return s.backgroundColor; })), operators.filter(( /** * @param {?} v * @return {?} */function (v) { return !isNull(v); }))).subscribe(( /** * @param {?} v * @return {?} */function (v) { return _this.backgroundColorChange.emit(v); })); formatStateChange$.pipe(operators.map(( /** * @param {?} s * @return {?} */function (s) { return s.textColor; })), operators.filter(( /** * @param {?} v * @return {?} */function (v) { return !isNull(v); }))).subscribe(( /** * @param {?} v * @return {?} */function (v) { return _this.textColorChange.emit(v); })); formatStateChange$.pipe(operators.map(( /** * @param {?} s * @return {?} */function (s) { return s.isBullet; })), operators.filter(( /** * @param {?} v * @return {?} */function (v) { return !isNull(v); }))).subscribe(( /** * @param {?} v * @return {?} */function (v) { return _this.isBulletChange.emit(v); })); formatStateChange$.pipe(operators.map(( /** * @param {?} s * @return {?} */function (s) { return s.isNumbering; })), operators.filter(( /** * @param {?} v * @return {?} */function (v) { return !isNull(v); }))).subscribe(( /** * @param {?} v * @return {?} */function (v) { return _this.isNumberingChange.emit(v); })); formatStateChange$.pipe(operators.map(( /** * @param {?} s * @return {?} */function (s) { return s.isStrikeThrough; })), operators.filter(( /** * @param {?} v * @return {?} */function (v) { return !isNull(v); }))).subscribe(( /** * @param {?} v * @return {?} */function (v) { return _this.isStrikeThroughChange.emit(v); })); formatStateChange$.pipe(operators.map(( /** * @param {?} s * @return {?} */function (s) { return s.isBlockQuote; })), operators.filter(( /** * @param {?} v * @return {?} */function (v) { return !isNull(v); }))).subscribe(( /** * @param {?} v * @return {?} */function (v) { return _this.isBlockQuoteChange.emit(v); })); formatStateChange$.pipe(operators.map(( /** * @param {?} s * @return {?} */function (s) { return s.isSubscript; })), operators.filter(( /** * @param {?} v * @return {?} */function (v) { return !isNull(v); }))).subscribe(( /** * @param {?} v * @return {?} */function (v) { return _this.isSubscriptChange.emit(v); })); formatStateChange$.pipe(operators.map(( /** * @param {?} s * @return {?} */function (s) { return s.isSuperscript; })), operators.filter(( /** * @param {?} v * @return {?} */function (v) { return !isNull(v); }))).subscribe(( /** * @param {?} v * @return {?} */function (v) { return _this.isSuperscriptChange.emit(v); })); // formatStateChange$.pipe( map(s=>s.canUnlink), filter(v=>!isNull(v)) ).subscribe(v=>this.u.emit(v)); // formatStateChange$.pipe( map(s=>s.canAddImageAltText), filter(v=>!isNull(v)) ); // formatStateChange$.pipe( map(s=>s.canUndo), filter(v=>!isNull(v)) ); // formatStateChange$.pipe( map(s=>s.canRedo), filter(v=>!isNull(v)) ); // formatStateChange$.pipe( map(s=>s.headerLevel), filter(v=>!isNull(v)) ); }; /** * @return {?} */ RoosterEditorComponent.prototype.ngAfterViewInit = /** * @return {?} */ function () { this.editor = this.editorDirective.editor; this.editor$.next(this.editor); this.editor$.complete(); }; /** * @return {?} */ RoosterEditorComponent.prototype.ngOnDestroy = /** * @return {?} */ function () { this.aligment$.complete(); this.backgroundColor$.complete(); this.direction$.complete(); this.fontName$.complete(); this.fontSize$.complete(); this.indentation$.complete(); this.textColor$.complete(); this.toggleBlockQuote$$.complete(); this.toggleBold$$.complete(); this.toggleBullet$$.complete(); this.toggleCodeBlock$$.complete(); this.toggleHeader$$.complete(); this.toggleItalic$$.complete(); this.toggleNumbering$$.complete(); this.toggleStrikethrough$$.complete(); this.toggleSubscript$$.complete(); this.toggleSuperscript$$.complete(); this.toggleUnderline$$.complete(); this.editor.dispose(); }; /** * @param {?} obj * @return {?} */ RoosterEditorComponent.prototype.writeValue = /** * @param {?} obj * @return {?} */ function (obj) { if (obj) this.editor.setContent(obj); }; /** * @param {?} fn * @return {?} */ RoosterEditorComponent.prototype.registerOnChange = /** * @param {?} fn * @return {?} */ function (fn) { this.onChange = fn; }; /** * @param {?} fn * @return {?} */ RoosterEditorComponent.prototype.registerOnTouched = /** * @param {?} fn * @return {?} */ function (fn) { this.onTouched = fn; }; /** * @param {?} isDisabled * @return {?} */ RoosterEditorComponent.prototype.setDisabledState = /** * @param {?} isDisabled * @return {?} */ function (isDisabled) { console.log(isDisabled); }; RoosterEditorComponent.decorators = [ { type: i0.Component, args: [{ selector: 'rooster-editor-box', template: "\r\n<div class=\"editor\" rooster-editor [plugins]=\"[formatStatePlugin$]\" ><ng-content></ng-content></div>\r\n", providers: [ { provide: forms.NG_VALUE_ACCESSOR, useExisting: i0.forwardRef(( /** * @return {?} */function () { return RoosterEditorComponent; })), multi: true } ], styles: [".editor{width:100%;height:100%}:host{display:block}"] }] } ]; /** @nocollapse */ RoosterEditorComponent.ctorParameters = function () { return []; }; RoosterEditorComponent.propDecorators = { editorDirective: [{ type: i0.ViewChild, args: [EditorDirective,] }], aligment: [{ type: i0.Input }], backgroundColor: [{ type: i0.Input }], backgroundColorChange: [{ type: i0.Output }], direction: [{ type: i0.Input }], fontName: [{ type: i0.Input }], fontNameChange: [{ type: i0.Output }], fontSize: [{ type: i0.Input }], fontSizeChange: [{ type: i0.Output }], indentation: [{ type: i0.Input }], textColor: [{ type: i0.Input }], textColorChange: [{ type: i0.Output }], toggleBlockQuote$: [{ type: i0.Input }], isBlockQuoteChange: [{ type: i0.Output }], toggleBold$: [{ type: i0.Input }], isBoldChange: [{ type: i0.Output }], toggleBullet$: [{ type: i0.Input }], isBulletChange: [{ type: i0.Output }], toggleCodeBlock$: [{ type: i0.Input }], toggleHeader$: [{ type: i0.Input }], headerLevelChange: [{ type: i0.Output }], toggleItalic$: [{ type: i0.Input }], isItalicChange: [{ type: i0.Output }], toggleNumbering$: [{ type: i0.Input }], isNumberingChange: [{ type: i0.Output }], toggleStrikethrough$: [{ type: i0.Input }], isStrikeThroughChange: [{ type: i0.Output }], toggleSubscript$: [{ type: i0.Input }], isSubscriptChange: [{ type: i0.Output }], toggleSuperscript$: [{ type: i0.Input }], isSuperscriptChange: [{ type: i0.Output }], toggleUnderline$: [{ type: i0.Input }], isUnderlineChange: [{ type: i0.Output }] }; return RoosterEditorComponent; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NgRoosterModule = /** @class */ (function () { function NgRoosterModule() { } NgRoosterModule.decorators = [ { type: i0.NgModule, args: [{ declarations: [ NgRoosterComponent, EditorDirective, RoosterEditorComponent, ], imports: [], exports: [ NgRoosterComponent, EditorDirective, RoosterEditorComponent, ] },] } ]; return NgRoosterModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ exports.NgRoosterService = NgRoosterService; exports.NgRoosterComponent = NgRoosterComponent; exports.NgRoosterModule = NgRoosterModule; exports.RoosterEditorComponent = RoosterEditorComponent; exports.EditorDirective = EditorDirective; Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=instechnologies-ng-rooster.umd.js.map