@instechnologies/ng-rooster
Version:
ng-rooster is wrapper to roosterjs, an open source library created by Microsoft: https://github.com/Microsoft/roosterjs.
1,225 lines (1,214 loc) • 41.6 kB
JavaScript
import { Injectable, Component, NgModule, Directive, ElementRef, Input, defineInjectable, EventEmitter, forwardRef, ViewChild, Output } from '@angular/core';
import { filter, map, pairwise } from 'rxjs/operators';
import { __read, __extends } from 'tslib';
import { Editor, setAlignment, setBackgroundColor, setDirection, setFontName, setFontSize, setIndentation, setTextColor, toggleBlockQuote, toggleBold, toggleBullet, toggleCodeBlock, toggleHeader, toggleItalic, toggleNumbering, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleUnderline, getFormatState } from 'roosterjs';
import { Observable, Subject, combineLatest } from 'rxjs';
import { isBoolean } from 'util';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var NgRoosterService = /** @class */ (function () {
function NgRoosterService() {
}
NgRoosterService.decorators = [
{ type: Injectable, args: [{
providedIn: 'root'
},] }
];
/** @nocollapse */
NgRoosterService.ctorParameters = function () { return []; };
/** @nocollapse */ NgRoosterService.ngInjectableDef = 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: 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 Editor(nativeElement, {
plugins: this.plugins,
defaultFormat: this.defaultFormat,
initialContent: this.initialContent,
disableRestoreSelectionOnFocus: this.disableRestoreSelectionOnFocus,
omitContentEditableAttributeChanges: this.omitContentEditableAttributeChanges
});
};
EditorDirective.decorators = [
{ type: Directive, args: [{
selector: '[rooster-editor]'
},] }
];
/** @nocollapse */
EditorDirective.ctorParameters = function () { return [
{ type: ElementRef }
]; };
EditorDirective.propDecorators = {
plugins: [{ type: Input }],
defaultFormat: [{ type: Input }],
initialContent: [{ type: Input }],
disableRestoreSelectionOnFocus: [{ type: Input }],
omitContentEditableAttributeChanges: [{ type: Input }]
};
return EditorDirective;
}());
/**
* @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 Subject();
_this._contentChangeSubject = new 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 = getFormatState(this.editor);
this._subject.next(state);
};
return FormatStateObservable;
}(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 (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 Subject();
this.formatStatePlugin$ = new FormatStateObservable();
this.aligment$ = new Subject();
this.backgroundColor$ = new Subject();
this.backgroundColorChange = new EventEmitter();
this.direction$ = new Subject();
this.fontName$ = new Subject();
this.fontNameChange = new EventEmitter();
this.fontSize$ = new Subject();
this.fontSizeChange = new EventEmitter();
this.indentation$ = new Subject();
this.textColor$ = new Subject();
this.textColorChange = new EventEmitter();
this.toggleBlockQuote$$ = new Subject();
this.isBlockQuoteChange = new EventEmitter();
this.toggleBold$$ = new Subject();
this.isBoldChange = new EventEmitter();
this.toggleBullet$$ = new Subject();
this.isBulletChange = new EventEmitter();
this.toggleCodeBlock$$ = new Subject();
this.toggleHeader$$ = new Subject();
this.headerLevelChange = new EventEmitter();
this.toggleItalic$$ = new Subject();
this.isItalicChange = new EventEmitter();
this.toggleNumbering$$ = new Subject();
this.isNumberingChange = new EventEmitter();
this.toggleStrikethrough$$ = new Subject();
this.isStrikeThroughChange = new EventEmitter();
this.toggleSubscript$$ = new Subject();
this.isSubscriptChange = new EventEmitter();
this.toggleSuperscript$$ = new Subject();
this.isSuperscriptChange = new EventEmitter();
this.toggleUnderline$$ = new Subject();
this.isUnderlineChange = new EventEmitter();
combineLatest(this.aligment$, this.editor$).pipe(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];
setAlignment(editor, value);
}));
combineLatest(this.backgroundColor$, this.editor$).pipe(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];
setBackgroundColor(editor, value);
}));
combineLatest(this.direction$, this.editor$).pipe(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];
setDirection(editor, value);
}));
combineLatest(this.fontName$, this.editor$).pipe(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];
setFontName(editor, value);
}));
combineLatest(this.fontSize$, this.editor$).pipe(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];
setFontSize(editor, value);
}));
combineLatest(this.indentation$, this.editor$).pipe(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];
setIndentation(editor, value);
}));
combineLatest(this.textColor$, this.editor$).pipe(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];
setTextColor(editor, value);
}));
/** @type {?} */
var toggleBlockQuoteSubscription = null;
combineLatest(this.toggleBlockQuote$$, this.editor$).pipe(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) {
toggleBlockQuote(editor, val);
}));
}));
/** @type {?} */
var toggleBoldSubscription = null;
combineLatest(this.toggleBold$$, this.editor$).pipe(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) {
toggleBold(editor);
}));
}));
/** @type {?} */
var toggleBulletSubscription = null;
combineLatest(this.toggleBullet$$, this.editor$).pipe(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) {
toggleBullet(editor);
}));
}));
/** @type {?} */
var toggleCodeBlockSubscription = null;
combineLatest(this.toggleCodeBlock$$, this.editor$).pipe(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) {
toggleCodeBlock(editor, val);
}));
}));
/** @type {?} */
var toggleHeaderSubscription = null;
combineLatest(this.toggleHeader$$, this.editor$).pipe(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) {
toggleHeader(editor, val);
}));
}));
/** @type {?} */
var toggleItalicSubscription = null;
combineLatest(this.toggleItalic$$, this.editor$).pipe(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) {
toggleItalic(editor);
}));
}));
/** @type {?} */
var toggleNumberingSubscription = null;
combineLatest(this.toggleNumbering$$, this.editor$).pipe(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) {
toggleNumbering(editor);
}));
}));
/** @type {?} */
var toggleStrikethroughSubscription = null;
combineLatest(this.toggleStrikethrough$$, this.editor$).pipe(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) {
toggleStrikethrough(editor);
}));
}));
/** @type {?} */
var toggleSubscriptSubscription = null;
combineLatest(this.toggleSubscript$$, this.editor$).pipe(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) {
toggleSubscript(editor);
}));
}));
/** @type {?} */
var toggleSuperscriptSubscription = null;
combineLatest(this.toggleSuperscript$$, this.editor$).pipe(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) {
toggleSuperscript(editor);
}));
}));
/** @type {?} */
var toggleUnderlineSubscription = null;
combineLatest(this.toggleUnderline$$, this.editor$).pipe(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) {
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(pairwise(), 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(map((/**
* @param {?} s
* @return {?}
*/
function (s) { return s.fontName; })), filter((/**
* @param {?} v
* @return {?}
*/
function (v) { return !isNull(v); }))).subscribe((/**
* @param {?} v
* @return {?}
*/
function (v) { return _this.fontNameChange.emit(v); }));
formatStateChange$.pipe(map((/**
* @param {?} s
* @return {?}
*/
function (s) { return s.fontSize; })), filter((/**
* @param {?} v
* @return {?}
*/
function (v) { return !isNull(v); }))).subscribe((/**
* @param {?} v
* @return {?}
*/
function (v) { return _this.fontSizeChange.emit(v); }));
formatStateChange$.pipe(map((/**
* @param {?} s
* @return {?}
*/
function (s) { return s.isBold; })), filter((/**
* @param {?} v
* @return {?}
*/
function (v) { return !isNull(v); }))).subscribe((/**
* @param {?} v
* @return {?}
*/
function (v) { return _this.isBoldChange.emit(v); }));
formatStateChange$.pipe(map((/**
* @param {?} s
* @return {?}
*/
function (s) { return s.isItalic; })), filter((/**
* @param {?} v
* @return {?}
*/
function (v) { return !isNull(v); }))).subscribe((/**
* @param {?} v
* @return {?}
*/
function (v) { return _this.isItalicChange.emit(v); }));
formatStateChange$.pipe(map((/**
* @param {?} s
* @return {?}
*/
function (s) { return s.isUnderline; })), filter((/**
* @param {?} v
* @return {?}
*/
function (v) { return !isNull(v); }))).subscribe((/**
* @param {?} v
* @return {?}
*/
function (v) { return _this.isUnderlineChange.emit(v); }));
formatStateChange$.pipe(map((/**
* @param {?} s
* @return {?}
*/
function (s) { return s.backgroundColor; })), filter((/**
* @param {?} v
* @return {?}
*/
function (v) { return !isNull(v); }))).subscribe((/**
* @param {?} v
* @return {?}
*/
function (v) { return _this.backgroundColorChange.emit(v); }));
formatStateChange$.pipe(map((/**
* @param {?} s
* @return {?}
*/
function (s) { return s.textColor; })), filter((/**
* @param {?} v
* @return {?}
*/
function (v) { return !isNull(v); }))).subscribe((/**
* @param {?} v
* @return {?}
*/
function (v) { return _this.textColorChange.emit(v); }));
formatStateChange$.pipe(map((/**
* @param {?} s
* @return {?}
*/
function (s) { return s.isBullet; })), filter((/**
* @param {?} v
* @return {?}
*/
function (v) { return !isNull(v); }))).subscribe((/**
* @param {?} v
* @return {?}
*/
function (v) { return _this.isBulletChange.emit(v); }));
formatStateChange$.pipe(map((/**
* @param {?} s
* @return {?}
*/
function (s) { return s.isNumbering; })), filter((/**
* @param {?} v
* @return {?}
*/
function (v) { return !isNull(v); }))).subscribe((/**
* @param {?} v
* @return {?}
*/
function (v) { return _this.isNumberingChange.emit(v); }));
formatStateChange$.pipe(map((/**
* @param {?} s
* @return {?}
*/
function (s) { return s.isStrikeThrough; })), filter((/**
* @param {?} v
* @return {?}
*/
function (v) { return !isNull(v); }))).subscribe((/**
* @param {?} v
* @return {?}
*/
function (v) { return _this.isStrikeThroughChange.emit(v); }));
formatStateChange$.pipe(map((/**
* @param {?} s
* @return {?}
*/
function (s) { return s.isBlockQuote; })), filter((/**
* @param {?} v
* @return {?}
*/
function (v) { return !isNull(v); }))).subscribe((/**
* @param {?} v
* @return {?}
*/
function (v) { return _this.isBlockQuoteChange.emit(v); }));
formatStateChange$.pipe(map((/**
* @param {?} s
* @return {?}
*/
function (s) { return s.isSubscript; })), filter((/**
* @param {?} v
* @return {?}
*/
function (v) { return !isNull(v); }))).subscribe((/**
* @param {?} v
* @return {?}
*/
function (v) { return _this.isSubscriptChange.emit(v); }));
formatStateChange$.pipe(map((/**
* @param {?} s
* @return {?}
*/
function (s) { return s.isSuperscript; })), 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: 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: NG_VALUE_ACCESSOR,
useExisting: 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: ViewChild, args: [EditorDirective,] }],
aligment: [{ type: Input }],
backgroundColor: [{ type: Input }],
backgroundColorChange: [{ type: Output }],
direction: [{ type: Input }],
fontName: [{ type: Input }],
fontNameChange: [{ type: Output }],
fontSize: [{ type: Input }],
fontSizeChange: [{ type: Output }],
indentation: [{ type: Input }],
textColor: [{ type: Input }],
textColorChange: [{ type: Output }],
toggleBlockQuote$: [{ type: Input }],
isBlockQuoteChange: [{ type: Output }],
toggleBold$: [{ type: Input }],
isBoldChange: [{ type: Output }],
toggleBullet$: [{ type: Input }],
isBulletChange: [{ type: Output }],
toggleCodeBlock$: [{ type: Input }],
toggleHeader$: [{ type: Input }],
headerLevelChange: [{ type: Output }],
toggleItalic$: [{ type: Input }],
isItalicChange: [{ type: Output }],
toggleNumbering$: [{ type: Input }],
isNumberingChange: [{ type: Output }],
toggleStrikethrough$: [{ type: Input }],
isStrikeThroughChange: [{ type: Output }],
toggleSubscript$: [{ type: Input }],
isSubscriptChange: [{ type: Output }],
toggleSuperscript$: [{ type: Input }],
isSuperscriptChange: [{ type: Output }],
toggleUnderline$: [{ type: Input }],
isUnderlineChange: [{ type: 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: 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
*/
export { NgRoosterService, NgRoosterComponent, NgRoosterModule, RoosterEditorComponent, EditorDirective };
//# sourceMappingURL=instechnologies-ng-rooster.js.map