@covalent/text-editor
Version:
Teradata UI Platform Text Editor Module
206 lines (201 loc) • 40.1 kB
JavaScript
import * as i0 from '@angular/core';
import { inject, NgZone, forwardRef, Component, Input, ViewChild, NgModule } from '@angular/core';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import { marked } from 'marked';
const _c0 = ["easymde"];
const noop = () => {
// empty method
};
const EasyMDE = window.EasyMDE;
class TdTextEditorComponent {
_zone = inject(NgZone);
_value = '';
_easyMDE;
_fromEditor = false;
textarea;
options = {};
/* tslint:disable-next-line */
propagateChange = (_) => noop;
onTouched = () => noop;
/**
* value?: string
* Value in the Editor after async getEditorContent was called
*/
set value(value) {
this._value = value;
if (this._easyMDE) {
if (!this._fromEditor) {
this._easyMDE.value(value);
}
this.propagateChange(this._value);
this._fromEditor = false;
this._zone.run(() => (this._value = value));
}
}
get value() {
return this._value;
}
get easyMDE() {
return this._easyMDE;
}
/**
* Implemented as part of ControlValueAccessor.
*/
writeValue(value) {
this.value = !value ? '' : value;
}
registerOnChange(fn) {
this.propagateChange = fn;
}
registerOnTouched(fn) {
this.onTouched = fn;
}
ngAfterViewInit() {
this.options.element = this.textarea.nativeElement;
// If content entered is html then don't evaluate it, prevent xss vulnerabilities
marked.setOptions({ sanitize: true });
this._easyMDE = new EasyMDE(this.options);
this._easyMDE.value(this.value);
this._easyMDE.codemirror.on('change', this._onChange);
}
ngOnDestroy() {
this._easyMDE?.codemirror.off('change', this._onChange);
}
/* Wrapped function provided by EasyMDE */
isPreviewActive() {
return this._easyMDE.isPreviewActive();
}
isSideBySideActive() {
return this._easyMDE.isSideBySideActive();
}
isFullscreenActive() {
return this._easyMDE.isFullscreenActive();
}
clearAutosavedValue() {
this._easyMDE.clearAutosavedValue();
}
toTextArea() {
this._easyMDE.toTextArea();
}
toggleBold() {
EasyMDE.toggleBold(this._easyMDE);
}
toggleItalic() {
EasyMDE.toggleItalic(this._easyMDE);
}
toggleStrikethrough() {
EasyMDE.toggleStrikethrough(this._easyMDE);
}
toggleHeadingSmaller() {
EasyMDE.toggleHeadingSmaller(this._easyMDE);
}
toggleHeadingBigger() {
EasyMDE.toggleHeadingBigger(this._easyMDE);
}
toggleHeading1() {
EasyMDE.toggleHeading1(this._easyMDE);
}
toggleHeading2() {
EasyMDE.toggleHeading2(this._easyMDE);
}
toggleHeading3() {
EasyMDE.toggleHeading3(this._easyMDE);
}
toggleCodeBlock() {
EasyMDE.toggleCodeBlock(this._easyMDE);
}
toggleBlockquote() {
EasyMDE.toggleBlockquote(this._easyMDE);
}
toggleUnorderedList() {
EasyMDE.toggleUnorderedList(this._easyMDE);
}
toggleOrderedList() {
EasyMDE.toggleOrderedList(this._easyMDE);
}
cleanBlock() {
EasyMDE.cleanBlock(this._easyMDE);
}
drawLink() {
EasyMDE.drawLink(this._easyMDE);
}
drawImage() {
EasyMDE.drawImage(this._easyMDE);
}
drawTable() {
EasyMDE.drawTable(this._easyMDE);
}
drawHorizontalRule() {
EasyMDE.drawHorizontalRule(this._easyMDE);
}
togglePreview() {
EasyMDE.togglePreview(this._easyMDE);
}
toggleSideBySide() {
EasyMDE.toggleSideBySide(this._easyMDE);
}
toggleFullScreen() {
EasyMDE.toggleFullScreen(this._easyMDE);
}
_onChange = () => {
this._fromEditor = true;
this.writeValue(this._easyMDE?.value());
};
static ɵfac = function TdTextEditorComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdTextEditorComponent)(); };
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TdTextEditorComponent, selectors: [["td-text-editor"]], viewQuery: function TdTextEditorComponent_Query(rf, ctx) { if (rf & 1) {
i0.ɵɵviewQuery(_c0, 7);
} if (rf & 2) {
let _t;
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.textarea = _t.first);
} }, inputs: { options: "options", value: "value" }, features: [i0.ɵɵProvidersFeature([
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => TdTextEditorComponent),
multi: true,
},
])], decls: 3, vars: 0, consts: [["easymde", ""]], template: function TdTextEditorComponent_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵdomElementStart(0, "div");
i0.ɵɵdomElement(1, "textarea", null, 0);
i0.ɵɵdomElementEnd();
} }, styles: ["@charset \"UTF-8\";[_nghost-%COMP%] .CodeMirror{font-family:monospace;height:300px;color:#000;direction:ltr}[_nghost-%COMP%] .CodeMirror-lines{padding:4px 0}[_nghost-%COMP%] .CodeMirror pre.CodeMirror-line, [_nghost-%COMP%] .CodeMirror pre.CodeMirror-line-like{padding:0 4px}[_nghost-%COMP%] .CodeMirror-gutter-filler, [_nghost-%COMP%] .CodeMirror-scrollbar-filler{background-color:#fff}[_nghost-%COMP%] .CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}[_nghost-%COMP%] .CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}[_nghost-%COMP%] .CodeMirror-guttermarker{color:#000}[_nghost-%COMP%] .CodeMirror-guttermarker-subtle{color:#999}[_nghost-%COMP%] .CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}[_nghost-%COMP%] .CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}[_nghost-%COMP%] .cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}[_nghost-%COMP%] .cm-fat-cursor div.CodeMirror-cursors{z-index:1}[_nghost-%COMP%] .cm-fat-cursor .CodeMirror-line::selection, [_nghost-%COMP%] .cm-fat-cursor .CodeMirror-line>span::selection, [_nghost-%COMP%] .cm-fat-cursor .CodeMirror-line>span>span::selection{background:0 0}[_nghost-%COMP%] .cm-fat-cursor .CodeMirror-line::-moz-selection, [_nghost-%COMP%] .cm-fat-cursor .CodeMirror-line>span::-moz-selection, [_nghost-%COMP%] .cm-fat-cursor .CodeMirror-line>span>span::-moz-selection{background:0 0}[_nghost-%COMP%] .cm-fat-cursor{caret-color:transparent}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes _ngcontent-%COMP%_blink{50%{background-color:transparent}}@keyframes _ngcontent-%COMP%_blink{50%{background-color:transparent}}[_nghost-%COMP%] .cm-tab{display:inline-block;text-decoration:inherit}[_nghost-%COMP%] .CodeMirror-rulers{position:absolute;inset:-50px 0 0;overflow:hidden}[_nghost-%COMP%] .CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}[_nghost-%COMP%] .cm-s-default .cm-header{color:#00f}[_nghost-%COMP%] .cm-s-default .cm-quote{color:#090}[_nghost-%COMP%] .cm-negative{color:#d44}[_nghost-%COMP%] .cm-positive{color:#292}[_nghost-%COMP%] .cm-header, [_nghost-%COMP%] .cm-strong{font-weight:700}[_nghost-%COMP%] .cm-em{font-style:italic}[_nghost-%COMP%] .cm-link{text-decoration:underline}[_nghost-%COMP%] .cm-strikethrough{text-decoration:line-through}[_nghost-%COMP%] .cm-s-default .cm-keyword{color:#708}[_nghost-%COMP%] .cm-s-default .cm-atom{color:#219}[_nghost-%COMP%] .cm-s-default .cm-number{color:#164}[_nghost-%COMP%] .cm-s-default .cm-def{color:#00f}[_nghost-%COMP%] .cm-s-default .cm-variable-2{color:#05a}[_nghost-%COMP%] .cm-s-default .cm-type, [_nghost-%COMP%] .cm-s-default .cm-variable-3{color:#085}[_nghost-%COMP%] .cm-s-default .cm-comment{color:#a50}[_nghost-%COMP%] .cm-s-default .cm-string{color:#a11}[_nghost-%COMP%] .cm-s-default .cm-string-2{color:#f50}[_nghost-%COMP%] .cm-s-default .cm-meta{color:#555}[_nghost-%COMP%] .cm-s-default .cm-qualifier{color:#555}[_nghost-%COMP%] .cm-s-default .cm-builtin{color:#30a}[_nghost-%COMP%] .cm-s-default .cm-bracket{color:#997}[_nghost-%COMP%] .cm-s-default .cm-tag{color:#170}[_nghost-%COMP%] .cm-s-default .cm-attribute{color:#00c}[_nghost-%COMP%] .cm-s-default .cm-hr{color:#999}[_nghost-%COMP%] .cm-s-default .cm-link{color:#00c}[_nghost-%COMP%] .cm-s-default .cm-error{color:red}[_nghost-%COMP%] .cm-invalidchar{color:red}[_nghost-%COMP%] .CodeMirror-composing{border-bottom:2px solid}[_nghost-%COMP%] div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}[_nghost-%COMP%] div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}[_nghost-%COMP%] .CodeMirror-matchingtag{background:#ff96004d}[_nghost-%COMP%] .CodeMirror-activeline-background{background:#e8f2ff}[_nghost-%COMP%] .CodeMirror{position:relative;overflow:hidden;background:#fff}[_nghost-%COMP%] .CodeMirror-scroll{overflow:scroll!important;margin-bottom:-50px;margin-right:-50px;padding-bottom:50px;height:100%;outline:0;position:relative;z-index:0}[_nghost-%COMP%] .CodeMirror-sizer{position:relative;border-right:50px solid transparent}[_nghost-%COMP%] .CodeMirror-gutter-filler, [_nghost-%COMP%] .CodeMirror-hscrollbar, [_nghost-%COMP%] .CodeMirror-scrollbar-filler, [_nghost-%COMP%] .CodeMirror-vscrollbar{position:absolute;z-index:6;display:none;outline:0}[_nghost-%COMP%] .CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}[_nghost-%COMP%] .CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}[_nghost-%COMP%] .CodeMirror-scrollbar-filler{right:0;bottom:0}[_nghost-%COMP%] .CodeMirror-gutter-filler{left:0;bottom:0}[_nghost-%COMP%] .CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}[_nghost-%COMP%] .CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-50px}[_nghost-%COMP%] .CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important}[_nghost-%COMP%] .CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}[_nghost-%COMP%] .CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}[_nghost-%COMP%] .CodeMirror-gutter-wrapper ::selection{background-color:transparent}[_nghost-%COMP%] .CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}[_nghost-%COMP%] .CodeMirror-lines{cursor:text;min-height:1px}[_nghost-%COMP%] .CodeMirror pre.CodeMirror-line, [_nghost-%COMP%] .CodeMirror pre.CodeMirror-line-like{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}[_nghost-%COMP%] .CodeMirror-wrap pre.CodeMirror-line, [_nghost-%COMP%] .CodeMirror-wrap pre.CodeMirror-line-like{word-wrap:break-word;white-space:pre-wrap;word-break:normal}[_nghost-%COMP%] .CodeMirror-linebackground{position:absolute;inset:0;z-index:0}[_nghost-%COMP%] .CodeMirror-linewidget{position:relative;z-index:2;padding:.1px}[_nghost-%COMP%] .CodeMirror-code{outline:0}[_nghost-%COMP%] .CodeMirror-gutter, [_nghost-%COMP%] .CodeMirror-gutters, [_nghost-%COMP%] .CodeMirror-linenumber, [_nghost-%COMP%] .CodeMirror-scroll, [_nghost-%COMP%] .CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}[_nghost-%COMP%] .CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}[_nghost-%COMP%] .CodeMirror-cursor{position:absolute;pointer-events:none}[_nghost-%COMP%] .CodeMirror-measure pre{position:static}[_nghost-%COMP%] div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}[_nghost-%COMP%] div.CodeMirror-dragcursors{visibility:visible}[_nghost-%COMP%] .CodeMirror-focused div.CodeMirror-cursors{visibility:visible}[_nghost-%COMP%] .CodeMirror-selected{background:#d9d9d9}[_nghost-%COMP%] .CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}[_nghost-%COMP%] .CodeMirror-crosshair{cursor:crosshair}[_nghost-%COMP%] .CodeMirror-line::selection, [_nghost-%COMP%] .CodeMirror-line>span::selection, [_nghost-%COMP%] .CodeMirror-line>span>span::selection{background:#d7d4f0}[_nghost-%COMP%] .CodeMirror-line::-moz-selection, [_nghost-%COMP%] .CodeMirror-line>span::-moz-selection, [_nghost-%COMP%] .CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}[_nghost-%COMP%] .cm-searching{background-color:#ffa;background-color:#ff06}[_nghost-%COMP%] .cm-force-border{padding-right:.1px}@media print{[_nghost-%COMP%] .CodeMirror div.CodeMirror-cursors{visibility:hidden}}[_nghost-%COMP%] .cm-tab-wrap-hack:after{content:\"\"}[_nghost-%COMP%] span.CodeMirror-selectedtext{background:0 0}[_nghost-%COMP%] .EasyMDEContainer{display:block}[_nghost-%COMP%] .CodeMirror-rtl pre{direction:rtl}[_nghost-%COMP%] .EasyMDEContainer.sided--no-fullscreen{display:flex;flex-direction:row;flex-wrap:wrap}[_nghost-%COMP%] .EasyMDEContainer .CodeMirror{box-sizing:border-box;height:auto;border:1px solid #ced4da;border-bottom-left-radius:4px;border-bottom-right-radius:4px;padding:10px;font:inherit;z-index:0;word-wrap:break-word}[_nghost-%COMP%] .EasyMDEContainer .CodeMirror-scroll{cursor:text}[_nghost-%COMP%] .EasyMDEContainer .CodeMirror-fullscreen{background:#fff;position:fixed!important;inset:50px 0 0;height:auto;z-index:8;border-right:none!important;border-bottom-right-radius:0!important}[_nghost-%COMP%] .EasyMDEContainer .CodeMirror-sided{width:50%!important}[_nghost-%COMP%] .EasyMDEContainer.sided--no-fullscreen .CodeMirror-sided{border-right:none!important;border-bottom-right-radius:0;position:relative;flex:1 1 auto}[_nghost-%COMP%] .EasyMDEContainer .CodeMirror-placeholder{opacity:.5}[_nghost-%COMP%] .EasyMDEContainer .CodeMirror-focused .CodeMirror-selected{background:#d9d9d9}[_nghost-%COMP%] .editor-toolbar{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;padding:9px 10px;border-top:1px solid #ced4da;border-left:1px solid #ced4da;border-right:1px solid #ced4da;border-top-left-radius:4px;border-top-right-radius:4px}[_nghost-%COMP%] .editor-toolbar.fullscreen{width:100%;height:50px;padding-top:10px;padding-bottom:10px;box-sizing:border-box;background:#fff;border:0;position:fixed;top:0;left:0;opacity:1;z-index:9}[_nghost-%COMP%] .editor-toolbar.fullscreen:before{width:20px;height:50px;background:-moz-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-webkit-gradient(linear,left top,right top,color-stop(0,#fff),color-stop(100%,rgba(255,255,255,0)));background:-webkit-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-o-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-ms-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:linear-gradient(to right,#fff 0,#fff0);position:fixed;top:0;left:0;margin:0;padding:0}[_nghost-%COMP%] .editor-toolbar.fullscreen:after{width:20px;height:50px;background:-moz-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-webkit-gradient(linear,left top,right top,color-stop(0,rgba(255,255,255,0)),color-stop(100%,#fff));background:-webkit-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-o-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-ms-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:linear-gradient(to right,#fff0 0,#fff);position:fixed;top:0;right:0;margin:0;padding:0}[_nghost-%COMP%] .EasyMDEContainer.sided--no-fullscreen .editor-toolbar{width:100%}[_nghost-%COMP%] .editor-toolbar .easymde-dropdown, [_nghost-%COMP%] .editor-toolbar button{background:0 0;display:inline-block;text-align:center;text-decoration:none!important;height:30px;margin:0;padding:0;border:1px solid transparent;border-radius:3px;cursor:pointer}[_nghost-%COMP%] .editor-toolbar button{font-weight:700;min-width:30px;padding:0 6px;white-space:nowrap}[_nghost-%COMP%] .editor-toolbar button.active, [_nghost-%COMP%] .editor-toolbar button:hover{background:#fcfcfc;border-color:#95a5a6}[_nghost-%COMP%] .editor-toolbar i.separator{display:inline-block;width:0;border-left:1px solid #d9d9d9;border-right:1px solid #fff;color:transparent;text-indent:-10px;margin:0 6px}[_nghost-%COMP%] .editor-toolbar button:after{font-family:Arial,Helvetica Neue,Helvetica,sans-serif;font-size:65%;vertical-align:text-bottom;position:relative;top:2px}[_nghost-%COMP%] .editor-toolbar button.heading-1:after{content:\"1\"}[_nghost-%COMP%] .editor-toolbar button.heading-2:after{content:\"2\"}[_nghost-%COMP%] .editor-toolbar button.heading-3:after{content:\"3\"}[_nghost-%COMP%] .editor-toolbar button.heading-bigger:after{content:\"\\25b2\"}[_nghost-%COMP%] .editor-toolbar button.heading-smaller:after{content:\"\\25bc\"}[_nghost-%COMP%] .editor-toolbar.disabled-for-preview button:not(.no-disable){opacity:.6;pointer-events:none}@media only screen and (max-width: 700px){[_nghost-%COMP%] .editor-toolbar i.no-mobile{display:none}}[_nghost-%COMP%] .editor-statusbar{padding:8px 10px;font-size:12px;color:#959694;text-align:right}[_nghost-%COMP%] .EasyMDEContainer.sided--no-fullscreen .editor-statusbar{width:100%}[_nghost-%COMP%] .editor-statusbar span{display:inline-block;min-width:4em;margin-left:1em}[_nghost-%COMP%] .editor-statusbar .lines:before{content:\"lines: \"}[_nghost-%COMP%] .editor-statusbar .words:before{content:\"words: \"}[_nghost-%COMP%] .editor-statusbar .characters:before{content:\"characters: \"}[_nghost-%COMP%] .editor-preview-full{position:absolute;width:100%;height:100%;top:0;left:0;z-index:7;overflow:auto;display:none;box-sizing:border-box}[_nghost-%COMP%] .editor-preview-side{position:fixed;bottom:0;width:50%;top:50px;right:0;z-index:9;overflow:auto;display:none;box-sizing:border-box;border:1px solid #ddd;word-wrap:break-word}[_nghost-%COMP%] .editor-preview-active-side{display:block}[_nghost-%COMP%] .EasyMDEContainer.sided--no-fullscreen .editor-preview-active-side{flex:1 1 auto;height:auto;position:static}[_nghost-%COMP%] .editor-preview-active{display:block}[_nghost-%COMP%] .editor-preview{padding:10px;background:#fafafa}[_nghost-%COMP%] .editor-preview>p{margin-top:0}[_nghost-%COMP%] .editor-preview pre{background:#eee;margin-bottom:10px}[_nghost-%COMP%] .editor-preview table td, [_nghost-%COMP%] .editor-preview table th{border:1px solid #ddd;padding:5px}[_nghost-%COMP%] .cm-s-easymde .cm-tag{color:#63a35c}[_nghost-%COMP%] .cm-s-easymde .cm-attribute{color:#795da3}[_nghost-%COMP%] .cm-s-easymde .cm-string{color:#183691}[_nghost-%COMP%] .cm-s-easymde .cm-header-1{font-size:calc(1.375rem + 1.5vw)}[_nghost-%COMP%] .cm-s-easymde .cm-header-2{font-size:calc(1.325rem + .9vw)}[_nghost-%COMP%] .cm-s-easymde .cm-header-3{font-size:calc(1.3rem + .6vw)}[_nghost-%COMP%] .cm-s-easymde .cm-header-4{font-size:calc(1.275rem + .3vw)}[_nghost-%COMP%] .cm-s-easymde .cm-header-5{font-size:1.25rem}[_nghost-%COMP%] .cm-s-easymde .cm-header-6{font-size:1rem}[_nghost-%COMP%] .cm-s-easymde .cm-header-1, [_nghost-%COMP%] .cm-s-easymde .cm-header-2, [_nghost-%COMP%] .cm-s-easymde .cm-header-3, [_nghost-%COMP%] .cm-s-easymde .cm-header-4, [_nghost-%COMP%] .cm-s-easymde .cm-header-5, [_nghost-%COMP%] .cm-s-easymde .cm-header-6{margin-bottom:.5rem;line-height:1.2}[_nghost-%COMP%] .cm-s-easymde .cm-comment{background:#0000000d;border-radius:2px}[_nghost-%COMP%] .cm-s-easymde .cm-link{color:#7f8c8d}[_nghost-%COMP%] .cm-s-easymde .cm-url{color:#aab2b3}[_nghost-%COMP%] .cm-s-easymde .cm-quote{color:#7f8c8d;font-style:italic}[_nghost-%COMP%] .editor-toolbar .easymde-dropdown{position:relative;background:linear-gradient(to bottom right,#fff 0 84%,#333 50% 100%);border-radius:0;border:1px solid #fff}[_nghost-%COMP%] .editor-toolbar .easymde-dropdown:hover{background:linear-gradient(to bottom right,#fff 0 84%,#333 50% 100%)}[_nghost-%COMP%] .easymde-dropdown-content{display:block;visibility:hidden;position:absolute;background-color:#f9f9f9;box-shadow:0 8px 16px #0003;padding:8px;z-index:2;top:30px}[_nghost-%COMP%] .easymde-dropdown:active .easymde-dropdown-content, [_nghost-%COMP%] .easymde-dropdown:focus .easymde-dropdown-content, [_nghost-%COMP%] .easymde-dropdown:focus-within .easymde-dropdown-content{visibility:visible}[_nghost-%COMP%] .easymde-dropdown-content button{display:block}[_nghost-%COMP%] span[data-img-src]:after{content:\"\";background-image:var(--bg-image);display:block;max-height:100%;max-width:100%;background-size:contain;height:0;padding-top:var(--height);width:var(--width);background-repeat:no-repeat}[_nghost-%COMP%] .CodeMirror .cm-spell-error:not(.cm-url):not(.cm-comment):not(.cm-tag):not(.cm-word){background:#ff000026}[_nghost-%COMP%] .editor-toolbar{background-color:inherit}[_nghost-%COMP%] .editor-toolbar i.separator{border-left:none}[_nghost-%COMP%] .editor-toolbar button .fa{color:var(--mat-app-text-color, inherit)}[_nghost-%COMP%] .editor-toolbar button:hover, [_nghost-%COMP%] .editor-toolbar button.active{background-color:transparent;border:1px solid inherit}[_nghost-%COMP%] .EasyMDEContainer .CodeMirror{background-color:inherit;color:inherit}"] });
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TdTextEditorComponent, [{
type: Component,
args: [{ selector: 'td-text-editor', providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => TdTextEditorComponent),
multi: true,
},
], template: "<div>\n <textarea #easymde></textarea>\n</div>\n", styles: ["@charset \"UTF-8\";:host ::ng-deep .CodeMirror{font-family:monospace;height:300px;color:#000;direction:ltr}:host ::ng-deep .CodeMirror-lines{padding:4px 0}:host ::ng-deep .CodeMirror pre.CodeMirror-line,:host ::ng-deep .CodeMirror pre.CodeMirror-line-like{padding:0 4px}:host ::ng-deep .CodeMirror-gutter-filler,:host ::ng-deep .CodeMirror-scrollbar-filler{background-color:#fff}:host ::ng-deep .CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}:host ::ng-deep .CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}:host ::ng-deep .CodeMirror-guttermarker{color:#000}:host ::ng-deep .CodeMirror-guttermarker-subtle{color:#999}:host ::ng-deep .CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}:host ::ng-deep .CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}:host ::ng-deep .cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}:host ::ng-deep .cm-fat-cursor div.CodeMirror-cursors{z-index:1}:host ::ng-deep .cm-fat-cursor .CodeMirror-line::selection,:host ::ng-deep .cm-fat-cursor .CodeMirror-line>span::selection,:host ::ng-deep .cm-fat-cursor .CodeMirror-line>span>span::selection{background:0 0}:host ::ng-deep .cm-fat-cursor .CodeMirror-line::-moz-selection,:host ::ng-deep .cm-fat-cursor .CodeMirror-line>span::-moz-selection,:host ::ng-deep .cm-fat-cursor .CodeMirror-line>span>span::-moz-selection{background:0 0}:host ::ng-deep .cm-fat-cursor{caret-color:transparent}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}:host ::ng-deep .cm-tab{display:inline-block;text-decoration:inherit}:host ::ng-deep .CodeMirror-rulers{position:absolute;inset:-50px 0 0;overflow:hidden}:host ::ng-deep .CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}:host ::ng-deep .cm-s-default .cm-header{color:#00f}:host ::ng-deep .cm-s-default .cm-quote{color:#090}:host ::ng-deep .cm-negative{color:#d44}:host ::ng-deep .cm-positive{color:#292}:host ::ng-deep .cm-header,:host ::ng-deep .cm-strong{font-weight:700}:host ::ng-deep .cm-em{font-style:italic}:host ::ng-deep .cm-link{text-decoration:underline}:host ::ng-deep .cm-strikethrough{text-decoration:line-through}:host ::ng-deep .cm-s-default .cm-keyword{color:#708}:host ::ng-deep .cm-s-default .cm-atom{color:#219}:host ::ng-deep .cm-s-default .cm-number{color:#164}:host ::ng-deep .cm-s-default .cm-def{color:#00f}:host ::ng-deep .cm-s-default .cm-variable-2{color:#05a}:host ::ng-deep .cm-s-default .cm-type,:host ::ng-deep .cm-s-default .cm-variable-3{color:#085}:host ::ng-deep .cm-s-default .cm-comment{color:#a50}:host ::ng-deep .cm-s-default .cm-string{color:#a11}:host ::ng-deep .cm-s-default .cm-string-2{color:#f50}:host ::ng-deep .cm-s-default .cm-meta{color:#555}:host ::ng-deep .cm-s-default .cm-qualifier{color:#555}:host ::ng-deep .cm-s-default .cm-builtin{color:#30a}:host ::ng-deep .cm-s-default .cm-bracket{color:#997}:host ::ng-deep .cm-s-default .cm-tag{color:#170}:host ::ng-deep .cm-s-default .cm-attribute{color:#00c}:host ::ng-deep .cm-s-default .cm-hr{color:#999}:host ::ng-deep .cm-s-default .cm-link{color:#00c}:host ::ng-deep .cm-s-default .cm-error{color:red}:host ::ng-deep .cm-invalidchar{color:red}:host ::ng-deep .CodeMirror-composing{border-bottom:2px solid}:host ::ng-deep div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}:host ::ng-deep div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}:host ::ng-deep .CodeMirror-matchingtag{background:#ff96004d}:host ::ng-deep .CodeMirror-activeline-background{background:#e8f2ff}:host ::ng-deep .CodeMirror{position:relative;overflow:hidden;background:#fff}:host ::ng-deep .CodeMirror-scroll{overflow:scroll!important;margin-bottom:-50px;margin-right:-50px;padding-bottom:50px;height:100%;outline:0;position:relative;z-index:0}:host ::ng-deep .CodeMirror-sizer{position:relative;border-right:50px solid transparent}:host ::ng-deep .CodeMirror-gutter-filler,:host ::ng-deep .CodeMirror-hscrollbar,:host ::ng-deep .CodeMirror-scrollbar-filler,:host ::ng-deep .CodeMirror-vscrollbar{position:absolute;z-index:6;display:none;outline:0}:host ::ng-deep .CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}:host ::ng-deep .CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}:host ::ng-deep .CodeMirror-scrollbar-filler{right:0;bottom:0}:host ::ng-deep .CodeMirror-gutter-filler{left:0;bottom:0}:host ::ng-deep .CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}:host ::ng-deep .CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-50px}:host ::ng-deep .CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important}:host ::ng-deep .CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}:host ::ng-deep .CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}:host ::ng-deep .CodeMirror-gutter-wrapper ::selection{background-color:transparent}:host ::ng-deep .CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}:host ::ng-deep .CodeMirror-lines{cursor:text;min-height:1px}:host ::ng-deep .CodeMirror pre.CodeMirror-line,:host ::ng-deep .CodeMirror pre.CodeMirror-line-like{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}:host ::ng-deep .CodeMirror-wrap pre.CodeMirror-line,:host ::ng-deep .CodeMirror-wrap pre.CodeMirror-line-like{word-wrap:break-word;white-space:pre-wrap;word-break:normal}:host ::ng-deep .CodeMirror-linebackground{position:absolute;inset:0;z-index:0}:host ::ng-deep .CodeMirror-linewidget{position:relative;z-index:2;padding:.1px}:host ::ng-deep .CodeMirror-code{outline:0}:host ::ng-deep .CodeMirror-gutter,:host ::ng-deep .CodeMirror-gutters,:host ::ng-deep .CodeMirror-linenumber,:host ::ng-deep .CodeMirror-scroll,:host ::ng-deep .CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}:host ::ng-deep .CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}:host ::ng-deep .CodeMirror-cursor{position:absolute;pointer-events:none}:host ::ng-deep .CodeMirror-measure pre{position:static}:host ::ng-deep div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}:host ::ng-deep div.CodeMirror-dragcursors{visibility:visible}:host ::ng-deep .CodeMirror-focused div.CodeMirror-cursors{visibility:visible}:host ::ng-deep .CodeMirror-selected{background:#d9d9d9}:host ::ng-deep .CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}:host ::ng-deep .CodeMirror-crosshair{cursor:crosshair}:host ::ng-deep .CodeMirror-line::selection,:host ::ng-deep .CodeMirror-line>span::selection,:host ::ng-deep .CodeMirror-line>span>span::selection{background:#d7d4f0}:host ::ng-deep .CodeMirror-line::-moz-selection,:host ::ng-deep .CodeMirror-line>span::-moz-selection,:host ::ng-deep .CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}:host ::ng-deep .cm-searching{background-color:#ffa;background-color:#ff06}:host ::ng-deep .cm-force-border{padding-right:.1px}@media print{:host ::ng-deep .CodeMirror div.CodeMirror-cursors{visibility:hidden}}:host ::ng-deep .cm-tab-wrap-hack:after{content:\"\"}:host ::ng-deep span.CodeMirror-selectedtext{background:0 0}:host ::ng-deep .EasyMDEContainer{display:block}:host ::ng-deep .CodeMirror-rtl pre{direction:rtl}:host ::ng-deep .EasyMDEContainer.sided--no-fullscreen{display:flex;flex-direction:row;flex-wrap:wrap}:host ::ng-deep .EasyMDEContainer .CodeMirror{box-sizing:border-box;height:auto;border:1px solid #ced4da;border-bottom-left-radius:4px;border-bottom-right-radius:4px;padding:10px;font:inherit;z-index:0;word-wrap:break-word}:host ::ng-deep .EasyMDEContainer .CodeMirror-scroll{cursor:text}:host ::ng-deep .EasyMDEContainer .CodeMirror-fullscreen{background:#fff;position:fixed!important;inset:50px 0 0;height:auto;z-index:8;border-right:none!important;border-bottom-right-radius:0!important}:host ::ng-deep .EasyMDEContainer .CodeMirror-sided{width:50%!important}:host ::ng-deep .EasyMDEContainer.sided--no-fullscreen .CodeMirror-sided{border-right:none!important;border-bottom-right-radius:0;position:relative;flex:1 1 auto}:host ::ng-deep .EasyMDEContainer .CodeMirror-placeholder{opacity:.5}:host ::ng-deep .EasyMDEContainer .CodeMirror-focused .CodeMirror-selected{background:#d9d9d9}:host ::ng-deep .editor-toolbar{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;padding:9px 10px;border-top:1px solid #ced4da;border-left:1px solid #ced4da;border-right:1px solid #ced4da;border-top-left-radius:4px;border-top-right-radius:4px}:host ::ng-deep .editor-toolbar.fullscreen{width:100%;height:50px;padding-top:10px;padding-bottom:10px;box-sizing:border-box;background:#fff;border:0;position:fixed;top:0;left:0;opacity:1;z-index:9}:host ::ng-deep .editor-toolbar.fullscreen:before{width:20px;height:50px;background:-moz-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-webkit-gradient(linear,left top,right top,color-stop(0,#fff),color-stop(100%,rgba(255,255,255,0)));background:-webkit-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-o-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-ms-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:linear-gradient(to right,#fff 0,#fff0);position:fixed;top:0;left:0;margin:0;padding:0}:host ::ng-deep .editor-toolbar.fullscreen:after{width:20px;height:50px;background:-moz-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-webkit-gradient(linear,left top,right top,color-stop(0,rgba(255,255,255,0)),color-stop(100%,#fff));background:-webkit-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-o-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-ms-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:linear-gradient(to right,#fff0 0,#fff);position:fixed;top:0;right:0;margin:0;padding:0}:host ::ng-deep .EasyMDEContainer.sided--no-fullscreen .editor-toolbar{width:100%}:host ::ng-deep .editor-toolbar .easymde-dropdown,:host ::ng-deep .editor-toolbar button{background:0 0;display:inline-block;text-align:center;text-decoration:none!important;height:30px;margin:0;padding:0;border:1px solid transparent;border-radius:3px;cursor:pointer}:host ::ng-deep .editor-toolbar button{font-weight:700;min-width:30px;padding:0 6px;white-space:nowrap}:host ::ng-deep .editor-toolbar button.active,:host ::ng-deep .editor-toolbar button:hover{background:#fcfcfc;border-color:#95a5a6}:host ::ng-deep .editor-toolbar i.separator{display:inline-block;width:0;border-left:1px solid #d9d9d9;border-right:1px solid #fff;color:transparent;text-indent:-10px;margin:0 6px}:host ::ng-deep .editor-toolbar button:after{font-family:Arial,Helvetica Neue,Helvetica,sans-serif;font-size:65%;vertical-align:text-bottom;position:relative;top:2px}:host ::ng-deep .editor-toolbar button.heading-1:after{content:\"1\"}:host ::ng-deep .editor-toolbar button.heading-2:after{content:\"2\"}:host ::ng-deep .editor-toolbar button.heading-3:after{content:\"3\"}:host ::ng-deep .editor-toolbar button.heading-bigger:after{content:\"\\25b2\"}:host ::ng-deep .editor-toolbar button.heading-smaller:after{content:\"\\25bc\"}:host ::ng-deep .editor-toolbar.disabled-for-preview button:not(.no-disable){opacity:.6;pointer-events:none}@media only screen and (max-width: 700px){:host ::ng-deep .editor-toolbar i.no-mobile{display:none}}:host ::ng-deep .editor-statusbar{padding:8px 10px;font-size:12px;color:#959694;text-align:right}:host ::ng-deep .EasyMDEContainer.sided--no-fullscreen .editor-statusbar{width:100%}:host ::ng-deep .editor-statusbar span{display:inline-block;min-width:4em;margin-left:1em}:host ::ng-deep .editor-statusbar .lines:before{content:\"lines: \"}:host ::ng-deep .editor-statusbar .words:before{content:\"words: \"}:host ::ng-deep .editor-statusbar .characters:before{content:\"characters: \"}:host ::ng-deep .editor-preview-full{position:absolute;width:100%;height:100%;top:0;left:0;z-index:7;overflow:auto;display:none;box-sizing:border-box}:host ::ng-deep .editor-preview-side{position:fixed;bottom:0;width:50%;top:50px;right:0;z-index:9;overflow:auto;display:none;box-sizing:border-box;border:1px solid #ddd;word-wrap:break-word}:host ::ng-deep .editor-preview-active-side{display:block}:host ::ng-deep .EasyMDEContainer.sided--no-fullscreen .editor-preview-active-side{flex:1 1 auto;height:auto;position:static}:host ::ng-deep .editor-preview-active{display:block}:host ::ng-deep .editor-preview{padding:10px;background:#fafafa}:host ::ng-deep .editor-preview>p{margin-top:0}:host ::ng-deep .editor-preview pre{background:#eee;margin-bottom:10px}:host ::ng-deep .editor-preview table td,:host ::ng-deep .editor-preview table th{border:1px solid #ddd;padding:5px}:host ::ng-deep .cm-s-easymde .cm-tag{color:#63a35c}:host ::ng-deep .cm-s-easymde .cm-attribute{color:#795da3}:host ::ng-deep .cm-s-easymde .cm-string{color:#183691}:host ::ng-deep .cm-s-easymde .cm-header-1{font-size:calc(1.375rem + 1.5vw)}:host ::ng-deep .cm-s-easymde .cm-header-2{font-size:calc(1.325rem + .9vw)}:host ::ng-deep .cm-s-easymde .cm-header-3{font-size:calc(1.3rem + .6vw)}:host ::ng-deep .cm-s-easymde .cm-header-4{font-size:calc(1.275rem + .3vw)}:host ::ng-deep .cm-s-easymde .cm-header-5{font-size:1.25rem}:host ::ng-deep .cm-s-easymde .cm-header-6{font-size:1rem}:host ::ng-deep .cm-s-easymde .cm-header-1,:host ::ng-deep .cm-s-easymde .cm-header-2,:host ::ng-deep .cm-s-easymde .cm-header-3,:host ::ng-deep .cm-s-easymde .cm-header-4,:host ::ng-deep .cm-s-easymde .cm-header-5,:host ::ng-deep .cm-s-easymde .cm-header-6{margin-bottom:.5rem;line-height:1.2}:host ::ng-deep .cm-s-easymde .cm-comment{background:#0000000d;border-radius:2px}:host ::ng-deep .cm-s-easymde .cm-link{color:#7f8c8d}:host ::ng-deep .cm-s-easymde .cm-url{color:#aab2b3}:host ::ng-deep .cm-s-easymde .cm-quote{color:#7f8c8d;font-style:italic}:host ::ng-deep .editor-toolbar .easymde-dropdown{position:relative;background:linear-gradient(to bottom right,#fff 0 84%,#333 50% 100%);border-radius:0;border:1px solid #fff}:host ::ng-deep .editor-toolbar .easymde-dropdown:hover{background:linear-gradient(to bottom right,#fff 0 84%,#333 50% 100%)}:host ::ng-deep .easymde-dropdown-content{display:block;visibility:hidden;position:absolute;background-color:#f9f9f9;box-shadow:0 8px 16px #0003;padding:8px;z-index:2;top:30px}:host ::ng-deep .easymde-dropdown:active .easymde-dropdown-content,:host ::ng-deep .easymde-dropdown:focus .easymde-dropdown-content,:host ::ng-deep .easymde-dropdown:focus-within .easymde-dropdown-content{visibility:visible}:host ::ng-deep .easymde-dropdown-content button{display:block}:host ::ng-deep span[data-img-src]:after{content:\"\";background-image:var(--bg-image);display:block;max-height:100%;max-width:100%;background-size:contain;height:0;padding-top:var(--height);width:var(--width);background-repeat:no-repeat}:host ::ng-deep .CodeMirror .cm-spell-error:not(.cm-url):not(.cm-comment):not(.cm-tag):not(.cm-word){background:#ff000026}:host ::ng-deep .editor-toolbar{background-color:inherit}:host ::ng-deep .editor-toolbar i.separator{border-left:none}:host ::ng-deep .editor-toolbar button .fa{color:var(--mat-app-text-color, inherit)}:host ::ng-deep .editor-toolbar button:hover,:host ::ng-deep .editor-toolbar button.active{background-color:transparent;border:1px solid inherit}:host ::ng-deep .EasyMDEContainer .CodeMirror{background-color:inherit;color:inherit}\n"] }]
}], null, { textarea: [{
type: ViewChild,
args: ['easymde', { static: true }]
}], options: [{
type: Input
}], value: [{
type: Input
}] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TdTextEditorComponent, { className: "TdTextEditorComponent", filePath: "lib/text-editor.component.ts", lineNumber: 33 }); })();
/**
* @deprecated This module is deprecated and will be removed in future versions.
* Please migrate to using standalone components as soon as possible.
*/
class CovalentTextEditorModule {
static ɵfac = function CovalentTextEditorModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CovalentTextEditorModule)(); };
static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: CovalentTextEditorModule });
static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CovalentTextEditorModule, [{
type: NgModule,
args: [{
imports: [TdTextEditorComponent],
exports: [TdTextEditorComponent],
}]
}], null, null); })();
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(CovalentTextEditorModule, { imports: [TdTextEditorComponent], exports: [TdTextEditorComponent] }); })();
/**
* Generated bundle index. Do not edit.
*/
export { CovalentTextEditorModule, TdTextEditorComponent };
//# sourceMappingURL=covalent-text-editor.mjs.map